@golemui/gui-lit 1.1.1-rc.3 → 1.2.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 (91) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/{accordion.element-BIgxl5e9.js → accordion.element-C9GzfKrY.js} +29 -30
  3. package/alert.element-CHn49Yaf.js +55 -0
  4. package/button.element-C9fHivSw.js +59 -0
  5. package/{calendar.element-Cv3RBphf.js → calendar.element-XkojKTJk.js} +30 -31
  6. package/checkbox.element-DU_tVMXu.js +66 -0
  7. package/currency.element-BmAH5KS_.js +73 -0
  8. package/date-picker.element-Bg3rF95F.js +94 -0
  9. package/{date-time-calendar.element-DlbWZjoe.js → date-time-calendar.element-sywQCeQQ.js} +24 -24
  10. package/date-time-picker.element-HHpwjWTQ.js +107 -0
  11. package/{date-time.element-CLLxM2nV.js → date-time.element-ucETvSTC.js} +26 -26
  12. package/{date.element-B8ZHK9KJ.js → date.element-BEHGxRFF.js} +27 -27
  13. package/default-list-item-renderer-CuPJ9jUD.js +24 -0
  14. package/{dropdown.element-DMZ7oL5n.js → dropdown.element-DUqG_p1x.js} +85 -84
  15. package/{flex.element-DG4Uaj_X.js → flex.element-pwba7621.js} +27 -28
  16. package/{grid.element-DCZsh-3J.js → grid.element-C8K7_Qi3.js} +29 -30
  17. package/index.js +1316 -3883
  18. package/index.umd.cjs +117 -2132
  19. package/{list.element-ADtUK2na.js → list.element-ZtEMKE2x.js} +41 -40
  20. package/markdown-text.element-DDm36qD0.js +54 -0
  21. package/markdown.element-DWz3U9rG.js +84 -0
  22. package/number.element-VkG5wScD.js +71 -0
  23. package/package.json +6 -6
  24. package/password.element-C5vQHq5P.js +72 -0
  25. package/radiogroup.element-CKdO9HwO.js +69 -0
  26. package/{range-calendar.element-D5eb2f7p.js → range-calendar.element-BznGrej5.js} +23 -24
  27. package/{range-date-input.element-C35grlYo.js → range-date-input.element-BloTHRDl.js} +24 -24
  28. package/range-date-picker.element-DKhwFasW.js +98 -0
  29. package/{range-date-time-calendar.element-BV0J96Gu.js → range-date-time-calendar.element-CZCET-sb.js} +26 -26
  30. package/{range-date-time-input.element-CzgRbR9F.js → range-date-time-input.element-Dr2VrYhG.js} +24 -24
  31. package/range-date-time-picker.element-CYeIMWLp.js +109 -0
  32. package/{range-time-input.element-BOHLUO8z.js → range-time-input.element-7OZhPQqx.js} +23 -23
  33. package/range-time-picker.element-D0mRFZkK.js +96 -0
  34. package/renderer.element-DbsFoBba.js +48 -0
  35. package/{repeater.element-Da8YN1Vy.js → repeater.element-DGEbwvhY.js} +54 -65
  36. package/select.element-Bb_9jAVB.js +76 -0
  37. package/{tabs.element-CvcIA8P3.js → tabs.element-BYDNF_pm.js} +49 -50
  38. package/tags.element-BSN3i9Gx.js +73 -0
  39. package/textarea.element-Dl1ZEOqO.js +71 -0
  40. package/textinput.element-C5Vbbkxq.js +68 -0
  41. package/{time-picker.element-C3oR0EkQ.js → time-picker.element-Crmj9YDy.js} +26 -26
  42. package/{time.element-X286nthD.js → time.element-DfSeAZp4.js} +29 -29
  43. package/toggle.element-ORsprZ2M.js +66 -0
  44. package/alert.element-DPWq9-0F.js +0 -56
  45. package/button.element-CJay43iR.js +0 -132
  46. package/calendar-DleRbmvP.js +0 -267
  47. package/checkbox.element-CpmrzdH0.js +0 -200
  48. package/currency.element-Cezgzbbs.js +0 -276
  49. package/date-DBuYpvcO.js +0 -849
  50. package/date-input-B3yHsn-g.js +0 -204
  51. package/date-picker.element-ByZefznr.js +0 -357
  52. package/date-time-calendar-CB5cNoOX.js +0 -374
  53. package/date-time-input-DrY68YDX.js +0 -246
  54. package/date-time-picker.element-CYwmumfq.js +0 -440
  55. package/day-status-ljexnwEO.js +0 -554
  56. package/errors-Bs_vYN-_.js +0 -110
  57. package/focus-leave.controller-2gV0pQd5.js +0 -73
  58. package/list-D730tmGN.js +0 -297
  59. package/markdown-text-X-BRJT6K.js +0 -30
  60. package/markdown-text.element-B8TfVLIO.js +0 -55
  61. package/markdown.element-D5zcxAUS.js +0 -693
  62. package/number.element-DEY5tR_y.js +0 -291
  63. package/numeric-jmOOKz30.js +0 -12
  64. package/one-of-anKkm7mD.js +0 -50
  65. package/part-templates-VORbpgs2.js +0 -691
  66. package/password.element-C1aQh_iz.js +0 -240
  67. package/pill-ranges-DpvWwP-3.js +0 -48
  68. package/pills-BDMO2NiR.js +0 -348
  69. package/popup.controller-B33OvX_y.js +0 -86
  70. package/radiogroup.element-B2G-XyGx.js +0 -235
  71. package/range-calendar-D7sG24Kx.js +0 -466
  72. package/range-commit-8-MmYUyo.js +0 -14
  73. package/range-date-input-BChaoBC1.js +0 -311
  74. package/range-date-picker.element-Do5YsL5V.js +0 -434
  75. package/range-date-time-calendar-DulGK2EQ.js +0 -734
  76. package/range-date-time-input-8ggqckP7.js +0 -353
  77. package/range-date-time-picker.element-hi5KdopZ.js +0 -472
  78. package/range-selection-CU3hxLJE.js +0 -25
  79. package/range-time-input-D7GFdDeA.js +0 -348
  80. package/range-time-picker.element-DDNQMA_u.js +0 -470
  81. package/renderer.element-CNyMn2Lu.js +0 -49
  82. package/select.element-SDxBhGjz.js +0 -266
  83. package/tabs-DzSCq_98.js +0 -13
  84. package/tags.element-Bnhfevp3.js +0 -369
  85. package/templates-Df7abEkB.js +0 -92
  86. package/textarea.element-Dx7eYEnl.js +0 -239
  87. package/textinput.element-BnIoDRmY.js +0 -205
  88. package/time-input-Kk4EX6at.js +0 -201
  89. package/time-list-DLcq8BAp.js +0 -217
  90. package/time-picker-DLj1rhOf.js +0 -299
  91. package/toggle.element-Dokdat_o.js +0 -203
@@ -1,201 +0,0 @@
1
- import { LitElement as p, nothing as n, html as d } from "lit";
2
- import { property as i, customElement as m } from "lit/decorators.js";
3
- import { classMap as c } from "lit/directives/class-map.js";
4
- import { G as g, b as y, c as b } from "./templates-Df7abEkB.js";
5
- import { G as v, g as f, u as L, r as E, v as D, w as T, P as A } from "./part-templates-VORbpgs2.js";
6
- var S = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (s, o, l, r) => {
7
- for (var a = r > 1 ? void 0 : r ? P(o, l) : o, u = s.length - 1, h; u >= 0; u--)
8
- (h = s[u]) && (a = (r ? h(o, l, a) : h(a)) || a);
9
- return r && a && S(o, l, a), a;
10
- };
11
- let t = class extends p {
12
- constructor() {
13
- 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.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.value = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.minTime = void 0, this.maxTime = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.inputBlockClass = "gui-time-input", this.groups = ["default"], this._parts = new v(this, {
14
- blockClass: this.inputBlockClass,
15
- groups: this.groups,
16
- getDescriptor: (s) => this.getPartDescriptor(s),
17
- commitGroup: (s) => this.validateAndEmit(s),
18
- isReadonly: () => !!this.readOnly,
19
- isDisabled: () => !!this.disabled,
20
- onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 })),
21
- getHourFormat: () => this.timeLocaleData.effectiveHourFormat,
22
- getDayPeriodLabels: () => this.timeLocaleData.dayPeriodLabels
23
- }), this.ariaController = new g(this, {
24
- getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
25
- getState: () => ({
26
- uid: this.uid,
27
- templateData: {
28
- hint: this.hint,
29
- errors: this.errors,
30
- readonly: this.readOnly,
31
- disabled: this.disabled,
32
- touched: this.touched,
33
- required: this.required
34
- }
35
- })
36
- });
37
- }
38
- createRenderRoot() {
39
- return this;
40
- }
41
- connectedCallback() {
42
- super.connectedCallback(), this.classList.add("gui-field");
43
- }
44
- get timeLocaleData() {
45
- return f(this.localeId, this.hourFormat, this.minuteStep);
46
- }
47
- getPartDescriptor(s) {
48
- return this.timeLocaleData.descriptors[s];
49
- }
50
- willUpdate(s) {
51
- (!this.hasUpdated || s.has("value") || s.has("hourFormat") || s.has("localeId")) && this._parts.setGroupFromISO(
52
- "default",
53
- this.value ?? "",
54
- "time",
55
- this.timeLocaleData.effectiveHourFormat
56
- );
57
- }
58
- render() {
59
- const s = {
60
- uid: this.uid,
61
- label: this.label,
62
- errors: this.errors,
63
- touched: this.touched,
64
- required: this.required,
65
- disabled: this.disabled,
66
- readonly: this.readOnly,
67
- value: this.value,
68
- icon: this.icon,
69
- hint: this.hint
70
- }, o = {
71
- blockClass: this.inputBlockClass,
72
- groups: this.groups,
73
- formatParts: L(this.localeId, this.timeLocaleData.effectiveHourFormat),
74
- getDescriptor: (r) => this.getPartDescriptor(r),
75
- getDisplayValue: this._parts.getPartDisplay,
76
- getPartAriaLabel: (r, a) => ({
77
- hour: this.hourAriaLabel,
78
- minute: this.minuteAriaLabel
79
- })[a] ?? A[a],
80
- dayPeriodAriaLabel: this.dayPeriodAriaLabel,
81
- disabled: this.disabled,
82
- partsReadonly: !!this.readOnly
83
- }, l = {
84
- "gui-widget-icon": !0,
85
- [this.icon]: !0
86
- };
87
- return d`
88
- ${this.label ? y(this.uid, s, !1, void 0, !1) : n}
89
-
90
- <div class="gui-widget">
91
- <div
92
- id=${this.uid}
93
- class="gui-widget-input gui-parts gui-parts-ring gui-time-input ${this.icon ? "gui-calendar--icon" : ""}"
94
- role="group"
95
- aria-labelledby=${`${this.uid}_label`}
96
- >
97
- ${E("default", o, this._parts)}
98
- </div>
99
- ${this.icon ? d`<span
100
- class=${c(l)}
101
- data-icon=${this.icon}
102
- aria-hidden="true"
103
- ></span>` : n}
104
- </div>
105
-
106
- ${this.showErrors && this.errors?.length ? b(this.uid, s) : n}
107
- `;
108
- }
109
- validateAndEmit(s) {
110
- const { effectiveHourFormat: o, descriptors: l } = this.timeLocaleData, { result: r, writeBacks: a } = D(this._parts.values[s] ?? {}, {
111
- hourFormat: o,
112
- descriptors: l
113
- });
114
- if (this._parts.applyWriteBacks(s, a), r.kind !== "valid") {
115
- this.requestUpdate();
116
- return;
117
- }
118
- const u = T(r.iso, {
119
- minTime: this.minTime,
120
- maxTime: this.maxTime,
121
- minTimeMessage: this.minTimeMessage,
122
- maxTimeMessage: this.maxTimeMessage
123
- });
124
- if (u) {
125
- this.dispatchEvent(
126
- new CustomEvent("change", { detail: { value: r.iso }, bubbles: !0 })
127
- ), this.dispatchEvent(
128
- new CustomEvent("inputError", { detail: { message: u }, bubbles: !0 })
129
- ), this.requestUpdate();
130
- return;
131
- }
132
- this.value = r.iso, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0 })), this.requestUpdate();
133
- }
134
- };
135
- e([
136
- i({ type: String })
137
- ], t.prototype, "uid", 2);
138
- e([
139
- i({ type: String })
140
- ], t.prototype, "label", 2);
141
- e([
142
- i({ type: String, attribute: "locale-id" })
143
- ], t.prototype, "localeId", 2);
144
- e([
145
- i({ type: Array })
146
- ], t.prototype, "errors", 2);
147
- e([
148
- i({ type: Boolean })
149
- ], t.prototype, "showErrors", 2);
150
- e([
151
- i({ type: Boolean })
152
- ], t.prototype, "touched", 2);
153
- e([
154
- i({ type: Boolean })
155
- ], t.prototype, "required", 2);
156
- e([
157
- i({ type: Boolean })
158
- ], t.prototype, "disabled", 2);
159
- e([
160
- i({ type: Boolean, attribute: "readonly" })
161
- ], t.prototype, "readOnly", 2);
162
- e([
163
- i({ type: String })
164
- ], t.prototype, "icon", 2);
165
- e([
166
- i({ type: String })
167
- ], t.prototype, "hint", 2);
168
- e([
169
- i({ type: String })
170
- ], t.prototype, "hourAriaLabel", 2);
171
- e([
172
- i({ type: String })
173
- ], t.prototype, "minuteAriaLabel", 2);
174
- e([
175
- i({ type: String })
176
- ], t.prototype, "dayPeriodAriaLabel", 2);
177
- e([
178
- i({ type: String })
179
- ], t.prototype, "value", 2);
180
- e([
181
- i({ type: String, attribute: "hour-format" })
182
- ], t.prototype, "hourFormat", 2);
183
- e([
184
- i({ type: Number, attribute: "minute-step" })
185
- ], t.prototype, "minuteStep", 2);
186
- e([
187
- i({ type: String, attribute: "min-time" })
188
- ], t.prototype, "minTime", 2);
189
- e([
190
- i({ type: String, attribute: "max-time" })
191
- ], t.prototype, "maxTime", 2);
192
- e([
193
- i({ type: String, attribute: "min-time-message" })
194
- ], t.prototype, "minTimeMessage", 2);
195
- e([
196
- i({ type: String, attribute: "max-time-message" })
197
- ], t.prototype, "maxTimeMessage", 2);
198
- t = e([
199
- m("gui-time")
200
- ], t);
201
- typeof customElements < "u" && !customElements.get("gui-time") && customElements.define("gui-time", t);
@@ -1,217 +0,0 @@
1
- import { LitElement as v, html as p, nothing as b } from "lit";
2
- import { property as l, customElement as _ } from "lit/decorators.js";
3
- import { classMap as S } from "lit/directives/class-map.js";
4
- import { g as O, l as x, n as f, c as T } from "./focus-leave.controller-2gV0pQd5.js";
5
- import { e as $, A as w, l as I, s as E, N as R } from "./part-templates-VORbpgs2.js";
6
- var A = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (t, e, i, o) => {
7
- for (var n = o > 1 ? void 0 : o ? C(e, i) : e, a = t.length - 1, u; a >= 0; a--)
8
- (u = t[a]) && (n = (o ? u(e, i, n) : u(n)) || n);
9
- return o && n && A(e, i, n), n;
10
- };
11
- let s = class extends v {
12
- constructor() {
13
- super(...arguments), this.uid = void 0, this.value = void 0, this.label = void 0, this.minTime = void 0, this.maxTime = void 0, this.minuteStep = void 0, this.disabledRanges = void 0, this.localeId = void 0, this.hourFormat = void 0, this.disabled = !1, this.readOnly = !1, this.height = void 0, this.itemHeight = void 0, this.columns = void 0, this.noAvailableTimesMessage = void 0;
14
- }
15
- createRenderRoot() {
16
- return this;
17
- }
18
- get effectiveColumns() {
19
- return this.columns || 1;
20
- }
21
- get timeOptions() {
22
- const t = $(this.localeId, this.hourFormat), e = [
23
- this.localeId,
24
- t,
25
- this.minTime,
26
- this.maxTime,
27
- this.minuteStep,
28
- JSON.stringify(this.disabledRanges ?? null)
29
- ].join("|");
30
- return this._optionsCache?.key !== e && (this._optionsCache = {
31
- key: e,
32
- options: w({
33
- minTime: this.minTime,
34
- maxTime: this.maxTime,
35
- minuteStep: this.minuteStep,
36
- disabledRanges: this.disabledRanges
37
- }).map((i) => ({
38
- ...i,
39
- template: I(i.value, this.localeId, t)
40
- }))
41
- }), this._optionsCache.options;
42
- }
43
- isSelected(t) {
44
- return this.value != null && E(t.value, this.value) === 0;
45
- }
46
- get rovingIndex() {
47
- const t = this.timeOptions, e = t.findIndex((i) => this.isSelected(i) && !i.disabled);
48
- return e !== -1 ? e : t.findIndex((i) => !i.disabled);
49
- }
50
- scrollToSelectedValue() {
51
- const t = this.querySelector(".gui-time-list__viewport"), e = this.querySelector(".gui-time-list__option--selected") ?? this.querySelector(".gui-time-list__option");
52
- if (t && e) {
53
- const i = t.getBoundingClientRect(), o = e.getBoundingClientRect(), n = t.scrollTop + (o.top - i.top) - i.height / 2 + o.height / 2;
54
- t.scrollTop = Math.max(0, n);
55
- }
56
- }
57
- focusSelectedOption() {
58
- this.querySelector('.gui-time-list__option[tabindex="0"]')?.focus();
59
- }
60
- selectOption(t, e) {
61
- e.stopPropagation(), !(this.disabled || this.readOnly || t.disabled) && (this.value = t.value, this.dispatchEvent(
62
- new CustomEvent("change", {
63
- detail: { value: t.value },
64
- bubbles: !0,
65
- composed: !0
66
- })
67
- ));
68
- }
69
- onKeyDown(t) {
70
- const e = t.target;
71
- if (!e.classList.contains("gui-time-list__option")) return;
72
- const i = Array.from(this.querySelectorAll(".gui-time-list__option")), o = i.indexOf(e), n = this.effectiveColumns, a = window.getComputedStyle(this).direction === "rtl", u = (m) => this.timeOptions[m].disabled;
73
- if (t.key === "Enter" || t.key === " ") {
74
- t.preventDefault();
75
- const m = this.timeOptions[o];
76
- m && this.selectOption(m, t);
77
- return;
78
- }
79
- const d = O(t.key, {
80
- columns: n,
81
- isRTL: a,
82
- pageSize: x(this.height, this.itemHeight, n)
83
- });
84
- if (d.kind === "none") return;
85
- if (t.preventDefault(), d.kind === "edge") {
86
- const m = d.edge === "first" ? 0 : i.length - 1, y = f(
87
- m,
88
- d.edge === "first" ? 1 : -1,
89
- this.timeOptions.length,
90
- u,
91
- { includeStart: !0, outOfBounds: "none" }
92
- );
93
- y !== -1 && i[y].focus();
94
- return;
95
- }
96
- const c = d.delta, g = Math.min(Math.max(o + c, 0), i.length - 1);
97
- if (g === o) return;
98
- const h = f(
99
- g,
100
- c > 0 ? 1 : -1,
101
- this.timeOptions.length,
102
- u,
103
- { includeStart: !0, outOfBounds: "none" }
104
- );
105
- h !== -1 && h !== o && i[h].focus();
106
- }
107
- renderOption(t, e, i) {
108
- const o = this.isSelected(t);
109
- return p`
110
- <button
111
- type="button"
112
- role=${i}
113
- class=${S({
114
- "gui-time-list__option": !0,
115
- "gui-time-list__option--selected": o
116
- })}
117
- tabindex=${e === this.rovingIndex ? 0 : -1}
118
- ?disabled=${t.disabled || this.disabled}
119
- data-value=${t.value}
120
- aria-selected=${o}
121
- aria-disabled=${t.disabled || this.disabled ? "true" : "false"}
122
- @click=${(a) => this.selectOption(t, a)}
123
- >
124
- ${t.template}
125
- </button>
126
- `;
127
- }
128
- render() {
129
- const t = this.timeOptions;
130
- if (t.length === 0)
131
- return p`<div class="gui-time-list__empty">
132
- ${this.noAvailableTimesMessage ?? R}
133
- </div>`;
134
- const e = this.effectiveColumns, i = `--gui-time-list-height: ${this.height ?? 300}px; --gui-time-list-item-height: ${this.itemHeight || 40}px; --gui-time-list-columns: ${e};`;
135
- if (e === 1)
136
- return p`
137
- <div
138
- class="gui-time-list__viewport"
139
- role="listbox"
140
- style=${i}
141
- aria-label=${this.label ?? b}
142
- @keydown=${this.onKeyDown}
143
- >
144
- ${t.map((n, a) => this.renderOption(n, a, "option"))}
145
- </div>
146
- `;
147
- const o = T(t, e);
148
- return p`
149
- <div
150
- class="gui-time-list__viewport gui-time-list__viewport--grid"
151
- role="grid"
152
- style=${i}
153
- aria-label=${this.label ?? b}
154
- @keydown=${this.onKeyDown}
155
- >
156
- ${o.map(
157
- (n, a) => p`
158
- <div role="row" class="gui-time-list__row">
159
- ${n.map(
160
- (u, d) => this.renderOption(u, a * e + d, "gridcell")
161
- )}
162
- </div>
163
- `
164
- )}
165
- </div>
166
- `;
167
- }
168
- };
169
- r([
170
- l({ type: String })
171
- ], s.prototype, "uid", 2);
172
- r([
173
- l({ type: String })
174
- ], s.prototype, "value", 2);
175
- r([
176
- l({ type: String })
177
- ], s.prototype, "label", 2);
178
- r([
179
- l({ type: String, attribute: "min-time" })
180
- ], s.prototype, "minTime", 2);
181
- r([
182
- l({ type: String, attribute: "max-time" })
183
- ], s.prototype, "maxTime", 2);
184
- r([
185
- l({ type: Number, attribute: "minute-step" })
186
- ], s.prototype, "minuteStep", 2);
187
- r([
188
- l({ type: Array, attribute: "disabled-ranges" })
189
- ], s.prototype, "disabledRanges", 2);
190
- r([
191
- l({ type: String, attribute: "locale-id" })
192
- ], s.prototype, "localeId", 2);
193
- r([
194
- l({ type: String, attribute: "hour-format" })
195
- ], s.prototype, "hourFormat", 2);
196
- r([
197
- l({ type: Boolean })
198
- ], s.prototype, "disabled", 2);
199
- r([
200
- l({ type: Boolean, attribute: "readonly" })
201
- ], s.prototype, "readOnly", 2);
202
- r([
203
- l({ type: Number })
204
- ], s.prototype, "height", 2);
205
- r([
206
- l({ type: Number, attribute: "item-height" })
207
- ], s.prototype, "itemHeight", 2);
208
- r([
209
- l({ type: Number })
210
- ], s.prototype, "columns", 2);
211
- r([
212
- l({ type: String, attribute: "no-available-times-message" })
213
- ], s.prototype, "noAvailableTimesMessage", 2);
214
- s = r([
215
- _("gui-time-list")
216
- ], s);
217
- typeof customElements < "u" && !customElements.get("gui-time-list") && customElements.define("gui-time-list", s);