@haiilo/catalyst 10.36.1 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/p-59e2ada2.entry.js +10 -0
  4. package/dist/catalyst/p-59e2ada2.entry.js.map +1 -0
  5. package/dist/cjs/cat-alert_30.cjs.entry.js +297 -1802
  6. package/dist/cjs/cat-alert_30.cjs.entry.js.map +1 -1
  7. package/dist/cjs/catalyst.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/collection-manifest.json +1 -1
  10. package/dist/collection/components/cat-alert/cat-alert.js +1 -1
  11. package/dist/collection/components/cat-badge/cat-badge.js +1 -1
  12. package/dist/collection/components/cat-button-group/cat-button-group.js +1 -1
  13. package/dist/collection/components/cat-card/cat-card.js +1 -1
  14. package/dist/collection/components/cat-checkbox/cat-checkbox.js +2 -2
  15. package/dist/collection/components/cat-date/cat-date.js +10 -5
  16. package/dist/collection/components/cat-date/cat-date.js.map +1 -1
  17. package/dist/collection/components/cat-date-inline/cat-date-inline.js +4 -4
  18. package/dist/collection/components/cat-dropdown/cat-dropdown.css +5 -0
  19. package/dist/collection/components/cat-dropdown/cat-dropdown.js +49 -24
  20. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  21. package/dist/collection/components/cat-dropdown/cat-dropdown.spec.js +1 -0
  22. package/dist/collection/components/cat-dropdown/cat-dropdown.spec.js.map +1 -1
  23. package/dist/collection/components/cat-input/cat-input.js +58 -43
  24. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  25. package/dist/collection/components/cat-select/cat-select.js +8 -8
  26. package/dist/collection/components/cat-time/cat-time-locale.js.map +1 -1
  27. package/dist/collection/components/cat-time/cat-time.js +3 -9
  28. package/dist/collection/components/cat-time/cat-time.js.map +1 -1
  29. package/dist/collection/components/cat-tooltip/cat-tooltip.js +3 -3
  30. package/dist/collection/index.js.map +1 -1
  31. package/dist/collection/utils/first-tabbable-with-visibility-hidden.js +49 -0
  32. package/dist/collection/utils/first-tabbable-with-visibility-hidden.js.map +1 -0
  33. package/dist/components/cat-alert.js +1 -1
  34. package/dist/components/cat-badge.js +1 -1
  35. package/dist/components/cat-button-group.js +1 -1
  36. package/dist/components/cat-card.js +1 -1
  37. package/dist/components/cat-checkbox2.js +2 -2
  38. package/dist/components/cat-date-inline2.js +4 -4
  39. package/dist/components/cat-date.js +6 -5
  40. package/dist/components/cat-date.js.map +1 -1
  41. package/dist/components/cat-dropdown2.js +83 -28
  42. package/dist/components/cat-dropdown2.js.map +1 -1
  43. package/dist/components/cat-input2.js +19 -1571
  44. package/dist/components/cat-input2.js.map +1 -1
  45. package/dist/components/cat-select2.js +4 -4
  46. package/dist/components/cat-time.js +3 -9
  47. package/dist/components/cat-time.js.map +1 -1
  48. package/dist/components/cat-tooltip.js +2 -2
  49. package/dist/esm/cat-alert_30.entry.js +299 -1804
  50. package/dist/esm/cat-alert_30.entry.js.map +1 -1
  51. package/dist/esm/catalyst.js +1 -1
  52. package/dist/esm/loader.js +1 -1
  53. package/dist/types/components/cat-date/cat-date.d.ts +2 -0
  54. package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +7 -1
  55. package/dist/types/components/cat-input/cat-input.d.ts +22 -7
  56. package/dist/types/components/cat-time/cat-time-locale.d.ts +4 -3
  57. package/dist/types/components/cat-time/cat-time.d.ts +1 -1
  58. package/dist/types/components.d.ts +26 -7
  59. package/dist/types/index.d.ts +1 -0
  60. package/dist/types/utils/first-tabbable-with-visibility-hidden.d.ts +2 -0
  61. package/package.json +3 -4
  62. package/dist/catalyst/p-a66b6ce8.entry.js +0 -10
  63. package/dist/catalyst/p-a66b6ce8.entry.js.map +0 -1
@@ -823,7 +823,7 @@ const CatAlert = class {
823
823
  setAttributeDefault(this, 'role', this.mapRole.get(this.color));
824
824
  }
825
825
  render() {
826
- return (index.h(index.Host, { key: 'c02988c259d20cfb381b69a43cd9800a075f9c97' }, !this.noIcon && index.h("cat-icon", { key: 'fee7a2b021437de0c7617187e48c3e436218b50f', size: "l", icon: this.icon || this.mapIcon.get(this.color) }), index.h("div", { key: '4bb19866ff246d7ec956c213e39f8d09080f02da', class: "content" }, index.h("slot", { key: 'a3356a8b51747570f01c33cd77106156aed5c404' }))));
826
+ return (index.h(index.Host, { key: '5cda6d92f1cf40029c2a93723999ed9e8c44baac' }, !this.noIcon && index.h("cat-icon", { key: '69124d111b0a62932bbd761b6cbd1dc4ab155670', size: "l", icon: this.icon || this.mapIcon.get(this.color) }), index.h("div", { key: '22f6070cefa6ef5036e8b9e1ec7dcad357a69462', class: "content" }, index.h("slot", { key: 'e86f500e97dd688b986aa90af5db0f94819407e4' }))));
827
827
  }
828
828
  get hostElement() { return index.getElement(this); }
829
829
  };
@@ -1084,7 +1084,7 @@ const CatBadge = class {
1084
1084
  }
1085
1085
  }
1086
1086
  render() {
1087
- return (index.h(index.Host, { key: '2c10a8da896b2fe6b7637ec871386da6ee9dc132', "data-icon-badge": this.isIconBadge ? this.size : null }, this.hasPrefixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null, this.isIconBadge ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "icon-only" })) : (index.h("slot", null)), this.hasSuffixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null));
1087
+ return (index.h(index.Host, { key: '61ec6bb61ee078254f1fc4277c4b5608d055acde', "data-icon-badge": this.isIconBadge ? this.size : null }, this.hasPrefixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null, this.isIconBadge ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "icon-only" })) : (index.h("slot", null)), this.hasSuffixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null));
1088
1088
  }
1089
1089
  get hostElement() { return index.getElement(this); }
1090
1090
  static get watchers() { return {
@@ -1296,7 +1296,7 @@ const CatButtonGroup = class {
1296
1296
  this.a11yLabel = undefined;
1297
1297
  }
1298
1298
  render() {
1299
- return (index.h(index.Host, { key: '2b9aeb09c4290a27751f568e596a3de21f8deeb3', role: "group", "aria-label": this.a11yLabel }, index.h("slot", { key: '5a6afa70513843b8c201a649ed0edb30fea9b7fc', onSlotchange: this.onSlotChange.bind(this) })));
1299
+ return (index.h(index.Host, { key: '3d43547333f73560d31ca96bdba2d2b8b9976dbd', role: "group", "aria-label": this.a11yLabel }, index.h("slot", { key: 'd329ea90250b161862361e907427920e8866445a', onSlotchange: this.onSlotChange.bind(this) })));
1300
1300
  }
1301
1301
  onSlotChange() {
1302
1302
  this.buttonElements = Array.from(this.hostElement.querySelectorAll(':scope > cat-button, :scope > cat-tooltip > cat-button, :scope > cat-dropdown cat-button[slot="trigger"]'));
@@ -1318,7 +1318,7 @@ const CatCard = class {
1318
1318
  this.catLoad = index.createEvent(this, "catLoad", 7);
1319
1319
  }
1320
1320
  render() {
1321
- return index.h("slot", { key: '4d88ab8e5cf1e13a3242b646314f034f5fa0fdfe' });
1321
+ return index.h("slot", { key: '6617daf8e8f9c7e854f287c49c23d4985588fc79' });
1322
1322
  }
1323
1323
  componentDidLoad() {
1324
1324
  this.catLoad.emit();
@@ -1411,13 +1411,13 @@ const CatCheckbox = class {
1411
1411
  this.input.blur();
1412
1412
  }
1413
1413
  render() {
1414
- return (index.h(index.Host, { key: '05b68d962533497b453115b800e3ea303158212c' }, index.h("label", { key: 'd15945284e20c6d58cf2df7688b036b2e5425f0f', htmlFor: this.id, class: {
1414
+ return (index.h(index.Host, { key: '22986b5dd3edf4e197fad9e02e7725c80e5f9bc5' }, index.h("label", { key: '531252b51952b5731b4038f6ddf77a56b2ce4b4b', htmlFor: this.id, class: {
1415
1415
  'is-hidden': this.labelHidden,
1416
1416
  'is-disabled': this.disabled,
1417
1417
  'label-left': this.labelLeft,
1418
1418
  'align-center': this.alignment === 'center',
1419
1419
  'align-end': this.alignment === 'bottom'
1420
- } }, index.h("input", { key: 'a5d6f3093e75db63e7c300253518e42106760a52', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, indeterminate: this.indeterminate, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), index.h("span", { key: '0c65b6e371a36520133fd172be153df28196491d', class: "box", "aria-hidden": "true" }, index.h("svg", { key: '044cab34d712b243c9329922482df42694950cfc', class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { key: 'a573d56014dc292b1f41cb1b01f28d814b4a5516', points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { key: 'f09647dc93bfb204ce076dc77ec32ca9d024ea65', class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { key: '9cb83216b18ba26d53936911c73e2f3de67916c3', points: "1.5 5 10.5 5" }))), index.h("span", { key: '84c1bee050ca233c8fdda98ceace71de343a350d', class: { label: true, 'label-wrapper': !this.hasSlottedLabel }, part: "label" }, (this.hasSlottedLabel && index.h("slot", { key: '61a771b1bad26a055baed80e762c0aaac09bc3f4', name: "label" })) || this.label, index.h("span", { key: '5a330f42046052f38bb46e149fc029daa8fb8f3e', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '4579818c0b721db3e9f177c9510072eaef451dba', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: 'a5ca8a8bc0753aef66d36f86f6c61c31ec4a4069', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")"))))), this.hasHint && (index.h("div", { key: '15312bf5c2d948928fb70e6055b28ae996ffdd1b', class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, index.h("div", { key: 'f1bf992ec81de9aa642093aafa8bd8da73d237f8', class: "box-placeholder" }), index.h(CatFormHint, { key: '66354c340d274a802a21eac6d95b1e4390cfde71', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) })))));
1420
+ } }, index.h("input", { key: '26e8943be3be357a3fdc921c36d12d0f4b7aa32a', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, indeterminate: this.indeterminate, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), index.h("span", { key: '4ec18b92e0d09f2f17ed7f9a5444efb4448d2bcf', class: "box", "aria-hidden": "true" }, index.h("svg", { key: '8e0f01f6326c0f39d0d1fece1a68eb51907194ea', class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { key: '4c43fcff56b492108820b0f657063d80cf478284', points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { key: 'b251c0afcef5841ed7c4e9bfd7a57c783109f897', class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { key: 'e44721268266f5e97884678da809d47fe6375bac', points: "1.5 5 10.5 5" }))), index.h("span", { key: '1ae79389911efaaeac38068a97f246666d259f0b', class: { label: true, 'label-wrapper': !this.hasSlottedLabel }, part: "label" }, (this.hasSlottedLabel && index.h("slot", { key: 'b07515a03f8231ce37e8718a0416e77ef59bca5a', name: "label" })) || this.label, index.h("span", { key: 'c301bc1625f34f3161387f9ef06b9710f533f2cd', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: 'f2aa2b0ca452521dfe567d9014bbfc4f39239cf3', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: '8810b908cfe30c9d4f66a5f10d15010d8a6e4a29', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")"))))), this.hasHint && (index.h("div", { key: 'a095e831cbd4a8ed9c6b490205607c2188c9405a', class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, index.h("div", { key: '9a3ad1814b1b14e57be99d3f09992813c07cb594', class: "box-placeholder" }), index.h(CatFormHint, { key: '0b4f2f7adb5c45f7e25ad6f29fa83036ec5a2cf7', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) })))));
1421
1421
  }
1422
1422
  get hasHint() {
1423
1423
  return !!this.hint || !!this.hasSlottedHint;
@@ -1554,6 +1554,7 @@ const CatDate = class {
1554
1554
  this.language = of.catI18nRegistry.getLocale();
1555
1555
  this.locale = getLocale$2(this.language);
1556
1556
  this.inputFocused = false;
1557
+ this.dateMaskOptions = undefined;
1557
1558
  this.requiredMarker = 'optional';
1558
1559
  this.horizontal = false;
1559
1560
  this.autoComplete = 'off';
@@ -1602,13 +1603,12 @@ const CatDate = class {
1602
1603
  componentDidLoad() {
1603
1604
  const format = this.locale.formatStr.replace('YYYY', 'Y').replace('YY', 'y').replace('MM', 'm').replace('DD', 'd');
1604
1605
  const [, p1, d1, p2, p3] = /(\w+)([^\w]+)(\w+)[^\w]+(\w+)/.exec(format) || [];
1605
- this.input?.mask({
1606
- date: true,
1606
+ this.dateMaskOptions = {
1607
1607
  dateMin: this.min,
1608
1608
  dateMax: this.max,
1609
1609
  delimiter: d1,
1610
1610
  datePattern: [p1, p2, p3]
1611
- });
1611
+ };
1612
1612
  }
1613
1613
  /**
1614
1614
  * Programmatically move focus to the input. Use this method instead of
@@ -1635,14 +1635,14 @@ const CatDate = class {
1635
1635
  }
1636
1636
  render() {
1637
1637
  this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
1638
- return (index.h(index.Host, { key: 'c5d22adcdcc4e7a1c27b5613b952f37a6ad3b85c' }, index.h("cat-input", { key: '1be6acf0b3e7c40bfc6705f26ae57f76b790c636', class: "cat-date-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, errors: this.errors, errorUpdate: this.errorUpdate, testId: this.testId, nativeAttributes: this.nativeAttributes, value: this.inputValue, onCatFocus: e => {
1638
+ return (index.h(index.Host, { key: '446b89d959955840787f93b304c60c14610f19a3' }, index.h("cat-input", { key: 'd1a7ac9cac5bbfaf53ad06c7604503658a378bdd', class: "cat-date-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, errors: this.errors, errorUpdate: this.errorUpdate, testId: this.testId, nativeAttributes: this.nativeAttributes, value: this.inputValue, dateMaskOptions: this.dateMaskOptions, onCatFocus: e => {
1639
1639
  this.inputFocused = e.target === this.input;
1640
1640
  e.stopPropagation();
1641
1641
  this.catFocus.emit(e.detail);
1642
1642
  }, onCatBlur: e => {
1643
1643
  e.stopPropagation();
1644
1644
  this.onInputBlur(e.detail);
1645
- } }, index.h("span", { key: '11dfc57ae496dda334707e09fb1cdc1f55a57a5f', slot: "label" }, this.label, index.h("span", { key: '97dc78369c99254d3bb5d1e8cf5b0c65a0b08aac', class: "label-aria" }, " (", this.locale.formatStr, ")")), index.h("cat-dropdown", { key: 'cebca16517e4117352b6366feb6b882fdb58e4f0', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, index.h("cat-button", { key: '410d6d2238bfc5f361d404fdfc679779318ce74e', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), index.h("div", { key: '2f72d4abc68e97c009a0b7a04aaf82569282bdce', slot: "content" }, index.h("cat-date-inline", { key: '4ed60377ffa0ae6de697be7eb5b447f5625e94e4', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, hint: true, weeks: true, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
1645
+ } }, index.h("span", { key: '04cf706a258dd0a8f45bbd938ac9cd0feb663044', slot: "label" }, this.label, index.h("span", { key: '87cb203b21f42eca664a06bf0363158f577248a7', class: "label-aria" }, " (", this.locale.formatStr, ")")), index.h("cat-dropdown", { key: '7bfa57a6f2758e8299f49ce9d7d114368c088084', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, index.h("cat-button", { key: 'e5fce006dccc245f98800c21adbe00354813f008', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), index.h("div", { key: '20896aaf3e536510c0c8ca1e354989ab9afc42e0', slot: "content" }, index.h("cat-date-inline", { key: '6b3d8c5cdf01af45926ef3593d72a6625bb022cb', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, hint: true, weeks: true, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
1646
1646
  }
1647
1647
  getTriggerA11yLabel() {
1648
1648
  const date = this.locale.fromLocalISO(this.value);
@@ -2445,12 +2445,12 @@ const CatDateInline = class {
2445
2445
  const [minDate, maxDate] = this.getMinMaxDate();
2446
2446
  const dateGrid = this.dateGrid(this.viewDate.getFullYear(), this.viewDate.getMonth());
2447
2447
  const [dateStart, dateEnd] = this.getValue();
2448
- return (index.h(index.Host, { key: '8b11e245fdd1d392e545692b68ea449dd19f13c8', "aria-label": this.label || undefined }, index.h("div", { key: 'bf1bd1923e220e9f209ae115eb8e6fb23b3c4b46', class: { 'label-container': true, 'label-hidden': this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: 'e3bfbf624e94f894c38fa97a35a0d5ad7c01915c', id: `${this.id}-label`, htmlFor: this.id, part: "label", onClick: () => this.doFocus() }, index.h("span", { key: 'd946093505f4a9092632b17bc035390a663d4e7f', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: 'aa9da48764a90c7d5db185e0472700465627d7c1', name: "label" })) || this.label, index.h("div", { key: 'd5d8c5c50de0578f96ffb3c80853a06e9bab9821', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '30b1b1149e7e07798e9786e2de260e07d2dad19a', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: '6d02133a159884bc9951894390f7d7d98a5bc1c9', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")"))))))), index.h("div", { key: 'd114855977b1fcdaf0baa77e9cbef1250bfa03be', class: { picker: true, 'picker-weeks': this.weeks }, id: this.id, "aria-describedby": `${this.id}-label` }, index.h("div", { key: '49ec46a464d223340dc74d4152c0048db1087ac6', class: "picker-head" }, index.h("cat-button", { key: '270b297b4a0f577f1ce3c1b8444781f77b089cab', icon: "$cat:datepicker-year-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevYear, disabled: isSameYear(this.viewDate, minDate), onClick: () => this.navigate('prev', 'year'), "data-dropdown-no-close": true }), index.h("cat-button", { key: 'b07427c2c6609b88f4cbbfc6ce14fdf029e22681', icon: "$cat:datepicker-month-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevMonth, disabled: isSameMonth(this.viewDate, minDate), onClick: () => this.navigate('prev', 'month'), "data-dropdown-no-close": true }), index.h("h3", { key: '72c71e36794070a1e2916b6296e453b4314ddf45' }, this.getHeadline()), index.h("cat-button", { key: '764278977f0b7c5a8e06ac03d395d7f4fcf0cd88', icon: "$cat:datepicker-month-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextMonth, disabled: isSameMonth(this.viewDate, maxDate), onClick: () => this.navigate('next', 'month'), "data-dropdown-no-close": true }), index.h("cat-button", { key: 'd19e69146ba96cece2a8e14d6463e2974840d905', icon: "$cat:datepicker-year-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextYear, disabled: isSameYear(this.viewDate, maxDate), onClick: () => this.navigate('next', 'year'), "data-dropdown-no-close": true })), index.h("div", { key: '68f854f2e92f054517091e5667204bdf79b0f57c', class: "picker-grid", onFocusin: () => this.setAriaLive(this.locale.arrowKeys) }, index.h("div", { key: '238564020faf306eadbe5e0178d1e4b1d4590f5c', class: "picker-grid-head" }, Array.from(Array(7), (_, i) => {
2448
+ return (index.h(index.Host, { key: 'f99536926cfa6b5cebaeee0234ef393cae7c6290', "aria-label": this.label || undefined }, index.h("div", { key: '75d8cc40adf407d30bb2346a76f0d88b4a3d7c6a', class: { 'label-container': true, 'label-hidden': this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: '038b0c612f7fad742371cbcc42367a9539dd75eb', id: `${this.id}-label`, htmlFor: this.id, part: "label", onClick: () => this.doFocus() }, index.h("span", { key: 'b5d55a662eebaa50c49a8c653e2659b256b65529', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '73f85529636703818e31875059d90b334ae41f80', name: "label" })) || this.label, index.h("div", { key: '9f1fabf18e18a8e5ef10c0b67fc7750555769d44', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '9aeec8774b56f6216d7dc56c08a4ac300fe11c67', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: '5e18a94063b8ae0844afeb3cb4ca71d14882f9e6', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")"))))))), index.h("div", { key: 'edecc4cf058717971710ee35b87a132b9906f5ec', class: { picker: true, 'picker-weeks': this.weeks }, id: this.id, "aria-describedby": `${this.id}-label` }, index.h("div", { key: '3bd9c5313671337674b07eb35c1af4e6127a3ce2', class: "picker-head" }, index.h("cat-button", { key: '807e707e95bf1861952b4d53dae86ba33a9fabbe', icon: "$cat:datepicker-year-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevYear, disabled: isSameYear(this.viewDate, minDate), onClick: () => this.navigate('prev', 'year'), "data-dropdown-no-close": true }), index.h("cat-button", { key: 'cae8a861478e370cb56a2a0b0e9e03b736fd536e', icon: "$cat:datepicker-month-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevMonth, disabled: isSameMonth(this.viewDate, minDate), onClick: () => this.navigate('prev', 'month'), "data-dropdown-no-close": true }), index.h("h3", { key: '4e6d8580663bb496dffe13c8f03806f15003073d' }, this.getHeadline()), index.h("cat-button", { key: 'ba0ee1f437b48067599148c526d6d843232640a6', icon: "$cat:datepicker-month-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextMonth, disabled: isSameMonth(this.viewDate, maxDate), onClick: () => this.navigate('next', 'month'), "data-dropdown-no-close": true }), index.h("cat-button", { key: '15359d6e6a498f633ec5d8a47b5fc317a3fe1fa3', icon: "$cat:datepicker-year-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextYear, disabled: isSameYear(this.viewDate, maxDate), onClick: () => this.navigate('next', 'year'), "data-dropdown-no-close": true })), index.h("div", { key: '9376764766e77ed75c78403f90c6cd2f45b609ea', class: "picker-grid", onFocusin: () => this.setAriaLive(this.locale.arrowKeys) }, index.h("div", { key: 'c4411952bf4fd12f6b14dd2d235e220eef1e0280', class: "picker-grid-head" }, Array.from(Array(7), (_, i) => {
2449
2449
  const day = (i + this.locale.weekInfo.firstDay) % 7;
2450
2450
  return index.h("abbr", { title: this.locale.days.long[day] }, this.locale.days.short[day]);
2451
- })), this.weeks && (index.h("div", { key: 'c59e9879cd8eacb4197a327a1f3c5e6d109c21b3', class: "picker-grid-weeks" }, dateGrid
2451
+ })), this.weeks && (index.h("div", { key: 'f076b226855bb73f817c534e34cb021fb6d48a08', class: "picker-grid-weeks" }, dateGrid
2452
2452
  .filter((_, i) => i % 7 === 0)
2453
- .map(day => (index.h("div", null, this.getWeekNumber(day)))))), index.h("div", { key: '3751aa8b4744cb6686a5badf2f76bb5a27460dd7', class: "picker-grid-days" }, dateGrid.map(day => {
2453
+ .map(day => (index.h("div", null, this.getWeekNumber(day)))))), index.h("div", { key: '48d757568b3d8640960caadf95f297cfe1f857ee', class: "picker-grid-days" }, dateGrid.map(day => {
2454
2454
  const isStartDate = isSameDay(dateStart, day);
2455
2455
  const isEndDate = isSameDay(dateEnd, day);
2456
2456
  const isRange = !!dateStart && !!dateEnd && day > dateStart && day < dateEnd;
@@ -2467,7 +2467,7 @@ const CatDateInline = class {
2467
2467
  'date-focusable': this.canFocus(day),
2468
2468
  'date-disabled': !this.canClick(day)
2469
2469
  }, nativeAttributes: !this.canFocus(day) ? { tabindex: '-1' } : {}, variant: isStartDate || isEndDate ? 'filled' : isToday ? 'outlined' : 'text', a11yLabel: this.locale.toLocalStr(day), active: isStartDate || isEndDate || isRange, color: isStartDate || isEndDate || isToday ? 'primary' : 'secondary', disabled: !this.canClick(day), onClick: () => this.select(day), "data-date": this.locale.toLocalISO(day) }, day.getDate()));
2470
- }))), index.h("div", { key: '7dabe502931e5a831423e368500a04577241253f', class: "picker-foot" }, !this.noToday && this.canClick(this.locale.now()) && (index.h("cat-button", { key: '6da0e2075e109a248a2bb2b6ab67d9ddf96206f1', size: "s", "data-dropdown-no-close": true, onClick: () => this.select(this.locale.now()) }, this.locale.today)), this.hint && index.h("p", { key: '8b3599454323e064ba22ebd3c16168f99600a64b', class: "cursor-help" }, this.locale.arrowKeys), !this.noClear && (index.h("cat-button", { key: '596d9b14c74f482098d5d5c3684fea633b43baa2', size: "s", disabled: !this.value, "data-dropdown-no-close": true, onClick: () => this.clear() }, this.locale.clear)))), index.h("p", { key: 'dd14d9dbec2061f1d55bf628fafadd3a4aa73460', class: "cursor-aria", "aria-live": "polite" })));
2470
+ }))), index.h("div", { key: 'b8df8f56cd18a70f241ad50a9309548355cd6437', class: "picker-foot" }, !this.noToday && this.canClick(this.locale.now()) && (index.h("cat-button", { key: '19b88e876f7770e6bd97134bccae479198e87992', size: "s", "data-dropdown-no-close": true, onClick: () => this.select(this.locale.now()) }, this.locale.today)), this.hint && index.h("p", { key: 'eb3a49013b64b0787b8c318e6a274900d95cf4f5', class: "cursor-help" }, this.locale.arrowKeys), !this.noClear && (index.h("cat-button", { key: '203a7eec0e8719d4a78f1222426049213f787ba7', size: "s", disabled: !this.value, "data-dropdown-no-close": true, onClick: () => this.clear() }, this.locale.clear)))), index.h("p", { key: '75736aa7b9f8636432a116f82cb886fd0c99393f', class: "cursor-aria", "aria-live": "polite" })));
2471
2471
  }
2472
2472
  focus(date, focus = true) {
2473
2473
  const [minDate, maxDate] = this.getMinMaxDate();
@@ -8671,7 +8671,55 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
8671
8671
  return trap;
8672
8672
  };
8673
8673
 
8674
- const catDropdownCss = ":host{display:contents}:host([hidden]){display:none}::slotted(nav){padding:0.25rem;min-width:8rem;max-width:16rem}.content{position:fixed;background:white;-webkit-overflow-scrolling:touch;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);border:1px solid rgb(var(--cat-border-color, 235, 236, 240));z-index:calc(var(--cat-z-index, 1000) + 100);display:none;opacity:0;transform:scale(0.9);transition:transform 125ms cubic-bezier(0.3, 0, 0.8, 0.15), opacity 125ms cubic-bezier(0.3, 0, 0.8, 0.15)}.content[data-placement^=top]{transform-origin:bottom}.content[data-placement^=top-start]{transform-origin:bottom left}.content[data-placement^=top-end]{transform-origin:bottom right}.content[data-placement^=left]{transform-origin:right}.content[data-placement^=left-start]{transform-origin:right top}.content[data-placement^=left-end]{transform-origin:right bottom}.content[data-placement^=right]{transform-origin:left}.content[data-placement^=right-start]{transform-origin:left top}.content[data-placement^=right-end]{transform-origin:left bottom}.content[data-placement^=bottom]{transform-origin:top}.content[data-placement^=bottom-start]{transform-origin:top left}.content[data-placement^=bottom-end]{transform-origin:top right}.content.show{opacity:1;transform:scale(1);transition:transform 250ms cubic-bezier(0.05, 0.7, 0.1, 1), opacity 250ms cubic-bezier(0.05, 0.7, 0.1, 1)}.content.overflow-auto{overflow:auto}";
8674
+ const focusableSelectors = [
8675
+ 'input',
8676
+ 'select',
8677
+ 'textarea',
8678
+ 'button',
8679
+ 'a[href]',
8680
+ '[tabindex]',
8681
+ 'iframe',
8682
+ '[contenteditable]',
8683
+ 'audio[controls]',
8684
+ 'video[controls]'
8685
+ ];
8686
+ const findFirstTabbableIncludeHidden = (element) => {
8687
+ if (element instanceof HTMLElement) {
8688
+ const potentiallyTabbableElement = getPotentiallyTabbable(element);
8689
+ if (potentiallyTabbableElement) {
8690
+ return potentiallyTabbableElement;
8691
+ }
8692
+ }
8693
+ const children = Array.from(element.querySelectorAll('*'));
8694
+ for (const child of children) {
8695
+ const potentiallyTabbableElement = getPotentiallyTabbable(child);
8696
+ if (potentiallyTabbableElement) {
8697
+ return potentiallyTabbableElement;
8698
+ }
8699
+ }
8700
+ return undefined;
8701
+ };
8702
+ function couldBeTabbable(value) {
8703
+ if (!value.matches(focusableSelectors.join(','))) {
8704
+ return false;
8705
+ }
8706
+ const tabindex = value.getAttribute('tabindex');
8707
+ return tabindex === null || Number(tabindex) >= 0;
8708
+ }
8709
+ function getPotentiallyTabbable(element) {
8710
+ if (couldBeTabbable(element)) {
8711
+ return element;
8712
+ }
8713
+ if (element.shadowRoot) {
8714
+ const shadowTabbable = findFirstTabbableIncludeHidden(element.shadowRoot);
8715
+ if (shadowTabbable) {
8716
+ return shadowTabbable;
8717
+ }
8718
+ }
8719
+ return undefined;
8720
+ }
8721
+
8722
+ const catDropdownCss = ":host{display:contents}:host([hidden]){display:none}::slotted(nav){padding:0.25rem}.aligned ::slotted(nav){min-width:8rem;max-width:16rem}.justified ::slotted(nav){width:100%}.content{position:fixed;background:white;-webkit-overflow-scrolling:touch;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);border:1px solid rgb(var(--cat-border-color, 235, 236, 240));z-index:calc(var(--cat-z-index, 1000) + 100);display:none;opacity:0;transform:scale(0.9);transition:transform 125ms cubic-bezier(0.3, 0, 0.8, 0.15), opacity 125ms cubic-bezier(0.3, 0, 0.8, 0.15)}.content[data-placement^=top]{transform-origin:bottom}.content[data-placement^=top-start]{transform-origin:bottom left}.content[data-placement^=top-end]{transform-origin:bottom right}.content[data-placement^=left]{transform-origin:right}.content[data-placement^=left-start]{transform-origin:right top}.content[data-placement^=left-end]{transform-origin:right bottom}.content[data-placement^=right]{transform-origin:left}.content[data-placement^=right-start]{transform-origin:left top}.content[data-placement^=right-end]{transform-origin:left bottom}.content[data-placement^=bottom]{transform-origin:top}.content[data-placement^=bottom-start]{transform-origin:top left}.content[data-placement^=bottom-end]{transform-origin:top right}.content.show{opacity:1;transform:scale(1);transition:transform 250ms cubic-bezier(0.05, 0.7, 0.1, 1), opacity 250ms cubic-bezier(0.05, 0.7, 0.1, 1)}.content.overflow-auto{overflow:auto}";
8675
8723
  const CatDropdownStyle0 = catDropdownCss;
8676
8724
 
8677
8725
  let nextUniqueId$8 = 0;
@@ -8689,6 +8737,7 @@ const CatDropdown = class {
8689
8737
  */
8690
8738
  this.hasInitialFocus = false;
8691
8739
  this.placement = 'bottom-start';
8740
+ this.justify = false;
8692
8741
  this.noAutoClose = false;
8693
8742
  this.arrowNavigation = 'vertical';
8694
8743
  this.noResize = false;
@@ -8697,14 +8746,6 @@ const CatDropdown = class {
8697
8746
  this.noReturnFocus = false;
8698
8747
  }
8699
8748
  clickHandler(event) {
8700
- // we need to delay the initialization of the trigger until first
8701
- // interaction because the element might still be hidden (and thus not
8702
- // tabbable) if contained in another Stencil web component
8703
- if (!this.trigger) {
8704
- this.hasInitialFocus = this.isEventOriginFromKeyboard(event.detail);
8705
- this.initTrigger();
8706
- this.toggle();
8707
- }
8708
8749
  // hide dropdown on button clicks inside the dropdown content
8709
8750
  const path = event.composedPath();
8710
8751
  if (!this.noAutoClose &&
@@ -8728,12 +8769,6 @@ const CatDropdown = class {
8728
8769
  * @param isFocusVisible is dropdown should receive visible focus when it's opened.
8729
8770
  */
8730
8771
  async open(isFocusVisible) {
8731
- // we need to delay the initialization of the trigger until first
8732
- // interaction because the element might still be hidden (and thus not
8733
- // tabbable) if contained in another Stencil web component
8734
- if (!this.trigger) {
8735
- this.initTrigger();
8736
- }
8737
8772
  if (this.isOpen === null || this.isOpen) {
8738
8773
  return; // busy or open
8739
8774
  }
@@ -8802,11 +8837,12 @@ const CatDropdown = class {
8802
8837
  this.catClose.emit();
8803
8838
  }, timeTransitionS);
8804
8839
  }
8805
- render() {
8806
- return (index.h(index.Host, { key: '8dd26958b3df631a6186f54e27214690b20e7349' }, index.h("slot", { key: '955019546e467a7e4a91ae4f2523ca920bc9b64c', name: "anchor", ref: el => (this.anchorSlot = el) }), index.h("slot", { key: '858ba852906f7646e69501d49eba1e8ad8964c2e', name: "trigger", ref: el => (this.triggerSlot = el) }), index.h("div", { key: '3a78c9967f6e38396d7bb399ecef05de74e55b78', id: this.contentId, class: { content: true, 'overflow-auto': !this.overflow }, ref: el => (this.content = el) }, index.h("slot", { key: '4b229c663a5ba4caee5c258b7ee8a92b7e5618d0', name: "content" }))));
8807
- }
8808
8840
  componentDidLoad() {
8809
8841
  this.initAnchor();
8842
+ this.initTrigger();
8843
+ }
8844
+ render() {
8845
+ return (index.h(index.Host, { key: '05019873f2b9ae46bfbe4c34c1c9b7349dddeb92' }, index.h("slot", { key: '0760052c1d65818b5a4f8c8bf8dc587da27ec5b3', name: "anchor", ref: el => (this.anchorSlot = el) }), index.h("slot", { key: '1ab727c6bc362c9a0d233fd1c0d3db76e04b2f1c', name: "trigger", ref: el => (this.triggerSlot = el) }), index.h("div", { key: '02c216317f4140217578020d83fb853194993d96', id: this.contentId, class: { content: true, 'overflow-auto': !this.overflow, justified: this.justify, aligned: !this.justify }, ref: el => (this.content = el) }, index.h("slot", { key: '8c31f2d7b16bbdfdc528938b5dd09fa84eeb80c3', name: "content" }))));
8810
8846
  }
8811
8847
  get contentId() {
8812
8848
  return `cat-dropdown-${this.id}`;
@@ -8836,7 +8872,7 @@ const CatDropdown = class {
8836
8872
  }
8837
8873
  findTrigger() {
8838
8874
  let trigger;
8839
- const elems = this.triggerSlot?.assignedElements?.() || [];
8875
+ let elems = this.triggerSlot?.assignedElements?.() || [];
8840
8876
  while (!trigger && elems.length) {
8841
8877
  const elem = elems.shift();
8842
8878
  trigger = elem?.hasAttribute('data-trigger')
@@ -8846,23 +8882,41 @@ const CatDropdown = class {
8846
8882
  if (!trigger) {
8847
8883
  trigger = firstTabbable(this.triggerSlot);
8848
8884
  }
8885
+ // if no tabbable element is still found let's attempt to search through elements with visibility:hidden styles
8886
+ // which stencil assigns to component in prehydration state
8887
+ if (!trigger) {
8888
+ elems = this.triggerSlot?.assignedElements?.() || [];
8889
+ while (!trigger && elems.length) {
8890
+ const elem = elems.shift();
8891
+ trigger = findFirstTabbableIncludeHidden(elem);
8892
+ }
8893
+ }
8849
8894
  if (!trigger) {
8850
8895
  throw new Error('Cannot find tabbable element. Use [data-trigger] to set the trigger.');
8851
8896
  }
8852
8897
  return trigger;
8853
8898
  }
8854
- update(anchorElement) {
8899
+ update(anchorElement, justify = this.justify) {
8855
8900
  if (anchorElement) {
8856
8901
  const resize = this.noResize
8857
8902
  ? []
8858
8903
  : [
8859
8904
  size({
8860
8905
  padding: CatDropdown.OFFSET,
8861
- apply({ availableWidth, availableHeight, elements }) {
8862
- Object.assign(elements.floating.style, {
8863
- maxWidth: `${availableWidth}px`,
8864
- maxHeight: `${availableHeight}px`
8865
- });
8906
+ apply({ rects, availableWidth, availableHeight, elements }) {
8907
+ if (justify) {
8908
+ Object.assign(elements.floating.style, {
8909
+ minWidth: `${rects.reference.width}px`,
8910
+ maxWidth: `${rects.reference.width}px`,
8911
+ maxHeight: `${availableHeight}px`
8912
+ });
8913
+ }
8914
+ else {
8915
+ Object.assign(elements.floating.style, {
8916
+ maxWidth: `${availableWidth}px`,
8917
+ maxHeight: `${availableHeight}px`
8918
+ });
8919
+ }
8866
8920
  }
8867
8921
  })
8868
8922
  ];
@@ -8947,1767 +9001,214 @@ const CatIcon = class {
8947
9001
  };
8948
9002
  CatIcon.style = CatIconStyle0;
8949
9003
 
8950
- var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8951
-
8952
- var NumeralFormatter = function (numeralDecimalMark,
8953
- numeralIntegerScale,
8954
- numeralDecimalScale,
8955
- numeralThousandsGroupStyle,
8956
- numeralPositiveOnly,
8957
- stripLeadingZeroes,
8958
- prefix,
8959
- signBeforePrefix,
8960
- tailPrefix,
8961
- delimiter) {
8962
- var owner = this;
8963
-
8964
- owner.numeralDecimalMark = numeralDecimalMark || '.';
8965
- owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
8966
- owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
8967
- owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
8968
- owner.numeralPositiveOnly = !!numeralPositiveOnly;
8969
- owner.stripLeadingZeroes = stripLeadingZeroes !== false;
8970
- owner.prefix = (prefix || prefix === '') ? prefix : '';
8971
- owner.signBeforePrefix = !!signBeforePrefix;
8972
- owner.tailPrefix = !!tailPrefix;
8973
- owner.delimiter = (delimiter || delimiter === '') ? delimiter : ',';
8974
- owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : '';
8975
- };
8976
-
8977
- NumeralFormatter.groupStyle = {
8978
- thousand: 'thousand',
8979
- lakh: 'lakh',
8980
- wan: 'wan',
8981
- none: 'none'
8982
- };
8983
-
8984
- NumeralFormatter.prototype = {
8985
- getRawValue: function (value) {
8986
- return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.');
8987
- },
8988
-
8989
- format: function (value) {
8990
- var owner = this, parts, partSign, partSignAndPrefix, partInteger, partDecimal = '';
8991
-
8992
- // strip alphabet letters
8993
- value = value.replace(/[A-Za-z]/g, '')
8994
- // replace the first decimal mark with reserved placeholder
8995
- .replace(owner.numeralDecimalMark, 'M')
8996
-
8997
- // strip non numeric letters except minus and "M"
8998
- // this is to ensure prefix has been stripped
8999
- .replace(/[^\dM-]/g, '')
9000
-
9001
- // replace the leading minus with reserved placeholder
9002
- .replace(/^\-/, 'N')
9003
-
9004
- // strip the other minus sign (if present)
9005
- .replace(/\-/g, '')
9004
+ /* eslint-disable @typescript-eslint/no-explicit-any */
9005
+ function coerceBoolean(value) {
9006
+ return value != null && `${value}` !== 'false';
9007
+ }
9008
+ function coerceNumber(value, fallbackValue = 0) {
9009
+ return isNumberValue(value) ? Number(value) : fallbackValue;
9010
+ }
9011
+ function isNumberValue(value) {
9012
+ return !isNaN(parseFloat(value)) && !isNaN(Number(value));
9013
+ }
9006
9014
 
9007
- // replace the minus sign (if present)
9008
- .replace('N', owner.numeralPositiveOnly ? '' : '-')
9015
+ var e$1,r$1,t$1,i=function(e){return e.replace(/[^\d]/g,"")},n$1=function(e){return e.reduce(function(e,r){return e+r},0)},a=function(e,r){return e.slice(0,r)},l=function(e){var r=e.value;return e.delimiters.forEach(function(e){e.split("").forEach(function(e){r=r.replace(new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),"");});}),r},u=function(e){var r=e.blocks,t=e.delimiter,i=void 0===t?"":t,n=e.delimiters,a=void 0===n?[]:n,l=e.delimiterLazyShow,u=void 0!==l&&l,c="",s=e.value,o="";return r.forEach(function(e,t){if(s.length>0){var n,l=s.slice(0,e),d=s.slice(e);o=a.length>0?null!=(n=a[u?t-1:t])?n:o:i,u?(t>0&&(c+=o),c+=l):(c+=l,l.length===e&&t<r.length-1&&(c+=o)),s=d;}}),c};!function(e){e.UATP="uatp",e.AMEX="amex",e.DINERS="diners",e.DISCOVER="discover",e.MASTERCARD="mastercard",e.DANKORT="dankort",e.INSTAPAYMENT="instapayment",e.JCB15="jcb15",e.JCB="jcb",e.MAESTRO="maestro",e.VISA="visa",e.MIR="mir",e.UNIONPAY="unionpay",e.GENERAL="general";}(t$1||(t$1={}));var v;((e$1={})[t$1.UATP]=[4,5,6],e$1[t$1.AMEX]=[4,6,5],e$1[t$1.DINERS]=[4,6,4],e$1[t$1.DISCOVER]=[4,4,4,4],e$1[t$1.MASTERCARD]=[4,4,4,4],e$1[t$1.DANKORT]=[4,4,4,4],e$1[t$1.INSTAPAYMENT]=[4,4,4,4],e$1[t$1.JCB15]=[4,6,5],e$1[t$1.JCB]=[4,4,4,4],e$1[t$1.MAESTRO]=[4,4,4,4],e$1[t$1.VISA]=[4,4,4,4],e$1[t$1.MIR]=[4,4,4,4],e$1[t$1.UNIONPAY]=[4,4,4,4],e$1[t$1.GENERAL]=[4,4,4,4],e$1);((r$1={})[t$1.UATP]=/^(?!1800)1\d{0,14}/,r$1[t$1.AMEX]=/^3[47]\d{0,13}/,r$1[t$1.DISCOVER]=/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,r$1[t$1.DINERS]=/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,r$1[t$1.MASTERCARD]=/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,r$1[t$1.DANKORT]=/^(5019|4175|4571)\d{0,12}/,r$1[t$1.INSTAPAYMENT]=/^63[7-9]\d{0,13}/,r$1[t$1.JCB15]=/^(?:2131|1800)\d{0,11}/,r$1[t$1.JCB]=/^(?:35\d{0,2})\d{0,12}/,r$1[t$1.MAESTRO]=/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,r$1[t$1.MIR]=/^220[0-4]\d{0,12}/,r$1[t$1.VISA]=/^4\d{0,15}/,r$1[t$1.UNIONPAY]=/^(62|81)\d{0,14}/,r$1);!function(e){e.THOUSAND="thousand",e.LAKH="lakh",e.WAN="wan",e.NONE="none";}(v||(v={}));var k=["d","m","Y"],C=function(e,r){return r?(e<10?"000":e<100?"00":e<1e3?"0":"")+e:(e<10?"0":"")+e},L=function(e){return (e<10?"0":"")+e},P=function(e,r,t){var i;return e=Math.min(e,31),t=null!=(i=t)?i:0,((r=Math.min(r,12))<7&&r%2==0||r>8&&r%2==1)&&(e=Math.min(e,2===r?function(e){return e%4==0&&e%100!=0||e%400==0}(t)?29:28:30)),[e,r,t]},y=function(e,r){var t=null!=r?r:{},c=t.delimiterLazyShow,s=void 0!==c&&c,o=t.delimiter,d=void 0===o?"/":o,v=t.datePattern,m=void 0===v?k:v,f=t.dateMax,p=void 0===f?"":f,h=t.dateMin,E=void 0===h?"":h;e=i(e);var g=function(e){var r=[];return e.forEach(function(e){r.push("Y"===e?4:2);}),r}(m),I=function(e){var r=e.dateMax,t=e.dateMin.split("-").reverse().map(function(e){return parseInt(e,10)});2===t.length&&t.unshift(0);var i=r.split("-").reverse().map(function(e){return parseInt(e,10)});return 2===i.length&&i.unshift(0),{min:t,max:i}}({dateMax:p,dateMin:E});e=function(e){var r=e.value,t=void 0===r?"":r,i=e.blocks,n=e.datePattern,a=e.min,l=e.max,u="";return (void 0===i?[]:i).forEach(function(e,r){if(t.length>0){var i=t.slice(0,e),a=i.slice(0,1),l=t.slice(e);switch(n[r]){case"d":"00"===i?i="01":parseInt(a,10)>3?i="0"+a:parseInt(i,10)>31&&(i="31");break;case"m":"00"===i?i="01":parseInt(a,10)>1?i="0"+a:parseInt(i,10)>12&&(i="12");}u+=i,t=l;}}),function(e){var r,t,i,n=e.value,a=void 0===n?"":n,l=e.datePattern,u=e.min,c=e.max,s=[],o=0,d=0,v=0,m=0,f=0,p=0,h=!1;return 4===a.length&&"y"!==l[0].toLowerCase()&&"y"!==l[1].toLowerCase()&&(f=2-(m="d"===l[0]?0:2),r=parseInt(a.slice(m,m+2),10),t=parseInt(a.slice(f,f+2),10),s=P(r,t,0)),8===a.length&&(l.forEach(function(e,r){switch(e){case"d":o=r;break;case"m":d=r;break;default:v=r;}}),p=2*v,m=o<=v?2*o:2*o+2,f=d<=v?2*d:2*d+2,r=parseInt(a.slice(m,m+2),10),t=parseInt(a.slice(f,f+2),10),i=parseInt(a.slice(p,p+4),10),h=4===a.slice(p,p+4).length,s=P(r,t,i)),4!==a.length||"y"!==l[0]&&"y"!==l[1]||(p=2-(f="m"===l[0]?0:2),t=parseInt(a.slice(f,f+2),10),i=parseInt(a.slice(p,p+2),10),h=2===a.slice(p,p+2).length,s=[0,t,i]),6!==a.length||"Y"!==l[0]&&"Y"!==l[1]||(p=2-.5*(f="m"===l[0]?0:4),t=parseInt(a.slice(f,f+2),10),i=parseInt(a.slice(p,p+4),10),h=4===a.slice(p,p+4).length,s=[0,t,i]),0===(s=function(e){var r=e.date,t=void 0===r?[]:r,i=e.min,n=e.max;return 0===t.length||i.length<3&&n.length<3||e.datePattern.filter(function(e){return "y"===e.toLowerCase()}).length>0&&0===t[2]?t:n.length>0&&(n[2]<t[2]||n[2]===t[2]&&(n[1]<t[1]||n[1]===t[1]&&n[0]<t[0]))?n:i.length>0&&(i[2]>t[2]||i[2]===t[2]&&(i[1]>t[1]||i[1]===t[1]&&i[0]>t[0]))?i:t}({date:s,datePattern:l,min:u,max:c})).length?a:l.reduce(function(e,r){switch(r){case"d":return e+(0===s[0]?"":L(s[0]));case"m":return e+(0===s[1]?"":L(s[1]));case"y":return e+(h?C(s[2],!1):"");case"Y":return e+(h?C(s[2],!0):"")}return e},"")}({value:u,datePattern:n,min:a,max:l})}({value:e,blocks:g,datePattern:m,min:I.min,max:I.max}),e=l({value:e,delimiters:[d]});var A=n$1(g);return e=a(e,A),u({value:e,blocks:g,delimiter:d,delimiterLazyShow:s})},R=["h","m","s"],T=function(e){return (e<10?"0":"")+e},b=function(e,r,t){return t=Math.min(t,60),r=Math.min(r,60),[e=Math.min(e,60),r,t]},w=function(e,r){var t=null!=r?r:{},c=t.delimiterLazyShow,s=void 0!==c&&c,o=t.delimiter,d=void 0===o?":":o,v=t.timePattern,m=void 0===v?R:v,f=t.timeFormat,p=void 0===f?"24":f;e=i(e);var h=function(e){var r=[];return e.forEach(function(){r.push(2);}),r}(m);e=function(e){var r=e.value,t=e.timePattern,i="",n="12"===e.timeFormat?{maxHourFirstDigit:1,maxHours:12,maxMinutesFirstDigit:5,maxMinutes:60}:{maxHourFirstDigit:2,maxHours:23,maxMinutesFirstDigit:5,maxMinutes:60};return e.blocks.forEach(function(e,a){if(r.length>0){var l=r.slice(0,e),u=l.slice(0,1),c=r.slice(e);switch(t[a]){case"h":parseInt(u,10)>n.maxHourFirstDigit?l="0"+u:parseInt(l,10)>n.maxHours&&(l=n.maxHours+"");break;case"m":case"s":parseInt(u,10)>n.maxMinutesFirstDigit?l="0"+u:parseInt(l,10)>n.maxMinutes&&(l=n.maxMinutes+"");}i+=l,r=c;}}),function(e){var r,t,i,n=e.value,a=e.timePattern,l=[],u=0,c=0,s=0,o=0,d=0,v=0;return 6===n.length&&(a.forEach(function(e,r){switch(e){case"s":u=2*r;break;case"m":c=2*r;break;case"h":s=2*r;}}),v=s,d=c,o=u,r=parseInt(n.slice(o,o+2),10),t=parseInt(n.slice(d,d+2),10),i=parseInt(n.slice(v,v+2),10),l=b(i,t,r)),4!==n.length||a.includes("s")||(a.forEach(function(e,r){switch(e){case"m":c=2*r;break;case"h":s=2*r;}}),v=s,d=c,r=0,t=parseInt(n.slice(d,d+2),10),i=parseInt(n.slice(v,v+2),10),l=b(i,t,r)),0===l.length?n:a.reduce(function(e,r){switch(r){case"s":return e+T(l[2]);case"m":return e+T(l[1]);case"h":return e+T(l[0])}return e},"")}({value:i,timePattern:t})}({value:e,blocks:h,timePattern:m,timeFormat:p}),e=l({value:e,delimiters:[d]});var E=n$1(h);return e=a(e,E),u({value:e,blocks:h,delimiter:d,delimiterLazyShow:s})};
9009
9016
 
9010
- // replace decimal mark
9011
- .replace('M', owner.numeralDecimalMark);
9017
+ const catInputCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-primary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-primary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-primary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-primary-hover{transition:background-color 125ms, color 125ms}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-primary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-primary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-primary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}button.cat-text-primary,button.cat-link-primary{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-primary:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-primary:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-primary,.cat-text-primary-hover{transition:color 125ms}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-bg-primaryInverted-hover{transition:background-color 125ms, color 125ms}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}button.cat-text-primaryInverted,button.cat-link-primaryInverted{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-primaryInverted:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-primaryInverted:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 125ms}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-secondary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-secondary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-secondary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-secondary-hover{transition:background-color 125ms, color 125ms}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-secondary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-secondary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-secondary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}button.cat-text-secondary,button.cat-link-secondary{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-secondary:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-secondary:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-secondary,.cat-text-secondary-hover{transition:color 125ms}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-bg-secondaryInverted-hover{transition:background-color 125ms, color 125ms}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}button.cat-text-secondaryInverted,button.cat-link-secondaryInverted{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-secondaryInverted:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-secondaryInverted:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 125ms}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-info{background-color:rgb(var(--cat-info-bg, 0, 115, 230)) !important;color:rgb(var(--cat-info-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-info-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-info-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-info-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-info-hover{transition:background-color 125ms, color 125ms}.cat-bg-info-hover:hover{background-color:rgb(var(--cat-info-bg-hover, 0, 107, 227)) !important;color:rgb(var(--cat-info-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-info-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-info-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-info-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-info,.cat-link-info{color:rgb(var(--cat-info-text, 0, 115, 230)) !important}button.cat-text-info,button.cat-link-info{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-info:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-info:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-info,.cat-text-info-hover{transition:color 125ms}.cat-link-info:hover,.cat-text-info-hover:hover{color:rgb(var(--cat-info-text-hover, 0, 107, 227)) !important}.cat-link-info:active,.cat-text-info-hover:active{color:rgb(var(--cat-info-text-active, 0, 96, 223)) !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-success-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-success-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-success-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-success-hover{transition:background-color 125ms, color 125ms}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-success-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-success-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-success-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}button.cat-text-success,button.cat-link-success{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-success:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-success:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-success,.cat-text-success-hover{transition:color 125ms}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important;--cat-primary-text:var(--cat-warning-fill, 0, 0, 0);--cat-primary-text-hover:var(--cat-warning-fill-hover, 0, 0, 0);--cat-primary-text-active:var(--cat-warning-fill-active, 0, 0, 0);--cat-link-decoration:underline}.cat-bg-warning-hover{transition:background-color 125ms, color 125ms}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important;--cat-primary-text:var(--cat-warning-fill, 0, 0, 0);--cat-primary-text-hover:var(--cat-warning-fill-hover, 0, 0, 0);--cat-primary-text-active:var(--cat-warning-fill-active, 0, 0, 0);--cat-link-decoration:underline}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}button.cat-text-warning,button.cat-link-warning{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-warning:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-warning:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-warning,.cat-text-warning-hover{transition:color 125ms}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-danger-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-danger-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-danger-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-danger-hover{transition:background-color 125ms, color 125ms}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-danger-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-danger-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-danger-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}button.cat-text-danger,button.cat-link-danger{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-danger:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-danger:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-danger,.cat-text-danger-hover{transition:color 125ms}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-text-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-bg-muted{background-color:#f2f4f7 !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.input-field:not(.input-horizontal) .label-container.hidden,.textarea-field:not(.textarea-horizontal) .label-container.hidden,.select-field:not(.select-horizontal) .label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container{flex-basis:var(--label-size, 33.33%)}.label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-optional,.label-character-count{display:inline-flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem}.label-character-count{margin-left:auto}.input-horizontal .label-container.hidden label,.textarea-horizontal .label-container.hidden label,.select-horizontal .label-container.hidden label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;font-size:0.9375rem;line-height:1.25rem}:host([hidden]){display:none}.input-field,.input-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.input-field.input-horizontal{flex-direction:row;gap:1rem}.input-wrapper{flex:1 1 auto;display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 125ms linear;--border-color:var(--cat-border-color-dark, 215, 219, 224);}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-readonly{pointer-events:none}.input-wrapper.input-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-wrapper:not(.input-disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}.input-wrapper:focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.input-wrapper:focus-within:has(.clearable:focus){outline:none}.input-wrapper.input-invalid{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}.input-wrapper:has(input:-webkit-autofill),.input-wrapper:has(input:-webkit-autofill):hover,.input-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.text-prefix{border-right:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-right:0.75rem}.text-suffix{border-left:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-left:0.75rem}.icon-loading,.icon-prefix,.icon-suffix{align-self:center}.input-outer-wrapper{display:flex}.input-inner-wrapper{display:flex;align-items:center;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input.has-clearable,input.has-toggle-password{padding-right:1.5rem}input.has-clearable.has-toggle-password{padding-right:3.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}.toggle-password{position:absolute;top:calc(50% - 1rem);right:-0.5rem}.has-clearable~.toggle-password{right:1.5rem}:host(.cat-date-input) .input-wrapper,:host(.cat-time-input) .input-wrapper{z-index:1;border-top-right-radius:0;border-bottom-right-radius:0}";
9018
+ const CatInputStyle0 = catInputCss;
9012
9019
 
9013
- // strip any leading zeros
9014
- if (owner.stripLeadingZeroes) {
9015
- value = value.replace(/^(-)?0+(?=\d)/, '$1');
9020
+ let nextUniqueId$7 = 0;
9021
+ const CatInput = class {
9022
+ constructor(hostRef) {
9023
+ index.registerInstance(this, hostRef);
9024
+ this.catChange = index.createEvent(this, "catChange", 7);
9025
+ this.catFocus = index.createEvent(this, "catFocus", 7);
9026
+ this.catBlur = index.createEvent(this, "catBlur", 7);
9027
+ if (hostRef.$hostElement$["s-ei"]) {
9028
+ this.internals = hostRef.$hostElement$["s-ei"];
9016
9029
  }
9017
-
9018
- partSign = value.slice(0, 1) === '-' ? '-' : '';
9019
- if (typeof owner.prefix != 'undefined') {
9020
- if (owner.signBeforePrefix) {
9021
- partSignAndPrefix = partSign + owner.prefix;
9022
- } else {
9023
- partSignAndPrefix = owner.prefix + partSign;
9030
+ else {
9031
+ this.internals = hostRef.$hostElement$.attachInternals();
9032
+ hostRef.$hostElement$["s-ei"] = this.internals;
9033
+ }
9034
+ this._id = `cat-input-${nextUniqueId$7++}`;
9035
+ this.hasSlottedLabel = false;
9036
+ this.hasSlottedHint = false;
9037
+ this.hasSlottedCounter = false;
9038
+ this.isPasswordShown = false;
9039
+ this.errorMap = undefined;
9040
+ this.requiredMarker = 'optional';
9041
+ this.horizontal = false;
9042
+ this.autoComplete = undefined;
9043
+ this.clearable = false;
9044
+ this.togglePassword = false;
9045
+ this.disabled = false;
9046
+ this.loading = false;
9047
+ this.hint = undefined;
9048
+ this.icon = undefined;
9049
+ this.iconRight = false;
9050
+ this.identifier = undefined;
9051
+ this.label = '';
9052
+ this.labelHidden = false;
9053
+ this.max = undefined;
9054
+ this.maxLength = undefined;
9055
+ this.min = undefined;
9056
+ this.minLength = undefined;
9057
+ this.name = undefined;
9058
+ this.placeholder = undefined;
9059
+ this.textPrefix = undefined;
9060
+ this.textSuffix = undefined;
9061
+ this.readonly = false;
9062
+ this.required = false;
9063
+ this.round = false;
9064
+ this.type = 'text';
9065
+ this.value = undefined;
9066
+ this.errors = undefined;
9067
+ this.errorUpdate = 0;
9068
+ this.nativeAttributes = undefined;
9069
+ this.testId = undefined;
9070
+ this.timeMaskOptions = undefined;
9071
+ this.dateMaskOptions = undefined;
9072
+ }
9073
+ get id() {
9074
+ return this.identifier || this._id;
9075
+ }
9076
+ componentWillLoad() {
9077
+ this.onErrorsChanged(this.errors, undefined, false);
9078
+ }
9079
+ componentWillRender() {
9080
+ this.internals.setFormValue(this.value ?? null);
9081
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
9082
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
9083
+ this.hasSlottedCounter = !!this.hostElement.querySelector('[slot="counter"]');
9084
+ }
9085
+ /**
9086
+ * Programmatically move focus to the input. Use this method instead of
9087
+ * `input.focus()`.
9088
+ *
9089
+ * @param options An optional object providing options to control aspects of
9090
+ * the focusing process.
9091
+ */
9092
+ async doFocus(options) {
9093
+ // hack to make datepicker inputs focusable. The datepicker hides the input
9094
+ // element and dynamically creates a sibling. We need to find the new input
9095
+ // element and focus it instead.
9096
+ const input = this.input.type === 'hidden' ? this.findSiblingInput(this.input.nextSibling) : this.input;
9097
+ input?.focus(options);
9098
+ }
9099
+ /**
9100
+ * Programmatically remove focus from the input. Use this method instead of
9101
+ * `input.blur()`.
9102
+ */
9103
+ async doBlur() {
9104
+ this.input.blur();
9105
+ }
9106
+ /**
9107
+ * Clear the input.
9108
+ */
9109
+ async clear() {
9110
+ this.value = '';
9111
+ this.catChange.emit(this.value);
9112
+ }
9113
+ onErrorsChanged(newValue, _oldValue, update = true) {
9114
+ if (!coerceBoolean(this.errorUpdate)) {
9115
+ this.errorMap = undefined;
9116
+ }
9117
+ else {
9118
+ this.errorMapSrc = Array.isArray(newValue)
9119
+ ? newValue.reduce((acc, err) => ({ ...acc, [err]: undefined }), {})
9120
+ : newValue || undefined;
9121
+ if (update) {
9122
+ this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();
9024
9123
  }
9025
- } else {
9026
- partSignAndPrefix = partSign;
9027
9124
  }
9028
-
9029
- partInteger = value;
9030
-
9031
- if (value.indexOf(owner.numeralDecimalMark) >= 0) {
9032
- parts = value.split(owner.numeralDecimalMark);
9033
- partInteger = parts[0];
9034
- partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale);
9125
+ }
9126
+ render() {
9127
+ this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
9128
+ return (index.h("div", { key: '2d1470e5fcbc444187c35b52a977ae919f5441f5', class: {
9129
+ 'input-field': true,
9130
+ 'input-horizontal': this.horizontal
9131
+ } }, index.h("div", { key: 'f78abacd75b12bccab406da85e6d77866e271dae', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: '5985d170af91fc174a28fa102f2a7e33475aaa93', htmlFor: this.id, part: "label" }, index.h("span", { key: '49c82004f681bd34acae7b3f7aef95278a975cb3', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '3c2b12e5bf2af34487569f346b48123d9d633618', name: "label" })) || this.label, index.h("div", { key: 'a0a12f7f406845bf49efcee8e3afc0dbcb20ec66', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: 'c3076888f346793dcd35b40efbe023e1b77a13af', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: 'a55f8332f32fe7b42062ef726ea6148c6cec72a1', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")")), (this.maxLength || this.hasSlottedCounter) && (index.h("div", { key: 'a7178393a4e61a6fa1a7548caeb2622561156499', class: "label-character-count", "aria-hidden": "true" }, this.hasSlottedCounter ? (index.h("slot", { name: "counter" })) : (`${this.value?.length ?? 0}/${this.maxLength}`)))))))), index.h("div", { key: '5be7d2b3f4630cbc98ff2f2370e58c3e02158e82', class: "input-container" }, index.h("div", { key: 'ffe47bed961517990aea7115fd48090cea7973f7', class: "input-outer-wrapper" }, index.h("div", { key: '8054a1dead8ec0f04ec09c42afa64304e1eeab73', class: {
9132
+ 'input-wrapper': true,
9133
+ 'input-round': this.round,
9134
+ 'input-readonly': this.readonly,
9135
+ 'input-disabled': this.disabled,
9136
+ 'input-invalid': this.invalid
9137
+ }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { key: '679c04bcdf71a18281c57d8b894bb2d09db04c61', class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && (index.h("cat-icon", { key: '9676f80f87886585bd1e66dc36d79f73d8dcbc1d', icon: this.icon, class: "icon-prefix", size: "l", onClick: () => this.doFocus() })), index.h("div", { key: '63d68df805f010fd43cabbb2a926b15d38cbac02', class: "input-inner-wrapper" }, index.h("input", { key: 'c647bb48d0ce78bfdd32738293d48a6fd0decebd', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.id, class: {
9138
+ 'has-clearable': this.clearable && !this.disabled && !this.readonly && !!this.value,
9139
+ 'has-toggle-password': this.togglePassword && !this.disabled && !this.readonly && !!this.value
9140
+ }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.isPasswordShown ? 'text' : this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), this.clearable && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: 'b55760f57d4e2a614ffb52e603a909002953023a', class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": of.catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this), "data-dropdown-no-close": true })), this.togglePassword && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: '09fb349df1ab00b7260a290bc3aa2fc7fae6ba55', class: "toggle-password", icon: this.isPasswordShown ? '$cat:input-password-hide' : '$cat:input-password-show', "icon-only": "true", size: "s", variant: "text", "a11y-label": of.catI18nRegistry.t(this.isPasswordShown ? 'input.hidePassword' : 'input.showPassword'), onClick: this.doTogglePassword.bind(this) }))), this.loading && index.h("cat-spinner", { key: '5afe2fb200dee5e83b0502db4dddb4609d2ff8c5', size: "m", class: "icon-loading" }), !this.invalid && this.icon && this.iconRight && (index.h("cat-icon", { key: '4aa4fbef3cd5c6de7819ebaf8b7fd9df86a33656', icon: this.icon, class: "icon-suffix", size: "l", onClick: () => this.doFocus() })), this.invalid && (index.h("cat-icon", { key: 'ead450e2a1aad0bd0ae939610bdd25555d487955', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (index.h("span", { key: '54b5f3a403ef48046f4a2ce077195e256e68cfaf', class: "text-suffix", part: "suffix" }, this.textSuffix))), index.h("slot", { key: '60f90528fa403d432bd930819961f41adbdffd64', name: "addon" })), this.hasHint && (index.h(CatFormHint, { key: 'de40c1cc2308e00089a6515d95faa3252ec2ec49', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))));
9141
+ }
9142
+ get hasHint() {
9143
+ return !!this.hint || !!this.hasSlottedHint || this.invalid;
9144
+ }
9145
+ get invalid() {
9146
+ return this.errorMap === true || !!Object.keys(this.errorMap || {}).length;
9147
+ }
9148
+ onInput() {
9149
+ let formattedValue = this.input.value;
9150
+ if (this.timeMaskOptions) {
9151
+ formattedValue = w(this.input.value, this.timeMaskOptions);
9035
9152
  }
9036
-
9037
- if(partSign === '-') {
9038
- partInteger = partInteger.slice(1);
9153
+ if (this.dateMaskOptions) {
9154
+ formattedValue = y(this.input.value, this.dateMaskOptions);
9039
9155
  }
9040
-
9041
- if (owner.numeralIntegerScale > 0) {
9042
- partInteger = partInteger.slice(0, owner.numeralIntegerScale);
9156
+ this.value = formattedValue;
9157
+ this.input.value = formattedValue;
9158
+ this.internals.setFormValue(this.input.value);
9159
+ this.catChange.emit(this.value);
9160
+ this.showErrorsIfTimeout();
9161
+ }
9162
+ onFocus(event) {
9163
+ this.catFocus.emit(event);
9164
+ }
9165
+ onBlur(event) {
9166
+ this.catBlur.emit(event);
9167
+ if (coerceBoolean(this.errorUpdate)) {
9168
+ this.showErrors();
9043
9169
  }
9044
-
9045
- switch (owner.numeralThousandsGroupStyle) {
9046
- case NumeralFormatter.groupStyle.lakh:
9047
- partInteger = partInteger.replace(/(\d)(?=(\d\d)+\d$)/g, '$1' + owner.delimiter);
9048
-
9049
- break;
9050
-
9051
- case NumeralFormatter.groupStyle.wan:
9052
- partInteger = partInteger.replace(/(\d)(?=(\d{4})+$)/g, '$1' + owner.delimiter);
9053
-
9054
- break;
9055
-
9056
- case NumeralFormatter.groupStyle.thousand:
9057
- partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + owner.delimiter);
9058
-
9059
- break;
9170
+ }
9171
+ doTogglePassword() {
9172
+ this.isPasswordShown = !this.isPasswordShown;
9173
+ }
9174
+ showErrors() {
9175
+ this.errorMap = this.errorMapSrc;
9176
+ }
9177
+ showErrorsIfTimeout() {
9178
+ const errorUpdate = coerceNumber(this.errorUpdate, null);
9179
+ if (errorUpdate !== null) {
9180
+ typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);
9181
+ this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);
9182
+ return true;
9060
9183
  }
9061
-
9062
- if (owner.tailPrefix) {
9063
- return partSign + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '') + owner.prefix;
9184
+ return false;
9185
+ }
9186
+ showErrorsIfNoFocus() {
9187
+ const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;
9188
+ if (!hasFocus) {
9189
+ this.showErrors();
9064
9190
  }
9065
-
9066
- return partSignAndPrefix + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '');
9067
9191
  }
9192
+ findSiblingInput(node) {
9193
+ if (node instanceof HTMLInputElement) {
9194
+ return node;
9195
+ }
9196
+ else if (node?.nextSibling) {
9197
+ return this.findSiblingInput(node.nextSibling);
9198
+ }
9199
+ return undefined;
9200
+ }
9201
+ static get delegatesFocus() { return true; }
9202
+ static get formAssociated() { return true; }
9203
+ get hostElement() { return index.getElement(this); }
9204
+ static get watchers() { return {
9205
+ "errors": ["onErrorsChanged"]
9206
+ }; }
9068
9207
  };
9208
+ CatInput.style = CatInputStyle0;
9069
9209
 
9070
- var NumeralFormatter_1 = NumeralFormatter;
9071
-
9072
- var DateFormatter = function (datePattern, dateMin, dateMax) {
9073
- var owner = this;
9074
-
9075
- owner.date = [];
9076
- owner.blocks = [];
9077
- owner.datePattern = datePattern;
9078
- owner.dateMin = dateMin
9079
- .split('-')
9080
- .reverse()
9081
- .map(function(x) {
9082
- return parseInt(x, 10);
9083
- });
9084
- if (owner.dateMin.length === 2) owner.dateMin.unshift(0);
9085
-
9086
- owner.dateMax = dateMax
9087
- .split('-')
9088
- .reverse()
9089
- .map(function(x) {
9090
- return parseInt(x, 10);
9091
- });
9092
- if (owner.dateMax.length === 2) owner.dateMax.unshift(0);
9093
-
9094
- owner.initBlocks();
9095
- };
9096
-
9097
- DateFormatter.prototype = {
9098
- initBlocks: function () {
9099
- var owner = this;
9100
- owner.datePattern.forEach(function (value) {
9101
- if (value === 'Y') {
9102
- owner.blocks.push(4);
9103
- } else {
9104
- owner.blocks.push(2);
9105
- }
9106
- });
9107
- },
9108
-
9109
- getISOFormatDate: function () {
9110
- var owner = this,
9111
- date = owner.date;
9112
-
9113
- return date[2] ? (
9114
- date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0])
9115
- ) : '';
9116
- },
9117
-
9118
- getBlocks: function () {
9119
- return this.blocks;
9120
- },
9121
-
9122
- getValidatedDate: function (value) {
9123
- var owner = this, result = '';
9124
-
9125
- value = value.replace(/[^\d]/g, '');
9126
-
9127
- owner.blocks.forEach(function (length, index) {
9128
- if (value.length > 0) {
9129
- var sub = value.slice(0, length),
9130
- sub0 = sub.slice(0, 1),
9131
- rest = value.slice(length);
9132
-
9133
- switch (owner.datePattern[index]) {
9134
- case 'd':
9135
- if (sub === '00') {
9136
- sub = '01';
9137
- } else if (parseInt(sub0, 10) > 3) {
9138
- sub = '0' + sub0;
9139
- } else if (parseInt(sub, 10) > 31) {
9140
- sub = '31';
9141
- }
9142
-
9143
- break;
9144
-
9145
- case 'm':
9146
- if (sub === '00') {
9147
- sub = '01';
9148
- } else if (parseInt(sub0, 10) > 1) {
9149
- sub = '0' + sub0;
9150
- } else if (parseInt(sub, 10) > 12) {
9151
- sub = '12';
9152
- }
9153
-
9154
- break;
9155
- }
9156
-
9157
- result += sub;
9158
-
9159
- // update remaining string
9160
- value = rest;
9161
- }
9162
- });
9163
-
9164
- return this.getFixedDateString(result);
9165
- },
9166
-
9167
- getFixedDateString: function (value) {
9168
- var owner = this, datePattern = owner.datePattern, date = [],
9169
- dayIndex = 0, monthIndex = 0, yearIndex = 0,
9170
- dayStartIndex = 0, monthStartIndex = 0, yearStartIndex = 0,
9171
- day, month, year, fullYearDone = false;
9172
-
9173
- // mm-dd || dd-mm
9174
- if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') {
9175
- dayStartIndex = datePattern[0] === 'd' ? 0 : 2;
9176
- monthStartIndex = 2 - dayStartIndex;
9177
- day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);
9178
- month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
9179
-
9180
- date = this.getFixedDate(day, month, 0);
9181
- }
9182
-
9183
- // yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd
9184
- if (value.length === 8) {
9185
- datePattern.forEach(function (type, index) {
9186
- switch (type) {
9187
- case 'd':
9188
- dayIndex = index;
9189
- break;
9190
- case 'm':
9191
- monthIndex = index;
9192
- break;
9193
- default:
9194
- yearIndex = index;
9195
- break;
9196
- }
9197
- });
9198
-
9199
- yearStartIndex = yearIndex * 2;
9200
- dayStartIndex = (dayIndex <= yearIndex) ? dayIndex * 2 : (dayIndex * 2 + 2);
9201
- monthStartIndex = (monthIndex <= yearIndex) ? monthIndex * 2 : (monthIndex * 2 + 2);
9202
-
9203
- day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);
9204
- month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
9205
- year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);
9206
-
9207
- fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;
9208
-
9209
- date = this.getFixedDate(day, month, year);
9210
- }
9211
-
9212
- // mm-yy || yy-mm
9213
- if (value.length === 4 && (datePattern[0] === 'y' || datePattern[1] === 'y')) {
9214
- monthStartIndex = datePattern[0] === 'm' ? 0 : 2;
9215
- yearStartIndex = 2 - monthStartIndex;
9216
- month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
9217
- year = parseInt(value.slice(yearStartIndex, yearStartIndex + 2), 10);
9218
-
9219
- fullYearDone = value.slice(yearStartIndex, yearStartIndex + 2).length === 2;
9220
-
9221
- date = [0, month, year];
9222
- }
9223
-
9224
- // mm-yyyy || yyyy-mm
9225
- if (value.length === 6 && (datePattern[0] === 'Y' || datePattern[1] === 'Y')) {
9226
- monthStartIndex = datePattern[0] === 'm' ? 0 : 4;
9227
- yearStartIndex = 2 - 0.5 * monthStartIndex;
9228
- month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
9229
- year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);
9230
-
9231
- fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;
9232
-
9233
- date = [0, month, year];
9234
- }
9235
-
9236
- date = owner.getRangeFixedDate(date);
9237
- owner.date = date;
9238
-
9239
- var result = date.length === 0 ? value : datePattern.reduce(function (previous, current) {
9240
- switch (current) {
9241
- case 'd':
9242
- return previous + (date[0] === 0 ? '' : owner.addLeadingZero(date[0]));
9243
- case 'm':
9244
- return previous + (date[1] === 0 ? '' : owner.addLeadingZero(date[1]));
9245
- case 'y':
9246
- return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], false) : '');
9247
- case 'Y':
9248
- return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], true) : '');
9249
- }
9250
- }, '');
9251
-
9252
- return result;
9253
- },
9254
-
9255
- getRangeFixedDate: function (date) {
9256
- var owner = this,
9257
- datePattern = owner.datePattern,
9258
- dateMin = owner.dateMin || [],
9259
- dateMax = owner.dateMax || [];
9260
-
9261
- if (!date.length || (dateMin.length < 3 && dateMax.length < 3)) return date;
9262
-
9263
- if (
9264
- datePattern.find(function(x) {
9265
- return x.toLowerCase() === 'y';
9266
- }) &&
9267
- date[2] === 0
9268
- ) return date;
9269
-
9270
- if (dateMax.length && (dateMax[2] < date[2] || (
9271
- dateMax[2] === date[2] && (dateMax[1] < date[1] || (
9272
- dateMax[1] === date[1] && dateMax[0] < date[0]
9273
- ))
9274
- ))) return dateMax;
9275
-
9276
- if (dateMin.length && (dateMin[2] > date[2] || (
9277
- dateMin[2] === date[2] && (dateMin[1] > date[1] || (
9278
- dateMin[1] === date[1] && dateMin[0] > date[0]
9279
- ))
9280
- ))) return dateMin;
9281
-
9282
- return date;
9283
- },
9284
-
9285
- getFixedDate: function (day, month, year) {
9286
- day = Math.min(day, 31);
9287
- month = Math.min(month, 12);
9288
- year = parseInt((year || 0), 10);
9289
-
9290
- if ((month < 7 && month % 2 === 0) || (month > 8 && month % 2 === 1)) {
9291
- day = Math.min(day, month === 2 ? (this.isLeapYear(year) ? 29 : 28) : 30);
9292
- }
9293
-
9294
- return [day, month, year];
9295
- },
9296
-
9297
- isLeapYear: function (year) {
9298
- return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
9299
- },
9300
-
9301
- addLeadingZero: function (number) {
9302
- return (number < 10 ? '0' : '') + number;
9303
- },
9304
-
9305
- addLeadingZeroForYear: function (number, fullYearMode) {
9306
- if (fullYearMode) {
9307
- return (number < 10 ? '000' : (number < 100 ? '00' : (number < 1000 ? '0' : ''))) + number;
9308
- }
9309
-
9310
- return (number < 10 ? '0' : '') + number;
9311
- }
9312
- };
9313
-
9314
- var DateFormatter_1 = DateFormatter;
9315
-
9316
- var TimeFormatter = function (timePattern, timeFormat) {
9317
- var owner = this;
9318
-
9319
- owner.time = [];
9320
- owner.blocks = [];
9321
- owner.timePattern = timePattern;
9322
- owner.timeFormat = timeFormat;
9323
- owner.initBlocks();
9324
- };
9325
-
9326
- TimeFormatter.prototype = {
9327
- initBlocks: function () {
9328
- var owner = this;
9329
- owner.timePattern.forEach(function () {
9330
- owner.blocks.push(2);
9331
- });
9332
- },
9333
-
9334
- getISOFormatTime: function () {
9335
- var owner = this,
9336
- time = owner.time;
9337
-
9338
- return time[2] ? (
9339
- owner.addLeadingZero(time[0]) + ':' + owner.addLeadingZero(time[1]) + ':' + owner.addLeadingZero(time[2])
9340
- ) : '';
9341
- },
9342
-
9343
- getBlocks: function () {
9344
- return this.blocks;
9345
- },
9346
-
9347
- getTimeFormatOptions: function () {
9348
- var owner = this;
9349
- if (String(owner.timeFormat) === '12') {
9350
- return {
9351
- maxHourFirstDigit: 1,
9352
- maxHours: 12,
9353
- maxMinutesFirstDigit: 5,
9354
- maxMinutes: 60
9355
- };
9356
- }
9357
-
9358
- return {
9359
- maxHourFirstDigit: 2,
9360
- maxHours: 23,
9361
- maxMinutesFirstDigit: 5,
9362
- maxMinutes: 60
9363
- };
9364
- },
9365
-
9366
- getValidatedTime: function (value) {
9367
- var owner = this, result = '';
9368
-
9369
- value = value.replace(/[^\d]/g, '');
9370
-
9371
- var timeFormatOptions = owner.getTimeFormatOptions();
9372
-
9373
- owner.blocks.forEach(function (length, index) {
9374
- if (value.length > 0) {
9375
- var sub = value.slice(0, length),
9376
- sub0 = sub.slice(0, 1),
9377
- rest = value.slice(length);
9378
-
9379
- switch (owner.timePattern[index]) {
9380
-
9381
- case 'h':
9382
- if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {
9383
- sub = '0' + sub0;
9384
- } else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {
9385
- sub = timeFormatOptions.maxHours + '';
9386
- }
9387
-
9388
- break;
9389
-
9390
- case 'm':
9391
- case 's':
9392
- if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {
9393
- sub = '0' + sub0;
9394
- } else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {
9395
- sub = timeFormatOptions.maxMinutes + '';
9396
- }
9397
- break;
9398
- }
9399
-
9400
- result += sub;
9401
-
9402
- // update remaining string
9403
- value = rest;
9404
- }
9405
- });
9406
-
9407
- return this.getFixedTimeString(result);
9408
- },
9409
-
9410
- getFixedTimeString: function (value) {
9411
- var owner = this, timePattern = owner.timePattern, time = [],
9412
- secondIndex = 0, minuteIndex = 0, hourIndex = 0,
9413
- secondStartIndex = 0, minuteStartIndex = 0, hourStartIndex = 0,
9414
- second, minute, hour;
9415
-
9416
- if (value.length === 6) {
9417
- timePattern.forEach(function (type, index) {
9418
- switch (type) {
9419
- case 's':
9420
- secondIndex = index * 2;
9421
- break;
9422
- case 'm':
9423
- minuteIndex = index * 2;
9424
- break;
9425
- case 'h':
9426
- hourIndex = index * 2;
9427
- break;
9428
- }
9429
- });
9430
-
9431
- hourStartIndex = hourIndex;
9432
- minuteStartIndex = minuteIndex;
9433
- secondStartIndex = secondIndex;
9434
-
9435
- second = parseInt(value.slice(secondStartIndex, secondStartIndex + 2), 10);
9436
- minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10);
9437
- hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10);
9438
-
9439
- time = this.getFixedTime(hour, minute, second);
9440
- }
9441
-
9442
- if (value.length === 4 && owner.timePattern.indexOf('s') < 0) {
9443
- timePattern.forEach(function (type, index) {
9444
- switch (type) {
9445
- case 'm':
9446
- minuteIndex = index * 2;
9447
- break;
9448
- case 'h':
9449
- hourIndex = index * 2;
9450
- break;
9451
- }
9452
- });
9453
-
9454
- hourStartIndex = hourIndex;
9455
- minuteStartIndex = minuteIndex;
9456
-
9457
- second = 0;
9458
- minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10);
9459
- hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10);
9460
-
9461
- time = this.getFixedTime(hour, minute, second);
9462
- }
9463
-
9464
- owner.time = time;
9465
-
9466
- return time.length === 0 ? value : timePattern.reduce(function (previous, current) {
9467
- switch (current) {
9468
- case 's':
9469
- return previous + owner.addLeadingZero(time[2]);
9470
- case 'm':
9471
- return previous + owner.addLeadingZero(time[1]);
9472
- case 'h':
9473
- return previous + owner.addLeadingZero(time[0]);
9474
- }
9475
- }, '');
9476
- },
9477
-
9478
- getFixedTime: function (hour, minute, second) {
9479
- second = Math.min(parseInt(second || 0, 10), 60);
9480
- minute = Math.min(minute, 60);
9481
- hour = Math.min(hour, 60);
9482
-
9483
- return [hour, minute, second];
9484
- },
9485
-
9486
- addLeadingZero: function (number) {
9487
- return (number < 10 ? '0' : '') + number;
9488
- }
9489
- };
9490
-
9491
- var TimeFormatter_1 = TimeFormatter;
9492
-
9493
- var PhoneFormatter = function (formatter, delimiter) {
9494
- var owner = this;
9495
-
9496
- owner.delimiter = (delimiter || delimiter === '') ? delimiter : ' ';
9497
- owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : '';
9498
-
9499
- owner.formatter = formatter;
9500
- };
9501
-
9502
- PhoneFormatter.prototype = {
9503
- setFormatter: function (formatter) {
9504
- this.formatter = formatter;
9505
- },
9506
-
9507
- format: function (phoneNumber) {
9508
- var owner = this;
9509
-
9510
- owner.formatter.clear();
9511
-
9512
- // only keep number and +
9513
- phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
9514
-
9515
- // strip non-leading +
9516
- phoneNumber = phoneNumber.replace(/^\+/, 'B').replace(/\+/g, '').replace('B', '+');
9517
-
9518
- // strip delimiter
9519
- phoneNumber = phoneNumber.replace(owner.delimiterRE, '');
9520
-
9521
- var result = '', current, validated = false;
9522
-
9523
- for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) {
9524
- current = owner.formatter.inputDigit(phoneNumber.charAt(i));
9525
-
9526
- // has ()- or space inside
9527
- if (/[\s()-]/g.test(current)) {
9528
- result = current;
9529
-
9530
- validated = true;
9531
- } else {
9532
- if (!validated) {
9533
- result = current;
9534
- }
9535
- // else: over length input
9536
- // it turns to invalid number again
9537
- }
9538
- }
9539
-
9540
- // strip ()
9541
- // e.g. US: 7161234567 returns (716) 123-4567
9542
- result = result.replace(/[()]/g, '');
9543
- // replace library delimiter with user customized delimiter
9544
- result = result.replace(/[\s-]/g, owner.delimiter);
9545
-
9546
- return result;
9547
- }
9548
- };
9549
-
9550
- var PhoneFormatter_1 = PhoneFormatter;
9551
-
9552
- var CreditCardDetector = {
9553
- blocks: {
9554
- uatp: [4, 5, 6],
9555
- amex: [4, 6, 5],
9556
- diners: [4, 6, 4],
9557
- discover: [4, 4, 4, 4],
9558
- mastercard: [4, 4, 4, 4],
9559
- dankort: [4, 4, 4, 4],
9560
- instapayment: [4, 4, 4, 4],
9561
- jcb15: [4, 6, 5],
9562
- jcb: [4, 4, 4, 4],
9563
- maestro: [4, 4, 4, 4],
9564
- visa: [4, 4, 4, 4],
9565
- mir: [4, 4, 4, 4],
9566
- unionPay: [4, 4, 4, 4],
9567
- general: [4, 4, 4, 4]
9568
- },
9569
-
9570
- re: {
9571
- // starts with 1; 15 digits, not starts with 1800 (jcb card)
9572
- uatp: /^(?!1800)1\d{0,14}/,
9573
-
9574
- // starts with 34/37; 15 digits
9575
- amex: /^3[47]\d{0,13}/,
9576
-
9577
- // starts with 6011/65/644-649; 16 digits
9578
- discover: /^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,
9579
-
9580
- // starts with 300-305/309 or 36/38/39; 14 digits
9581
- diners: /^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,
9582
-
9583
- // starts with 51-55/2221–2720; 16 digits
9584
- mastercard: /^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,
9585
-
9586
- // starts with 5019/4175/4571; 16 digits
9587
- dankort: /^(5019|4175|4571)\d{0,12}/,
9588
-
9589
- // starts with 637-639; 16 digits
9590
- instapayment: /^63[7-9]\d{0,13}/,
9591
-
9592
- // starts with 2131/1800; 15 digits
9593
- jcb15: /^(?:2131|1800)\d{0,11}/,
9594
-
9595
- // starts with 2131/1800/35; 16 digits
9596
- jcb: /^(?:35\d{0,2})\d{0,12}/,
9597
-
9598
- // starts with 50/56-58/6304/67; 16 digits
9599
- maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,
9600
-
9601
- // starts with 22; 16 digits
9602
- mir: /^220[0-4]\d{0,12}/,
9603
-
9604
- // starts with 4; 16 digits
9605
- visa: /^4\d{0,15}/,
9606
-
9607
- // starts with 62/81; 16 digits
9608
- unionPay: /^(62|81)\d{0,14}/
9609
- },
9610
-
9611
- getStrictBlocks: function (block) {
9612
- var total = block.reduce(function (prev, current) {
9613
- return prev + current;
9614
- }, 0);
9615
-
9616
- return block.concat(19 - total);
9617
- },
9618
-
9619
- getInfo: function (value, strictMode) {
9620
- var blocks = CreditCardDetector.blocks,
9621
- re = CreditCardDetector.re;
9622
-
9623
- // Some credit card can have up to 19 digits number.
9624
- // Set strictMode to true will remove the 16 max-length restrain,
9625
- // however, I never found any website validate card number like
9626
- // this, hence probably you don't want to enable this option.
9627
- strictMode = !!strictMode;
9628
-
9629
- for (var key in re) {
9630
- if (re[key].test(value)) {
9631
- var matchedBlocks = blocks[key];
9632
- return {
9633
- type: key,
9634
- blocks: strictMode ? this.getStrictBlocks(matchedBlocks) : matchedBlocks
9635
- };
9636
- }
9637
- }
9638
-
9639
- return {
9640
- type: 'unknown',
9641
- blocks: strictMode ? this.getStrictBlocks(blocks.general) : blocks.general
9642
- };
9643
- }
9644
- };
9645
-
9646
- var CreditCardDetector_1 = CreditCardDetector;
9647
-
9648
- var Util = {
9649
- noop: function () {
9650
- },
9651
-
9652
- strip: function (value, re) {
9653
- return value.replace(re, '');
9654
- },
9655
-
9656
- getPostDelimiter: function (value, delimiter, delimiters) {
9657
- // single delimiter
9658
- if (delimiters.length === 0) {
9659
- return value.slice(-delimiter.length) === delimiter ? delimiter : '';
9660
- }
9661
-
9662
- // multiple delimiters
9663
- var matchedDelimiter = '';
9664
- delimiters.forEach(function (current) {
9665
- if (value.slice(-current.length) === current) {
9666
- matchedDelimiter = current;
9667
- }
9668
- });
9669
-
9670
- return matchedDelimiter;
9671
- },
9672
-
9673
- getDelimiterREByDelimiter: function (delimiter) {
9674
- return new RegExp(delimiter.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'), 'g');
9675
- },
9676
-
9677
- getNextCursorPosition: function (prevPos, oldValue, newValue, delimiter, delimiters) {
9678
- // If cursor was at the end of value, just place it back.
9679
- // Because new value could contain additional chars.
9680
- if (oldValue.length === prevPos) {
9681
- return newValue.length;
9682
- }
9683
-
9684
- return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter ,delimiters);
9685
- },
9686
-
9687
- getPositionOffset: function (prevPos, oldValue, newValue, delimiter, delimiters) {
9688
- var oldRawValue, newRawValue, lengthOffset;
9689
-
9690
- oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters);
9691
- newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters);
9692
- lengthOffset = oldRawValue.length - newRawValue.length;
9693
-
9694
- return (lengthOffset !== 0) ? (lengthOffset / Math.abs(lengthOffset)) : 0;
9695
- },
9696
-
9697
- stripDelimiters: function (value, delimiter, delimiters) {
9698
- var owner = this;
9699
-
9700
- // single delimiter
9701
- if (delimiters.length === 0) {
9702
- var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : '';
9703
-
9704
- return value.replace(delimiterRE, '');
9705
- }
9706
-
9707
- // multiple delimiters
9708
- delimiters.forEach(function (current) {
9709
- current.split('').forEach(function (letter) {
9710
- value = value.replace(owner.getDelimiterREByDelimiter(letter), '');
9711
- });
9712
- });
9713
-
9714
- return value;
9715
- },
9716
-
9717
- headStr: function (str, length) {
9718
- return str.slice(0, length);
9719
- },
9720
-
9721
- getMaxLength: function (blocks) {
9722
- return blocks.reduce(function (previous, current) {
9723
- return previous + current;
9724
- }, 0);
9725
- },
9726
-
9727
- // strip prefix
9728
- // Before type | After type | Return value
9729
- // PEFIX-... | PEFIX-... | ''
9730
- // PREFIX-123 | PEFIX-123 | 123
9731
- // PREFIX-123 | PREFIX-23 | 23
9732
- // PREFIX-123 | PREFIX-1234 | 1234
9733
- getPrefixStrippedValue: function (value, prefix, prefixLength, prevResult, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix) {
9734
- // No prefix
9735
- if (prefixLength === 0) {
9736
- return value;
9737
- }
9738
-
9739
- // Value is prefix
9740
- if (value === prefix && value !== '') {
9741
- return '';
9742
- }
9743
-
9744
- if (signBeforePrefix && (value.slice(0, 1) == '-')) {
9745
- var prev = (prevResult.slice(0, 1) == '-') ? prevResult.slice(1) : prevResult;
9746
- return '-' + this.getPrefixStrippedValue(value.slice(1), prefix, prefixLength, prev, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix);
9747
- }
9748
-
9749
- // Pre result prefix string does not match pre-defined prefix
9750
- if (prevResult.slice(0, prefixLength) !== prefix && !tailPrefix) {
9751
- // Check if the first time user entered something
9752
- if (noImmediatePrefix && !prevResult && value) return value;
9753
- return '';
9754
- } else if (prevResult.slice(-prefixLength) !== prefix && tailPrefix) {
9755
- // Check if the first time user entered something
9756
- if (noImmediatePrefix && !prevResult && value) return value;
9757
- return '';
9758
- }
9759
-
9760
- var prevValue = this.stripDelimiters(prevResult, delimiter, delimiters);
9761
-
9762
- // New value has issue, someone typed in between prefix letters
9763
- // Revert to pre value
9764
- if (value.slice(0, prefixLength) !== prefix && !tailPrefix) {
9765
- return prevValue.slice(prefixLength);
9766
- } else if (value.slice(-prefixLength) !== prefix && tailPrefix) {
9767
- return prevValue.slice(0, -prefixLength - 1);
9768
- }
9769
-
9770
- // No issue, strip prefix for new value
9771
- return tailPrefix ? value.slice(0, -prefixLength) : value.slice(prefixLength);
9772
- },
9773
-
9774
- getFirstDiffIndex: function (prev, current) {
9775
- var index = 0;
9776
-
9777
- while (prev.charAt(index) === current.charAt(index)) {
9778
- if (prev.charAt(index++) === '') {
9779
- return -1;
9780
- }
9781
- }
9782
-
9783
- return index;
9784
- },
9785
-
9786
- getFormattedValue: function (value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) {
9787
- var result = '',
9788
- multipleDelimiters = delimiters.length > 0,
9789
- currentDelimiter = '';
9790
-
9791
- // no options, normal input
9792
- if (blocksLength === 0) {
9793
- return value;
9794
- }
9795
-
9796
- blocks.forEach(function (length, index) {
9797
- if (value.length > 0) {
9798
- var sub = value.slice(0, length),
9799
- rest = value.slice(length);
9800
-
9801
- if (multipleDelimiters) {
9802
- currentDelimiter = delimiters[delimiterLazyShow ? (index - 1) : index] || currentDelimiter;
9803
- } else {
9804
- currentDelimiter = delimiter;
9805
- }
9806
-
9807
- if (delimiterLazyShow) {
9808
- if (index > 0) {
9809
- result += currentDelimiter;
9810
- }
9811
-
9812
- result += sub;
9813
- } else {
9814
- result += sub;
9815
-
9816
- if (sub.length === length && index < blocksLength - 1) {
9817
- result += currentDelimiter;
9818
- }
9819
- }
9820
-
9821
- // update remaining string
9822
- value = rest;
9823
- }
9824
- });
9825
-
9826
- return result;
9827
- },
9828
-
9829
- // move cursor to the end
9830
- // the first time user focuses on an input with prefix
9831
- fixPrefixCursor: function (el, prefix, delimiter, delimiters) {
9832
- if (!el) {
9833
- return;
9834
- }
9835
-
9836
- var val = el.value,
9837
- appendix = delimiter || (delimiters[0] || ' ');
9838
-
9839
- if (!el.setSelectionRange || !prefix || (prefix.length + appendix.length) <= val.length) {
9840
- return;
9841
- }
9842
-
9843
- var len = val.length * 2;
9844
-
9845
- // set timeout to avoid blink
9846
- setTimeout(function () {
9847
- el.setSelectionRange(len, len);
9848
- }, 1);
9849
- },
9850
-
9851
- // Check if input field is fully selected
9852
- checkFullSelection: function(value) {
9853
- try {
9854
- var selection = window.getSelection() || document.getSelection() || {};
9855
- return selection.toString().length === value.length;
9856
- } catch (ex) {
9857
- // Ignore
9858
- }
9859
-
9860
- return false;
9861
- },
9862
-
9863
- setSelection: function (element, position, doc) {
9864
- if (element !== this.getActiveElement(doc)) {
9865
- return;
9866
- }
9867
-
9868
- // cursor is already in the end
9869
- if (element && element.value.length <= position) {
9870
- return;
9871
- }
9872
-
9873
- if (element.createTextRange) {
9874
- var range = element.createTextRange();
9875
-
9876
- range.move('character', position);
9877
- range.select();
9878
- } else {
9879
- try {
9880
- element.setSelectionRange(position, position);
9881
- } catch (e) {
9882
- // eslint-disable-next-line
9883
- console.warn('The input element type does not support selection');
9884
- }
9885
- }
9886
- },
9887
-
9888
- getActiveElement: function(parent) {
9889
- var activeElement = parent.activeElement;
9890
- if (activeElement && activeElement.shadowRoot) {
9891
- return this.getActiveElement(activeElement.shadowRoot);
9892
- }
9893
- return activeElement;
9894
- },
9895
-
9896
- isAndroid: function () {
9897
- return navigator && /android/i.test(navigator.userAgent);
9898
- },
9899
-
9900
- // On Android chrome, the keyup and keydown events
9901
- // always return key code 229 as a composition that
9902
- // buffers the user’s keystrokes
9903
- // see https://github.com/nosir/cleave.js/issues/147
9904
- isAndroidBackspaceKeydown: function (lastInputValue, currentInputValue) {
9905
- if (!this.isAndroid() || !lastInputValue || !currentInputValue) {
9906
- return false;
9907
- }
9908
-
9909
- return currentInputValue === lastInputValue.slice(0, -1);
9910
- }
9911
- };
9912
-
9913
- var Util_1 = Util;
9914
-
9915
- /**
9916
- * Props Assignment
9917
- *
9918
- * Separate this, so react module can share the usage
9919
- */
9920
- var DefaultProperties = {
9921
- // Maybe change to object-assign
9922
- // for now just keep it as simple
9923
- assign: function (target, opts) {
9924
- target = target || {};
9925
- opts = opts || {};
9926
-
9927
- // credit card
9928
- target.creditCard = !!opts.creditCard;
9929
- target.creditCardStrictMode = !!opts.creditCardStrictMode;
9930
- target.creditCardType = '';
9931
- target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || (function () {});
9932
-
9933
- // phone
9934
- target.phone = !!opts.phone;
9935
- target.phoneRegionCode = opts.phoneRegionCode || 'AU';
9936
- target.phoneFormatter = {};
9937
-
9938
- // time
9939
- target.time = !!opts.time;
9940
- target.timePattern = opts.timePattern || ['h', 'm', 's'];
9941
- target.timeFormat = opts.timeFormat || '24';
9942
- target.timeFormatter = {};
9943
-
9944
- // date
9945
- target.date = !!opts.date;
9946
- target.datePattern = opts.datePattern || ['d', 'm', 'Y'];
9947
- target.dateMin = opts.dateMin || '';
9948
- target.dateMax = opts.dateMax || '';
9949
- target.dateFormatter = {};
9950
-
9951
- // numeral
9952
- target.numeral = !!opts.numeral;
9953
- target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
9954
- target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
9955
- target.numeralDecimalMark = opts.numeralDecimalMark || '.';
9956
- target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
9957
- target.numeralPositiveOnly = !!opts.numeralPositiveOnly;
9958
- target.stripLeadingZeroes = opts.stripLeadingZeroes !== false;
9959
- target.signBeforePrefix = !!opts.signBeforePrefix;
9960
- target.tailPrefix = !!opts.tailPrefix;
9961
-
9962
- // others
9963
- target.swapHiddenInput = !!opts.swapHiddenInput;
9964
-
9965
- target.numericOnly = target.creditCard || target.date || !!opts.numericOnly;
9966
-
9967
- target.uppercase = !!opts.uppercase;
9968
- target.lowercase = !!opts.lowercase;
9969
-
9970
- target.prefix = (target.creditCard || target.date) ? '' : (opts.prefix || '');
9971
- target.noImmediatePrefix = !!opts.noImmediatePrefix;
9972
- target.prefixLength = target.prefix.length;
9973
- target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
9974
- target.copyDelimiter = !!opts.copyDelimiter;
9975
-
9976
- target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : '';
9977
-
9978
- target.delimiter =
9979
- (opts.delimiter || opts.delimiter === '') ? opts.delimiter :
9980
- (opts.date ? '/' :
9981
- (opts.time ? ':' :
9982
- (opts.numeral ? ',' :
9983
- (opts.phone ? ' ' :
9984
- ' '))));
9985
- target.delimiterLength = target.delimiter.length;
9986
- target.delimiterLazyShow = !!opts.delimiterLazyShow;
9987
- target.delimiters = opts.delimiters || [];
9988
-
9989
- target.blocks = opts.blocks || [];
9990
- target.blocksLength = target.blocks.length;
9991
-
9992
- target.root = (typeof commonjsGlobal === 'object' && commonjsGlobal) ? commonjsGlobal : window;
9993
- target.document = opts.document || target.root.document;
9994
-
9995
- target.maxLength = 0;
9996
-
9997
- target.backspace = false;
9998
- target.result = '';
9999
-
10000
- target.onValueChanged = opts.onValueChanged || (function () {});
10001
-
10002
- return target;
10003
- }
10004
- };
10005
-
10006
- var DefaultProperties_1 = DefaultProperties;
10007
-
10008
- /**
10009
- * Construct a new Cleave instance by passing the configuration object
10010
- *
10011
- * @param {String | HTMLElement} element
10012
- * @param {Object} opts
10013
- */
10014
- var Cleave = function (element, opts) {
10015
- var owner = this;
10016
- var hasMultipleElements = false;
10017
-
10018
- if (typeof element === 'string') {
10019
- owner.element = document.querySelector(element);
10020
- hasMultipleElements = document.querySelectorAll(element).length > 1;
10021
- } else {
10022
- if (typeof element.length !== 'undefined' && element.length > 0) {
10023
- owner.element = element[0];
10024
- hasMultipleElements = element.length > 1;
10025
- } else {
10026
- owner.element = element;
10027
- }
10028
- }
10029
-
10030
- if (!owner.element) {
10031
- throw new Error('[cleave.js] Please check the element');
10032
- }
10033
-
10034
- if (hasMultipleElements) {
10035
- try {
10036
- // eslint-disable-next-line
10037
- console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.');
10038
- } catch (e) {
10039
- // Old IE
10040
- }
10041
- }
10042
-
10043
- opts.initValue = owner.element.value;
10044
-
10045
- owner.properties = Cleave.DefaultProperties.assign({}, opts);
10046
-
10047
- owner.init();
10048
- };
10049
-
10050
- Cleave.prototype = {
10051
- init: function () {
10052
- var owner = this, pps = owner.properties;
10053
-
10054
- // no need to use this lib
10055
- if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.time && !pps.date && (pps.blocksLength === 0 && !pps.prefix)) {
10056
- owner.onInput(pps.initValue);
10057
-
10058
- return;
10059
- }
10060
-
10061
- pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);
10062
-
10063
- owner.isAndroid = Cleave.Util.isAndroid();
10064
- owner.lastInputValue = '';
10065
- owner.isBackward = '';
10066
-
10067
- owner.onChangeListener = owner.onChange.bind(owner);
10068
- owner.onKeyDownListener = owner.onKeyDown.bind(owner);
10069
- owner.onFocusListener = owner.onFocus.bind(owner);
10070
- owner.onCutListener = owner.onCut.bind(owner);
10071
- owner.onCopyListener = owner.onCopy.bind(owner);
10072
-
10073
- owner.initSwapHiddenInput();
10074
-
10075
- owner.element.addEventListener('input', owner.onChangeListener);
10076
- owner.element.addEventListener('keydown', owner.onKeyDownListener);
10077
- owner.element.addEventListener('focus', owner.onFocusListener);
10078
- owner.element.addEventListener('cut', owner.onCutListener);
10079
- owner.element.addEventListener('copy', owner.onCopyListener);
10080
-
10081
-
10082
- owner.initPhoneFormatter();
10083
- owner.initDateFormatter();
10084
- owner.initTimeFormatter();
10085
- owner.initNumeralFormatter();
10086
-
10087
- // avoid touch input field if value is null
10088
- // otherwise Firefox will add red box-shadow for <input required />
10089
- if (pps.initValue || (pps.prefix && !pps.noImmediatePrefix)) {
10090
- owner.onInput(pps.initValue);
10091
- }
10092
- },
10093
-
10094
- initSwapHiddenInput: function () {
10095
- var owner = this, pps = owner.properties;
10096
- if (!pps.swapHiddenInput) return;
10097
-
10098
- var inputFormatter = owner.element.cloneNode(true);
10099
- owner.element.parentNode.insertBefore(inputFormatter, owner.element);
10100
-
10101
- owner.elementSwapHidden = owner.element;
10102
- owner.elementSwapHidden.type = 'hidden';
10103
-
10104
- owner.element = inputFormatter;
10105
- owner.element.id = '';
10106
- },
10107
-
10108
- initNumeralFormatter: function () {
10109
- var owner = this, pps = owner.properties;
10110
-
10111
- if (!pps.numeral) {
10112
- return;
10113
- }
10114
-
10115
- pps.numeralFormatter = new Cleave.NumeralFormatter(
10116
- pps.numeralDecimalMark,
10117
- pps.numeralIntegerScale,
10118
- pps.numeralDecimalScale,
10119
- pps.numeralThousandsGroupStyle,
10120
- pps.numeralPositiveOnly,
10121
- pps.stripLeadingZeroes,
10122
- pps.prefix,
10123
- pps.signBeforePrefix,
10124
- pps.tailPrefix,
10125
- pps.delimiter
10126
- );
10127
- },
10128
-
10129
- initTimeFormatter: function() {
10130
- var owner = this, pps = owner.properties;
10131
-
10132
- if (!pps.time) {
10133
- return;
10134
- }
10135
-
10136
- pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat);
10137
- pps.blocks = pps.timeFormatter.getBlocks();
10138
- pps.blocksLength = pps.blocks.length;
10139
- pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);
10140
- },
10141
-
10142
- initDateFormatter: function () {
10143
- var owner = this, pps = owner.properties;
10144
-
10145
- if (!pps.date) {
10146
- return;
10147
- }
10148
-
10149
- pps.dateFormatter = new Cleave.DateFormatter(pps.datePattern, pps.dateMin, pps.dateMax);
10150
- pps.blocks = pps.dateFormatter.getBlocks();
10151
- pps.blocksLength = pps.blocks.length;
10152
- pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);
10153
- },
10154
-
10155
- initPhoneFormatter: function () {
10156
- var owner = this, pps = owner.properties;
10157
-
10158
- if (!pps.phone) {
10159
- return;
10160
- }
10161
-
10162
- // Cleave.AsYouTypeFormatter should be provided by
10163
- // external google closure lib
10164
- try {
10165
- pps.phoneFormatter = new Cleave.PhoneFormatter(
10166
- new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode),
10167
- pps.delimiter
10168
- );
10169
- } catch (ex) {
10170
- throw new Error('[cleave.js] Please include phone-type-formatter.{country}.js lib');
10171
- }
10172
- },
10173
-
10174
- onKeyDown: function (event) {
10175
- var owner = this,
10176
- charCode = event.which || event.keyCode;
10177
-
10178
- owner.lastInputValue = owner.element.value;
10179
- owner.isBackward = charCode === 8;
10180
- },
10181
-
10182
- onChange: function (event) {
10183
- var owner = this, pps = owner.properties,
10184
- Util = Cleave.Util;
10185
-
10186
- owner.isBackward = owner.isBackward || event.inputType === 'deleteContentBackward';
10187
-
10188
- var postDelimiter = Util.getPostDelimiter(owner.lastInputValue, pps.delimiter, pps.delimiters);
10189
-
10190
- if (owner.isBackward && postDelimiter) {
10191
- pps.postDelimiterBackspace = postDelimiter;
10192
- } else {
10193
- pps.postDelimiterBackspace = false;
10194
- }
10195
-
10196
- this.onInput(this.element.value);
10197
- },
10198
-
10199
- onFocus: function () {
10200
- var owner = this,
10201
- pps = owner.properties;
10202
- owner.lastInputValue = owner.element.value;
10203
-
10204
- if (pps.prefix && pps.noImmediatePrefix && !owner.element.value) {
10205
- this.onInput(pps.prefix);
10206
- }
10207
-
10208
- Cleave.Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters);
10209
- },
10210
-
10211
- onCut: function (e) {
10212
- if (!Cleave.Util.checkFullSelection(this.element.value)) return;
10213
- this.copyClipboardData(e);
10214
- this.onInput('');
10215
- },
10216
-
10217
- onCopy: function (e) {
10218
- if (!Cleave.Util.checkFullSelection(this.element.value)) return;
10219
- this.copyClipboardData(e);
10220
- },
10221
-
10222
- copyClipboardData: function (e) {
10223
- var owner = this,
10224
- pps = owner.properties,
10225
- Util = Cleave.Util,
10226
- inputValue = owner.element.value,
10227
- textToCopy = '';
10228
-
10229
- if (!pps.copyDelimiter) {
10230
- textToCopy = Util.stripDelimiters(inputValue, pps.delimiter, pps.delimiters);
10231
- } else {
10232
- textToCopy = inputValue;
10233
- }
10234
-
10235
- try {
10236
- if (e.clipboardData) {
10237
- e.clipboardData.setData('Text', textToCopy);
10238
- } else {
10239
- window.clipboardData.setData('Text', textToCopy);
10240
- }
10241
-
10242
- e.preventDefault();
10243
- } catch (ex) {
10244
- // empty
10245
- }
10246
- },
10247
-
10248
- onInput: function (value) {
10249
- var owner = this, pps = owner.properties,
10250
- Util = Cleave.Util;
10251
-
10252
- // case 1: delete one more character "4"
10253
- // 1234*| -> hit backspace -> 123|
10254
- // case 2: last character is not delimiter which is:
10255
- // 12|34* -> hit backspace -> 1|34*
10256
- // note: no need to apply this for numeral mode
10257
- var postDelimiterAfter = Util.getPostDelimiter(value, pps.delimiter, pps.delimiters);
10258
- if (!pps.numeral && pps.postDelimiterBackspace && !postDelimiterAfter) {
10259
- value = Util.headStr(value, value.length - pps.postDelimiterBackspace.length);
10260
- }
10261
-
10262
- // phone formatter
10263
- if (pps.phone) {
10264
- if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
10265
- pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length);
10266
- } else {
10267
- pps.result = pps.phoneFormatter.format(value);
10268
- }
10269
- owner.updateValueState();
10270
-
10271
- return;
10272
- }
10273
-
10274
- // numeral formatter
10275
- if (pps.numeral) {
10276
- // Do not show prefix when noImmediatePrefix is specified
10277
- // This mostly because we need to show user the native input placeholder
10278
- if (pps.prefix && pps.noImmediatePrefix && value.length === 0) {
10279
- pps.result = '';
10280
- } else {
10281
- pps.result = pps.numeralFormatter.format(value);
10282
- }
10283
- owner.updateValueState();
10284
-
10285
- return;
10286
- }
10287
-
10288
- // date
10289
- if (pps.date) {
10290
- value = pps.dateFormatter.getValidatedDate(value);
10291
- }
10292
-
10293
- // time
10294
- if (pps.time) {
10295
- value = pps.timeFormatter.getValidatedTime(value);
10296
- }
10297
-
10298
- // strip delimiters
10299
- value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters);
10300
-
10301
- // strip prefix
10302
- value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix);
10303
-
10304
- // strip non-numeric characters
10305
- value = pps.numericOnly ? Util.strip(value, /[^\d]/g) : value;
10306
-
10307
- // convert case
10308
- value = pps.uppercase ? value.toUpperCase() : value;
10309
- value = pps.lowercase ? value.toLowerCase() : value;
10310
-
10311
- // prevent from showing prefix when no immediate option enabled with empty input value
10312
- if (pps.prefix) {
10313
- if (pps.tailPrefix) {
10314
- value = value + pps.prefix;
10315
- } else {
10316
- value = pps.prefix + value;
10317
- }
10318
-
10319
-
10320
- // no blocks specified, no need to do formatting
10321
- if (pps.blocksLength === 0) {
10322
- pps.result = value;
10323
- owner.updateValueState();
10324
-
10325
- return;
10326
- }
10327
- }
10328
-
10329
- // update credit card props
10330
- if (pps.creditCard) {
10331
- owner.updateCreditCardPropsByValue(value);
10332
- }
10333
-
10334
- // strip over length characters
10335
- value = Util.headStr(value, pps.maxLength);
10336
-
10337
- // apply blocks
10338
- pps.result = Util.getFormattedValue(
10339
- value,
10340
- pps.blocks, pps.blocksLength,
10341
- pps.delimiter, pps.delimiters, pps.delimiterLazyShow
10342
- );
10343
-
10344
- owner.updateValueState();
10345
- },
10346
-
10347
- updateCreditCardPropsByValue: function (value) {
10348
- var owner = this, pps = owner.properties,
10349
- Util = Cleave.Util,
10350
- creditCardInfo;
10351
-
10352
- // At least one of the first 4 characters has changed
10353
- if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) {
10354
- return;
10355
- }
10356
-
10357
- creditCardInfo = Cleave.CreditCardDetector.getInfo(value, pps.creditCardStrictMode);
10358
-
10359
- pps.blocks = creditCardInfo.blocks;
10360
- pps.blocksLength = pps.blocks.length;
10361
- pps.maxLength = Util.getMaxLength(pps.blocks);
10362
-
10363
- // credit card type changed
10364
- if (pps.creditCardType !== creditCardInfo.type) {
10365
- pps.creditCardType = creditCardInfo.type;
10366
-
10367
- pps.onCreditCardTypeChanged.call(owner, pps.creditCardType);
10368
- }
10369
- },
10370
-
10371
- updateValueState: function () {
10372
- var owner = this,
10373
- Util = Cleave.Util,
10374
- pps = owner.properties;
10375
-
10376
- if (!owner.element) {
10377
- return;
10378
- }
10379
-
10380
- var endPos = owner.element.selectionEnd;
10381
- var oldValue = owner.element.value;
10382
- var newValue = pps.result;
10383
-
10384
- endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters);
10385
-
10386
- // fix Android browser type="text" input field
10387
- // cursor not jumping issue
10388
- if (owner.isAndroid) {
10389
- window.setTimeout(function () {
10390
- owner.element.value = newValue;
10391
- Util.setSelection(owner.element, endPos, pps.document, false);
10392
- owner.callOnValueChanged();
10393
- }, 1);
10394
-
10395
- return;
10396
- }
10397
-
10398
- owner.element.value = newValue;
10399
- if (pps.swapHiddenInput) owner.elementSwapHidden.value = owner.getRawValue();
10400
-
10401
- Util.setSelection(owner.element, endPos, pps.document, false);
10402
- owner.callOnValueChanged();
10403
- },
10404
-
10405
- callOnValueChanged: function () {
10406
- var owner = this,
10407
- pps = owner.properties;
10408
-
10409
- pps.onValueChanged.call(owner, {
10410
- target: {
10411
- name: owner.element.name,
10412
- value: pps.result,
10413
- rawValue: owner.getRawValue()
10414
- }
10415
- });
10416
- },
10417
-
10418
- setPhoneRegionCode: function (phoneRegionCode) {
10419
- var owner = this, pps = owner.properties;
10420
-
10421
- pps.phoneRegionCode = phoneRegionCode;
10422
- owner.initPhoneFormatter();
10423
- owner.onChange();
10424
- },
10425
-
10426
- setRawValue: function (value) {
10427
- var owner = this, pps = owner.properties;
10428
-
10429
- value = value !== undefined && value !== null ? value.toString() : '';
10430
-
10431
- if (pps.numeral) {
10432
- value = value.replace('.', pps.numeralDecimalMark);
10433
- }
10434
-
10435
- pps.postDelimiterBackspace = false;
10436
-
10437
- owner.element.value = value;
10438
- owner.onInput(value);
10439
- },
10440
-
10441
- getRawValue: function () {
10442
- var owner = this,
10443
- pps = owner.properties,
10444
- Util = Cleave.Util,
10445
- rawValue = owner.element.value;
10446
-
10447
- if (pps.rawValueTrimPrefix) {
10448
- rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix);
10449
- }
10450
-
10451
- if (pps.numeral) {
10452
- rawValue = pps.numeralFormatter.getRawValue(rawValue);
10453
- } else {
10454
- rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters);
10455
- }
10456
-
10457
- return rawValue;
10458
- },
10459
-
10460
- getISOFormatDate: function () {
10461
- var owner = this,
10462
- pps = owner.properties;
10463
-
10464
- return pps.date ? pps.dateFormatter.getISOFormatDate() : '';
10465
- },
10466
-
10467
- getISOFormatTime: function () {
10468
- var owner = this,
10469
- pps = owner.properties;
10470
-
10471
- return pps.time ? pps.timeFormatter.getISOFormatTime() : '';
10472
- },
10473
-
10474
- getFormattedValue: function () {
10475
- return this.element.value;
10476
- },
10477
-
10478
- destroy: function () {
10479
- var owner = this;
10480
-
10481
- owner.element.removeEventListener('input', owner.onChangeListener);
10482
- owner.element.removeEventListener('keydown', owner.onKeyDownListener);
10483
- owner.element.removeEventListener('focus', owner.onFocusListener);
10484
- owner.element.removeEventListener('cut', owner.onCutListener);
10485
- owner.element.removeEventListener('copy', owner.onCopyListener);
10486
- },
10487
-
10488
- toString: function () {
10489
- return '[Cleave Object]';
10490
- }
10491
- };
10492
-
10493
- Cleave.NumeralFormatter = NumeralFormatter_1;
10494
- Cleave.DateFormatter = DateFormatter_1;
10495
- Cleave.TimeFormatter = TimeFormatter_1;
10496
- Cleave.PhoneFormatter = PhoneFormatter_1;
10497
- Cleave.CreditCardDetector = CreditCardDetector_1;
10498
- Cleave.Util = Util_1;
10499
- Cleave.DefaultProperties = DefaultProperties_1;
10500
-
10501
- // for angular directive
10502
- ((typeof commonjsGlobal === 'object' && commonjsGlobal) ? commonjsGlobal : window)['Cleave'] = Cleave;
10503
-
10504
- // CommonJS
10505
- var Cleave_1 = Cleave;
10506
-
10507
- /* eslint-disable @typescript-eslint/no-explicit-any */
10508
- function coerceBoolean(value) {
10509
- return value != null && `${value}` !== 'false';
10510
- }
10511
- function coerceNumber(value, fallbackValue = 0) {
10512
- return isNumberValue(value) ? Number(value) : fallbackValue;
10513
- }
10514
- function isNumberValue(value) {
10515
- return !isNaN(parseFloat(value)) && !isNaN(Number(value));
10516
- }
10517
-
10518
- const catInputCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-primary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-primary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-primary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-primary-hover{transition:background-color 125ms, color 125ms}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-primary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-primary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-primary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}button.cat-text-primary,button.cat-link-primary{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-primary:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-primary:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-primary,.cat-text-primary-hover{transition:color 125ms}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-bg-primaryInverted-hover{transition:background-color 125ms, color 125ms}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}button.cat-text-primaryInverted,button.cat-link-primaryInverted{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-primaryInverted:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-primaryInverted:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 125ms}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-secondary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-secondary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-secondary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-secondary-hover{transition:background-color 125ms, color 125ms}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-secondary-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-secondary-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-secondary-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}button.cat-text-secondary,button.cat-link-secondary{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-secondary:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-secondary:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-secondary,.cat-text-secondary-hover{transition:color 125ms}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-bg-secondaryInverted-hover{transition:background-color 125ms, color 125ms}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important;--cat-primary-text:0, 0, 0;--cat-primary-text-hover:0, 0, 0;--cat-primary-text-active:0, 0, 0;--cat-link-decoration:underline}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}button.cat-text-secondaryInverted,button.cat-link-secondaryInverted{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-secondaryInverted:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-secondaryInverted:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 125ms}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-info{background-color:rgb(var(--cat-info-bg, 0, 115, 230)) !important;color:rgb(var(--cat-info-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-info-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-info-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-info-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-info-hover{transition:background-color 125ms, color 125ms}.cat-bg-info-hover:hover{background-color:rgb(var(--cat-info-bg-hover, 0, 107, 227)) !important;color:rgb(var(--cat-info-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-info-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-info-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-info-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-info,.cat-link-info{color:rgb(var(--cat-info-text, 0, 115, 230)) !important}button.cat-text-info,button.cat-link-info{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-info:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-info:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-info,.cat-text-info-hover{transition:color 125ms}.cat-link-info:hover,.cat-text-info-hover:hover{color:rgb(var(--cat-info-text-hover, 0, 107, 227)) !important}.cat-link-info:active,.cat-text-info-hover:active{color:rgb(var(--cat-info-text-active, 0, 96, 223)) !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-success-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-success-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-success-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-success-hover{transition:background-color 125ms, color 125ms}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-success-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-success-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-success-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}button.cat-text-success,button.cat-link-success{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-success:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-success:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-success,.cat-text-success-hover{transition:color 125ms}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important;--cat-primary-text:var(--cat-warning-fill, 0, 0, 0);--cat-primary-text-hover:var(--cat-warning-fill-hover, 0, 0, 0);--cat-primary-text-active:var(--cat-warning-fill-active, 0, 0, 0);--cat-link-decoration:underline}.cat-bg-warning-hover{transition:background-color 125ms, color 125ms}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important;--cat-primary-text:var(--cat-warning-fill, 0, 0, 0);--cat-primary-text-hover:var(--cat-warning-fill-hover, 0, 0, 0);--cat-primary-text-active:var(--cat-warning-fill-active, 0, 0, 0);--cat-link-decoration:underline}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}button.cat-text-warning,button.cat-link-warning{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-warning:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-warning:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-warning,.cat-text-warning-hover{transition:color 125ms}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important;--cat-primary-text:var(--cat-danger-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-danger-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-danger-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-bg-danger-hover{transition:background-color 125ms, color 125ms}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important;--cat-primary-text:var(--cat-danger-fill, 255, 255, 255);--cat-primary-text-hover:var(--cat-danger-fill-hover, 255, 255, 255);--cat-primary-text-active:var(--cat-danger-fill-active, 255, 255, 255);--cat-link-decoration:underline}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}button.cat-text-danger,button.cat-link-danger{margin:0;padding:0;font:inherit;border:none;background:none;cursor:pointer}button.cat-link-danger:hover:not(:disabled){text-decoration:var(--cat-link-decoration-hover, underline)}button.cat-link-danger:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-link-danger,.cat-text-danger-hover{transition:color 125ms}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-text-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-bg-muted{background-color:#f2f4f7 !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.input-field:not(.input-horizontal) .label-container.hidden,.textarea-field:not(.textarea-horizontal) .label-container.hidden,.select-field:not(.select-horizontal) .label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container{flex-basis:var(--label-size, 33.33%)}.label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-optional,.label-character-count{display:inline-flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem}.label-character-count{margin-left:auto}.input-horizontal .label-container.hidden label,.textarea-horizontal .label-container.hidden label,.select-horizontal .label-container.hidden label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;font-size:0.9375rem;line-height:1.25rem}:host([hidden]){display:none}.input-field,.input-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.input-field.input-horizontal{flex-direction:row;gap:1rem}.input-wrapper{flex:1 1 auto;display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 125ms linear;--border-color:var(--cat-border-color-dark, 215, 219, 224);}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-readonly{pointer-events:none}.input-wrapper.input-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-wrapper:not(.input-disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}.input-wrapper:focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.input-wrapper:focus-within:has(.clearable:focus){outline:none}.input-wrapper.input-invalid{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}.input-wrapper:has(input:-webkit-autofill),.input-wrapper:has(input:-webkit-autofill):hover,.input-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.text-prefix{border-right:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-right:0.75rem}.text-suffix{border-left:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-left:0.75rem}.icon-loading,.icon-prefix,.icon-suffix{align-self:center}.input-outer-wrapper{display:flex}.input-inner-wrapper{display:flex;align-items:center;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input.has-clearable,input.has-toggle-password{padding-right:1.5rem}input.has-clearable.has-toggle-password{padding-right:3.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}.toggle-password{position:absolute;top:calc(50% - 1rem);right:-0.5rem}.has-clearable~.toggle-password{right:1.5rem}:host(.cat-date-input) .input-wrapper,:host(.cat-time-input) .input-wrapper{z-index:1;border-top-right-radius:0;border-bottom-right-radius:0}";
10519
- const CatInputStyle0 = catInputCss;
10520
-
10521
- let nextUniqueId$7 = 0;
10522
- const CatInput = class {
10523
- constructor(hostRef) {
10524
- index.registerInstance(this, hostRef);
10525
- this.catChange = index.createEvent(this, "catChange", 7);
10526
- this.catFocus = index.createEvent(this, "catFocus", 7);
10527
- this.catBlur = index.createEvent(this, "catBlur", 7);
10528
- if (hostRef.$hostElement$["s-ei"]) {
10529
- this.internals = hostRef.$hostElement$["s-ei"];
10530
- }
10531
- else {
10532
- this.internals = hostRef.$hostElement$.attachInternals();
10533
- hostRef.$hostElement$["s-ei"] = this.internals;
10534
- }
10535
- this._id = `cat-input-${nextUniqueId$7++}`;
10536
- this.hasSlottedLabel = false;
10537
- this.hasSlottedHint = false;
10538
- this.hasSlottedCounter = false;
10539
- this.isPasswordShown = false;
10540
- this.errorMap = undefined;
10541
- this.requiredMarker = 'optional';
10542
- this.horizontal = false;
10543
- this.autoComplete = undefined;
10544
- this.clearable = false;
10545
- this.togglePassword = false;
10546
- this.disabled = false;
10547
- this.loading = false;
10548
- this.hint = undefined;
10549
- this.icon = undefined;
10550
- this.iconRight = false;
10551
- this.identifier = undefined;
10552
- this.label = '';
10553
- this.labelHidden = false;
10554
- this.max = undefined;
10555
- this.maxLength = undefined;
10556
- this.min = undefined;
10557
- this.minLength = undefined;
10558
- this.name = undefined;
10559
- this.placeholder = undefined;
10560
- this.textPrefix = undefined;
10561
- this.textSuffix = undefined;
10562
- this.readonly = false;
10563
- this.required = false;
10564
- this.round = false;
10565
- this.type = 'text';
10566
- this.value = undefined;
10567
- this.errors = undefined;
10568
- this.errorUpdate = 0;
10569
- this.nativeAttributes = undefined;
10570
- this.testId = undefined;
10571
- }
10572
- get id() {
10573
- return this.identifier || this._id;
10574
- }
10575
- componentWillLoad() {
10576
- this.onErrorsChanged(this.errors, undefined, false);
10577
- }
10578
- componentWillRender() {
10579
- this.internals.setFormValue(this.value ?? null);
10580
- this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
10581
- this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
10582
- this.hasSlottedCounter = !!this.hostElement.querySelector('[slot="counter"]');
10583
- }
10584
- /**
10585
- * Programmatically move focus to the input. Use this method instead of
10586
- * `input.focus()`.
10587
- *
10588
- * @param options An optional object providing options to control aspects of
10589
- * the focusing process.
10590
- */
10591
- async doFocus(options) {
10592
- // hack to make datepicker inputs focusable. The datepicker hides the input
10593
- // element and dynamically creates a sibling. We need to find the new input
10594
- // element and focus it instead.
10595
- const input = this.input.type === 'hidden' ? this.findSiblingInput(this.input.nextSibling) : this.input;
10596
- input?.focus(options);
10597
- }
10598
- /**
10599
- * Programmatically remove focus from the input. Use this method instead of
10600
- * `input.blur()`.
10601
- */
10602
- async doBlur() {
10603
- this.input.blur();
10604
- }
10605
- /**
10606
- * Clear the input.
10607
- */
10608
- async clear() {
10609
- this.value = '';
10610
- this.catChange.emit(this.value);
10611
- }
10612
- /**
10613
- * Adds a Cleave.js mask to the input.
10614
- *
10615
- * @param options The Cleave.js options.
10616
- */
10617
- async mask(options) {
10618
- new Cleave_1(this.input, options);
10619
- }
10620
- onErrorsChanged(newValue, _oldValue, update = true) {
10621
- if (!coerceBoolean(this.errorUpdate)) {
10622
- this.errorMap = undefined;
10623
- }
10624
- else {
10625
- this.errorMapSrc = Array.isArray(newValue)
10626
- ? newValue.reduce((acc, err) => ({ ...acc, [err]: undefined }), {})
10627
- : newValue || undefined;
10628
- if (update) {
10629
- this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();
10630
- }
10631
- }
10632
- }
10633
- render() {
10634
- this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
10635
- return (index.h("div", { key: '72c7cf2c86831c1aca03467ec92149fa0a58b05a', class: {
10636
- 'input-field': true,
10637
- 'input-horizontal': this.horizontal
10638
- } }, index.h("div", { key: '7cc76563550305d886b1a18d2344bf59b27f6fc2', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: '247ad3243e98e5ecf1002e59a84f8f2d1b4f17f4', htmlFor: this.id, part: "label" }, index.h("span", { key: '0d5f489a87735fc11c9dbacf9acded6d7523926a', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '3ade7278530f2b79a3dda8db8923392b84629feb', name: "label" })) || this.label, index.h("div", { key: '0c1bea5d04c65ceace3ba7a10f7d513301709f86', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '437f7c224b323514b2a4dcca8ffd6cdc83d3c384', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: 'cbc29c60d0f624bcceb1b5e55ba6bc38afc8d514', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")")), (this.maxLength || this.hasSlottedCounter) && (index.h("div", { key: 'f00cdace4e8f842019d7ffae484aca11925e2bc2', class: "label-character-count", "aria-hidden": "true" }, this.hasSlottedCounter ? (index.h("slot", { name: "counter" })) : (`${this.value?.length ?? 0}/${this.maxLength}`)))))))), index.h("div", { key: '8c961aaf1d0451118d9f5ae583a228be54b320eb', class: "input-container" }, index.h("div", { key: '6e9e98caaabea18e4a71b8b09baea5355f2eac7b', class: "input-outer-wrapper" }, index.h("div", { key: '38a5db004dbee08ce542dd36bf0da13156887e26', class: {
10639
- 'input-wrapper': true,
10640
- 'input-round': this.round,
10641
- 'input-readonly': this.readonly,
10642
- 'input-disabled': this.disabled,
10643
- 'input-invalid': this.invalid
10644
- }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { key: '350c53ffd8b59df4aa63d23c44213425df9add95', class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && (index.h("cat-icon", { key: '5f4794dac4ded82db99a395f1fe34fa9d393498f', icon: this.icon, class: "icon-prefix", size: "l", onClick: () => this.doFocus() })), index.h("div", { key: '5514838423e9ecfed27f877edc2bedaeeebb1584', class: "input-inner-wrapper" }, index.h("input", { key: '2dd5de3d46df35470caf488d3f48b5339081c537', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.id, class: {
10645
- 'has-clearable': this.clearable && !this.disabled && !this.readonly && !!this.value,
10646
- 'has-toggle-password': this.togglePassword && !this.disabled && !this.readonly && !!this.value
10647
- }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.isPasswordShown ? 'text' : this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), this.clearable && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: '0392b61e401ad12bcc32fe6de7f2acdf49184093', class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": of.catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this), "data-dropdown-no-close": true })), this.togglePassword && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: 'c33c6b188af0d2ccbf67b4a3527d7dc53af8a1fb', class: "toggle-password", icon: this.isPasswordShown ? '$cat:input-password-hide' : '$cat:input-password-show', "icon-only": "true", size: "s", variant: "text", "a11y-label": of.catI18nRegistry.t(this.isPasswordShown ? 'input.hidePassword' : 'input.showPassword'), onClick: this.doTogglePassword.bind(this) }))), this.loading && index.h("cat-spinner", { key: '3c51656392e532a3a16efcc5dbf181c40b96ed32', size: "m", class: "icon-loading" }), !this.invalid && this.icon && this.iconRight && (index.h("cat-icon", { key: 'f3a527250b2ab0ae5bb56217366cabe00c5e7bee', icon: this.icon, class: "icon-suffix", size: "l", onClick: () => this.doFocus() })), this.invalid && (index.h("cat-icon", { key: '063104b3c65eceb1260109c0f55944ca39c5c2ac', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (index.h("span", { key: '0508e322d57cc28a245a8e1fe2f16e02af04679b', class: "text-suffix", part: "suffix" }, this.textSuffix))), index.h("slot", { key: 'b5ea42f17934631b97c05c0ccfbadd8a1554d779', name: "addon" })), this.hasHint && (index.h(CatFormHint, { key: '549e082c4e1ff946d2d26ce3843db26af96333d3', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))));
10648
- }
10649
- get hasHint() {
10650
- return !!this.hint || !!this.hasSlottedHint || this.invalid;
10651
- }
10652
- get invalid() {
10653
- return this.errorMap === true || !!Object.keys(this.errorMap || {}).length;
10654
- }
10655
- onInput() {
10656
- this.value = this.input.value;
10657
- this.internals.setFormValue(this.input.value);
10658
- this.catChange.emit(this.value);
10659
- this.showErrorsIfTimeout();
10660
- }
10661
- onFocus(event) {
10662
- this.catFocus.emit(event);
10663
- }
10664
- onBlur(event) {
10665
- this.catBlur.emit(event);
10666
- if (coerceBoolean(this.errorUpdate)) {
10667
- this.showErrors();
10668
- }
10669
- }
10670
- doTogglePassword() {
10671
- this.isPasswordShown = !this.isPasswordShown;
10672
- }
10673
- showErrors() {
10674
- this.errorMap = this.errorMapSrc;
10675
- }
10676
- showErrorsIfTimeout() {
10677
- const errorUpdate = coerceNumber(this.errorUpdate, null);
10678
- if (errorUpdate !== null) {
10679
- typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);
10680
- this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);
10681
- return true;
10682
- }
10683
- return false;
10684
- }
10685
- showErrorsIfNoFocus() {
10686
- const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;
10687
- if (!hasFocus) {
10688
- this.showErrors();
10689
- }
10690
- }
10691
- findSiblingInput(node) {
10692
- if (node instanceof HTMLInputElement) {
10693
- return node;
10694
- }
10695
- else if (node?.nextSibling) {
10696
- return this.findSiblingInput(node.nextSibling);
10697
- }
10698
- return undefined;
10699
- }
10700
- static get delegatesFocus() { return true; }
10701
- static get formAssociated() { return true; }
10702
- get hostElement() { return index.getElement(this); }
10703
- static get watchers() { return {
10704
- "errors": ["onErrorsChanged"]
10705
- }; }
10706
- };
10707
- CatInput.style = CatInputStyle0;
10708
-
10709
- const catPaginationCss = ":host{display:inline-block}:host([hidden]){display:none}ol{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0}li{display:inline-flex;justify-content:center}li.dots{-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([variant=outlined]) ol{gap:0.75rem}.cat-pagination-xs li.dots,.cat-pagination-xs li.text{height:1.5rem;line-height:1.5rem;font-size:0.875rem}.cat-pagination-xs li.dots{width:1.5rem}:host([variant=outlined]) .cat-pagination-xs{gap:0.375rem}.cat-pagination-s li.dots,.cat-pagination-s li.text{height:2rem;line-height:2rem;font-size:0.9375rem}.cat-pagination-s li.dots{width:2rem}:host([variant=outlined]) .cat-pagination-s{gap:0.5rem}.cat-pagination-m li.dots,.cat-pagination-m li.text{height:2.5rem;line-height:2.5rem;font-size:0.9375rem}.cat-pagination-m li.dots{width:2.5rem}:host([variant=outlined]) .cat-pagination-m{gap:0.625rem}.cat-pagination-l li.dots,.cat-pagination-l li.text{height:3rem;line-height:3rem;font-size:0.9375rem}.cat-pagination-l li.dots{width:3rem}:host([variant=outlined]) .cat-pagination-l{gap:0.75rem}.cat-pagination-xl li.dots,.cat-pagination-xl li.text{height:3.5rem;line-height:3.5rem;font-size:1.125rem}.cat-pagination-xl li.dots{width:3.5rem}:host([variant=outlined]) .cat-pagination-xl{gap:0.875rem}";
10710
- const CatPaginationStyle0 = catPaginationCss;
9210
+ const catPaginationCss = ":host{display:inline-block}:host([hidden]){display:none}ol{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0}li{display:inline-flex;justify-content:center}li.dots{-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([variant=outlined]) ol{gap:0.75rem}.cat-pagination-xs li.dots,.cat-pagination-xs li.text{height:1.5rem;line-height:1.5rem;font-size:0.875rem}.cat-pagination-xs li.dots{width:1.5rem}:host([variant=outlined]) .cat-pagination-xs{gap:0.375rem}.cat-pagination-s li.dots,.cat-pagination-s li.text{height:2rem;line-height:2rem;font-size:0.9375rem}.cat-pagination-s li.dots{width:2rem}:host([variant=outlined]) .cat-pagination-s{gap:0.5rem}.cat-pagination-m li.dots,.cat-pagination-m li.text{height:2.5rem;line-height:2.5rem;font-size:0.9375rem}.cat-pagination-m li.dots{width:2.5rem}:host([variant=outlined]) .cat-pagination-m{gap:0.625rem}.cat-pagination-l li.dots,.cat-pagination-l li.text{height:3rem;line-height:3rem;font-size:0.9375rem}.cat-pagination-l li.dots{width:3rem}:host([variant=outlined]) .cat-pagination-l{gap:0.75rem}.cat-pagination-xl li.dots,.cat-pagination-xl li.text{height:3.5rem;line-height:3.5rem;font-size:1.125rem}.cat-pagination-xl li.dots{width:3.5rem}:host([variant=outlined]) .cat-pagination-xl{gap:0.875rem}";
9211
+ const CatPaginationStyle0 = catPaginationCss;
10711
9212
 
10712
9213
  const CatPagination = class {
10713
9214
  constructor(hostRef) {
@@ -11482,18 +9983,18 @@ const CatSelect = class {
11482
9983
  }
11483
9984
  render() {
11484
9985
  this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
11485
- return (index.h(index.Host, { key: '4ffaec1ec7c59635d3e923912e5bb5b554661973' }, index.h("div", { key: 'ad9ad59ff47ab4fe9c9485da344b0be8f030f824', class: {
9986
+ return (index.h(index.Host, { key: 'c26f4f1d90648ae5bdc7d15f6c112adafb2e4f78' }, index.h("div", { key: '15d47938edbc1226d59bc8f921178424dccf7999', class: {
11486
9987
  'select-field': true,
11487
9988
  'select-horizontal': this.horizontal,
11488
9989
  'select-multiple': this.multiple
11489
- } }, index.h("div", { key: 'd87e3451ded9630ef471c6a0d0230f73bf2001f0', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: '0eb6bd92232da327fd11a5b8fa5108064216b98d', htmlFor: `select-${this.id}-input`, part: "label" }, index.h("span", { key: '29b3bc2a6300cf116e85b598c43bc3d590bfca40', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '105d69c1c4ebce966d207248d0919713402775fc', name: "label" })) || this.label, index.h("div", { key: '60d737d4bc621e64c4d60a4454c81d5cd2f14036', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '3ff4fc174c6769300fecde9b4f3785e7f510b3c5', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: '44beff5fb235a6ecfe4d3bde6173309ab9374b7d', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")"))))))), index.h("div", { key: 'ca853307f93adc14b4ebe5de1f0b5cd255d438d7', class: "select-container" }, index.h("div", { key: 'fc56c44f4d6b27ca4d7d1c3f344bef6c5495ae84', class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, index.h("div", { key: '77d3a48ea7ad111136fb1513aaeb6c3b15533436', class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (index.h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (index.h("span", { class: {
9990
+ } }, index.h("div", { key: '3ac28917d6f6ea995142803bbc74f381c540775d', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: 'f0a54b4dd57db2771b216408313fb289eedd27a2', htmlFor: `select-${this.id}-input`, part: "label" }, index.h("span", { key: '024573bca075cd84d08349af763d96ed9b53c8c4', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '8e7d2ef38e100add967d3c369cda2cccf7c3f334', name: "label" })) || this.label, index.h("div", { key: 'b9abce3cd81828a3e9dadf6d3c9fc551043cc927', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '3d55ace4e034fcc81c56c887649846ff330d25c4', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: 'ca265e7b81572037f80e78c167622680ae7ba74e', class: "label-optional", "aria-hidden": "true" }, "(", of.catI18nRegistry.t('input.required'), ")"))))))), index.h("div", { key: '2941249432c643a7aca2887edb76c9503a93fdca', class: "select-container" }, index.h("div", { key: 'eaeccdc2e8305a9937bf5c646ae03798bda777ff', class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, index.h("div", { key: '6f17f7a17ab914a3430e5dccc84fe6fcd1b22166', class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (index.h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (index.h("span", { class: {
11490
9991
  pill: true,
11491
9992
  'select-no-open': true,
11492
9993
  'select-option-active': this.state.activeSelectionIndex === i
11493
- }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, index.h("span", null, item.render.label), !this.disabled && (index.h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: of.catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (index.h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, index.h("input", { key: 'a4e438192ecee41d5acf77de45a1526876409a0f', "data-test": this.testId, ...this.nativeAttributes, part: "input", id: `select-${this.id}-input`, class: "select-input", role: "combobox", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined, "aria-autocomplete": "list", onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && index.h("cat-spinner", { key: '04d53d0d39bc429a6ac9a479c46f42c6b03a9283' }), this.invalid && (index.h("cat-icon", { key: 'd21136d141632914fc176ea1939164a4d40dc446', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
9994
+ }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, index.h("span", null, item.render.label), !this.disabled && (index.h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: of.catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (index.h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, index.h("input", { key: '364215d3ab64ccaf43edfefa6bc1b9bbb4cbd176', "data-test": this.testId, ...this.nativeAttributes, part: "input", id: `select-${this.id}-input`, class: "select-input", role: "combobox", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined, "aria-autocomplete": "list", onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && index.h("cat-spinner", { key: '1350abe2789adba0e65931358e2637a4a6be2b8f' }), this.invalid && (index.h("cat-icon", { key: 'af9025ce007880906410bc6047ebbb7dab7e5f8c', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
11494
9995
  !this.disabled &&
11495
9996
  !this.state.isResolving &&
11496
- this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: of.catI18nRegistry.t('input.clear'), onCatClick: () => this.clearInput(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (index.h("cat-button", { key: 'cd5c84bbc7b04b28acda86d656b2ea9835cbb439', iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? of.catI18nRegistry.t('select.close') : of.catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, "data-dropdown-no-close": true }))), this.hasHint && (index.h(CatFormHint, { key: 'd0f3f4f080abf2136e681161802f0b332591a30a', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))), index.h("div", { key: '1fb0555801f6793b6351dbc19f2eba12c7292593', class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { key: '8eea85eea2b000f29d690aafc7fbae106bf275e5', class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.h("ul", { key: 'fa0415a3459967bc8a8591c94e3227c8fb99443d', class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isFirstLoading
9997
+ this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: of.catI18nRegistry.t('input.clear'), onCatClick: () => this.clearInput(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (index.h("cat-button", { key: '253cd4626cd0c2503f2f6d832656d091b1b1db83', iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? of.catI18nRegistry.t('select.close') : of.catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, "data-dropdown-no-close": true }))), this.hasHint && (index.h(CatFormHint, { key: 'f5403e4f52632c7e69c781d3b5f2fe5dd476d086', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))), index.h("div", { key: 'f72b057e941d0a8abc535314e83339a59c09416b', class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { key: '2a9a17d9a9e2e931e15296c504735c6d77ba2a9f', class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.h("ul", { key: 'af6c9b9152eff975198123219f19b840feddac92', class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isFirstLoading
11497
9998
  ? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (index.h("li", { class: "select-option-loading" }, index.h("cat-skeleton", { variant: "body", lines: 1 }), index.h("cat-skeleton", { variant: "body", lines: 1 }))))
11498
9999
  : !this.state.options.length &&
11499
10000
  !this.tags && (index.h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : of.catI18nRegistry.t('select.empty')))))))));
@@ -13789,6 +12290,7 @@ const CatTime = class {
13789
12290
  this.catBlur = index.createEvent(this, "catBlur", 7);
13790
12291
  this.language = of.catI18nRegistry.getLocale();
13791
12292
  this.locale = getLocale(this.language);
12293
+ this.timeMaskOptions = { timeFormat: this.locale.timeFormat, timePattern: ['h', 'm'] };
13792
12294
  this.hasSlottedLabel = false;
13793
12295
  this.hasSlottedHint = false;
13794
12296
  this.selectionTime = null;
@@ -13848,13 +12350,6 @@ const CatTime = class {
13848
12350
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
13849
12351
  this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
13850
12352
  }
13851
- componentDidLoad() {
13852
- this.input?.mask({
13853
- time: true,
13854
- timeFormat: this.locale.timeFormat,
13855
- timePattern: ['h', 'm']
13856
- });
13857
- }
13858
12353
  onOpen() {
13859
12354
  const query = (selector) => this.hostElement.shadowRoot?.querySelector(selector);
13860
12355
  const time = clampTime(this.min ?? null, this.selectionTime ?? new Date(2000, 5, 1, 8), this.max ?? null);
@@ -13923,14 +12418,14 @@ const CatTime = class {
13923
12418
  }
13924
12419
  render() {
13925
12420
  this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
13926
- return (index.h(index.Host, { key: 'a9ea5c301a387ca17e5a1b9db11e986cf5f12415' }, index.h("cat-input", { key: '09ffc2451c3b0e3fb433147ffa3b5f32dbdc5a61', class: "cat-time-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.format(this.selectionTime, false), errors: this.errors, errorUpdate: this.errorUpdate, testId: this.testId, nativeAttributes: this.nativeAttributes, onCatFocus: e => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, index.h("span", { key: 'f5752625a27dea2745aaf7954a52dafa85c93373', slot: "label" }, this.hasSlottedLabel && index.h("slot", { key: 'e1fe6b9b959a5e86883cd86522636293eb20f5bb', name: "label" }), !this.hasSlottedLabel && this.label, index.h("span", { key: '7fd59e9221a853d26b134be94c0270d1999fbfbf', class: "label-aria" }, " (HH:mm)")), index.h("div", { key: '6ac6825380182fadcfbfb008e62cdd72fed515b9', slot: "addon", class: "cat-time-addon" }, this.locale.timeFormat === '12' && (index.h("cat-button", { key: '1635dd498b5680294c693cb2d9052eb6d0b6277b', class: "cat-time-format", disabled: this.disabled || this.readonly, onCatClick: () => this.toggleAm() }, this.isAm ? 'AM' : 'PM')), index.h("cat-dropdown", { key: '6b85cedb852413d70a322449f5ac609fe85b379b', slot: "addon", placement: this.placement }, index.h("cat-button", { key: 'f2eef3e696a3424e44285a5d2edcb54bbf88606c', slot: "trigger", class: "cat-time-toggle", disabled: this.disabled || this.readonly, icon: "$cat:timepicker-clock", iconOnly: true, a11yLabel: this.selectionTime ? `${this.locale.change}, ${this.format(this.selectionTime)}` : this.locale.choose }), index.h("nav", { key: 'e75f5f46f632632ead917d431eb431bba1c27d95', slot: "content", class: "cat-nav" }, index.h("ul", { key: '26fcb756ebd85196d3abbd70ab63c73d32d14c4b' }, this.timeArray().map(time => {
12421
+ return (index.h(index.Host, { key: 'e0c2114b16b85916f3dce9dfad94d03c12239605' }, index.h("cat-input", { key: '5efacf81af8c646cfd374a67890052c8456c7427', class: "cat-time-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.format(this.selectionTime, false), errors: this.errors, errorUpdate: this.errorUpdate, testId: this.testId, nativeAttributes: this.nativeAttributes, timeMaskOptions: this.timeMaskOptions, onCatFocus: e => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, index.h("span", { key: '3a6975d2d679c3b115cd4d56793f0754d78a01b9', slot: "label" }, this.hasSlottedLabel && index.h("slot", { key: 'ba3b9a395737599e0f69df407e310acce9ef43f0', name: "label" }), !this.hasSlottedLabel && this.label, index.h("span", { key: 'f8f19c73c24d62d890d37d817dedbfb362f5f423', class: "label-aria" }, " (HH:mm)")), index.h("div", { key: '8bd9f5e3599e9cca6c2a9d8e76882c0c939427e8', slot: "addon", class: "cat-time-addon" }, this.locale.timeFormat === '12' && (index.h("cat-button", { key: 'b17a3bb5aba864ca5a9beced56c9e7f5618c0758', class: "cat-time-format", disabled: this.disabled || this.readonly, onCatClick: () => this.toggleAm() }, this.isAm ? 'AM' : 'PM')), index.h("cat-dropdown", { key: '164d26eb81e3645806b31f61086ac08a0ff2a034', slot: "addon", placement: this.placement }, index.h("cat-button", { key: '47a1f42ae5edb4c074f57e0fca7b06d42084be2f', slot: "trigger", class: "cat-time-toggle", disabled: this.disabled || this.readonly, icon: "$cat:timepicker-clock", iconOnly: true, a11yLabel: this.selectionTime ? `${this.locale.change}, ${this.format(this.selectionTime)}` : this.locale.choose }), index.h("nav", { key: '7d8479f2d343202ba7f582420687b42747a7267e', slot: "content", class: "cat-nav" }, index.h("ul", { key: '54bd4225780e10d7e9abb0f31e0fc6a6e58672a7' }, this.timeArray().map(time => {
13927
12422
  const isoTime = formatIso(time);
13928
12423
  const disabled = isBefore(time, this.min ?? null) || isAfter(time, this.max ?? null);
13929
12424
  return (index.h("li", null, index.h("cat-button", { class: {
13930
12425
  'cat-nav-item': true,
13931
12426
  'time-disabled': disabled
13932
12427
  }, disabled: disabled, active: isoTime === this.value, color: isoTime === this.value ? 'primary' : 'secondary', variant: isoTime === this.value ? 'filled' : 'outlined', onCatClick: () => this.select(time), "data-time": isoTime }, this.format(time))));
13933
- }))))), this.hasSlottedHint && (index.h("span", { key: 'c67a2df1b05ba6772695b0103347750e3d1e8f04', slot: "hint" }, index.h("slot", { key: '147946f77422d6cdd48f4a469c40889835a9f5a9', name: "hint" }))))));
12428
+ }))))), this.hasSlottedHint && (index.h("span", { key: '395d2ed324e51c1899004acad59072e47377c29a', slot: "hint" }, index.h("slot", { key: '4f07ebff747ac5cf97239150875daa8cd5295f2f', name: "hint" }))))));
13934
12429
  }
13935
12430
  timeArray() {
13936
12431
  const result = [];
@@ -14163,12 +12658,12 @@ const CatTooltip = class {
14163
12658
  }
14164
12659
  }
14165
12660
  render() {
14166
- return (index.h(index.Host, { key: '340e9ed5613717d88fc8dde858d16716d0d100e8' }, index.h("slot", { key: 'af044aaa5e320540463d1318ba8cf8ed1b02b7e4' }), index.h("div", { key: '117ed1ce275f03f879aa2f320d9c0b28bfc953bd', ref: el => (this.tooltip = el), id: this.id, role: "tooltip", "aria-hidden": !this.open, "aria-live": this.open ? 'polite' : 'off', class: {
12661
+ return (index.h(index.Host, { key: 'a4d508bd463b29935745236c388f31b4bc01516f' }, index.h("slot", { key: 'b1992e73fa0e53b58493b8253c10823d562dac05' }), index.h("div", { key: 'd33515016f4d31548d9628f23d778acde69be531', ref: el => (this.tooltip = el), id: this.id, role: "tooltip", "aria-hidden": !this.open, "aria-live": this.open ? 'polite' : 'off', class: {
14167
12662
  tooltip: true,
14168
12663
  'tooltip-hidden': this.inactive,
14169
12664
  'tooltip-round': this.round,
14170
12665
  [`tooltip-${this.size}`]: Boolean(this.size)
14171
- } }, index.h("slot", { key: 'af0986e70f3d6ba0ad2f791cfa327ae9ebf768f5', name: "content" }, index.h("p", { key: 'bfcca7d936fa6e05719a88ace8bacf806b8f423b' }, this.content)))));
12666
+ } }, index.h("slot", { key: '58c5455be822bf8bc9476c2e5086e0299805791f', name: "content" }, index.h("p", { key: '56d35f4ec8846ad8928c72a269fd5ed19bf087e1' }, this.content)))));
14172
12667
  }
14173
12668
  async update() {
14174
12669
  if (this.trigger && this.tooltip) {