smoothly 0.1.87 → 0.1.88

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 (36) hide show
  1. package/dist/cjs/{index-328edd81.js → index-bc3845e8.js} +253 -182
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +291 -198
  4. package/dist/cjs/smoothly-calendar.cjs.entry.js +38 -10
  5. package/dist/cjs/smoothly-display.cjs.entry.js +1 -1
  6. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +8 -9
  7. package/dist/cjs/smoothly-input-date.cjs.entry.js +4 -0
  8. package/dist/cjs/smoothly-input.cjs.entry.js +1 -1
  9. package/dist/cjs/smoothly.cjs.js +1 -1
  10. package/dist/collection/components/calendar/index.js +80 -11
  11. package/dist/collection/components/input-date/index.js +12 -1
  12. package/dist/collection/components/input-date-range/index.js +14 -15
  13. package/dist/custom-elements/index.js +312 -210
  14. package/dist/esm/{index-1be6d668.js → index-37a67c97.js} +253 -182
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/smoothly-accordion_47.entry.js +291 -198
  17. package/dist/esm/smoothly-calendar.entry.js +38 -10
  18. package/dist/esm/smoothly-display.entry.js +1 -1
  19. package/dist/esm/smoothly-input-date-range.entry.js +8 -9
  20. package/dist/esm/smoothly-input-date.entry.js +4 -0
  21. package/dist/esm/smoothly-input.entry.js +1 -1
  22. package/dist/esm/smoothly.js +1 -1
  23. package/dist/smoothly/{index-1be6d668.js → index-37a67c97.js} +253 -182
  24. package/dist/smoothly/p-0286085b.entry.js +1 -0
  25. package/dist/smoothly/smoothly-calendar.entry.js +38 -10
  26. package/dist/smoothly/smoothly-display.entry.js +1 -1
  27. package/dist/smoothly/smoothly-input-date-range.entry.js +8 -9
  28. package/dist/smoothly/smoothly-input-date.entry.js +4 -0
  29. package/dist/smoothly/smoothly-input.entry.js +1 -1
  30. package/dist/smoothly/smoothly.esm.js +1 -1
  31. package/dist/types/components/calendar/index.d.ts +6 -1
  32. package/dist/types/components/input-date/index.d.ts +1 -0
  33. package/dist/types/components/input-date-range/index.d.ts +2 -2
  34. package/dist/types/components.d.ts +3 -1
  35. package/package.json +2 -2
  36. package/dist/smoothly/p-7b43df84.entry.js +0 -1
@@ -1011,7 +1011,7 @@ var __awaiter$a = (undefined && undefined.__awaiter) || function (thisArg, _argu
1011
1011
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1012
1012
  });
1013
1013
  };
1014
- class Base {
1014
+ class Base$1 {
1015
1015
  sign(data) {
1016
1016
  return __awaiter$a(this, void 0, void 0, function* () {
1017
1017
  return typeof data == "string"
@@ -1037,7 +1037,7 @@ var __awaiter$9 = (undefined && undefined.__awaiter) || function (thisArg, _argu
1037
1037
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1038
1038
  });
1039
1039
  };
1040
- class ECDSA extends Base {
1040
+ class ECDSA extends Base$1 {
1041
1041
  constructor(hash, publicKey, privateKey) {
1042
1042
  super();
1043
1043
  this.hash = hash;
@@ -1081,7 +1081,7 @@ var __awaiter$8 = (undefined && undefined.__awaiter) || function (thisArg, _argu
1081
1081
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1082
1082
  });
1083
1083
  };
1084
- class Symmetric$1 extends Base {
1084
+ class Symmetric$1 extends Base$1 {
1085
1085
  verifyBinary(data, signature) {
1086
1086
  return __awaiter$8(this, void 0, void 0, function* () {
1087
1087
  return encode$1(yield this.signBinary(data), "url") == encode$1(signature, "url");
@@ -1128,7 +1128,7 @@ var __awaiter$6 = (undefined && undefined.__awaiter) || function (thisArg, _argu
1128
1128
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1129
1129
  });
1130
1130
  };
1131
- class RSA extends Base {
1131
+ class RSA extends Base$1 {
1132
1132
  constructor(hash, publicKey, privateKey) {
1133
1133
  super();
1134
1134
  this.hash = hash;
@@ -1164,7 +1164,7 @@ var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _argu
1164
1164
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1165
1165
  });
1166
1166
  };
1167
- class RSAPSS extends Base {
1167
+ class RSAPSS extends Base$1 {
1168
1168
  constructor(hash, publicKey, privateKey) {
1169
1169
  super();
1170
1170
  this.hash = hash;
@@ -21448,6 +21448,8 @@ let Calendar = class extends HTMLElement {
21448
21448
  this.valueChanged = createEvent(this, "valueChanged", 7);
21449
21449
  this.startChanged = createEvent(this, "startChanged", 7);
21450
21450
  this.endChanged = createEvent(this, "endChanged", 7);
21451
+ this.dateSet = createEvent(this, "dateSet", 7);
21452
+ this.dateRangeSet = createEvent(this, "dateRangeSet", 7);
21451
21453
  this.value = dist$3.Date.now();
21452
21454
  this.clickCounter = 0;
21453
21455
  }
@@ -21460,13 +21462,33 @@ let Calendar = class extends HTMLElement {
21460
21462
  onClick(date) {
21461
21463
  this.valueChanged.emit((this.value = date));
21462
21464
  this.clickCounter += 1;
21463
- if (this.clickCounter % 2 == 1)
21464
- this.start = this.end = date;
21465
- else {
21466
- if (this.start && date > this.start)
21467
- this.end = date;
21468
- else
21465
+ if (this.doubleInput) {
21466
+ if (this.clickCounter % 2 == 1)
21467
+ this.start = this.end = this.frozenDate = date;
21468
+ else {
21469
+ if (this.start && date > this.start)
21470
+ this.end = date;
21471
+ else
21472
+ this.start = date;
21473
+ }
21474
+ }
21475
+ !this.doubleInput && this.dateSet.emit(this.value);
21476
+ this.doubleInput &&
21477
+ this.clickCounter % 2 == 0 &&
21478
+ this.start &&
21479
+ this.end &&
21480
+ this.dateRangeSet.emit({ start: this.start, end: this.end });
21481
+ }
21482
+ onHover(date) {
21483
+ if (this.doubleInput && this.clickCounter % 2 == 1) {
21484
+ if (date < this.frozenDate) {
21469
21485
  this.start = date;
21486
+ this.end = this.frozenDate;
21487
+ }
21488
+ else {
21489
+ this.start = this.frozenDate;
21490
+ this.end = date;
21491
+ }
21470
21492
  }
21471
21493
  }
21472
21494
  render() {
@@ -21478,11 +21500,17 @@ let Calendar = class extends HTMLElement {
21478
21500
  } }),
21479
21501
  h("table", null, h("thead", null, h("tr", null, weekdays().map(day => (h("th", null, day))))), month((_b = this.month) !== null && _b !== void 0 ? _b : this.value).map(week => (h("tr", null, week.map(date => {
21480
21502
  var _a, _b, _c;
21481
- return (h("td", { tabindex: 1, onClick: (this.min || this.max) && (date < this.min || date > this.max) ? undefined : () => this.onClick(date), class: (date == this.value ? ["selected"] : [])
21503
+ return (h("td", { tabindex: 1, onMouseOver: () => {
21504
+ !this.doubleInput && (this.min || this.max) && (date < this.min || date > this.max)
21505
+ ? undefined
21506
+ : this.onHover(date);
21507
+ }, onClick: (this.min || this.max) && (date < this.min || date > this.max) ? undefined : () => this.onClick(date), class: (date == this.value ? ["selected"] : [])
21482
21508
  .concat(...(date == dist$3.Date.now() ? ["today"] : []), dist$3.Date.firstOfMonth((_a = this.month) !== null && _a !== void 0 ? _a : this.value) == dist$3.Date.firstOfMonth(date) ? ["currentMonth"] : [], this.doubleInput
21483
- ? date >= ((_b = this.start) !== null && _b !== void 0 ? _b : "") && date <= ((_c = this.end) !== null && _c !== void 0 ? _c : "")
21484
- ? ["dateRange"]
21485
- : []
21509
+ ? this.start == date || this.end == date
21510
+ ? ["selected"]
21511
+ : date >= ((_b = this.start) !== null && _b !== void 0 ? _b : "") && date <= ((_c = this.end) !== null && _c !== void 0 ? _c : "")
21512
+ ? ["dateRange"]
21513
+ : []
21486
21514
  : "")
21487
21515
  .concat(...(this.min || this.max ? (date < this.min || date > this.max ? ["disable"] : []) : ""))
21488
21516
  .join(" ") }, date.substring(8, 10)));
@@ -40713,17 +40741,31 @@ var DateFormat;
40713
40741
  function fromLocale(locale) {
40714
40742
  let result;
40715
40743
  switch (locale) {
40744
+ case "sq-AL":
40745
+ case "es-AR":
40746
+ case "it-IT":
40716
40747
  case "en-GB":
40748
+ case "fr-FR":
40717
40749
  result = "dd/mm/YYYY";
40718
40750
  break;
40719
40751
  case "en-US":
40720
40752
  result = "mm/dd/YYYY";
40721
40753
  break;
40754
+ case "et-EE":
40755
+ case "de-AT":
40722
40756
  case "de-DE":
40757
+ case "he-IL":
40758
+ case "is-IS":
40759
+ case "lv-LV":
40723
40760
  case "pl-PL":
40724
40761
  case "ru-RU":
40762
+ case "fi-FI":
40725
40763
  result = "dd.mm.YYYY";
40726
40764
  break;
40765
+ case "hi-IN":
40766
+ case "en-IN":
40767
+ result = "dd-mm-YYYY";
40768
+ break;
40727
40769
  default:
40728
40770
  result = "YYYY-mm-dd";
40729
40771
  break;
@@ -40761,150 +40803,270 @@ var DateFormat;
40761
40803
 
40762
40804
  const DateFormat = /*@__PURE__*/getDefaultExportFromCjs(DateFormat_1);
40763
40805
 
40764
- var helper = createCommonjsModule(function (module, exports) {
40806
+ var Base_1 = createCommonjsModule(function (module, exports) {
40765
40807
  "use strict";
40766
40808
  Object.defineProperty(exports, "__esModule", { value: true });
40767
- exports.validFormat = exports.validSymbol = exports.validYear = exports.validMonth = exports.validDay = void 0;
40768
- function validDay(symbol, state, startIndex, endIndex) {
40769
- let result = false;
40770
- if (state.value.length == startIndex)
40771
- result = symbol <= "3" && symbol >= "0";
40772
- else if (state.value.length == endIndex) {
40773
- if (state.value.substring(startIndex, startIndex + 1) == "2" ||
40774
- state.value.substring(startIndex, startIndex + 1) == "1")
40775
- result = symbol <= "9" && symbol >= "0";
40776
- else if (state.value.substring(startIndex, startIndex + 1) == "0")
40777
- result = symbol <= "9" && symbol >= "1";
40778
- else
40779
- result = symbol == "1" || symbol == "0";
40809
+ exports.register = exports.Base = void 0;
40810
+
40811
+
40812
+
40813
+ class Base {
40814
+ constructor(seperator) {
40815
+ this.seperator = seperator;
40780
40816
  }
40781
- return result;
40782
- }
40783
- exports.validDay = validDay;
40784
- function validMonth(symbol, state, startIndex, endIndex) {
40785
- let result = false;
40786
- if (state.value.length == startIndex)
40787
- result = symbol == "1" || symbol == "0";
40788
- else if (state.value.length == endIndex) {
40789
- if (state.value.substring(startIndex, startIndex + 1) != "1")
40790
- result = symbol <= "9" && symbol >= "1";
40791
- else
40792
- result = symbol < "3" && symbol >= "0";
40817
+ unformat(formated) {
40818
+ return formated.delete(this.seperator);
40819
+ }
40820
+ daysInMonth(value) {
40821
+ var _a;
40822
+ return (32 -
40823
+ Number.parseInt(dist$3.Date.next(((_a = this.fromString(value.padEnd(8, "1"))) !== null && _a !== void 0 ? _a : "1970-01-01").substring(0, 8) + "28", 4).substring(8, 10)));
40824
+ }
40825
+ validMonth(day, month, year) {
40826
+ return (new Date(Number.parseInt(year !== null && year !== void 0 ? year : "2004"), Number.parseInt(month), 0).getDate() >=
40827
+ Number.parseInt(day));
40793
40828
  }
40794
- return result;
40795
- }
40796
- exports.validMonth = validMonth;
40797
- function validYear(symbol, state, startIndex, endIndex) {
40798
- return state.value.length < endIndex && state.value.length >= startIndex && symbol >= "0" && symbol <= "9";
40799
40829
  }
40800
- exports.validYear = validYear;
40801
- function validSymbol(symbol, state, firstSplitter, lastSplitter, character) {
40802
- return (state.value.length == firstSplitter || state.value.length == lastSplitter) && symbol == character;
40830
+ exports.Base = Base;
40831
+ const handlers = {};
40832
+ function register(format, create) {
40833
+ handlers[format] = create;
40803
40834
  }
40804
- exports.validSymbol = validSymbol;
40805
- function validFormat(symbol, state, format) {
40806
- let result;
40807
- switch (format) {
40808
- case "dd/mm/YYYY":
40809
- result =
40810
- validDay(symbol, state, 0, 1) ||
40811
- validSymbol(symbol, state, 2, 5, "/") ||
40812
- validMonth(symbol, state, 3, 4) ||
40813
- validYear(symbol, state, 6, 10);
40814
- break;
40815
- case "dd.mm.YYYY":
40816
- result =
40817
- validDay(symbol, state, 0, 1) ||
40818
- validSymbol(symbol, state, 2, 5, ".") ||
40819
- validMonth(symbol, state, 3, 4) ||
40820
- validYear(symbol, state, 6, 10);
40821
- break;
40822
- case "mm/dd/YYYY":
40823
- result =
40824
- validDay(symbol, state, 3, 4) ||
40825
- validSymbol(symbol, state, 2, 5, "/") ||
40826
- validMonth(symbol, state, 0, 1) ||
40827
- validYear(symbol, state, 6, 10);
40828
- break;
40829
- default:
40830
- result =
40831
- validDay(symbol, state, 8, 9) ||
40832
- validSymbol(symbol, state, 4, 7, "-") ||
40833
- validMonth(symbol, state, 5, 6) ||
40834
- validYear(symbol, state, 0, 4);
40835
- break;
40835
+ exports.register = register;
40836
+ base.add("date", (parameters) => {
40837
+ var _a;
40838
+ const argument = parameters && parameters.length > 0 ? parameters[0] : undefined;
40839
+ const format = DateFormat_1.DateFormat.is(argument) ? argument : DateFormat_1.DateFormat.fromLocale(argument);
40840
+ const create = (_a = handlers[format]) !== null && _a !== void 0 ? _a : handlers["YYYY-mm-dd"];
40841
+ return create();
40842
+ });
40843
+ //# sourceMappingURL=Base.js.map
40844
+ });
40845
+
40846
+ const Base = /*@__PURE__*/getDefaultExportFromCjs(Base_1);
40847
+
40848
+ var dmy = createCommonjsModule(function (module, exports) {
40849
+ "use strict";
40850
+ Object.defineProperty(exports, "__esModule", { value: true });
40851
+
40852
+
40853
+ class Handler extends Base_1.Base {
40854
+ constructor(seperator) {
40855
+ super(seperator);
40856
+ }
40857
+ toString(data) {
40858
+ return data.length == 10
40859
+ ? [data.substring(8, 10), data.substring(5, 7), data.substring(0, 4)].join(this.seperator)
40860
+ : "";
40861
+ }
40862
+ fromString(value) {
40863
+ const result = value.length == 8 ? `${value.substring(4, 8)}-${value.substring(2, 4)}-${value.substring(0, 2)}` : undefined;
40864
+ return dist$3.Date.is(result) ? result : undefined;
40865
+ }
40866
+ format(unformatted) {
40867
+ let result = unformatted;
40868
+ if (result.get(0, 1) > "3")
40869
+ result = result.insert(0, "0");
40870
+ if (result.value.length > 1)
40871
+ result = result.insert(2, this.seperator);
40872
+ if (result.get(3, 1) > "1")
40873
+ result = result.insert(3, "0");
40874
+ if (result.value.length > 4)
40875
+ result = result.insert(5, this.seperator);
40876
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^(0[1-9]|[12][0-9]|3[01])", "(0[1-9]|1[012])", "\\d{4}$"].join(this.seperator)) });
40877
+ }
40878
+ allowed(symbol, state) {
40879
+ return state.selection.start == 1 && state.value[0] == "3"
40880
+ ? symbol >= "0" && symbol <= "1"
40881
+ : state.selection.start == 1 && state.value[0] == "0"
40882
+ ? symbol >= "1" && symbol <= "9"
40883
+ : state.selection.start == 2
40884
+ ? symbol >= "0" &&
40885
+ symbol <= "9" &&
40886
+ (symbol == "0" || symbol == "1" || this.validMonth(state.value.substring(0, 2), symbol))
40887
+ : state.selection.start == 3
40888
+ ? symbol >= "0" && symbol <= "9" && this.validMonth(state.value.substring(0, 2), state.value[2] + symbol)
40889
+ : state.selection.start == 7
40890
+ ? symbol >= "0" &&
40891
+ symbol <= "9" &&
40892
+ this.validMonth(state.value.substring(0, 2), state.value.substring(2, 4), state.value.substring(4, 7) + symbol)
40893
+ : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
40894
+ }
40895
+ }
40896
+ Base_1.register("dd.mm.YYYY", () => new Handler("."));
40897
+ Base_1.register("dd/mm/YYYY", () => new Handler("/"));
40898
+ Base_1.register("dd-mm-YYYY", () => new Handler("-"));
40899
+ //# sourceMappingURL=dmy.js.map
40900
+ });
40901
+
40902
+ const dmy$1 = /*@__PURE__*/getDefaultExportFromCjs(dmy);
40903
+
40904
+ var mdy = createCommonjsModule(function (module, exports) {
40905
+ "use strict";
40906
+ Object.defineProperty(exports, "__esModule", { value: true });
40907
+
40908
+
40909
+ class Handler extends Base_1.Base {
40910
+ constructor(seperator) {
40911
+ super(seperator);
40912
+ }
40913
+ toString(data) {
40914
+ return data.length == 10
40915
+ ? [data.substring(5, 7), data.substring(8, 10), data.substring(0, 4)].join(this.seperator)
40916
+ : "";
40917
+ }
40918
+ fromString(value) {
40919
+ const result = value.length == 8 ? `${value.substring(4, 8)}-${value.substring(0, 2)}-${value.substring(2, 4)}` : undefined;
40920
+ return dist$3.Date.is(result) ? result : undefined;
40921
+ }
40922
+ format(unformatted) {
40923
+ let result = unformatted;
40924
+ if (result.get(0, 1) > "1")
40925
+ result = result.insert(0, "0");
40926
+ if (result.value.length > 1)
40927
+ result = result.insert(2, this.seperator);
40928
+ if (result.get(3, 1) > (result.get(0, 2) == "02" ? "2" : "3"))
40929
+ result = result.insert(3, "0");
40930
+ if (result.value.length > 4)
40931
+ result = result.insert(5, this.seperator);
40932
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^(0[1-9]|1[012])", "(0[1-9]|[12][0-9]|3[01])", "\\d{4}$"].join(this.seperator)) });
40933
+ }
40934
+ allowed(symbol, state) {
40935
+ const result = state.selection.start == 1 && state.value[0] == "1"
40936
+ ? symbol >= "0" && symbol <= "2"
40937
+ : state.selection.start == 1 && state.value[0] == "0"
40938
+ ? symbol >= "1" && symbol <= "9"
40939
+ : state.selection.start == 3
40940
+ ? symbol >= "0" && symbol <= "9" && this.validMonth(state.value[2] + symbol, state.value.substring(0, 2))
40941
+ : state.selection.start == 7
40942
+ ? symbol >= "0" &&
40943
+ symbol <= "9" &&
40944
+ this.validMonth(state.value.substring(2, 4), state.value.substring(0, 2), state.value.substring(4, 7) + symbol)
40945
+ : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
40946
+ return result;
40836
40947
  }
40837
- return result;
40838
40948
  }
40839
- exports.validFormat = validFormat;
40840
- //# sourceMappingURL=helper.js.map
40949
+ Base_1.register("mm/dd/YYYY", () => new Handler("/"));
40950
+ //# sourceMappingURL=mdy.js.map
40841
40951
  });
40842
40952
 
40843
- const helper$1 = /*@__PURE__*/getDefaultExportFromCjs(helper);
40953
+ const mdy$1 = /*@__PURE__*/getDefaultExportFromCjs(mdy);
40954
+
40955
+ var ymd = createCommonjsModule(function (module, exports) {
40956
+ "use strict";
40957
+ Object.defineProperty(exports, "__esModule", { value: true });
40958
+
40959
+
40960
+ class Handler extends Base_1.Base {
40961
+ constructor(seperator) {
40962
+ super(seperator);
40963
+ }
40964
+ toString(data) {
40965
+ return typeof data != "string" ? "" : data;
40966
+ }
40967
+ fromString(value) {
40968
+ const result = value.length == 8 ? `${value.substring(0, 4)}-${value.substring(4, 6)}-${value.substring(6, 8)}` : undefined;
40969
+ return dist$3.Date.is(result) ? result : undefined;
40970
+ }
40971
+ format(unformatted) {
40972
+ let result = unformatted;
40973
+ if (result.value.length > 3) {
40974
+ result = result.insert(4, this.seperator);
40975
+ if (result.get(5, 1) > "1")
40976
+ result = result.insert(5, "0");
40977
+ if (result.value.length > 6) {
40978
+ result = result.insert(7, this.seperator);
40979
+ if (result.get(8, 1) > this.daysInMonth(unformatted.value).toString().substring(0, 1))
40980
+ result = result.insert(8, "0");
40981
+ }
40982
+ }
40983
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^\\d{4}", "(0[1-9]|1[012])", "(0[1-9]|[12][0-9]|3[01])$"].join(this.seperator)) });
40984
+ }
40985
+ allowed(symbol, state) {
40986
+ const daysInMonth = this.daysInMonth(state.value);
40987
+ return state.selection.start == 5 && state.value[4] == "0"
40988
+ ? symbol >= "1" && symbol <= "9"
40989
+ : state.selection.start == 5 && state.value[4] == "1"
40990
+ ? symbol >= "0" && symbol <= "2"
40991
+ : state.selection.start == 7 && state.value[6] == "0"
40992
+ ? symbol >= "1" && symbol <= "9"
40993
+ : state.selection.start == 7 && ((state.value[6] == "2" && daysInMonth < 30) || state.value[6] == "3")
40994
+ ? symbol >= "0" && symbol <= daysInMonth.toString().substring(1)
40995
+ : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
40996
+ }
40997
+ }
40998
+ Base_1.register("YYYY-mm-dd", () => new Handler("-"));
40999
+ //# sourceMappingURL=ymd.js.map
41000
+ });
41001
+
41002
+ const ymd$1 = /*@__PURE__*/getDefaultExportFromCjs(ymd);
40844
41003
 
40845
41004
  var date = createCommonjsModule(function (module, exports) {
40846
41005
  "use strict";
40847
41006
  Object.defineProperty(exports, "__esModule", { value: true });
40848
- exports.formatDate = void 0;
40849
41007
 
40850
41008
 
40851
41009
 
41010
+ //# sourceMappingURL=index.js.map
41011
+ });
41012
+
41013
+ const index$2 = /*@__PURE__*/getDefaultExportFromCjs(date);
41014
+
41015
+ var dateTime = createCommonjsModule(function (module, exports) {
41016
+ "use strict";
41017
+ Object.defineProperty(exports, "__esModule", { value: true });
41018
+ exports.formatDate = void 0;
41019
+
40852
41020
 
40853
41021
  class Handler {
40854
- constructor(formatting) {
40855
- this.formatting = DateFormat_1.DateFormat.is(formatting) ? formatting : DateFormat_1.DateFormat.fromLocale(formatting);
40856
- this.locale = dist$3.Locale.is(formatting)
40857
- ? formatting
40858
- : DateFormat_1.DateFormat.is(formatting)
40859
- ? DateFormat_1.DateFormat.toLocale(formatting)
40860
- : undefined;
40861
- }
40862
41022
  toString(data) {
40863
- return typeof data != "string" ? "" : dist$3.Date.is(data) ? dist$3.Date.localize(data, this.locale) : data;
41023
+ return typeof data == "string" ? data : "";
40864
41024
  }
40865
41025
  fromString(value) {
40866
- let result;
40867
- switch (this.formatting) {
40868
- case "dd/mm/YYYY":
40869
- case "dd.mm.YYYY":
40870
- result = `${value.substring(6, 10)}-${value.substring(3, 5)}-${value.substring(0, 2)}`;
40871
- break;
40872
- case "mm/dd/YYYY":
40873
- result = `${value.substring(6, 10)}-${value.substring(0, 2)}-${value.substring(3, 5)}`;
40874
- break;
40875
- default:
40876
- result = value;
40877
- break;
40878
- }
40879
- return dist$3.Date.is(result) ? result : undefined;
41026
+ let result = value.replace(" ", "T");
41027
+ const fillerDate = "0000-01-01T00:00:00.000Z";
41028
+ if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
41029
+ result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
41030
+ result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
41031
+ ? undefined
41032
+ : result + fillerDate.substring(result.length, fillerDate.length);
41033
+ return dist$3.DateTime.is(result) ? result : undefined;
40880
41034
  }
40881
41035
  format(unformated) {
40882
- let result;
40883
- switch (this.formatting) {
40884
- case "dd/mm/YYYY":
40885
- result = Object.assign(Object.assign({}, formatDate(unformated, "dd/mm/YYYY")), { type: "text", length: [0, 10], pattern: /^([0-2][0-9]|(3)[0-1])(\/)(((0)[0-9])|((1)[0-2]))(\/)\d{4}$/ });
40886
- break;
40887
- case "dd.mm.YYYY":
40888
- result = Object.assign(Object.assign({}, formatDate(unformated, "dd.mm.YYYY")), { type: "text", length: [0, 10], pattern: /^([0-2][0-9]|(3)[0-1])(\.)(((0)[0-9])|((1)[0-2]))(\.)\d{4}$/ });
40889
- break;
40890
- case "mm/dd/YYYY":
40891
- result = Object.assign(Object.assign({}, formatDate(unformated, "mm/dd/YYYY")), { type: "text", length: [0, 10], pattern: /^(((0)[0-9])|((1)[0-2]))(\/)([0-2][0-9]|(3)[0-1])(\/)\d{4}$/ });
40892
- break;
40893
- default:
40894
- result = Object.assign(Object.assign({}, formatDate(unformated)), { type: "text", length: [0, 10], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/ });
40895
- break;
40896
- }
40897
- return result;
41036
+ let result = formatDate(unformated);
41037
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
41038
+ result = result.insert(10, " ");
41039
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
41040
+ result = result.replace(11, 12, "23:");
41041
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
41042
+ result = result.insert(11, "23:");
41043
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
41044
+ result = result.insert(11, "23:5");
41045
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
41046
+ result = result.replace(10, 13, "00:");
41047
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
41048
+ result = result.insert(12, "3:");
41049
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
41050
+ result = result.insert(12, "3:5").append(":");
41051
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
41052
+ result = result.insert(13, ":");
41053
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
41054
+ result = result.insert(14, "5");
41055
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
41056
+ result = result.insert(16, ":");
41057
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
41058
+ result = result.insert(17, "5");
41059
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
40898
41060
  }
40899
41061
  unformat(formated) {
40900
41062
  return formated;
40901
41063
  }
40902
41064
  allowed(symbol, state) {
40903
- var _a;
40904
- return helper.validFormat(symbol, state, (_a = this.formatting) !== null && _a !== void 0 ? _a : "YYYY-mm-dd");
41065
+ return (state.value.length < 19 &&
41066
+ ((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
40905
41067
  }
40906
41068
  }
40907
- base.add("date", (argument) => new Handler(argument && argument.length > 0 ? argument[0] : undefined));
41069
+ base.add("date-time", () => new Handler());
40908
41070
  function formatDate(unformated, format) {
40909
41071
  let result = unformated;
40910
41072
  switch (format) {
@@ -40935,7 +41097,7 @@ function formatDate(unformated, format) {
40935
41097
  break;
40936
41098
  default:
40937
41099
  if (unformated.value.length == 10) {
40938
- if (!validDate(result.value))
41100
+ if (!validDate(result.value)) {
40939
41101
  result = result.replace(0, 10, validDate(result.value.substring(0, 8) + "31")
40940
41102
  ? result.value.substring(0, 8) + "31"
40941
41103
  : validDate(result.value.substring(0, 8) + "30")
@@ -40945,7 +41107,9 @@ function formatDate(unformated, format) {
40945
41107
  : validDate(result.value.substring(0, 8) + "28")
40946
41108
  ? result.value.substring(0, 8) + "28"
40947
41109
  : result.value);
40948
- break;
41110
+ break;
41111
+ }
41112
+ return unformated;
40949
41113
  }
40950
41114
  }
40951
41115
  return result;
@@ -40955,29 +41119,24 @@ function validDate(date, format) {
40955
41119
  let year;
40956
41120
  let month;
40957
41121
  let day;
40958
- let result;
40959
41122
  switch (format) {
40960
41123
  case "dd/mm/YYYY":
40961
41124
  case "dd.mm.YYYY":
40962
41125
  year = parseInt(date.substring(6, 10));
40963
41126
  month = parseInt(date.substring(3, 5));
40964
41127
  day = parseInt(date.substring(0, 2));
40965
- result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
40966
- break;
41128
+ return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
40967
41129
  case "mm/dd/YYYY":
40968
41130
  year = parseInt(date.substring(6, 10));
40969
41131
  month = parseInt(date.substring(0, 2));
40970
41132
  day = parseInt(date.substring(3, 5));
40971
- result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
40972
- break;
41133
+ return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
40973
41134
  default:
40974
41135
  year = parseInt(date.substring(0, 4));
40975
41136
  month = parseInt(date.substring(5, 7));
40976
41137
  day = parseInt(date.substring(8, 10));
40977
- result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
40978
- break;
41138
+ return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
40979
41139
  }
40980
- return result;
40981
41140
  }
40982
41141
  function daysPerMonth(year, month) {
40983
41142
  let result;
@@ -41004,66 +41163,6 @@ function daysPerMonth(year, month) {
41004
41163
  }
41005
41164
  return result;
41006
41165
  }
41007
- //# sourceMappingURL=index.js.map
41008
- });
41009
-
41010
- const index$2 = /*@__PURE__*/getDefaultExportFromCjs(date);
41011
-
41012
- var dateTime = createCommonjsModule(function (module, exports) {
41013
- "use strict";
41014
- Object.defineProperty(exports, "__esModule", { value: true });
41015
-
41016
-
41017
-
41018
- class Handler {
41019
- toString(data) {
41020
- return typeof data == "string" ? data : "";
41021
- }
41022
- fromString(value) {
41023
- let result = value.replace(" ", "T");
41024
- const fillerDate = "0000-01-01T00:00:00.000Z";
41025
- if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
41026
- result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
41027
- result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
41028
- ? undefined
41029
- : result + fillerDate.substring(result.length, fillerDate.length);
41030
- return dist$3.DateTime.is(result) ? result : undefined;
41031
- }
41032
- format(unformated) {
41033
- let result = date.formatDate(unformated);
41034
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
41035
- result = result.insert(10, " ");
41036
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
41037
- result = result.replace(11, 12, "23:");
41038
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
41039
- result = result.insert(11, "23:");
41040
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
41041
- result = result.insert(11, "23:5");
41042
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
41043
- result = result.replace(10, 13, "00:");
41044
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
41045
- result = result.insert(12, "3:");
41046
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
41047
- result = result.insert(12, "3:5").append(":");
41048
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
41049
- result = result.insert(13, ":");
41050
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
41051
- result = result.insert(14, "5");
41052
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
41053
- result = result.insert(16, ":");
41054
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
41055
- result = result.insert(17, "5");
41056
- return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
41057
- }
41058
- unformat(formated) {
41059
- return formated;
41060
- }
41061
- allowed(symbol, state) {
41062
- return (state.value.length < 19 &&
41063
- ((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
41064
- }
41065
- }
41066
- base.add("date-time", () => new Handler());
41067
41166
  //# sourceMappingURL=date-time.js.map
41068
41167
  });
41069
41168
 
@@ -42656,6 +42755,10 @@ let InputDate = class extends HTMLElement {
42656
42755
  onStart(next) {
42657
42756
  this.valueChanged.emit(next);
42658
42757
  }
42758
+ dateSetHandler(e) {
42759
+ this.open = false;
42760
+ e.stopPropagation();
42761
+ }
42659
42762
  render() {
42660
42763
  var _a;
42661
42764
  return [
@@ -42685,16 +42788,18 @@ let InputDateRange = class extends HTMLElement {
42685
42788
  onValue(next) {
42686
42789
  this.valueChanged.emit(next);
42687
42790
  }
42688
- onClose(open) {
42689
- if (open == false && dist$3.Date.is(this.start) && dist$3.Date.is(this.end))
42690
- this.dateRangeSelected.emit({ start: this.start, end: this.end });
42691
- }
42692
42791
  onStartChanged(event) {
42693
42792
  this.start = event.detail;
42694
42793
  }
42695
42794
  onEndChanged(event) {
42696
42795
  this.end = event.detail;
42697
42796
  }
42797
+ onDateRangeSet(event) {
42798
+ console.log("dateRangeSet", event.detail);
42799
+ this.open = false;
42800
+ event.stopPropagation();
42801
+ dist$3.DateRange.is(event.detail) && this.dateRangeSelected.emit(event.detail);
42802
+ }
42698
42803
  render() {
42699
42804
  var _a;
42700
42805
  return [
@@ -42703,14 +42808,11 @@ let InputDateRange = class extends HTMLElement {
42703
42808
  this.open ? (h("nav", null, h("div", { class: "arrow" }), h("smoothly-calendar", { doubleInput: true, value: (_a = this.value) !== null && _a !== void 0 ? _a : dist$3.Date.now(), onValueChanged: event => {
42704
42809
  this.value = event.detail;
42705
42810
  event.stopPropagation();
42706
- }, max: this.max, min: this.min }))) : ([]),
42811
+ }, start: this.start, end: this.end, max: this.max, min: this.min }))) : ([]),
42707
42812
  ];
42708
42813
  }
42709
42814
  static get watchers() { return {
42710
- "value": ["onValue"],
42711
- "open": ["onClose"],
42712
- "start": ["onClose"],
42713
- "end": ["onClose"]
42815
+ "value": ["onValue"]
42714
42816
  }; }
42715
42817
  static get style() { return styleCss$t; }
42716
42818
  };
@@ -43960,7 +44062,7 @@ const SmoothlyAccordion = /*@__PURE__*/proxyCustomElement(SmoothlyAccordion$1, [
43960
44062
  const SmoothlyAccordionItem = /*@__PURE__*/proxyCustomElement(SmoothlyAccordionItem$1, [6,"smoothly-accordion-item",{"name":[1],"brand":[1],"open":[1540]}]);
43961
44063
  const SmoothlyApp = /*@__PURE__*/proxyCustomElement(SmoothlyApp$1, [4,"smoothly-app",{"color":[1]}]);
43962
44064
  const SmoothlyAppDemo = /*@__PURE__*/proxyCustomElement(SmoothlyAppDemo$1, [0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}]);
43963
- const SmoothlyCalendar = /*@__PURE__*/proxyCustomElement(Calendar, [2,"smoothly-calendar",{"month":[1025],"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"doubleInput":[516,"double-input"]}]);
44065
+ const SmoothlyCalendar = /*@__PURE__*/proxyCustomElement(Calendar, [2,"smoothly-calendar",{"month":[1025],"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"doubleInput":[516,"double-input"],"firstSelected":[32]}]);
43964
44066
  const SmoothlyCheckbox = /*@__PURE__*/proxyCustomElement(SmoothlyCheckbox$1, [2,"smoothly-checkbox",{"selectAll":[4,"select-all"],"selected":[1540],"disabled":[1540],"t":[32]}]);
43965
44067
  const SmoothlyDialog = /*@__PURE__*/proxyCustomElement(SmoothlyDialog$1, [6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]]);
43966
44068
  const SmoothlyDialogDemo = /*@__PURE__*/proxyCustomElement(SmoothlyDialogDemo$1, [0,"smoothly-dialog-demo"]);
@@ -43972,8 +44074,8 @@ const SmoothlyFrame = /*@__PURE__*/proxyCustomElement(SmoothlyFrame$1, [2,"smoot
43972
44074
  const SmoothlyIcon = /*@__PURE__*/proxyCustomElement(SmoothlyIcon$1, [2,"smoothly-icon",{"color":[513],"fill":[513],"name":[1],"size":[513],"toolTip":[1,"tool-tip"],"document":[32]}]);
43973
44075
  const SmoothlyIconDemo = /*@__PURE__*/proxyCustomElement(SmoothlyIconDemo$1, [2,"smoothly-icon-demo"]);
43974
44076
  const SmoothlyInput = /*@__PURE__*/proxyCustomElement(SmoothlyInput$1, [6,"smoothly-input",{"name":[513],"value":[1032],"type":[513],"required":[1540],"minLength":[1026,"min-length"],"maxLength":[1026,"max-length"],"autocomplete":[1028],"pattern":[1040],"placeholder":[1025],"disabled":[1028],"currency":[513]}]);
43975
- const SmoothlyInputDate = /*@__PURE__*/proxyCustomElement(InputDate, [6,"smoothly-input-date",{"value":[1025],"open":[1028],"max":[1025],"min":[1025]}]);
43976
- const SmoothlyInputDateRange = /*@__PURE__*/proxyCustomElement(InputDateRange, [2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"]]]);
44077
+ const SmoothlyInputDate = /*@__PURE__*/proxyCustomElement(InputDate, [6,"smoothly-input-date",{"value":[1025],"open":[1028],"max":[1025],"min":[1025]},[[0,"dateSet","dateSetHandler"]]]);
44078
+ const SmoothlyInputDateRange = /*@__PURE__*/proxyCustomElement(InputDateRange, [2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"],[0,"dateRangeSet","onDateRangeSet"]]]);
43977
44079
  const SmoothlyInputDemo = /*@__PURE__*/proxyCustomElement(SmoothlyInputDemo$1, [0,"smoothly-input-demo"]);
43978
44080
  const SmoothlyInputMonth = /*@__PURE__*/proxyCustomElement(MonthSelector, [2,"smoothly-input-month",{"value":[1025]}]);
43979
44081
  const SmoothlyItem = /*@__PURE__*/proxyCustomElement(Item, [6,"smoothly-item",{"value":[8],"selected":[1540]},[[0,"click","onClick"]]]);