@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,86 +0,0 @@
1
- import "lit";
2
- import { G as n } from "./focus-leave.controller-2gV0pQd5.js";
3
- class c {
4
- constructor(e, i) {
5
- this._open = !1, this._restoringFocus = !1, this._suppressNextFocusOut = !1, this._pointerDownInside = !1, this._pointerDownTarget = null, this.show = () => {
6
- this.options.isDisabled() || this._restoringFocus || (this.options.beforeOpen?.(this), this.setOpen(!0));
7
- }, this.close = () => {
8
- this.setOpen(!1);
9
- }, this.openAndFocus = () => {
10
- this.show(), !(!this._open || !this.options.focusPopupSelector) && Promise.resolve(this.host.updateComplete).then(() => {
11
- this.host.querySelector(this.options.focusPopupSelector)?.focus();
12
- });
13
- }, this.toggle = () => {
14
- this.options.isDisabled() || (this.options.keyToggleMode === "toggle" ? this.setOpen(!this._open) : this._open ? this.close() : this.show());
15
- }, this.onAnchorClick = (t) => {
16
- if (this.options.isDisabled()) return;
17
- const s = this._pointerDownTarget ?? t.target, o = this.options.clickIntent(s);
18
- if (o !== "ignore") {
19
- if (o === "open") {
20
- this.show();
21
- return;
22
- }
23
- this.toggle();
24
- }
25
- }, this.onAnchorKeyDown = (t) => this.options.isDisabled() ? !1 : t.key === "Escape" && this._open ? (t.preventDefault(), t.stopPropagation(), this.restoreFocusToInput(), this.close(), !0) : !1, this.onDocumentClick = (t) => {
26
- if (!this._open) return;
27
- !t.composedPath().includes(this.host) && !this._pointerDownInside && this.close();
28
- }, this.onDocumentPointerDown = (t) => {
29
- const s = t.composedPath();
30
- this._pointerDownInside = s.includes(this.host), this._pointerDownTarget = s[0] ?? null;
31
- }, this.onDocumentKeyDown = (t) => {
32
- t.key !== "Tab" && t.key !== "Escape" || (this._pointerDownInside = !1, this._pointerDownTarget = null);
33
- }, this.closeOnFocusLeave = () => {
34
- this._pointerDownInside || this.close();
35
- }, this.onHostFocusOut = (t) => {
36
- if (this._suppressNextFocusOut) {
37
- this._suppressNextFocusOut = !1;
38
- return;
39
- }
40
- if (!this._open) return;
41
- const s = t.relatedTarget;
42
- this._pointerDownInside && (!s || s.contains(this.host)) || this.focusLeave.handleFocusOut(t);
43
- }, this.host = e, this.options = i, this.focusLeave = new n(e, {
44
- onLeave: () => {
45
- this.close();
46
- }
47
- }), e.addController(this);
48
- }
49
- get open() {
50
- return this._open;
51
- }
52
- /**
53
- * Swallows exactly the next focusout pass — even one that arrives while
54
- * the popup is closed — then re-arms normal behavior. Used around
55
- * operations that transiently move focus (pills dropdown coordination).
56
- */
57
- suppressNextFocusOut() {
58
- this._suppressNextFocusOut = !0;
59
- }
60
- setOpen(e) {
61
- this._open !== e && (this._open = e, this.host.requestUpdate(), this.options.onOpenChanged?.(e));
62
- }
63
- /**
64
- * Focuses the `focusRestoreSelector` element, arming the restoring-focus
65
- * flag (reset via setTimeout(0)) so the resulting focus event does not
66
- * re-open the popup through show().
67
- */
68
- restoreFocusToInput() {
69
- const e = this.host.querySelector(this.options.focusRestoreSelector);
70
- e && (this._restoringFocus = !0, e.focus(), setTimeout(() => {
71
- this._restoringFocus = !1;
72
- }));
73
- }
74
- hostUpdated() {
75
- this._open && this.options.isDisabled() && this.close();
76
- }
77
- hostConnected() {
78
- document.addEventListener("click", this.onDocumentClick), document.addEventListener("pointerdown", this.onDocumentPointerDown, !0), document.addEventListener("keydown", this.onDocumentKeyDown, !0), this.host.addEventListener("focusout", this.onHostFocusOut);
79
- }
80
- hostDisconnected() {
81
- document.removeEventListener("click", this.onDocumentClick), document.removeEventListener("pointerdown", this.onDocumentPointerDown, !0), document.removeEventListener("keydown", this.onDocumentKeyDown, !0), this.host.removeEventListener("focusout", this.onHostFocusOut);
82
- }
83
- }
84
- export {
85
- c as G
86
- };
@@ -1,235 +0,0 @@
1
- import { InputWidgetAdapter as m, formContext as y, inputContext as $ } from "@golemui/lit";
2
- import { LitElement as g, html as u, nothing as p } from "lit";
3
- import { repeat as f } from "lit-html/directives/repeat.js";
4
- import { property as s, customElement as b } from "lit/decorators.js";
5
- import { G as C, b as D, c as _ } from "./templates-Df7abEkB.js";
6
- import { u as F, i as q } from "./one-of-anKkm7mD.js";
7
- import { consume as O, provide as w } from "@lit/context";
8
- import "rxjs";
9
- var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, o = (e, i, d, a) => {
10
- for (var t = a > 1 ? void 0 : a ? S(i, d) : i, l = e.length - 1, n; l >= 0; l--)
11
- (n = e[l]) && (t = (a ? n(i, d, t) : n(t)) || t);
12
- return a && t && E(i, d, t), t;
13
- };
14
- let r = class extends g {
15
- constructor() {
16
- super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.options = [], this.labelField = void 0, this.valueField = void 0, this.direction = "column", this.optionsLoading = !1, this.hasMatchingValue = !1, this.ariaController = new C(this, {
17
- getTargets: () => this.querySelectorAll(`input[name="${this.uid}"]`),
18
- getState: () => ({
19
- uid: this.uid,
20
- templateData: {
21
- hint: this.hint,
22
- errors: this.errors,
23
- touched: this.touched,
24
- // Radiogroup inputs can't be readonly
25
- readonly: !1,
26
- disabled: !1,
27
- required: this.required
28
- }
29
- })
30
- });
31
- }
32
- createRenderRoot() {
33
- return this;
34
- }
35
- connectedCallback() {
36
- super.connectedCallback(), this.classList.add("gui-field");
37
- }
38
- render() {
39
- super.render();
40
- const e = {
41
- uid: this.uid,
42
- label: this.label,
43
- errors: this.errors,
44
- touched: this.touched,
45
- required: this.required,
46
- disabled: this.disabled,
47
- readonly: this.readOnly,
48
- value: this.value,
49
- hint: this.hint,
50
- options: this.options,
51
- labelField: this.labelField,
52
- valueField: this.valueField,
53
- direction: this.direction
54
- };
55
- this.options = F(this.options, {
56
- labelField: this.labelField,
57
- valueField: this.valueField
58
- });
59
- const i = this.value;
60
- this.hasMatchingValue = this.options?.length ? this.options.find(({ value: a }) => a === i) !== void 0 : !1;
61
- const d = this.optionsLoading ? u`<span>Loading...</span>` : u`
62
- ${f(
63
- this.options || [],
64
- (a) => a?.value,
65
- (a, t) => {
66
- const l = this.hasMatchingValue && a.value === e.value, n = !this.hasMatchingValue && t === 0, v = l || n;
67
- return u`<label for=${`${this.uid}_${t}`}>
68
- <input
69
- type="radio"
70
- tabindex=${v ? "0" : "-1"}
71
- id=${`${this.uid}_${t}`}
72
- data-cy=${`${this.uid}_radiogroup_${t}`}
73
- name=${this.uid}
74
- value=${a.value}
75
- ?checked=${l}
76
- ?required=${e.required}
77
- ?disabled=${e.disabled || e.readonly}
78
- @change=${this.valueChanged}
79
- @blur=${this.onBlur}
80
- />
81
- ${a.label}
82
- </label>`;
83
- }
84
- )}
85
- `;
86
- return u`
87
- ${D(this.uid, e, !1, void 0, !1)}
88
-
89
- <div
90
- class="gui-widget${this.direction === "row" ? " gui-widget--horizontal" : ""}"
91
- role="radiogroup"
92
- id=${this.uid}
93
- aria-labelledby=${e.label ? `${this.uid}_label` : p}
94
- aria-describedby=${e.hint ? `${this.uid}_hint` : p}
95
- aria-required=${this.required ? "true" : p}
96
- aria-invalid=${this.touched && this.errors?.length ? "true" : p}
97
- aria-errormessage=${this.touched && this.errors?.length ? `${this.uid}_errors` : p}
98
- >
99
- ${d}
100
- </div>
101
-
102
- ${_(this.uid, e)}
103
- `;
104
- }
105
- valueChanged(e) {
106
- if (e.stopPropagation(), !this.readOnly) {
107
- const i = e.target;
108
- this.dispatchEvent(
109
- new CustomEvent("change", {
110
- detail: { value: q(i.value, this.options) },
111
- bubbles: !0,
112
- composed: !0
113
- })
114
- );
115
- }
116
- }
117
- onBlur() {
118
- this.dispatchEvent(
119
- new CustomEvent("blur", {
120
- bubbles: !0,
121
- composed: !0
122
- })
123
- );
124
- }
125
- };
126
- o([
127
- s({ type: String })
128
- ], r.prototype, "uid", 2);
129
- o([
130
- s({ type: String })
131
- ], r.prototype, "label", 2);
132
- o([
133
- s({ type: String, attribute: "locale-id" })
134
- ], r.prototype, "localeId", 2);
135
- o([
136
- s({ type: Array })
137
- ], r.prototype, "errors", 2);
138
- o([
139
- s({ type: Boolean })
140
- ], r.prototype, "touched", 2);
141
- o([
142
- s({ type: Boolean })
143
- ], r.prototype, "required", 2);
144
- o([
145
- s({ type: Boolean })
146
- ], r.prototype, "disabled", 2);
147
- o([
148
- s({ type: Boolean, attribute: "readonly" })
149
- ], r.prototype, "readOnly", 2);
150
- o([
151
- s({ type: String })
152
- ], r.prototype, "value", 2);
153
- o([
154
- s({ type: String })
155
- ], r.prototype, "hint", 2);
156
- o([
157
- s({ type: Array })
158
- ], r.prototype, "options", 2);
159
- o([
160
- s({ type: String })
161
- ], r.prototype, "labelField", 2);
162
- o([
163
- s({ type: String })
164
- ], r.prototype, "valueField", 2);
165
- o([
166
- s({ type: String })
167
- ], r.prototype, "direction", 2);
168
- r = o([
169
- b("gui-radiogroup")
170
- ], r);
171
- typeof customElements < "u" && !customElements.get("gui-radiogroup") && customElements.define("gui-radiogroup", r);
172
- var x = Object.defineProperty, P = Object.getOwnPropertyDescriptor, c = (e, i, d, a) => {
173
- for (var t = a > 1 ? void 0 : a ? P(i, d) : i, l = e.length - 1, n; l >= 0; l--)
174
- (n = e[l]) && (t = (a ? n(i, d, t) : n(t)) || t);
175
- return a && t && x(i, d, t), t;
176
- };
177
- let h = class extends g {
178
- constructor() {
179
- super(...arguments), this.adapter = new m(), this.subscriptions = [];
180
- }
181
- createRenderRoot() {
182
- return this;
183
- }
184
- updated(e) {
185
- super.updated(e);
186
- const i = this.adapter.templateData.size;
187
- i ? this.style.flex = String(i) : this.style.removeProperty("flex");
188
- }
189
- connectedCallback() {
190
- super.connectedCallback(), this.classList.add("gui-radiogroup", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
191
- this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
192
- );
193
- }
194
- render() {
195
- return super.render(), u`
196
- <gui-radiogroup
197
- .uid=${this.widget.uid}
198
- .label=${this.adapter.templateData.label}
199
- .errors=${this.adapter.templateData.errors}
200
- ?touched=${this.adapter.templateData.touched}
201
- ?required=${this.adapter.templateData.validator?.required}
202
- ?disabled=${this.adapter.templateData.disabled}
203
- ?readonly=${this.adapter.templateData.readonly}
204
- .value=${this.adapter.templateData.value}
205
- .hint=${this.adapter.templateData.hint}
206
- .options=${this.adapter.templateData.options}
207
- .labelField=${this.adapter.templateData.labelField}
208
- .valueField=${this.adapter.templateData.valueField}
209
- .direction=${this.adapter.templateData.direction}
210
- @change=${this.valueChanged}
211
- @blur=${() => this.adapter.onBlur()}
212
- ></gui-radiogroup>
213
- `;
214
- }
215
- valueChanged(e) {
216
- const i = e.detail.value;
217
- this.adapter.valueChanged(i);
218
- }
219
- disconnectedCallback() {
220
- super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
221
- }
222
- };
223
- c([
224
- O({ context: y }),
225
- s({ attribute: !1 })
226
- ], h.prototype, "formContext", 2);
227
- c([
228
- w({ context: $ })
229
- ], h.prototype, "adapter", 2);
230
- h = c([
231
- b("gui-radiogroup-input")
232
- ], h);
233
- export {
234
- h as RadiogroupElement
235
- };