@golemui/gui-lit 1.2.0 → 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 +19 -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,276 +0,0 @@
1
- import { InputWidgetAdapter as g, formContext as b, inputContext as v } from "@golemui/lit";
2
- import { LitElement as m, nothing as p, html as d } from "lit";
3
- import { property as a, state as f, query as $, customElement as y } from "lit/decorators.js";
4
- import { classMap as D } from "lit/directives/class-map.js";
5
- import { G as C, a as x, b as F, c as w } from "./templates-Df7abEkB.js";
6
- import { b as S, a as _ } from "./numeric-jmOOKz30.js";
7
- import { consume as E, provide as I } from "@lit/context";
8
- import "rxjs";
9
- var O = Object.defineProperty, q = Object.getOwnPropertyDescriptor, r = (t, e, o, n) => {
10
- for (var s = n > 1 ? void 0 : n ? q(e, o) : e, l = t.length - 1, u; l >= 0; l--)
11
- (u = t[l]) && (s = (n ? u(e, o, s) : u(s)) || s);
12
- return n && s && O(e, o, s), s;
13
- };
14
- let i = class extends m {
15
- constructor() {
16
- super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.currency = void 0, this.step = void 0, this.maximumFractionDigits = void 0, this.minimumFractionDigits = void 0, this.hint = void 0, this.icon = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.ariaController = new C(this, {
17
- getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
18
- getState: () => ({
19
- uid: this.uid,
20
- templateData: {
21
- hint: this.hint,
22
- errors: this.errors,
23
- readonly: this.readOnly,
24
- disabled: this.disabled,
25
- touched: this.touched,
26
- required: this.required
27
- }
28
- })
29
- });
30
- }
31
- createRenderRoot() {
32
- return this;
33
- }
34
- connectedCallback() {
35
- super.connectedCallback(), this.classList.add("gui-field");
36
- }
37
- willUpdate(t) {
38
- t.has("value") && document.activeElement !== this.inputElement && (this.displayValue = this.formatCurrency(this.value));
39
- }
40
- render() {
41
- super.render();
42
- const t = {
43
- uid: this.uid,
44
- label: this.label,
45
- hint: this.hint,
46
- errors: this.errors,
47
- touched: this.touched,
48
- required: this.required,
49
- disabled: this.disabled,
50
- readonly: this.readOnly,
51
- value: this.value,
52
- currency: this.currency,
53
- maximumFractionDigits: this.maximumFractionDigits,
54
- minimumFractionDigits: this.minimumFractionDigits,
55
- icon: this.icon,
56
- placeholder: this.placeholder,
57
- autocomplete: this.autocomplete
58
- };
59
- this.displayValue = this.formatCurrency(this.value);
60
- const e = x("currency", t), o = {
61
- "gui-widget-input": !0,
62
- "gui-currency--icon": !!this.icon
63
- };
64
- return d`
65
- ${F(this.uid, t)}
66
-
67
- <div class="gui-widget">
68
- <input
69
- type="number"
70
- inputmode="decimal"
71
- id=${this.uid}
72
- data-cy=${`${this.uid}_currency`}
73
- class=${D(o)}
74
- step=${this.step && this.step > 0 ? this.step : p}
75
- .value=${this.value ?? ""}
76
- ?required=${this.required}
77
- ?disabled=${this.disabled}
78
- ?readonly=${this.readOnly}
79
- placeholder=${this.placeholder || p}
80
- autocomplete=${this.autocomplete || p}
81
- @input=${this.handleInput}
82
- @beforeinput=${S}
83
- @keydown=${_}
84
- @focus=${this.handleFocus}
85
- @blur=${this.handleBlur}
86
- />
87
- ${this.displayValue ? d`<span
88
- aria-hidden="true"
89
- class="gui-currency__format-value ${this.icon ? "gui-currency__format-value--icon" : ""}"
90
- >${this.displayValue}</span
91
- >` : p}
92
- ${e.html}
93
- </div>
94
-
95
- ${w(this.uid, t)}
96
- `;
97
- }
98
- handleInput(t) {
99
- if (t.stopPropagation(), !this.readOnly) {
100
- const e = t.target;
101
- this.displayValue = this.formatCurrency(e.valueAsNumber);
102
- const o = e.valueAsNumber;
103
- this.dispatchEvent(
104
- new CustomEvent("input", {
105
- detail: { value: Number.isNaN(o) ? void 0 : o },
106
- bubbles: !0,
107
- composed: !0
108
- })
109
- );
110
- }
111
- }
112
- handleFocus() {
113
- this.displayValue = this.formatCurrency(this.value);
114
- }
115
- handleBlur() {
116
- this.displayValue = this.formatCurrency(this.value), this.dispatchEvent(
117
- new CustomEvent("blur", {
118
- bubbles: !0,
119
- composed: !0
120
- })
121
- );
122
- }
123
- formatCurrency(t) {
124
- if (t === "" || t === void 0 || t === null || isNaN(t)) return "";
125
- try {
126
- const e = this.maximumFractionDigits ?? Math.max(this.minimumFractionDigits ?? 2, 2), o = Math.min(
127
- this.minimumFractionDigits ?? 2,
128
- e
129
- );
130
- return new Intl.NumberFormat(this.localeId ?? "en", {
131
- style: "currency",
132
- currency: this.currency ?? "USD",
133
- maximumFractionDigits: e,
134
- minimumFractionDigits: o
135
- }).format(t);
136
- } catch (e) {
137
- return console.warn("Invalid locale or currency", e), t.toString();
138
- }
139
- }
140
- get separators() {
141
- const t = new Intl.NumberFormat(this.localeId ?? "en").format(1111.1);
142
- return {
143
- group: t.replace(/1/g, "").replace(/\d/g, "")[0] || ",",
144
- decimal: t.replace(/1/g, "").replace(/\d/g, "").slice(-1) || "."
145
- };
146
- }
147
- };
148
- r([
149
- a({ type: String })
150
- ], i.prototype, "uid", 2);
151
- r([
152
- a({ type: String })
153
- ], i.prototype, "label", 2);
154
- r([
155
- a({ type: String, attribute: "locale-id" })
156
- ], i.prototype, "localeId", 2);
157
- r([
158
- a({ type: Array })
159
- ], i.prototype, "errors", 2);
160
- r([
161
- a({ type: Boolean })
162
- ], i.prototype, "touched", 2);
163
- r([
164
- a({ type: Boolean })
165
- ], i.prototype, "required", 2);
166
- r([
167
- a({ type: Boolean })
168
- ], i.prototype, "disabled", 2);
169
- r([
170
- a({ type: Boolean, attribute: "readonly" })
171
- ], i.prototype, "readOnly", 2);
172
- r([
173
- a({ type: String })
174
- ], i.prototype, "value", 2);
175
- r([
176
- a({ type: String })
177
- ], i.prototype, "currency", 2);
178
- r([
179
- a({ type: String })
180
- ], i.prototype, "step", 2);
181
- r([
182
- a({ type: String })
183
- ], i.prototype, "maximumFractionDigits", 2);
184
- r([
185
- a({ type: String })
186
- ], i.prototype, "minimumFractionDigits", 2);
187
- r([
188
- a({ type: String })
189
- ], i.prototype, "hint", 2);
190
- r([
191
- a({ type: String })
192
- ], i.prototype, "icon", 2);
193
- r([
194
- a({ type: String })
195
- ], i.prototype, "placeholder", 2);
196
- r([
197
- a({ type: String })
198
- ], i.prototype, "autocomplete", 2);
199
- r([
200
- f()
201
- ], i.prototype, "displayValue", 2);
202
- r([
203
- $("input")
204
- ], i.prototype, "inputElement", 2);
205
- i = r([
206
- y("gui-currency")
207
- ], i);
208
- typeof customElements < "u" && !customElements.get("gui-currency") && customElements.define("gui-currency", i);
209
- var N = Object.defineProperty, P = Object.getOwnPropertyDescriptor, h = (t, e, o, n) => {
210
- for (var s = n > 1 ? void 0 : n ? P(e, o) : e, l = t.length - 1, u; l >= 0; l--)
211
- (u = t[l]) && (s = (n ? u(e, o, s) : u(s)) || s);
212
- return n && s && N(e, o, s), s;
213
- };
214
- let c = class extends m {
215
- constructor() {
216
- super(...arguments), this.adapter = new g(), this.subscriptions = [];
217
- }
218
- createRenderRoot() {
219
- return this;
220
- }
221
- updated(t) {
222
- super.updated(t);
223
- const e = this.adapter.templateData.size;
224
- e ? this.style.flex = String(e) : this.style.removeProperty("flex");
225
- }
226
- connectedCallback() {
227
- super.connectedCallback(), this.classList.add("gui-currency", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
228
- this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
229
- );
230
- }
231
- render() {
232
- return super.render(), d`
233
- <gui-currency
234
- .uid=${this.widget.uid}
235
- .label=${this.adapter.templateData.label}
236
- .hint=${this.adapter.templateData.hint}
237
- .errors=${this.adapter.templateData.errors}
238
- ?touched=${this.adapter.templateData.touched}
239
- ?required=${this.adapter.templateData.validator?.required}
240
- ?disabled=${this.adapter.templateData.disabled}
241
- ?readonly=${this.adapter.templateData.readonly}
242
- .value=${this.adapter.templateData.value}
243
- .currency=${this.adapter.templateData.currency}
244
- .step=${this.adapter.templateData.step}
245
- .maximumFractionDigits=${this.adapter.templateData.maximumFractionDigits}
246
- .minimumFractionDigits=${this.adapter.templateData.minimumFractionDigits}
247
- .icon=${this.adapter.templateData.icon}
248
- .placeholder=${this.adapter.templateData.placeholder}
249
- .autocomplete=${this.adapter.templateData.autocomplete}
250
- .localeId=${this.adapter.templateData.lang}
251
- @input=${this.valueChanged}
252
- @blur=${() => this.adapter.onBlur()}
253
- ></gui-currency>
254
- `;
255
- }
256
- valueChanged(t) {
257
- const e = t.detail.value;
258
- this.adapter.valueChanged(e);
259
- }
260
- disconnectedCallback() {
261
- super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
262
- }
263
- };
264
- h([
265
- E({ context: b }),
266
- a({ attribute: !1 })
267
- ], c.prototype, "formContext", 2);
268
- h([
269
- I({ context: v })
270
- ], c.prototype, "adapter", 2);
271
- c = h([
272
- y("gui-currency-input")
273
- ], c);
274
- export {
275
- c as CurrencyElement
276
- };