@descope/web-components-ui 1.105.0 → 1.107.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 (38) hide show
  1. package/dist/cjs/index.cjs.js +224 -128
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +856 -760
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/DescopeDev.js +1 -1
  6. package/dist/umd/DescopeDev.js.map +1 -1
  7. package/dist/umd/descope-alert-index-js.js +1 -1
  8. package/dist/umd/descope-alert-index-js.js.map +1 -1
  9. package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
  10. package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
  11. package/dist/umd/descope-date-field-index-js.js +1 -1
  12. package/dist/umd/descope-date-field-index-js.js.map +1 -1
  13. package/dist/umd/descope-enriched-text.js +2 -0
  14. package/dist/umd/descope-enriched-text.js.map +1 -0
  15. package/dist/umd/descope-link.js +2 -0
  16. package/dist/umd/descope-link.js.map +1 -0
  17. package/dist/umd/index.js +1 -1
  18. package/dist/umd/index.js.map +1 -1
  19. package/package.json +11 -10
  20. package/src/components/descope-alert/AlertClass.js +1 -1
  21. package/src/components/descope-alert/index.js +1 -1
  22. package/src/components/descope-date-field/DateFieldClass.js +94 -3
  23. package/src/components/descope-date-field/helpers.js +8 -0
  24. package/src/index.cjs.js +0 -2
  25. package/src/index.js +0 -2
  26. package/src/theme/components/index.js +2 -2
  27. package/dist/umd/descope-enriched-text-index-js.js +0 -2
  28. package/dist/umd/descope-enriched-text-index-js.js.map +0 -1
  29. package/dist/umd/descope-link-index-js.js +0 -2
  30. package/dist/umd/descope-link-index-js.js.map +0 -1
  31. package/src/components/descope-enriched-text/EnrichedTextClass.js +0 -209
  32. package/src/components/descope-enriched-text/consts.js +0 -14
  33. package/src/components/descope-enriched-text/helpers.js +0 -5
  34. package/src/components/descope-enriched-text/index.js +0 -5
  35. package/src/components/descope-link/LinkClass.js +0 -76
  36. package/src/components/descope-link/index.js +0 -6
  37. package/src/theme/components/enrichedText.js +0 -40
  38. package/src/theme/components/link.js +0 -36
@@ -6825,9 +6825,9 @@ const decodeHTML = (html) => {
6825
6825
  /* eslint-disable no-param-reassign */
6826
6826
 
6827
6827
 
6828
- const componentName$X = getComponentName$1('enriched-text');
6828
+ const componentName$X = getComponentName('enriched-text');
6829
6829
 
6830
- class EnrichedText extends createBaseClass({ componentName: componentName$X, baseSelector: ':host > div' }) {
6830
+ class EnrichedText extends createBaseClass$1({ componentName: componentName$X, baseSelector: ':host > div' }) {
6831
6831
  #origLinkRenderer;
6832
6832
 
6833
6833
  #origEmRenderer;
@@ -6879,7 +6879,7 @@ class EnrichedText extends createBaseClass({ componentName: componentName$X, bas
6879
6879
 
6880
6880
  this.#initProcessor();
6881
6881
 
6882
- observeChildren$1(this, this.#parseChildren.bind(this));
6882
+ observeChildren(this, this.#parseChildren.bind(this));
6883
6883
  }
6884
6884
 
6885
6885
  static get observedAttributes() {
@@ -6995,8 +6995,8 @@ class EnrichedText extends createBaseClass({ componentName: componentName$X, bas
6995
6995
  }
6996
6996
  }
6997
6997
 
6998
- const EnrichedTextClass = compose$1(
6999
- createStyleMixin({
6998
+ const EnrichedTextClass = compose(
6999
+ createStyleMixin$1({
7000
7000
  mappings: {
7001
7001
  hostWidth: { selector: () => ':host', property: 'width' },
7002
7002
  hostDisplay: { selector: () => ':host', property: 'display', fallback: 'inline-block' },
@@ -7018,15 +7018,15 @@ const EnrichedTextClass = compose$1(
7018
7018
  minWidth: {},
7019
7019
  },
7020
7020
  }),
7021
- createStyleMixin({ componentNameOverride: getComponentName$1('link') }),
7022
- createStyleMixin({ componentNameOverride: getComponentName$1('text') }),
7023
- draggableMixin,
7024
- componentNameValidationMixin
7021
+ createStyleMixin$1({ componentNameOverride: getComponentName('link') }),
7022
+ createStyleMixin$1({ componentNameOverride: getComponentName('text') }),
7023
+ draggableMixin$1,
7024
+ componentNameValidationMixin$1
7025
7025
  )(EnrichedText);
7026
7026
 
7027
- const componentName$W = getComponentName$1('link');
7027
+ const componentName$W = getComponentName('link');
7028
7028
 
7029
- class RawLink extends createBaseClass({ componentName: componentName$W, baseSelector: ':host a' }) {
7029
+ class RawLink extends createBaseClass$1({ componentName: componentName$W, baseSelector: ':host a' }) {
7030
7030
  constructor() {
7031
7031
  super();
7032
7032
 
@@ -7053,14 +7053,14 @@ class RawLink extends createBaseClass({ componentName: componentName$W, baseSele
7053
7053
  this
7054
7054
  );
7055
7055
 
7056
- forwardAttrs$1(this, this.shadowRoot.querySelector('a'), {
7056
+ forwardAttrs(this, this.shadowRoot.querySelector('a'), {
7057
7057
  includeAttrs: ['href', 'target', 'tooltip'],
7058
7058
  mapAttrs: {
7059
7059
  tooltip: 'title',
7060
7060
  },
7061
7061
  });
7062
7062
 
7063
- forwardAttrs$1(this, this.shadowRoot.querySelector('descope-text'), {
7063
+ forwardAttrs(this, this.shadowRoot.querySelector('descope-text'), {
7064
7064
  includeAttrs: ['mode', 'variant'],
7065
7065
  });
7066
7066
  }
@@ -7076,8 +7076,8 @@ const selectors$3 = {
7076
7076
 
7077
7077
  const { anchor, text: text$2, host: host$n, wrapper: wrapper$1, link: link$3 } = selectors$3;
7078
7078
 
7079
- const LinkClass = compose$1(
7080
- createStyleMixin({
7079
+ const LinkClass = compose(
7080
+ createStyleMixin$1({
7081
7081
  mappings: {
7082
7082
  hostWidth: { ...host$n, property: 'width' },
7083
7083
  hostDirection: { ...text$2, property: 'direction' },
@@ -7090,11 +7090,11 @@ const LinkClass = compose$1(
7090
7090
  cursor: anchor,
7091
7091
  },
7092
7092
  }),
7093
- draggableMixin,
7094
- componentNameValidationMixin
7093
+ draggableMixin$1,
7094
+ componentNameValidationMixin$1
7095
7095
  )(RawLink);
7096
7096
 
7097
- const globalRefs$z = getThemeRefs(globals$1);
7097
+ const globalRefs$z = getThemeRefs$1(globals);
7098
7098
  const vars$N = LinkClass.cssVarList;
7099
7099
 
7100
7100
  const link$1 = {
@@ -7130,22 +7130,22 @@ var link$2 = /*#__PURE__*/Object.freeze({
7130
7130
  vars: vars$N
7131
7131
  });
7132
7132
 
7133
- const globalRefs$y = getThemeRefs(globals$1);
7133
+ const globalRefs$y = getThemeRefs$1(globals);
7134
7134
  const vars$M = EnrichedTextClass.cssVarList;
7135
7135
 
7136
7136
  const enrichedText = {
7137
7137
  [vars$M.hostDirection]: globalRefs$y.direction,
7138
- [vars$M.hostWidth]: useVar(vars$O.hostWidth),
7138
+ [vars$M.hostWidth]: useVar$1(vars$O.hostWidth),
7139
7139
 
7140
- [vars$M.textLineHeight]: useVar(vars$O.textLineHeight),
7141
- [vars$M.textColor]: useVar(vars$O.textColor),
7142
- [vars$M.textAlign]: useVar(vars$O.textAlign),
7140
+ [vars$M.textLineHeight]: useVar$1(vars$O.textLineHeight),
7141
+ [vars$M.textColor]: useVar$1(vars$O.textColor),
7142
+ [vars$M.textAlign]: useVar$1(vars$O.textAlign),
7143
7143
 
7144
- [vars$M.fontSize]: useVar(vars$O.fontSize),
7145
- [vars$M.fontWeight]: useVar(vars$O.fontWeight),
7146
- [vars$M.fontFamily]: useVar(vars$O.fontFamily),
7144
+ [vars$M.fontSize]: useVar$1(vars$O.fontSize),
7145
+ [vars$M.fontWeight]: useVar$1(vars$O.fontWeight),
7146
+ [vars$M.fontFamily]: useVar$1(vars$O.fontFamily),
7147
7147
 
7148
- [vars$M.linkColor]: useVar(vars$N.textColor),
7148
+ [vars$M.linkColor]: useVar$1(vars$N.textColor),
7149
7149
  [vars$M.linkTextDecoration]: 'none',
7150
7150
  [vars$M.linkHoverTextDecoration]: 'underline',
7151
7151
 
@@ -15756,6 +15756,104 @@ var radioButton$1 = /*#__PURE__*/Object.freeze({
15756
15756
  vars: vars$j
15757
15757
  });
15758
15758
 
15759
+ const SUPPORTED_FORMATS = ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD'];
15760
+
15761
+ const DEFAULT_FORMAT = SUPPORTED_FORMATS[0];
15762
+
15763
+ const NATIVE_FORMAT = 'YYYY-MM-DD';
15764
+
15765
+ const YEARS_RANGE = 100;
15766
+
15767
+ const DIVIDER = '/';
15768
+
15769
+ const months = [
15770
+ 'January',
15771
+ 'February',
15772
+ 'March',
15773
+ 'April',
15774
+ 'May',
15775
+ 'June',
15776
+ 'July',
15777
+ 'August',
15778
+ 'September',
15779
+ 'October',
15780
+ 'November',
15781
+ 'December',
15782
+ ];
15783
+
15784
+ const weekdays = [
15785
+ 'Sunday',
15786
+ 'Monday',
15787
+ 'Tuesday',
15788
+ 'Wednesday',
15789
+ 'Thursday',
15790
+ 'Friday',
15791
+ 'Saturday',
15792
+ ];
15793
+
15794
+ const counterConfig = {
15795
+ MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM' },
15796
+ DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD' },
15797
+ YEAR: { id: 'year', min: 0, max: 9999, placeholder: 'YYYY' },
15798
+ };
15799
+
15800
+ const valRange = {
15801
+ year: { min: 1900, max: 2099 },
15802
+ };
15803
+
15804
+ const BUTTON_LABEL_DONE = 'Done';
15805
+ const BUTTON_LABEL_CANCEL = 'Cancel';
15806
+ const CALENDAR_LABEL_TODAY = 'Today';
15807
+
15808
+ const MOBILE_DEVICE_INTERACTION_TIMEOUT_MS = 150;
15809
+
15810
+ const patterns = {
15811
+ MM: '(0?[1-9]|1[0-2])',
15812
+ DD: '(0?[1-9]|[12][0-9]|3[01])',
15813
+ YYYY: '([0-9]{4})',
15814
+ };
15815
+
15816
+ const createPattern = (format) => {
15817
+ const pattern = format
15818
+ .split(DIVIDER)
15819
+ .map((part) => patterns[part])
15820
+ .join('\\D');
15821
+
15822
+ return `^${pattern}$`;
15823
+ };
15824
+
15825
+ const createToValuesFn = (format) => {
15826
+ const order = format.split(DIVIDER);
15827
+ return (match) => {
15828
+ const values = {};
15829
+ order.forEach((part, index) => {
15830
+ values[part] = match[index + 1];
15831
+ });
15832
+ return [values.YYYY, values.MM, values.DD];
15833
+ };
15834
+ };
15835
+
15836
+ const createDate = (val, regexp, toValuesFn) => {
15837
+ const match = regexp.exec(val);
15838
+ if (!match) return null;
15839
+ const [year, month, day] = toValuesFn(match);
15840
+ return newDate([year, month, day].join(DIVIDER));
15841
+ };
15842
+
15843
+ const createFormat = (format) => {
15844
+ const pattern = createPattern(format);
15845
+ const toValuesFn = createToValuesFn(format);
15846
+ const regexp = new RegExp(pattern);
15847
+
15848
+ return {
15849
+ pattern,
15850
+ validate: (val) => regexp.test(val),
15851
+ getDate: (val) => createDate(val, regexp, toValuesFn),
15852
+ };
15853
+ };
15854
+
15855
+ const formats = Object.fromEntries(SUPPORTED_FORMATS.map((f) => [f, createFormat(f)]));
15856
+
15759
15857
  const isValidTimestamp = (val) => !Number.isNaN(Number(val));
15760
15858
 
15761
15859
  const isNumber = (val) => !!String(val || '').trim() && !Number.isNaN(Number(val));
@@ -15805,6 +15903,12 @@ const overrideConstructedStylesheet = (ele) => {
15805
15903
  ele?.shadowRoot?.adoptedStyleSheets?.push(cs);
15806
15904
  };
15807
15905
 
15906
+ const parseDateString = (val, format) => {
15907
+ const trimmed = val.trim?.();
15908
+ if (!trimmed) return null;
15909
+ return formats[format].getDate(trimmed);
15910
+ };
15911
+
15808
15912
  const calendarIcon = `
15809
15913
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
15810
15914
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9 5H15V4.50468C15 4.21404 15.226 4 15.5047 4H16.4953C16.786 4 17 4.22595 17 4.50468V5H18.7568C19.3028 5 19.75 5.44725 19.75 5.99896V7.00104C19.75 7.55734 19.3053 8 18.7568 8H5.24317C4.69717 8 4.25 7.55275 4.25 7.00104V5.99896C4.25 5.44266 4.69466 5 5.24317 5H7V4.50468C7 4.21404 7.22596 4 7.50468 4H8.49532C8.78596 4 9 4.22595 9 4.50468V5ZM5.50468 9H6.49532C6.78596 9 7 9.22596 7 9.50468V10.4953C7 10.786 6.77404 11 6.49532 11H5.50468C5.21404 11 5 10.774 5 10.4953V9.50468C5 9.21404 5.22595 9 5.50468 9ZM8.50468 9H9.49532C9.78596 9 10 9.22596 10 9.50468V10.4953C10 10.786 9.77404 11 9.49532 11H8.50468C8.21404 11 8 10.774 8 10.4953V9.50468C8 9.21404 8.22596 9 8.50468 9ZM11.5047 9H12.4953C12.786 9 13 9.22596 13 9.50468V10.4953C13 10.786 12.774 11 12.4953 11H11.5047C11.214 11 11 10.774 11 10.4953V9.50468C11 9.21404 11.226 9 11.5047 9ZM5.50468 12H6.49532C6.78596 12 7 12.226 7 12.5047V13.4953C7 13.786 6.77404 14 6.49532 14H5.50468C5.21404 14 5 13.774 5 13.4953V12.5047C5 12.214 5.22595 12 5.50468 12ZM8.50468 12H9.49532C9.78596 12 10 12.226 10 12.5047V13.4953C10 13.786 9.77404 14 9.49532 14H8.50468C8.21404 14 8 13.774 8 13.4953V12.5047C8 12.214 8.22596 12 8.50468 12ZM11.5047 12H12.4953C12.786 12 13 12.226 13 12.5047V13.4953C13 13.786 12.774 14 12.4953 14H11.5047C11.214 14 11 13.774 11 13.4953V12.5047C11 12.214 11.226 12 11.5047 12ZM5.50468 15H6.49532C6.78596 15 7 15.226 7 15.5047V16.4953C7 16.786 6.77404 17 6.49532 17H5.50468C5.21404 17 5 16.774 5 16.4953V15.5047C5 15.214 5.22595 15 5.50468 15ZM8.50468 15H9.49532C9.78596 15 10 15.226 10 15.5047V16.4953C10 16.786 9.77404 17 9.49532 17H8.50468C8.21404 17 8 16.774 8 16.4953V15.5047C8 15.214 8.22596 15 8.50468 15ZM11.5047 15H12.4953C12.786 15 13 15.226 13 15.5047V16.4953C13 16.786 12.774 17 12.4953 17H11.5047C11.214 17 11 16.774 11 16.4953V15.5047C11 15.214 11.226 15 11.5047 15ZM14.5047 9H15.4953C15.786 9 16 9.22596 16 9.50468V10.4953C16 10.786 15.774 11 15.4953 11H14.5047C14.214 11 14 10.774 14 10.4953V9.50468C14 9.21404 14.226 9 14.5047 9ZM14.5047 12H15.4953C15.786 12 16 12.226 16 12.5047V13.4953C16 13.786 15.774 14 15.4953 14H14.5047C14.214 14 14 13.774 14 13.4953V12.5047C14 12.214 14.226 12 14.5047 12ZM14.5047 15H15.4953C15.786 15 16 15.226 16 15.5047V16.4953C16 16.786 15.774 17 15.4953 17H14.5047C14.214 17 14 16.774 14 16.4953V15.5047C14 15.214 14.226 15 14.5047 15ZM17.5047 15H18.4953C18.786 15 19 15.226 19 15.5047V16.4953C19 16.786 18.774 17 18.4953 17H17.5047C17.214 17 17 16.774 17 16.4953V15.5047C17 15.214 17.226 15 17.5047 15ZM5.50468 18H6.49532C6.78596 18 7 18.226 7 18.5047V19.4953C7 19.786 6.77404 20 6.49532 20H5.50468C5.21404 20 5 19.774 5 19.4953V18.5047C5 18.214 5.22595 18 5.50468 18ZM8.50468 18H9.49532C9.78596 18 10 18.226 10 18.5047V19.4953C10 19.786 9.77404 20 9.49532 20H8.50468C8.21404 20 8 19.774 8 19.4953V18.5047C8 18.214 8.22596 18 8.50468 18ZM11.5047 18H12.4953C12.786 18 13 18.226 13 18.5047V19.4953C13 19.786 12.774 20 12.4953 20H11.5047C11.214 20 11 19.774 11 19.4953V18.5047C11 18.214 11.226 18 11.5047 18ZM14.5047 18H15.4953C15.786 18 16 18.226 16 18.5047V19.4953C16 19.786 15.774 20 15.4953 20H14.5047C14.214 20 14 19.774 14 19.4953V18.5047C14 18.214 14.226 18 14.5047 18ZM17.5047 18H18.4953C18.786 18 19 18.226 19 18.5047V19.4953C19 19.786 18.774 20 18.4953 20H17.5047C17.214 20 17 19.774 17 19.4953V18.5047C17 18.214 17.226 18 17.5047 18ZM17.5047 12H18.4953C18.786 12 19 12.226 19 12.5047V13.4953C19 13.786 18.774 14 18.4953 14H17.5047C17.214 14 17 13.774 17 13.4953V12.5047C17 12.214 17.226 12 17.5047 12ZM17.5047 9H18.4953C18.786 9 19 9.22596 19 9.50468V10.4953C19 10.786 18.774 11 18.4953 11H17.5047C17.214 11 17 10.774 17 10.4953V9.50468C17 9.21404 17.226 9 17.5047 9Z" fill="#808080"/>
@@ -15820,57 +15924,6 @@ const arrowLeftIcon = `<svg width="24" height="24" viewBox="0 0 24 24" fill="non
15820
15924
  <path d="M14.7272 17.2193C15.1209 17.6584 15.0841 18.3334 14.6451 18.7272C14.206 19.1209 13.5309 19.0841 13.1372 18.6451C13.1372 18.6451 7.99776 13.0457 7.63399 12.64C7.27023 12.2343 7.27023 11.7608 7.63399 11.3552L13.1372 5.35492C13.5309 4.91587 14.206 4.87912 14.6451 5.27283C15.0841 5.66655 15.1209 6.34164 14.7272 6.78069L9.86322 12L14.7272 17.2193Z" fill="#808080"/>
15821
15925
  </svg>`;
15822
15926
 
15823
- const SUPPORTED_FORMATS = ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD'];
15824
-
15825
- const DEFAULT_FORMAT = SUPPORTED_FORMATS[0];
15826
-
15827
- const NATIVE_FORMAT = 'YYYY-MM-DD';
15828
-
15829
- const YEARS_RANGE = 100;
15830
-
15831
- const DIVIDER = '/';
15832
-
15833
- const months = [
15834
- 'January',
15835
- 'February',
15836
- 'March',
15837
- 'April',
15838
- 'May',
15839
- 'June',
15840
- 'July',
15841
- 'August',
15842
- 'September',
15843
- 'October',
15844
- 'November',
15845
- 'December',
15846
- ];
15847
-
15848
- const weekdays = [
15849
- 'Sunday',
15850
- 'Monday',
15851
- 'Tuesday',
15852
- 'Wednesday',
15853
- 'Thursday',
15854
- 'Friday',
15855
- 'Saturday',
15856
- ];
15857
-
15858
- const counterConfig = {
15859
- MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM' },
15860
- DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD' },
15861
- YEAR: { id: 'year', min: 0, max: 9999, placeholder: 'YYYY' },
15862
- };
15863
-
15864
- const valRange = {
15865
- year: { min: 1900, max: 2099 },
15866
- };
15867
-
15868
- const BUTTON_LABEL_DONE = 'Done';
15869
- const BUTTON_LABEL_CANCEL = 'Cancel';
15870
- const CALENDAR_LABEL_TODAY = 'Today';
15871
-
15872
- const MOBILE_DEVICE_INTERACTION_TIMEOUT_MS = 150;
15873
-
15874
15927
  const isValidAttrArr = (arr, count) =>
15875
15928
  Array.isArray(arr) && arr.length === count && arr.filter(Boolean).length === count;
15876
15929
 
@@ -16772,53 +16825,6 @@ var calendar$1 = /*#__PURE__*/Object.freeze({
16772
16825
  vars: vars$i
16773
16826
  });
16774
16827
 
16775
- const patterns = {
16776
- MM: '(0?[1-9]|1[0-2])',
16777
- DD: '(0?[1-9]|[12][0-9]|3[01])',
16778
- YYYY: '([0-9]{4})',
16779
- };
16780
-
16781
- const createPattern = (format) => {
16782
- const pattern = format
16783
- .split(DIVIDER)
16784
- .map((part) => patterns[part])
16785
- .join('\\D');
16786
-
16787
- return `^${pattern}$`;
16788
- };
16789
-
16790
- const createToValuesFn = (format) => {
16791
- const order = format.split(DIVIDER);
16792
- return (match) => {
16793
- const values = {};
16794
- order.forEach((part, index) => {
16795
- values[part] = match[index + 1];
16796
- });
16797
- return [values.YYYY, values.MM, values.DD];
16798
- };
16799
- };
16800
-
16801
- const createDate = (val, regexp, toValuesFn) => {
16802
- const match = regexp.exec(val);
16803
- if (!match) return null;
16804
- const [year, month, day] = toValuesFn(match);
16805
- return newDate([year, month, day].join(DIVIDER));
16806
- };
16807
-
16808
- const createFormat = (format) => {
16809
- const pattern = createPattern(format);
16810
- const toValuesFn = createToValuesFn(format);
16811
- const regexp = new RegExp(pattern);
16812
-
16813
- return {
16814
- pattern,
16815
- validate: (val) => regexp.test(val),
16816
- getDate: (val) => createDate(val, regexp, toValuesFn),
16817
- };
16818
- };
16819
-
16820
- const formats = Object.fromEntries(SUPPORTED_FORMATS.map((f) => [f, createFormat(f)]));
16821
-
16822
16828
  // DateCounterClass allows us to add several counters to the input, and use them seperately.
16823
16829
  // For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate
16824
16830
  // between different ranges.
@@ -17128,6 +17134,11 @@ class RawDateFieldClass extends BaseInputClass$1 {
17128
17134
  return this.getAttribute('disable-calendar') === 'true';
17129
17135
  }
17130
17136
 
17137
+ get isSelectAll() {
17138
+ const inputEle = this.inputElement.baseElement.inputElement;
17139
+ return inputEle.value.length === inputEle.selectionStart + inputEle.selectionEnd;
17140
+ }
17141
+
17131
17142
  reportValidity() {
17132
17143
  this.inputElement.reportValidity();
17133
17144
  }
@@ -17162,9 +17173,10 @@ class RawDateFieldClass extends BaseInputClass$1 {
17162
17173
  this.inputElement.addEventListener('focus', this.onFocus.bind(this));
17163
17174
  this.inputElement.addEventListener('blur', this.onBlur.bind(this));
17164
17175
  this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));
17165
- this.inputElement.addEventListener('keydown', this.handleArrowKeys.bind(this));
17176
+ this.inputElement.addEventListener('keydown', this.handleKeyboard.bind(this));
17166
17177
  this.inputElement.addEventListener('beforeinput', this.handleInput.bind(this));
17167
17178
  this.inputElement.addEventListener('pointerdown', this.onPointerDown.bind(this));
17179
+ this.inputElement.addEventListener('paste', this.onPaste.bind(this));
17168
17180
 
17169
17181
  forwardAttrs$1(this, this.inputElement, {
17170
17182
  includeAttrs: [
@@ -17193,6 +17205,8 @@ class RawDateFieldClass extends BaseInputClass$1 {
17193
17205
  handleInput(e) {
17194
17206
  e.preventDefault();
17195
17207
 
17208
+ this.handleSelectAll();
17209
+
17196
17210
  if (e.data && isNumber(e.data)) {
17197
17211
  this.parseDigits(e.data);
17198
17212
  this.updateCountersDisplay();
@@ -17213,6 +17227,12 @@ class RawDateFieldClass extends BaseInputClass$1 {
17213
17227
  });
17214
17228
  }
17215
17229
 
17230
+ handleSelectAll() {
17231
+ if (this.isSelectAll) {
17232
+ this.selectFirstCounter();
17233
+ }
17234
+ }
17235
+
17216
17236
  #popoverPosStylesheet;
17217
17237
 
17218
17238
  #popoverRenderer(root) {
@@ -17383,7 +17403,8 @@ class RawDateFieldClass extends BaseInputClass$1 {
17383
17403
  }
17384
17404
 
17385
17405
  // On focus select the first counter
17386
- this.selectedCounterIdx = 0;
17406
+ this.selectFirstCounter();
17407
+ // set selection on first counter
17387
17408
  this.inputElement.setSelectionRange(0, this.sortedCounters[0].length);
17388
17409
  }
17389
17410
 
@@ -17442,6 +17463,10 @@ class RawDateFieldClass extends BaseInputClass$1 {
17442
17463
  );
17443
17464
  }
17444
17465
 
17466
+ selectFirstCounter() {
17467
+ this.selectedCounterIdx = 0;
17468
+ }
17469
+
17445
17470
  selectNextCounter() {
17446
17471
  if (this.selectedCounterIdx < this.dateCounters.length) {
17447
17472
  this.selectedCounterIdx = Math.min(this.selectedCounterIdx + 1, 2);
@@ -17499,7 +17524,17 @@ class RawDateFieldClass extends BaseInputClass$1 {
17499
17524
  });
17500
17525
  }
17501
17526
 
17502
- handleArrowKeys(e) {
17527
+ handleKeyboard(e) {
17528
+ if (e.metaKey || e.ctrlKey) {
17529
+ if (e.key.toLowerCase() === 'x') {
17530
+ this.onCut(e);
17531
+ }
17532
+
17533
+ return;
17534
+ }
17535
+
17536
+ this.handleSelectAll();
17537
+
17503
17538
  if (e.key === 'ArrowUp') {
17504
17539
  this.activeCounter.inc();
17505
17540
  } else if (e.key === 'ArrowDown') {
@@ -17532,6 +17567,11 @@ class RawDateFieldClass extends BaseInputClass$1 {
17532
17567
  }
17533
17568
 
17534
17569
  handleBackspace() {
17570
+ if (this.isSelectAll) {
17571
+ this.resetToInitialState();
17572
+ return;
17573
+ }
17574
+
17535
17575
  const counter = this.activeCounter;
17536
17576
 
17537
17577
  if (counter.isEmpty) {
@@ -17649,6 +17689,62 @@ class RawDateFieldClass extends BaseInputClass$1 {
17649
17689
 
17650
17690
  return ret;
17651
17691
  }
17692
+
17693
+ resetToInitialState() {
17694
+ this.resetDateCounters();
17695
+ this.selectFirstCounter();
17696
+ this.resetDisplay();
17697
+ }
17698
+
17699
+ onCut(e) {
17700
+ e.preventDefault();
17701
+
17702
+ if (this.isSelectAll) {
17703
+ this.#copyToClipboard(this.countersValue);
17704
+ this.resetToInitialState();
17705
+ } else {
17706
+ this.#copyToClipboard(this.activeCounter.stringValue);
17707
+ this.activeCounter.set('');
17708
+ }
17709
+
17710
+ this.setInputSelectionRange();
17711
+ }
17712
+
17713
+ #copyToClipboard(value) {
17714
+ try {
17715
+ navigator.clipboard.writeText(value);
17716
+ } catch (err) {
17717
+ console.error('Failed to copy date value:', err);
17718
+ }
17719
+ }
17720
+
17721
+ onPaste(e) {
17722
+ e.preventDefault();
17723
+
17724
+ const clipboardData = e.clipboardData || window.clipboardData;
17725
+ const pastedData = clipboardData.getData('Text');
17726
+
17727
+ // try paste entire date if valid
17728
+ const validDate = parseDateString(pastedData, this.format);
17729
+
17730
+ if (validDate) {
17731
+ this.value = validDate.getTime();
17732
+ this.onDateCounterChange();
17733
+
17734
+ // select all
17735
+ setTimeout(() => this.inputElement.setSelectionRange(0, this.inputElement.value.length));
17736
+ } else {
17737
+ const value = Number(pastedData);
17738
+
17739
+ // try paste in counter if possible
17740
+ if (value && this.activeCounter.min <= value && this.activeCounter.max >= value) {
17741
+ // use String to get rid of any zero padding
17742
+ this.activeCounter.set(String(value));
17743
+
17744
+ setTimeout(() => this.setInputSelectionRange());
17745
+ }
17746
+ }
17747
+ }
17652
17748
  }
17653
17749
 
17654
17750
  const textVars$1 = TextFieldClass.cssVarList;