@golemui/gui-lit 1.0.3 → 1.1.1-rc.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 (83) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
  3. package/calendar-D31xNsxx.js +267 -0
  4. package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
  5. package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
  6. package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
  7. package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
  8. package/date-input-DLiMreSS.js +204 -0
  9. package/date-picker.element-DeUQtbLg.js +357 -0
  10. package/date-time-calendar-DzU-FtVl.js +374 -0
  11. package/date-time-calendar.element-BLBcVsFu.js +95 -0
  12. package/date-time-input-DZaz2heD.js +246 -0
  13. package/date-time-picker.element-BUbLdV6i.js +440 -0
  14. package/date-time.element-B5onfSBG.js +93 -0
  15. package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
  16. package/day-status-CsWStVQV.js +554 -0
  17. package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
  18. package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
  19. package/focus-leave.controller-2gV0pQd5.js +73 -0
  20. package/index.js +1635 -948
  21. package/index.umd.cjs +2046 -601
  22. package/lib/components/date-picker.element.d.ts +0 -11
  23. package/lib/components/date-time-calendar.element.d.ts +18 -0
  24. package/lib/components/date-time-picker.element.d.ts +18 -0
  25. package/lib/components/date-time.element.d.ts +18 -0
  26. package/lib/components/dropdown.element.d.ts +2 -0
  27. package/lib/components/range-calendar.element.d.ts +2 -1
  28. package/lib/components/range-date-picker.element.d.ts +0 -15
  29. package/lib/components/range-date-time-calendar.element.d.ts +18 -0
  30. package/lib/components/range-date-time-input.element.d.ts +18 -0
  31. package/lib/components/range-date-time-picker.element.d.ts +18 -0
  32. package/lib/components/range-time-input.element.d.ts +18 -0
  33. package/lib/components/range-time-picker.element.d.ts +18 -0
  34. package/lib/components/time-picker.element.d.ts +18 -0
  35. package/lib/components/time.element.d.ts +18 -0
  36. package/list-D730tmGN.js +297 -0
  37. package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
  38. package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
  39. package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
  40. package/package.json +6 -6
  41. package/part-templates-VORbpgs2.js +691 -0
  42. package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
  43. package/pill-ranges-DpvWwP-3.js +48 -0
  44. package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
  45. package/popup.controller-B33OvX_y.js +86 -0
  46. package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
  47. package/range-calendar-DO_woqcF.js +466 -0
  48. package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
  49. package/range-commit-8-MmYUyo.js +14 -0
  50. package/range-date-input-Br7XqQPK.js +311 -0
  51. package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
  52. package/range-date-picker.element-DWRHiAoC.js +434 -0
  53. package/range-date-time-calendar-B3EMgN1E.js +734 -0
  54. package/range-date-time-calendar.element-Coea6RF4.js +97 -0
  55. package/range-date-time-input-Cu-T_nuC.js +353 -0
  56. package/range-date-time-input.element-Cti44iuW.js +87 -0
  57. package/range-date-time-picker.element-CDN2RL1y.js +472 -0
  58. package/range-selection-CU3hxLJE.js +25 -0
  59. package/range-time-input-BP9ZL9O8.js +348 -0
  60. package/range-time-input.element-B7wtHJoQ.js +84 -0
  61. package/range-time-picker.element-CPIAiQPC.js +470 -0
  62. package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
  63. package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
  64. package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
  65. package/{tags.element-CX3vQL8L.js → tags.element-CPHgotb0.js} +21 -14
  66. package/templates-Dmr34nwp.js +88 -0
  67. package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
  68. package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
  69. package/time-input-5dkSm8UW.js +201 -0
  70. package/time-list-DLcq8BAp.js +217 -0
  71. package/time-picker-g337F8d0.js +299 -0
  72. package/time-picker.element-DLihegjg.js +89 -0
  73. package/time.element-BneqgMlQ.js +85 -0
  74. package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
  75. package/abstract-calendar-D0-077XJ.js +0 -545
  76. package/calendar-BclCC9VJ.js +0 -96
  77. package/date-input-DCdGWRio.js +0 -268
  78. package/date-picker.element-k7AJFQ5W.js +0 -168
  79. package/list-D1oKnH89.js +0 -283
  80. package/range-calendar-CBINu84w.js +0 -255
  81. package/range-date-input-BYXzqnr1.js +0 -395
  82. package/range-date-picker.element-BCBefgvY.js +0 -182
  83. package/templates-Dk1jxLwS.js +0 -75
@@ -1,4 +1,4 @@
1
- const r = {
1
+ const l = {
2
2
  aa: { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
3
3
  "aa-DJ": { firstDay: 6, weekend: [6, 7], minimalDays: 1 },
4
4
  "aa-ER": { firstDay: 1, weekend: [6, 7], minimalDays: 1 },
@@ -709,8 +709,8 @@ const r = {
709
709
  "zh-Hant-HK": { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
710
710
  "zh-Hant-MO": { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
711
711
  zu: { firstDay: 7, weekend: [6, 7], minimalDays: 1 }
712
- };
713
- function y(e) {
712
+ }, A = "Invalid date: day is greater than the maximum valid day for the month and year.", k = "Invalid date: date is before the minimum allowed date.", w = "Invalid date: date is after the maximum allowed date.", o = "Invalid date: date is within a disabled range.", I = "Invalid time: time is before the minimum allowed time.", S = "Invalid time: time is after the maximum allowed time.", h = "Invalid range: end time must be after start time.", E = "Invalid time: time is within a disabled range.", b = "Invalid date-time: date-time is before the minimum allowed date-time.", L = "Invalid date-time: date-time is after the maximum allowed date-time.";
713
+ function r(e) {
714
714
  const a = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), i = String(e.getDate()).padStart(2, "0");
715
715
  return `${a}-${n}-${i}`;
716
716
  }
@@ -718,28 +718,72 @@ function t(e) {
718
718
  const a = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
719
719
  return a ? new Date(Number(a[1]), Number(a[2]) - 1, Number(a[3])) : new Date(e);
720
720
  }
721
- function w(e) {
722
- return f(e, /* @__PURE__ */ new Date());
721
+ function d(e, a, n, i) {
722
+ const s = e.split("T")[0];
723
+ if (a && s < a.split("T")[0] || n && s > n.split("T")[0]) return !0;
724
+ if (i && i.length > 0)
725
+ for (const m of i) {
726
+ const D = m.start.split("T")[0], y = m.end ? m.end.split("T")[0] : D;
727
+ if (s >= D && s <= y)
728
+ return !0;
729
+ }
730
+ return !1;
731
+ }
732
+ function T(e, a, n, i, s) {
733
+ const m = e.split("T")[0];
734
+ return a && m < a.split("T")[0] ? s?.minDateMessage ?? k : n && m > n.split("T")[0] ? s?.maxDateMessage ?? w : d(m, void 0, void 0, i) ? s?.disabledDateRangeMessage ?? o : null;
735
+ }
736
+ function G(e, a, n, i, s) {
737
+ const m = t(e), D = t(a);
738
+ if (isNaN(m.getTime()) || isNaN(D.getTime())) return !1;
739
+ const y = new Date(m);
740
+ y.setHours(0, 0, 0, 0);
741
+ const f = new Date(D);
742
+ for (f.setHours(0, 0, 0, 0); y <= f; ) {
743
+ if (d(r(y), i, s, n))
744
+ return !0;
745
+ y.setDate(y.getDate() + 1);
746
+ }
747
+ return !1;
748
+ }
749
+ function N(e) {
750
+ return new Intl.DateTimeFormat(e ?? "en", {
751
+ year: "numeric",
752
+ month: "numeric",
753
+ day: "numeric"
754
+ }).formatToParts(/* @__PURE__ */ new Date());
755
+ }
756
+ function p(e, a) {
757
+ return e === 2 ? new Date(a, 1, 29).getDate() === 29 || !a ? 29 : 28 : e === 4 || e === 6 || e === 9 || e === 11 ? 30 : 31;
723
758
  }
724
- function f(e, a) {
759
+ function C(e) {
760
+ return u(e, /* @__PURE__ */ new Date());
761
+ }
762
+ function u(e, a) {
725
763
  return e.getDate() === a.getDate() && e.getMonth() === a.getMonth() && e.getFullYear() === a.getFullYear();
726
764
  }
727
- function l(e) {
765
+ function c(e) {
728
766
  const a = [0, 1, 2, 3, 4, 5, 6], n = e % 7;
729
767
  return [...a.slice(n), ...a.slice(0, n)];
730
768
  }
731
- function d(e) {
732
- const a = r[e ?? "en"] || { firstDay: 0 };
733
- return l(a.firstDay);
769
+ function g(e) {
770
+ const a = e ?? "en", n = l[a] || l[a.split("-")[0]] || { firstDay: 0 };
771
+ return c(n.firstDay);
734
772
  }
735
- function o(e) {
773
+ function v(e) {
736
774
  const a = new Intl.DateTimeFormat(e, { weekday: "narrow" }), n = new Date(2025, 10, 30);
737
- return d(e).map((i) => {
775
+ return g(e).map((i) => {
738
776
  const s = new Date(n);
739
777
  return s.setDate(n.getDate() + i), a.format(s);
740
778
  });
741
779
  }
742
- function u(e, a, n) {
780
+ function B(e, a) {
781
+ return new Intl.DateTimeFormat(e, { month: "long", year: "numeric" }).format(a);
782
+ }
783
+ function R(e, a) {
784
+ return new Intl.DateTimeFormat(e, { dateStyle: "full" }).format(a);
785
+ }
786
+ function F(e, a, n) {
743
787
  for (let i = 0; i < n; i++) {
744
788
  const s = new Date(a.getFullYear(), a.getMonth() + i, 1);
745
789
  if (e.getMonth() === s.getMonth() && e.getFullYear() === s.getFullYear())
@@ -747,18 +791,18 @@ function u(e, a, n) {
747
791
  }
748
792
  return !1;
749
793
  }
750
- function g(e, a, n = "long") {
794
+ function H(e, a, n = "long") {
751
795
  return new Intl.DateTimeFormat(e, { month: n, year: "numeric" }).formatToParts(a).filter((s) => s.type === "month" || s.type === "year");
752
796
  }
753
- function c(e, a) {
797
+ function _(e, a) {
754
798
  const n = e || "en-US", m = new Intl.DateTimeFormat(n, { day: "numeric" }).formatToParts(a).find((D) => D.type === "day");
755
799
  return m ? m.value : a.getDate().toString();
756
800
  }
757
- function k(e, a) {
758
- const n = y(e), i = y(a);
801
+ function M(e, a) {
802
+ const n = r(e), i = r(a);
759
803
  return n === i ? { start: n } : { start: n, end: i };
760
804
  }
761
- function b(e) {
805
+ function z(e) {
762
806
  return e.length ? e.map((i) => ({
763
807
  start: t(i.start).getTime(),
764
808
  end: t(i.end ?? i.start).getTime()
@@ -773,18 +817,33 @@ function b(e) {
773
817
  return [...i, s];
774
818
  },
775
819
  []
776
- ).map((i) => k(new Date(i.start), new Date(i.end))) : [];
820
+ ).map((i) => M(new Date(i.start), new Date(i.end))) : [];
777
821
  }
778
822
  export {
779
- w as a,
780
- f as b,
781
- k as c,
782
- o as d,
783
- g as e,
784
- c as g,
785
- u as i,
786
- b as m,
823
+ o as D,
824
+ I,
825
+ N as a,
826
+ S as b,
827
+ M as c,
828
+ T as d,
829
+ E as e,
830
+ h as f,
831
+ R as g,
832
+ C as h,
833
+ d as i,
834
+ _ as j,
835
+ F as k,
836
+ B as l,
837
+ z as m,
838
+ v as n,
839
+ H as o,
787
840
  t as p,
788
- y as t,
789
- d as w
841
+ u as q,
842
+ G as r,
843
+ b as s,
844
+ r as t,
845
+ L as u,
846
+ p as v,
847
+ g as w,
848
+ A as x
790
849
  };
@@ -0,0 +1,204 @@
1
+ import { LitElement as u, nothing as p, html as h } from "lit";
2
+ import { property as i, customElement as c } from "lit/decorators.js";
3
+ import { classMap as g } from "lit/directives/class-map.js";
4
+ import { G as y, b as m, c as b } from "./templates-Dmr34nwp.js";
5
+ import { n as v, G as D, r as f, q as E, P as A } from "./part-templates-VORbpgs2.js";
6
+ import { a as C, d as S } from "./date-DBuYpvcO.js";
7
+ var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (s, a, l, r) => {
8
+ for (var o = r > 1 ? void 0 : r ? P(a, l) : a, d = s.length - 1, n; d >= 0; d--)
9
+ (n = s[d]) && (o = (r ? n(a, l, o) : n(o)) || o);
10
+ return r && o && w(a, l, o), o;
11
+ };
12
+ let t = class extends u {
13
+ constructor() {
14
+ super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.value = void 0, this.invalidDateMessage = void 0, this.minDate = void 0, this.maxDate = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.inputBlockClass = "gui-date-input", this.groups = ["default"], this.partDescriptors = v(), this._parts = new D(this, {
15
+ blockClass: this.inputBlockClass,
16
+ groups: this.groups,
17
+ getDescriptor: (s) => this.getPartDescriptor(s),
18
+ commitGroup: (s) => this.validateAndEmit(s),
19
+ isReadonly: () => !!this.readOnly,
20
+ isDisabled: () => !!this.disabled,
21
+ onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 }))
22
+ }), this.ariaController = new y(this, {
23
+ getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
24
+ getState: () => ({
25
+ uid: this.uid,
26
+ templateData: {
27
+ hint: this.hint,
28
+ errors: this.errors,
29
+ readonly: this.readOnly,
30
+ disabled: this.disabled,
31
+ touched: this.touched,
32
+ required: this.required
33
+ }
34
+ })
35
+ });
36
+ }
37
+ createRenderRoot() {
38
+ return this;
39
+ }
40
+ connectedCallback() {
41
+ super.connectedCallback(), this.classList.add("gui-field");
42
+ }
43
+ getPartDescriptor(s) {
44
+ return this.partDescriptors[s];
45
+ }
46
+ willUpdate(s) {
47
+ s.has("value") && this._parts.setGroupFromISO("default", this.value ?? "", "date");
48
+ }
49
+ render() {
50
+ const s = {
51
+ uid: this.uid,
52
+ label: this.label,
53
+ errors: this.errors,
54
+ touched: this.touched,
55
+ required: this.required,
56
+ disabled: this.disabled,
57
+ readonly: this.readOnly,
58
+ value: this.value,
59
+ icon: this.icon,
60
+ hint: this.hint
61
+ }, a = {
62
+ blockClass: this.inputBlockClass,
63
+ groups: this.groups,
64
+ formatParts: C(this.localeId),
65
+ getDescriptor: (r) => this.getPartDescriptor(r),
66
+ getDisplayValue: this._parts.getPartDisplay,
67
+ getPartAriaLabel: (r, o) => ({
68
+ day: this.dayAriaLabel,
69
+ month: this.monthAriaLabel,
70
+ year: this.yearAriaLabel
71
+ })[o] ?? A[o],
72
+ disabled: this.disabled,
73
+ partsReadonly: !!this.readOnly
74
+ }, l = {
75
+ "gui-widget-icon": !0,
76
+ [this.icon]: !0
77
+ };
78
+ return h`
79
+ ${this.label ? m(this.uid, s, !1, void 0, !1) : p}
80
+
81
+ <div class="gui-widget">
82
+ <div
83
+ id=${this.uid}
84
+ class="gui-widget-input gui-parts gui-parts-ring gui-date-input ${this.icon ? "gui-calendar--icon" : ""}"
85
+ role="group"
86
+ aria-labelledby=${`${this.uid}_label`}
87
+ >
88
+ ${f("default", a, this._parts)}
89
+ </div>
90
+ ${this.icon ? h`<span
91
+ class=${g(l)}
92
+ data-icon=${this.icon}
93
+ aria-hidden="true"
94
+ ></span>` : p}
95
+ </div>
96
+
97
+ ${this.showErrors && this.errors?.length ? b(this.uid, s) : p}
98
+ `;
99
+ }
100
+ validateAndEmit(s) {
101
+ const { result: a, writeBacks: l } = E(this._parts.values[s] ?? {}, {
102
+ descriptors: this.partDescriptors,
103
+ invalidDateMessage: this.invalidDateMessage
104
+ });
105
+ if (this._parts.applyWriteBacks(s, l), a.kind === "invalid")
106
+ this.dispatchEvent(
107
+ new CustomEvent("inputError", {
108
+ detail: { message: a.message },
109
+ bubbles: !0
110
+ })
111
+ );
112
+ else if (a.kind === "valid") {
113
+ const r = S(a.iso, this.minDate, this.maxDate, void 0, {
114
+ minDateMessage: this.minDateMessage,
115
+ maxDateMessage: this.maxDateMessage
116
+ });
117
+ if (r) {
118
+ this.dispatchEvent(
119
+ new CustomEvent("change", {
120
+ detail: { value: a.iso },
121
+ bubbles: !0
122
+ })
123
+ ), this.dispatchEvent(
124
+ new CustomEvent("inputError", {
125
+ detail: { message: r },
126
+ bubbles: !0
127
+ })
128
+ ), this.requestUpdate();
129
+ return;
130
+ }
131
+ this.value = a.iso, this.dispatchEvent(
132
+ new CustomEvent("change", {
133
+ detail: { value: this.value },
134
+ bubbles: !0
135
+ })
136
+ );
137
+ }
138
+ this.requestUpdate();
139
+ }
140
+ };
141
+ e([
142
+ i({ type: String })
143
+ ], t.prototype, "uid", 2);
144
+ e([
145
+ i({ type: String })
146
+ ], t.prototype, "label", 2);
147
+ e([
148
+ i({ type: String, attribute: "locale-id" })
149
+ ], t.prototype, "localeId", 2);
150
+ e([
151
+ i({ type: Array })
152
+ ], t.prototype, "errors", 2);
153
+ e([
154
+ i({ type: Boolean })
155
+ ], t.prototype, "showErrors", 2);
156
+ e([
157
+ i({ type: Boolean })
158
+ ], t.prototype, "touched", 2);
159
+ e([
160
+ i({ type: Boolean })
161
+ ], t.prototype, "required", 2);
162
+ e([
163
+ i({ type: Boolean })
164
+ ], t.prototype, "disabled", 2);
165
+ e([
166
+ i({ type: Boolean, attribute: "readonly" })
167
+ ], t.prototype, "readOnly", 2);
168
+ e([
169
+ i({ type: String })
170
+ ], t.prototype, "icon", 2);
171
+ e([
172
+ i({ type: String })
173
+ ], t.prototype, "hint", 2);
174
+ e([
175
+ i({ type: String })
176
+ ], t.prototype, "dayAriaLabel", 2);
177
+ e([
178
+ i({ type: String })
179
+ ], t.prototype, "monthAriaLabel", 2);
180
+ e([
181
+ i({ type: String })
182
+ ], t.prototype, "yearAriaLabel", 2);
183
+ e([
184
+ i({ type: String })
185
+ ], t.prototype, "value", 2);
186
+ e([
187
+ i({ type: String, attribute: "invalid-date-message" })
188
+ ], t.prototype, "invalidDateMessage", 2);
189
+ e([
190
+ i({ type: String, attribute: "min-date" })
191
+ ], t.prototype, "minDate", 2);
192
+ e([
193
+ i({ type: String, attribute: "max-date" })
194
+ ], t.prototype, "maxDate", 2);
195
+ e([
196
+ i({ type: String, attribute: "min-date-message" })
197
+ ], t.prototype, "minDateMessage", 2);
198
+ e([
199
+ i({ type: String, attribute: "max-date-message" })
200
+ ], t.prototype, "maxDateMessage", 2);
201
+ t = e([
202
+ c("gui-date")
203
+ ], t);
204
+ typeof customElements < "u" && !customElements.get("gui-date") && customElements.define("gui-date", t);