@golemui/gui-react 0.12.2 → 0.13.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 (96) hide show
  1. package/Accordion-BU3skkjb.js +58 -0
  2. package/Alert-DpUiDxQT.js +17 -0
  3. package/Button-BYVR5EKG.js +86 -0
  4. package/CHANGELOG.md +4 -0
  5. package/{Calendar-Dxavv2c7.js → Calendar-BmMkpTcV.js} +13 -11
  6. package/Checkbox-B1Tsf-vi.js +164 -0
  7. package/Currency-D0pOQwU4.js +233 -0
  8. package/{DateInput-CdkyyAhc.js → DateInput-CqFHtc9F.js} +12 -10
  9. package/{DatePicker-TkMCndrw.js → DatePicker-BmW3TO0X.js} +18 -15
  10. package/{Dropdown-jKk4TyOa.js → Dropdown-C-_zDFCe.js} +5 -3
  11. package/Flex-Rs-RvIcq.js +20 -0
  12. package/{Grid-DREMTVQI.js → Grid-BcPUrfRL.js} +3 -2
  13. package/{List-BjMIo577.js → List-YkH8gdMh.js} +5 -3
  14. package/Markdown-DeAW4y3P.js +571 -0
  15. package/MarkdownText-BdISjAsE.js +11 -0
  16. package/Number-GsGZMR5a.js +247 -0
  17. package/Password-B8QjtpUe.js +204 -0
  18. package/RadioGroup-Cd1_Zkkz.js +197 -0
  19. package/{RangeCalendar-u2vxIhna.js → RangeCalendar-9IJoFEXw.js} +10 -8
  20. package/{RangeDateInput-CopLdb6J.js → RangeDateInput-DrVR4T_z.js} +21 -19
  21. package/{RangeDatePicker-DXpV-B_G.js → RangeDatePicker-Cq_Tt6NE.js} +38 -35
  22. package/{Renderer-B6WmwKDv.js → Renderer-CWqudTUu.js} +4 -2
  23. package/Repeater-DE-DAylQ.js +124 -0
  24. package/Select-CCCPYQW6.js +238 -0
  25. package/{Tabs-C2qqi8xO.js → Tabs-BVgVVvnu.js} +4 -3
  26. package/TextArea-BlRaVCon.js +202 -0
  27. package/TextInput-KuHLSN2X.js +169 -0
  28. package/Toggle-D-bglMPv.js +166 -0
  29. package/abstract-calendar-JfbbRwFb.js +528 -0
  30. package/calendar-BgptByan.js +95 -0
  31. package/class-map-DrTVAYz_.js +26 -0
  32. package/date-BS1lA1xg.js +786 -0
  33. package/date-input-Dux0mFJw.js +266 -0
  34. package/directive-1yd1wdny.js +555 -0
  35. package/errors-6UKoJh8Y.js +108 -0
  36. package/index.js +2705 -1171
  37. package/index.umd.cjs +878 -2
  38. package/lib/components/Accordion.d.ts +2 -2
  39. package/lib/components/Alert.d.ts +2 -2
  40. package/lib/components/Button.d.ts +2 -2
  41. package/lib/components/Calendar.d.ts +2 -2
  42. package/lib/components/Checkbox.d.ts +2 -2
  43. package/lib/components/Currency.d.ts +2 -2
  44. package/lib/components/DateInput.d.ts +2 -2
  45. package/lib/components/DatePicker.d.ts +2 -2
  46. package/lib/components/Dropdown.d.ts +2 -2
  47. package/lib/components/Flex.d.ts +2 -2
  48. package/lib/components/Form.d.ts +5 -5
  49. package/lib/components/Grid.d.ts +2 -2
  50. package/lib/components/List.d.ts +2 -2
  51. package/lib/components/Markdown.d.ts +2 -2
  52. package/lib/components/MarkdownText.d.ts +2 -2
  53. package/lib/components/Number.d.ts +2 -2
  54. package/lib/components/Password.d.ts +2 -2
  55. package/lib/components/RadioGroup.d.ts +2 -2
  56. package/lib/components/RangeCalendar.d.ts +2 -2
  57. package/lib/components/RangeDateInput.d.ts +2 -2
  58. package/lib/components/RangeDatePicker.d.ts +2 -2
  59. package/lib/components/Renderer.d.ts +2 -2
  60. package/lib/components/Repeater.d.ts +2 -2
  61. package/lib/components/Select.d.ts +2 -2
  62. package/lib/components/Tabs.d.ts +2 -2
  63. package/lib/components/TextArea.d.ts +2 -2
  64. package/lib/components/TextInput.d.ts +2 -2
  65. package/lib/components/Toggle.d.ts +2 -2
  66. package/lib/widget.loaders.d.ts +2 -2
  67. package/list-DHX7bG4r.js +282 -0
  68. package/live-BfTBpQrp.js +24 -0
  69. package/markdown-text-BUv0K0WF.js +44 -0
  70. package/one-of-DifUsEYY.js +48 -0
  71. package/package.json +6 -6
  72. package/query-h1h36oxg.js +12 -0
  73. package/range-calendar-SAyiW3EF.js +326 -0
  74. package/range-date-input-8WtB1urD.js +507 -0
  75. package/repeat-BucBfSPF.js +79 -0
  76. package/state-DI9ZsB5W.js +7 -0
  77. package/style-map-C_0XzJlx.js +29 -0
  78. package/tabs-DzSCq_98.js +13 -0
  79. package/templates-DBGyvZtc.js +75 -0
  80. package/Accordion-Btp_b0xA.js +0 -59
  81. package/Alert-CBgIsMKO.js +0 -16
  82. package/Button-DN0G-MUb.js +0 -21
  83. package/Checkbox-ViM9MktI.js +0 -30
  84. package/Currency-C4QFWO7Y.js +0 -37
  85. package/DefaultListItemRenderer-lNc9Kk7x.js +0 -18
  86. package/Flex-gD893rrB.js +0 -19
  87. package/Markdown-Ck_88HOR.js +0 -47
  88. package/MarkdownText-kJVkmihW.js +0 -9
  89. package/Number-CnQ95aLO.js +0 -35
  90. package/Password-Bg97DYW3.js +0 -36
  91. package/RadioGroup-Dldom5ja.js +0 -33
  92. package/Repeater-BYgXVfbl.js +0 -111
  93. package/Select-BLUX_W91.js +0 -55
  94. package/TextArea-cw3Q2v97.js +0 -35
  95. package/TextInput-geLoAA0c.js +0 -32
  96. package/Toggle-a7L71GwR.js +0 -30
@@ -0,0 +1,58 @@
1
+ import { jsx as c, jsxs as g } from "react/jsx-runtime";
2
+ import { useLayoutWidget as v, WidgetRenderer as b } from "@golemui/react";
3
+ import "@golemui/gui-shared";
4
+ import { useState as x, useEffect as y, useCallback as r } from "react";
5
+ const f = {};
6
+ function S(h) {
7
+ const m = h.widget, { uid: p, children: d, templateData: i, onChange: a } = v(m), [t, s] = x(f);
8
+ y(() => {
9
+ t === f && i.defaultOpen && s(i.defaultOpen || {});
10
+ }, [t, i]);
11
+ const l = r(
12
+ (n) => {
13
+ const e = { ...t };
14
+ i.singleOpen && Object.keys(e).filter((o) => o !== n).forEach((o) => {
15
+ e[o] = o === n ? !e[o] : !1;
16
+ }), e[n] = !e[n], s(e), a(e);
17
+ },
18
+ [t, i.singleOpen, a]
19
+ ), u = r(
20
+ (n) => {
21
+ const e = d.find((w) => w.uid === n), o = t[n];
22
+ return (o || i.renderMode !== "activeOnly") && e ? /* @__PURE__ */ c(
23
+ "section",
24
+ {
25
+ className: "gui-widget",
26
+ role: "region",
27
+ id: `accordion_section_${n}`,
28
+ hidden: !o && i.renderMode !== "activeOnly",
29
+ "aria-labelledby": `accordion_button_${n}`,
30
+ children: /* @__PURE__ */ c(b, { widget: e })
31
+ }
32
+ ) : null;
33
+ },
34
+ [d, t, i.renderMode]
35
+ ), _ = r(() => (i.sections || []).map((e, o) => /* @__PURE__ */ g("div", { className: "gui-accordion__section", children: [
36
+ /* @__PURE__ */ g(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ tabIndex: 0,
41
+ id: `accordion_button_${e.uid}`,
42
+ "aria-controls": `accordion_section_${e.uid}`,
43
+ "aria-expanded": t[e.uid] ? "true" : "false",
44
+ className: t[e.uid] ? "active" : "",
45
+ onClick: () => l(e.uid),
46
+ children: [
47
+ e.label,
48
+ /* @__PURE__ */ c("span", { className: "gui-accordion__arrow", children: /* @__PURE__ */ c("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 256 256", children: /* @__PURE__ */ c("path", { d: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" }) }) })
49
+ ]
50
+ }
51
+ ),
52
+ u(e.uid)
53
+ ] }, `${"accordion_section_" + e.uid}`)), [i.sections, t, u, l]);
54
+ return /* @__PURE__ */ c("div", { className: "gui-accordion gui-field", style: { flex: i.size }, children: /* @__PURE__ */ c("div", { className: "gui-widget", id: p, children: _() }) });
55
+ }
56
+ export {
57
+ S as Accordion
58
+ };
@@ -0,0 +1,17 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useDisplayWdiget as r } from "@golemui/react";
3
+ import "@golemui/gui-shared";
4
+ function n(t) {
5
+ const l = t.widget, { uid: a, templateData: i } = r(l);
6
+ return /* @__PURE__ */ e("div", { className: "gui-alert gui-field", style: { flex: i.size }, children: /* @__PURE__ */ e("div", { className: "gui-widget", id: a, children: /* @__PURE__ */ e(
7
+ "div",
8
+ {
9
+ role: "alert",
10
+ className: `gui-alert-notification gui-alert-notification--${i.level || "default"}`,
11
+ children: i.text
12
+ }
13
+ ) }) });
14
+ }
15
+ export {
16
+ n as Alert
17
+ };
@@ -0,0 +1,86 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useActionWidget as b } from "@golemui/react";
3
+ import { i as g, b as d, A as r, n as l, t as f } from "./directive-1yd1wdny.js";
4
+ import { e as h } from "./class-map-DrTVAYz_.js";
5
+ /* empty css */
6
+ import "@golemui/gui-shared";
7
+ var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, a = (o, i, s, t) => {
8
+ for (var e = t > 1 ? void 0 : t ? v(i, s) : i, u = o.length - 1, c; u >= 0; u--)
9
+ (c = o[u]) && (e = (t ? c(i, s, e) : c(e)) || e);
10
+ return t && e && m(i, s, e), e;
11
+ };
12
+ let n = class extends g {
13
+ constructor() {
14
+ super(...arguments), this.uid = void 0, this.label = void 0, this.disabled = !1, this.icon = void 0, this.variant = "filled", this.iconPosition = "left";
15
+ }
16
+ createRenderRoot() {
17
+ return this;
18
+ }
19
+ connectedCallback() {
20
+ super.connectedCallback(), this.classList.add("gui-field");
21
+ }
22
+ render() {
23
+ const o = this.icon, i = this.iconPosition || "left", s = {
24
+ "gui-button-with-icon": !!o,
25
+ [`gui-button-icon-${i}`]: !0,
26
+ "gui-button--outlined": this.variant === "outlined",
27
+ "gui-button--link": this.variant === "link"
28
+ }, t = o ? d`<span class="gui-widget-icon gui-button-icon ${o}" data-icon=${o}></span>` : r;
29
+ return d`
30
+ <div class="gui-widget">
31
+ <button
32
+ type="button"
33
+ tabindex="0"
34
+ id=${this.uid}
35
+ class=${h(s)}
36
+ data-cy=${`${this.uid}_button`}
37
+ ?disabled=${this.disabled}
38
+ >
39
+ ${i === "left" ? t : r}
40
+ ${this.label ? d`<span>${this.label}</span>` : r}
41
+ ${i === "right" ? t : r}
42
+ </button>
43
+ </div>
44
+ `;
45
+ }
46
+ };
47
+ a([
48
+ l({ type: String })
49
+ ], n.prototype, "uid", 2);
50
+ a([
51
+ l({ type: String })
52
+ ], n.prototype, "label", 2);
53
+ a([
54
+ l({ type: Boolean })
55
+ ], n.prototype, "disabled", 2);
56
+ a([
57
+ l({ type: String })
58
+ ], n.prototype, "icon", 2);
59
+ a([
60
+ l({ type: String })
61
+ ], n.prototype, "variant", 2);
62
+ a([
63
+ l({ type: String })
64
+ ], n.prototype, "iconPosition", 2);
65
+ n = a([
66
+ f("gui-button")
67
+ ], n);
68
+ typeof customElements < "u" && !customElements.get("gui-button") && customElements.define("gui-button", n);
69
+ function C(o) {
70
+ const i = o.widget, { uid: s, templateData: t, onClick: e } = b(i);
71
+ return /* @__PURE__ */ p("div", { className: "gui-button gui-field", style: { flex: t.size }, children: /* @__PURE__ */ p(
72
+ "gui-button",
73
+ {
74
+ uid: s,
75
+ label: t.label,
76
+ disabled: t.disabled,
77
+ variant: t.variant,
78
+ icon: t.icon,
79
+ iconPosition: t.iconPosition,
80
+ onClick: e
81
+ }
82
+ ) });
83
+ }
84
+ export {
85
+ C as Button
86
+ };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.12.2 (2026-05-16)
2
+
3
+ This was a version bump only for gui-react to align it with other projects, there were no code changes.
4
+
1
5
  ## 0.12.1 (2026-05-16)
2
6
 
3
7
  This was a version bump only for gui-react to align it with other projects, there were no code changes.
@@ -1,33 +1,35 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import { useInputWidget as O } from "@golemui/react";
3
+ import "@golemui/gui-shared";
3
4
  import { useCallback as H } from "react";
5
+ import "./calendar-BgptByan.js";
4
6
  /* empty css */
5
- function T(d) {
6
- const c = d.widget, { uid: m, errors: u, value: h, isTouched: b, templateData: e, onBlur: t, onValueChanged: a } = O(c), g = H(
7
+ function W(d) {
8
+ const c = d.widget, { uid: m, errors: u, value: h, isTouched: b, templateData: e, onBlur: n, onValueChanged: a } = O(c), g = H(
7
9
  (o) => {
8
- const n = o, r = (i) => a(i.detail.value), s = (i) => {
9
- t();
10
+ const t = o, r = (i) => a(i.detail.value), s = (i) => {
11
+ n();
10
12
  };
11
- return o && (n.addEventListener("blur", s), n.addEventListener("change", r)), () => {
12
- n.removeEventListener("blur", s), n.removeEventListener("change", r);
13
+ return o && (t.addEventListener("blur", s), t.addEventListener("change", r)), () => {
14
+ t.removeEventListener("blur", s), t.removeEventListener("change", r);
13
15
  };
14
16
  },
15
- [a, t]
16
- ), v = e.label, f = e.hint, p = e.prevMonthIcon, M = e.nextMonthIcon, x = e.prevMonthAriaLabel, y = e.nextMonthAriaLabel, L = e.dayFormat, D = e.weekdayFormat, F = e.monthFormat, I = e.minDate, R = e.maxDate, w = e.disabledRanges, A = e.numberOfMonths, E = e.lang, k = e.disabled, q = e.readonly, C = e.validator?.required;
17
+ [a, n]
18
+ ), v = e.label, p = e.hint, f = e.prevMonthIcon, M = e.nextMonthIcon, x = e.prevMonthAriaLabel, y = e.nextMonthAriaLabel, L = e.dayFormat, D = e.weekdayFormat, F = e.monthFormat, I = e.minDate, R = e.maxDate, w = e.disabledRanges, A = e.numberOfMonths, E = e.lang, k = e.disabled, q = e.readonly, C = e.validator?.required;
17
19
  return /* @__PURE__ */ l("div", { className: "gui-calendar gui-field", style: { flex: e.size }, children: /* @__PURE__ */ l(
18
20
  "gui-calendar",
19
21
  {
20
22
  ref: g,
21
23
  uid: m,
22
24
  label: v,
23
- hint: f,
25
+ hint: p,
24
26
  errors: u,
25
27
  touched: b,
26
28
  required: C,
27
29
  disabled: k,
28
30
  readOnly: q,
29
31
  value: h,
30
- prevMonthIcon: p,
32
+ prevMonthIcon: f,
31
33
  nextMonthIcon: M,
32
34
  prevMonthAriaLabel: x,
33
35
  nextMonthAriaLabel: y,
@@ -43,5 +45,5 @@ function T(d) {
43
45
  ) });
44
46
  }
45
47
  export {
46
- T as Calendar
48
+ W as Calendar
47
49
  };
@@ -0,0 +1,164 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useInputWidget as k } from "@golemui/react";
3
+ import "@golemui/gui-shared";
4
+ import { useCallback as $ } from "react";
5
+ import { G as C, c as P } from "./templates-DBGyvZtc.js";
6
+ import { i as _, A as q, b as w, n as o, t as O } from "./directive-1yd1wdny.js";
7
+ /* empty css */
8
+ var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, i = (e, r, n, l) => {
9
+ for (var s = l > 1 ? void 0 : l ? S(r, n) : r, d = e.length - 1, h; d >= 0; d--)
10
+ (h = e[d]) && (s = (l ? h(r, n, s) : h(s)) || s);
11
+ return l && s && E(r, n, s), s;
12
+ };
13
+ let t = class extends _ {
14
+ constructor() {
15
+ super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = void 0, this.required = void 0, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.checkboxPosition = "left", this.ariaController = new C(this, {
16
+ getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
17
+ getState: () => ({
18
+ uid: this.uid,
19
+ templateData: {
20
+ hint: this.hint,
21
+ errors: this.errors,
22
+ touched: this.touched,
23
+ // Checkboxes can't have aria-readonly
24
+ readonly: !1,
25
+ disabled: !1
26
+ }
27
+ })
28
+ });
29
+ }
30
+ createRenderRoot() {
31
+ return this;
32
+ }
33
+ connectedCallback() {
34
+ super.connectedCallback(), this.classList.add("gui-field");
35
+ }
36
+ render() {
37
+ super.render();
38
+ const e = {
39
+ uid: this.uid,
40
+ label: this.label,
41
+ hint: this.hint,
42
+ errors: this.errors,
43
+ touched: this.touched,
44
+ required: this.required,
45
+ disabled: this.disabled,
46
+ readonly: this.readOnly,
47
+ value: this.value,
48
+ checkboxPosition: this.checkboxPosition
49
+ };
50
+ return e.checkboxPosition === "right" ? this.classList.add("gui-checkbox--right") : this.classList.contains("gui-checkbox--right") && this.classList.remove("gui-checkbox--right"), w`
51
+ <label
52
+ class="gui-label"
53
+ for=${this.uid}
54
+ data-cy=${`${this.uid}_label`}
55
+ id=${`${this.uid}_label`}
56
+ >
57
+ <div class="gui-widget gui-widget--horizontal">
58
+ <input
59
+ type="checkbox"
60
+ tabindex="0"
61
+ id=${this.uid}
62
+ data-cy=${`${this.uid}_checkbox`}
63
+ ?checked=${this.value}
64
+ ?required=${this.required}
65
+ ?disabled=${this.disabled || this.readOnly}
66
+ @change=${this.valueChanged}
67
+ @blur=${this.onBlur}
68
+ />
69
+ </div>
70
+
71
+ <span class="gui-label__container">
72
+ ${e.label + (e.required ? " *" : "")}
73
+ </span>
74
+ </label>
75
+
76
+ <div class="gui-widget-hint" id=${`${e.uid}_hint`}>
77
+ ${e.hint ?? q} ${P(this.uid, e)}
78
+ </div>
79
+ `;
80
+ }
81
+ valueChanged(e) {
82
+ if (e.stopPropagation(), !this.readOnly) {
83
+ const r = e.target;
84
+ this.dispatchEvent(
85
+ new CustomEvent("change", {
86
+ detail: { value: r.checked },
87
+ bubbles: !0,
88
+ composed: !0
89
+ })
90
+ );
91
+ }
92
+ }
93
+ onBlur() {
94
+ this.dispatchEvent(
95
+ new CustomEvent("blur", {
96
+ bubbles: !0,
97
+ composed: !0
98
+ })
99
+ );
100
+ }
101
+ };
102
+ i([
103
+ o({ type: String })
104
+ ], t.prototype, "uid", 2);
105
+ i([
106
+ o({ type: String })
107
+ ], t.prototype, "label", 2);
108
+ i([
109
+ o({ type: String, attribute: "locale-id" })
110
+ ], t.prototype, "localeId", 2);
111
+ i([
112
+ o({ type: Array })
113
+ ], t.prototype, "errors", 2);
114
+ i([
115
+ o({ type: Boolean })
116
+ ], t.prototype, "touched", 2);
117
+ i([
118
+ o({ type: Boolean })
119
+ ], t.prototype, "required", 2);
120
+ i([
121
+ o({ type: Boolean })
122
+ ], t.prototype, "disabled", 2);
123
+ i([
124
+ o({ type: Boolean, attribute: "readonly" })
125
+ ], t.prototype, "readOnly", 2);
126
+ i([
127
+ o({ type: String })
128
+ ], t.prototype, "value", 2);
129
+ i([
130
+ o({ type: String })
131
+ ], t.prototype, "hint", 2);
132
+ i([
133
+ o({ type: String })
134
+ ], t.prototype, "checkboxPosition", 2);
135
+ t = i([
136
+ O("gui-checkbox")
137
+ ], t);
138
+ typeof customElements < "u" && !customElements.get("gui-checkbox") && customElements.define("gui-checkbox", t);
139
+ function G(e) {
140
+ const r = e.widget, { uid: n, errors: l, value: s, onValueChanged: d, onBlur: h, templateData: a, isTouched: u } = k(r), p = $(
141
+ (x) => d(x.nativeEvent.detail.value),
142
+ [d]
143
+ ), b = a.label, g = a.hint, y = a.checkboxPosition, v = a.disabled, m = a.readonly, f = a.validator?.required;
144
+ return /* @__PURE__ */ c("div", { className: "gui-checkbox gui-field", style: { flex: a.size }, children: /* @__PURE__ */ c(
145
+ "gui-checkbox",
146
+ {
147
+ uid: n,
148
+ label: b,
149
+ errors: l,
150
+ touched: u,
151
+ required: f,
152
+ disabled: v,
153
+ readOnly: m,
154
+ value: s,
155
+ hint: g,
156
+ checkboxPosition: y,
157
+ onChange: p,
158
+ onBlur: h
159
+ }
160
+ ) });
161
+ }
162
+ export {
163
+ G as Checkbox
164
+ };
@@ -0,0 +1,233 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useInputWidget as _ } from "@golemui/react";
3
+ import "@golemui/gui-shared";
4
+ import { useCallback as q } from "react";
5
+ import { i as V, A as u, b as h, n as o, t as B } from "./directive-1yd1wdny.js";
6
+ import { r as N } from "./state-DI9ZsB5W.js";
7
+ import { e as A } from "./query-h1h36oxg.js";
8
+ import { e as P } from "./class-map-DrTVAYz_.js";
9
+ import { G as R, a as j, b as G, c as U } from "./templates-DBGyvZtc.js";
10
+ /* empty css */
11
+ var L = Object.defineProperty, T = Object.getOwnPropertyDescriptor, i = (t, s, n, l) => {
12
+ for (var a = l > 1 ? void 0 : l ? T(s, n) : s, c = t.length - 1, r; c >= 0; c--)
13
+ (r = t[c]) && (a = (l ? r(s, n, a) : r(a)) || a);
14
+ return l && a && L(s, n, a), a;
15
+ };
16
+ let e = class extends V {
17
+ constructor() {
18
+ 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 R(this, {
19
+ getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
20
+ getState: () => ({
21
+ uid: this.uid,
22
+ templateData: {
23
+ hint: this.hint,
24
+ errors: this.errors,
25
+ readonly: this.readOnly,
26
+ disabled: this.disabled,
27
+ touched: this.touched
28
+ }
29
+ })
30
+ });
31
+ }
32
+ createRenderRoot() {
33
+ return this;
34
+ }
35
+ connectedCallback() {
36
+ super.connectedCallback(), this.classList.add("gui-field");
37
+ }
38
+ willUpdate(t) {
39
+ t.has("value") && document.activeElement !== this.inputElement && (this.displayValue = this.formatCurrency(this.value));
40
+ }
41
+ render() {
42
+ super.render();
43
+ const t = {
44
+ uid: this.uid,
45
+ label: this.label,
46
+ hint: this.hint,
47
+ errors: this.errors,
48
+ touched: this.touched,
49
+ required: this.required,
50
+ disabled: this.disabled,
51
+ readonly: this.readOnly,
52
+ value: this.value,
53
+ currency: this.currency,
54
+ maximumFractionDigits: this.maximumFractionDigits,
55
+ minimumFractionDigits: this.minimumFractionDigits,
56
+ icon: this.icon,
57
+ placeholder: this.placeholder,
58
+ autocomplete: this.autocomplete
59
+ };
60
+ this.displayValue = this.formatCurrency(this.value);
61
+ const s = j("currency", t), n = {
62
+ "gui-currency--icon": !!this.icon
63
+ };
64
+ return h`
65
+ ${G(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=${P(n)}
74
+ step=${this.step && this.step > 0 ? this.step : u}
75
+ .value=${this.value ?? ""}
76
+ ?required=${this.disabled}
77
+ ?disabled=${this.disabled}
78
+ ?readonly=${this.readOnly}
79
+ placeholder=${this.placeholder || u}
80
+ autocomplete=${this.autocomplete || u}
81
+ @input=${this.handleInput}
82
+ @focus=${this.handleFocus}
83
+ @blur=${this.handleBlur}
84
+ />
85
+ ${this.displayValue ? h`<label
86
+ for=${this.uid}
87
+ class="gui-currency__format-value ${this.icon ? "gui-currency__format-value--icon" : ""}"
88
+ >${this.displayValue}</label
89
+ >` : u}
90
+ ${s.html}
91
+ </div>
92
+
93
+ ${U(this.uid, t)}
94
+ `;
95
+ }
96
+ handleInput(t) {
97
+ if (t.stopPropagation(), !this.readOnly) {
98
+ const s = t.target;
99
+ this.displayValue = this.formatCurrency(s.valueAsNumber), this.dispatchEvent(
100
+ new CustomEvent("input", {
101
+ detail: { value: s.valueAsNumber },
102
+ bubbles: !0,
103
+ composed: !0
104
+ })
105
+ );
106
+ }
107
+ }
108
+ handleFocus() {
109
+ this.displayValue = this.formatCurrency(this.value);
110
+ }
111
+ handleBlur() {
112
+ this.displayValue = this.formatCurrency(this.value), this.dispatchEvent(
113
+ new CustomEvent("blur", {
114
+ bubbles: !0,
115
+ composed: !0
116
+ })
117
+ );
118
+ }
119
+ formatCurrency(t) {
120
+ if (t === "" || t === void 0 || t === null || isNaN(t)) return "";
121
+ try {
122
+ return new Intl.NumberFormat(this.localeId ?? "en", {
123
+ style: "currency",
124
+ currency: this.currency ?? "USD",
125
+ maximumFractionDigits: this.maximumFractionDigits ?? Math.max(this.minimumFractionDigits ?? 2, 2),
126
+ minimumFractionDigits: this.minimumFractionDigits ?? 2
127
+ }).format(t);
128
+ } catch (s) {
129
+ return console.warn("Invalid locale or currency", s), t.toString();
130
+ }
131
+ }
132
+ get separators() {
133
+ const t = new Intl.NumberFormat(this.localeId ?? "en").format(1111.1);
134
+ return {
135
+ group: t.replace(/1/g, "").replace(/\d/g, "")[0] || ",",
136
+ decimal: t.replace(/1/g, "").replace(/\d/g, "").slice(-1) || "."
137
+ };
138
+ }
139
+ };
140
+ i([
141
+ o({ type: String })
142
+ ], e.prototype, "uid", 2);
143
+ i([
144
+ o({ type: String })
145
+ ], e.prototype, "label", 2);
146
+ i([
147
+ o({ type: String, attribute: "locale-id" })
148
+ ], e.prototype, "localeId", 2);
149
+ i([
150
+ o({ type: Array })
151
+ ], e.prototype, "errors", 2);
152
+ i([
153
+ o({ type: Boolean })
154
+ ], e.prototype, "touched", 2);
155
+ i([
156
+ o({ type: Boolean })
157
+ ], e.prototype, "required", 2);
158
+ i([
159
+ o({ type: Boolean })
160
+ ], e.prototype, "disabled", 2);
161
+ i([
162
+ o({ type: Boolean, attribute: "readonly" })
163
+ ], e.prototype, "readOnly", 2);
164
+ i([
165
+ o({ type: String })
166
+ ], e.prototype, "value", 2);
167
+ i([
168
+ o({ type: String })
169
+ ], e.prototype, "currency", 2);
170
+ i([
171
+ o({ type: String })
172
+ ], e.prototype, "step", 2);
173
+ i([
174
+ o({ type: String })
175
+ ], e.prototype, "maximumFractionDigits", 2);
176
+ i([
177
+ o({ type: String })
178
+ ], e.prototype, "minimumFractionDigits", 2);
179
+ i([
180
+ o({ type: String })
181
+ ], e.prototype, "hint", 2);
182
+ i([
183
+ o({ type: String })
184
+ ], e.prototype, "icon", 2);
185
+ i([
186
+ o({ type: String })
187
+ ], e.prototype, "placeholder", 2);
188
+ i([
189
+ o({ type: String })
190
+ ], e.prototype, "autocomplete", 2);
191
+ i([
192
+ N()
193
+ ], e.prototype, "displayValue", 2);
194
+ i([
195
+ A("input")
196
+ ], e.prototype, "inputElement", 2);
197
+ e = i([
198
+ B("gui-currency")
199
+ ], e);
200
+ typeof customElements < "u" && !customElements.get("gui-currency") && customElements.define("gui-currency", e);
201
+ function k(t) {
202
+ const s = t.widget, { uid: n, errors: l, value: a, isTouched: c, templateData: r, onValueChanged: d, onBlur: m } = _(s), y = q(
203
+ (O) => d(O.nativeEvent.detail.value),
204
+ [d]
205
+ ), g = r.label, v = r.hint, b = r.placeholder, f = r.currency, D = r.step, $ = r.maximumFractionDigits, F = r.minimumFractionDigits, C = r.autocomplete, S = r.icon, I = r.disabled, x = r.readonly, w = r.validator?.required, E = r.lang;
206
+ return /* @__PURE__ */ p("div", { className: "gui-currency gui-field", style: { flex: r.size }, children: /* @__PURE__ */ p(
207
+ "gui-currency",
208
+ {
209
+ uid: n,
210
+ label: g,
211
+ hint: v,
212
+ errors: l,
213
+ touched: c,
214
+ required: w,
215
+ disabled: I,
216
+ readOnly: x,
217
+ value: a,
218
+ currency: f,
219
+ step: D,
220
+ maximumFractionDigits: $,
221
+ minimumFractionDigits: F,
222
+ icon: S,
223
+ autocomplete: C ?? void 0,
224
+ placeholder: b ?? void 0,
225
+ localeId: E,
226
+ onInput: y,
227
+ onBlur: m
228
+ }
229
+ ) });
230
+ }
231
+ export {
232
+ k as Currency
233
+ };
@@ -1,18 +1,20 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
2
  import { useInputWidget as x } from "@golemui/react";
3
+ import "@golemui/gui-shared";
3
4
  import { useCallback as D } from "react";
5
+ import "./date-input-Dux0mFJw.js";
4
6
  /* empty css */
5
- function H(c) {
7
+ function k(c) {
6
8
  const u = c.widget, {
7
- uid: g,
8
- errors: m,
9
+ uid: m,
10
+ errors: g,
9
11
  value: v,
10
- isTouched: h,
12
+ isTouched: p,
11
13
  templateData: e,
12
14
  onValueChanged: a,
13
15
  onBlur: n,
14
16
  injectValidationIssues: r
15
- } = x(u), p = D(
17
+ } = x(u), h = D(
16
18
  (o) => {
17
19
  const t = o, s = (i) => {
18
20
  r(null), a(i.detail.value);
@@ -28,12 +30,12 @@ function H(c) {
28
30
  return /* @__PURE__ */ d("div", { className: "gui-date gui-field", style: { flex: e.size }, children: /* @__PURE__ */ d(
29
31
  "gui-date",
30
32
  {
31
- ref: p,
32
- uid: g,
33
+ ref: h,
34
+ uid: m,
33
35
  label: f,
34
36
  hint: b,
35
- errors: m,
36
- touched: h,
37
+ errors: g,
38
+ touched: p,
37
39
  required: I,
38
40
  disabled: L,
39
41
  readOnly: y,
@@ -44,5 +46,5 @@ function H(c) {
44
46
  ) });
45
47
  }
46
48
  export {
47
- H as DateInput
49
+ k as DateInput
48
50
  };