@golemui/gui-react 0.0.2 → 0.12.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 (58) hide show
  1. package/Accordion-Btp_b0xA.js +59 -0
  2. package/{Alert-B71lVm89.js → Alert-CBgIsMKO.js} +1 -1
  3. package/Button-DN0G-MUb.js +21 -0
  4. package/{Calendar-BtYEcLJH.js → Calendar-Dxavv2c7.js} +12 -12
  5. package/Checkbox-ViM9MktI.js +30 -0
  6. package/Currency-C4QFWO7Y.js +37 -0
  7. package/{DateInput-B4S5ssKR.js → DateInput-CdkyyAhc.js} +4 -4
  8. package/DatePicker-TkMCndrw.js +138 -0
  9. package/Dropdown-jKk4TyOa.js +201 -0
  10. package/Errors-D7gxq0y6.js +16 -0
  11. package/Flex-gD893rrB.js +19 -0
  12. package/Grid-DREMTVQI.js +30 -0
  13. package/List-BjMIo577.js +103 -0
  14. package/Markdown-Ck_88HOR.js +47 -0
  15. package/MarkdownText-kJVkmihW.js +9 -0
  16. package/Number-CnQ95aLO.js +35 -0
  17. package/Password-Bg97DYW3.js +36 -0
  18. package/README.md +17 -4
  19. package/RadioGroup-Dldom5ja.js +33 -0
  20. package/RangeCalendar-u2vxIhna.js +49 -0
  21. package/RangeDateInput-CopLdb6J.js +54 -0
  22. package/RangeDatePicker-DXpV-B_G.js +146 -0
  23. package/Renderer-B6WmwKDv.js +9 -0
  24. package/Repeater-BYgXVfbl.js +111 -0
  25. package/Select-BLUX_W91.js +55 -0
  26. package/Tabs-C2qqi8xO.js +129 -0
  27. package/TextArea-cw3Q2v97.js +35 -0
  28. package/TextInput-geLoAA0c.js +32 -0
  29. package/{Toggle-CCzdFjkq.js → Toggle-a7L71GwR.js} +5 -5
  30. package/index.js +790 -698
  31. package/index.umd.cjs +2 -2
  32. package/lib/components/Form.d.ts +7 -13
  33. package/lib/components/Grid.d.ts +2 -0
  34. package/lib/components/Markdown.d.ts +2 -0
  35. package/lib/components/MarkdownText.d.ts +2 -0
  36. package/lib/components/RangeDateInput.d.ts +2 -0
  37. package/lib/components/RangeDatePicker.d.ts +2 -0
  38. package/lib/widget.loaders.d.ts +2 -2
  39. package/package.json +11 -6
  40. package/Accordion-F768Nqhg.js +0 -58
  41. package/Button-BctTVpNg.js +0 -20
  42. package/CHANGELOG.md +0 -529
  43. package/Checkbox-CezJrTAx.js +0 -30
  44. package/Currency-Bj2yx0JY.js +0 -36
  45. package/DatePicker-C1Qiridi.js +0 -130
  46. package/Dropdown-Dd50Psea.js +0 -196
  47. package/Flex-DPIzOItG.js +0 -11
  48. package/List-CLplkkLa.js +0 -103
  49. package/Number-DsIN4V1r.js +0 -34
  50. package/Password-B_QkZ1WU.js +0 -35
  51. package/RadioGroup-BPhyHxKf.js +0 -32
  52. package/RangeCalendar-B-FeEowl.js +0 -47
  53. package/Renderer-CRWbM4oE.js +0 -9
  54. package/Repeater-D1koXq-v.js +0 -46
  55. package/Select-DvFmJB1_.js +0 -54
  56. package/Tabs-CsmJz1Vs.js +0 -115
  57. package/TextArea-z99jVJ4-.js +0 -35
  58. package/TextInput-BTkEyMEv.js +0 -31
@@ -0,0 +1,59 @@
1
+ import { jsx as o, jsxs as g } from "react/jsx-runtime";
2
+ import { useLayoutWidget as v, WidgetRenderer as b } from "@golemui/react";
3
+ import { useState as x, useEffect as y, useCallback as d } from "react";
4
+ const f = {};
5
+ function C(h) {
6
+ const m = h.widget, { uid: p, children: r, templateData: n, onChange: a } = v(m), [t, s] = x(f);
7
+ y(() => {
8
+ t === f && n.defaultOpen && s(n.defaultOpen || {});
9
+ }, [t, n]);
10
+ const l = d(
11
+ (i) => {
12
+ const e = { ...t };
13
+ n.singleOpen && Object.keys(e).filter((c) => c !== i).forEach((c) => {
14
+ e[c] = c === i ? !e[c] : !1;
15
+ }), e[i] = !e[i], s(e), a(e);
16
+ },
17
+ [t, n.singleOpen, a]
18
+ ), u = d(
19
+ (i) => {
20
+ const e = r.find(
21
+ (w) => w.uid === i
22
+ ), c = t[i];
23
+ return (c || n.renderMode !== "activeOnly") && e ? /* @__PURE__ */ o(
24
+ "section",
25
+ {
26
+ className: "gui-widget",
27
+ role: "region",
28
+ id: `accordion_section_${i}`,
29
+ hidden: !c && n.renderMode !== "activeOnly",
30
+ "aria-labelledby": `accordion_button_${i}`,
31
+ children: /* @__PURE__ */ o(b, { widget: e })
32
+ }
33
+ ) : null;
34
+ },
35
+ [r, t, n.renderMode]
36
+ ), _ = d(() => (n.sections || []).map((e, c) => /* @__PURE__ */ g("div", { className: "gui-accordion__section", children: [
37
+ /* @__PURE__ */ g(
38
+ "button",
39
+ {
40
+ type: "button",
41
+ tabIndex: 0,
42
+ id: `accordion_button_${e.uid}`,
43
+ "aria-controls": `accordion_section_${e.uid}`,
44
+ "aria-expanded": t[e.uid] ? "true" : "false",
45
+ className: t[e.uid] ? "active" : "",
46
+ onClick: () => l(e.uid),
47
+ children: [
48
+ e.label,
49
+ /* @__PURE__ */ o("span", { className: "gui-accordion__arrow", children: /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 256 256", children: /* @__PURE__ */ o("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" }) }) })
50
+ ]
51
+ }
52
+ ),
53
+ u(e.uid)
54
+ ] }, `${"accordion_section_" + e.uid}`)), [n.sections, t, u, l]);
55
+ return /* @__PURE__ */ o("div", { className: "gui-accordion gui-field", style: { flex: n.size }, children: /* @__PURE__ */ o("div", { className: "gui-widget", id: p, children: _() }) });
56
+ }
57
+ export {
58
+ C as Accordion
59
+ };
@@ -2,7 +2,7 @@ import { jsx as i } from "react/jsx-runtime";
2
2
  import { useDisplayWdiget as r } from "@golemui/react";
3
3
  function s(t) {
4
4
  const l = t.widget, { uid: a, templateData: e } = r(l);
5
- return /* @__PURE__ */ i("div", { className: "gui-alert", style: { flex: e.size }, children: /* @__PURE__ */ i("div", { className: "gui-widget", id: a, children: /* @__PURE__ */ i(
5
+ return /* @__PURE__ */ i("div", { className: "gui-alert gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i("div", { className: "gui-widget", id: a, children: /* @__PURE__ */ i(
6
6
  "div",
7
7
  {
8
8
  role: "alert",
@@ -0,0 +1,21 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useActionWidget as l } from "@golemui/react";
3
+ /* empty css */
4
+ function r(o) {
5
+ const n = o.widget, { uid: e, templateData: i, onClick: a } = l(n);
6
+ return /* @__PURE__ */ t("div", { className: "gui-button gui-field", style: { flex: i.size }, children: /* @__PURE__ */ t(
7
+ "gui-button",
8
+ {
9
+ uid: e,
10
+ label: i.label,
11
+ disabled: i.disabled,
12
+ variant: i.variant,
13
+ icon: i.icon,
14
+ iconPosition: i.iconPosition,
15
+ onClick: a
16
+ }
17
+ ) });
18
+ }
19
+ export {
20
+ r as Button
21
+ };
@@ -1,11 +1,11 @@
1
- import { jsx as i } from "react/jsx-runtime";
1
+ import { jsx as l } from "react/jsx-runtime";
2
2
  import { useInputWidget as O } from "@golemui/react";
3
3
  import { useCallback as H } from "react";
4
4
  /* empty css */
5
- function V(l) {
6
- const c = l.widget, { uid: m, errors: u, value: h, isTouched: b, templateData: e, onBlur: t, onValueChanged: a } = O(c), g = H(
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
7
  (o) => {
8
- const n = o, r = (d) => a(d.detail.value), s = (d) => {
8
+ const n = o, r = (i) => a(i.detail.value), s = (i) => {
9
9
  t();
10
10
  };
11
11
  return o && (n.addEventListener("blur", s), n.addEventListener("change", r)), () => {
@@ -13,25 +13,25 @@ function V(l) {
13
13
  };
14
14
  },
15
15
  [a, t]
16
- ), v = e.label, p = e.hint, M = e.prevMonthIcon, f = e.nextMonthIcon, x = e.prevMonthAriaLabel, L = e.nextMonthAriaLabel, y = 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
- return /* @__PURE__ */ i("div", { className: "gui-calendar", children: /* @__PURE__ */ i(
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
+ return /* @__PURE__ */ l("div", { className: "gui-calendar gui-field", style: { flex: e.size }, children: /* @__PURE__ */ l(
18
18
  "gui-calendar",
19
19
  {
20
20
  ref: g,
21
21
  uid: m,
22
22
  label: v,
23
- hint: p,
23
+ hint: f,
24
24
  errors: u,
25
25
  touched: b,
26
26
  required: C,
27
27
  disabled: k,
28
28
  readOnly: q,
29
29
  value: h,
30
- prevMonthIcon: M,
31
- nextMonthIcon: f,
30
+ prevMonthIcon: p,
31
+ nextMonthIcon: M,
32
32
  prevMonthAriaLabel: x,
33
- nextMonthAriaLabel: L,
34
- dayFormat: y,
33
+ nextMonthAriaLabel: y,
34
+ dayFormat: L,
35
35
  weekdayFormat: D,
36
36
  monthFormat: F,
37
37
  minDate: I,
@@ -43,5 +43,5 @@ function V(l) {
43
43
  ) });
44
44
  }
45
45
  export {
46
- V as Calendar
46
+ T as Calendar
47
47
  };
@@ -0,0 +1,30 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useInputWidget as f } from "@golemui/react";
3
+ import { useCallback as k } from "react";
4
+ /* empty css */
5
+ function w(t) {
6
+ const n = t.widget, { uid: a, errors: s, value: l, onValueChanged: o, onBlur: c, templateData: e, isTouched: d } = f(n), r = k(
7
+ (p) => o(p.nativeEvent.detail.value),
8
+ [o]
9
+ ), u = e.label, h = e.hint, b = e.checkboxPosition, g = e.disabled, m = e.readonly, x = e.validator?.required;
10
+ return /* @__PURE__ */ i("div", { className: "gui-checkbox gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i(
11
+ "gui-checkbox",
12
+ {
13
+ uid: a,
14
+ label: u,
15
+ errors: s,
16
+ touched: d,
17
+ required: x,
18
+ disabled: g,
19
+ readOnly: m,
20
+ value: l,
21
+ hint: h,
22
+ checkboxPosition: b,
23
+ onChange: r,
24
+ onBlur: c
25
+ }
26
+ ) });
27
+ }
28
+ export {
29
+ w as Checkbox
30
+ };
@@ -0,0 +1,37 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useInputWidget as I } from "@golemui/react";
3
+ import { useCallback as w } from "react";
4
+ /* empty css */
5
+ function B(o) {
6
+ const n = o.widget, { uid: c, errors: a, value: r, isTouched: l, templateData: e, onValueChanged: t, onBlur: s } = I(n), u = w(
7
+ (q) => t(q.nativeEvent.detail.value),
8
+ [t]
9
+ ), d = e.label, m = e.hint, p = e.placeholder, g = e.currency, h = e.step, y = e.maximumFractionDigits, v = e.minimumFractionDigits, b = e.autocomplete, f = e.icon, D = e.disabled, x = e.readonly, C = e.validator?.required, F = e.lang;
10
+ return /* @__PURE__ */ i("div", { className: "gui-currency gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i(
11
+ "gui-currency",
12
+ {
13
+ uid: c,
14
+ label: d,
15
+ hint: m,
16
+ errors: a,
17
+ touched: l,
18
+ required: C,
19
+ disabled: D,
20
+ readOnly: x,
21
+ value: r,
22
+ currency: g,
23
+ step: h,
24
+ maximumFractionDigits: y,
25
+ minimumFractionDigits: v,
26
+ icon: f,
27
+ autocomplete: b ?? void 0,
28
+ placeholder: p ?? void 0,
29
+ localeId: F,
30
+ onInput: u,
31
+ onBlur: s
32
+ }
33
+ ) });
34
+ }
35
+ export {
36
+ B as Currency
37
+ };
@@ -24,14 +24,14 @@ function H(c) {
24
24
  };
25
25
  },
26
26
  [a, n, r]
27
- ), b = e.label, f = e.hint, E = e.icon, L = e.disabled, y = e.readonly, I = e.validator?.required, q = e.lang;
28
- return /* @__PURE__ */ d("div", { className: "gui-date", style: { flex: e.size }, children: /* @__PURE__ */ d(
27
+ ), f = e.label, b = e.hint, E = e.icon, L = e.disabled, y = e.readonly, I = e.validator?.required, q = e.lang;
28
+ return /* @__PURE__ */ d("div", { className: "gui-date gui-field", style: { flex: e.size }, children: /* @__PURE__ */ d(
29
29
  "gui-date",
30
30
  {
31
31
  ref: p,
32
32
  uid: g,
33
- label: b,
34
- hint: f,
33
+ label: f,
34
+ hint: b,
35
35
  errors: m,
36
36
  touched: h,
37
37
  required: I,
@@ -0,0 +1,138 @@
1
+ import { jsxs as L, jsx as i } from "react/jsx-runtime";
2
+ import { useInputWidget as W } from "@golemui/react";
3
+ import { useState as Z, useRef as k, useCallback as M, useEffect as G } from "react";
4
+ /* empty css */
5
+ import { E as J } from "./Errors-D7gxq0y6.js";
6
+ function ne(D) {
7
+ const R = D.widget, {
8
+ uid: l,
9
+ errors: h,
10
+ value: w,
11
+ isTouched: f,
12
+ templateData: t,
13
+ onValueChanged: g,
14
+ onBlur: d,
15
+ injectValidationIssues: u
16
+ } = W(R), [c, o] = Z(!1), x = k(null), v = k(null), p = k(null), F = M(
17
+ (n) => {
18
+ const e = n, r = (E) => {
19
+ u(null), g(E.detail.value);
20
+ }, a = (E) => {
21
+ u([E.detail.message]);
22
+ }, s = () => {
23
+ o(!0);
24
+ };
25
+ return v.current = n, n && (e.addEventListener("change", r), e.addEventListener("focus", s), e.addEventListener("blur", d), e.addEventListener("inputError", a)), () => {
26
+ e.removeEventListener("change", r), e.removeEventListener("focus", s), e.removeEventListener("blur", d), e.removeEventListener("inputError", a);
27
+ };
28
+ },
29
+ [g, d, u]
30
+ ), O = M(
31
+ (n) => {
32
+ const e = n, r = (s) => {
33
+ u(null), g(s.detail.value);
34
+ }, a = (s) => {
35
+ d(), o(!1);
36
+ };
37
+ return p.current = n, n && (e.addEventListener("blur", a), e.addEventListener("change", r)), () => {
38
+ e.addEventListener("blur", a), e.addEventListener("change", r);
39
+ };
40
+ },
41
+ [g, u, d]
42
+ );
43
+ G(() => {
44
+ const n = (e) => {
45
+ if (!c) return;
46
+ const r = e.composedPath(), a = v.current && r.includes(v.current), s = p.current && r.includes(p.current);
47
+ !a && !s && o(!1);
48
+ };
49
+ return document.addEventListener("click", n), () => {
50
+ document.removeEventListener("click", n);
51
+ };
52
+ }, [c]);
53
+ const _ = (n) => {
54
+ if (!c) return;
55
+ const e = n.relatedTarget;
56
+ e && x.current?.contains(e) || o(!1);
57
+ }, A = (n) => {
58
+ const e = n.target, r = e.closest(".gui-date-input__part"), a = e.closest("gui-calendar");
59
+ r || a ? c || o(!0) : o((s) => !s);
60
+ }, m = t.hint, H = t.icon, N = t.prevMonthIcon, q = t.nextMonthIcon, T = t.prevMonthAriaLabel, j = t.nextMonthAriaLabel, B = t.dayFormat, P = t.weekdayFormat, V = t.monthFormat, $ = t.minDate, z = t.maxDate, K = t.disabledRanges, S = t.numberOfMonths, U = f && h && h.length > 0, C = t.disabled, y = t.readonly, b = t.validator?.required, I = t.lang;
61
+ return /* @__PURE__ */ L(
62
+ "div",
63
+ {
64
+ ref: x,
65
+ className: "gui-date-picker gui-field",
66
+ style: { flex: t.size },
67
+ onBlur: _,
68
+ children: [
69
+ t.label && /* @__PURE__ */ L("label", { className: "gui-label", htmlFor: l, "data-cy": `${l}_label`, children: [
70
+ t.label + (b ? " *" : ""),
71
+ m && /* @__PURE__ */ i("div", { className: "gui-widget-hint", id: `${l}_hint`, children: m })
72
+ ] }),
73
+ /* @__PURE__ */ L(
74
+ "div",
75
+ {
76
+ role: "button",
77
+ tabIndex: -1,
78
+ className: "gui-widget",
79
+ onClick: A,
80
+ onKeyUp: (n) => {
81
+ n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && o((e) => !e);
82
+ },
83
+ "aria-expanded": c,
84
+ children: [
85
+ /* @__PURE__ */ i(
86
+ "gui-date",
87
+ {
88
+ ref: F,
89
+ uid: l,
90
+ hint: m,
91
+ showErrors: !1,
92
+ errors: h,
93
+ touched: f,
94
+ required: b,
95
+ disabled: C,
96
+ readOnly: y,
97
+ value: w,
98
+ icon: H,
99
+ localeId: I
100
+ }
101
+ ),
102
+ /* @__PURE__ */ i("span", { className: "gui-date-picker__arrow", children: /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 256 256", children: /* @__PURE__ */ i("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" }) }) }),
103
+ c && /* @__PURE__ */ i(
104
+ "gui-calendar",
105
+ {
106
+ ref: O,
107
+ uid: l,
108
+ hint: m,
109
+ touched: f,
110
+ required: b,
111
+ disabled: C,
112
+ readOnly: y,
113
+ value: w,
114
+ prevMonthIcon: N,
115
+ nextMonthIcon: q,
116
+ prevMonthAriaLabel: T,
117
+ nextMonthAriaLabel: j,
118
+ dayFormat: B,
119
+ weekdayFormat: P,
120
+ monthFormat: V,
121
+ minDate: $,
122
+ maxDate: z,
123
+ disabledRanges: K,
124
+ numberOfMonths: S,
125
+ localeId: I
126
+ }
127
+ )
128
+ ]
129
+ }
130
+ ),
131
+ U && /* @__PURE__ */ i(J, { errors: h, uid: l })
132
+ ]
133
+ }
134
+ );
135
+ }
136
+ export {
137
+ ne as DatePicker
138
+ };
@@ -0,0 +1,201 @@
1
+ import { jsxs as M, jsx as u } from "react/jsx-runtime";
2
+ import { useInputWidget as ae, useDebounceCallback as oe, useItemRenderer as de } from "@golemui/react";
3
+ import { useState as g, useRef as q, useMemo as ue, useCallback as I, useEffect as R } from "react";
4
+ import { D as fe } from "./DefaultListItemRenderer-lNc9Kk7x.js";
5
+ function pe(P) {
6
+ const y = P.widget, { uid: d, errors: w, value: b, isTouched: L, templateData: t, onFilter: x, onValueChanged: D, onBlur: B } = ae(y), [k, z] = g({ start: 0, end: 10 }), [C, U] = g([]), [W, N] = g([]), [Z, A] = g(-1), [J, v] = g(!1), [m, f] = g(!1), [p, j] = g(void 0), r = q(null), c = q(null), O = q(null), Q = ue(() => C.slice(k.start, k.end), [C, k]), S = I(() => {
7
+ B(), f(!1), v(!1);
8
+ }, [B]), F = I(
9
+ (e) => {
10
+ if (D(e), c.current) {
11
+ const n = (t.items || []).find(
12
+ (i) => t.valueField ? i[t.valueField] === e : i === e
13
+ );
14
+ if (n) {
15
+ const i = t.valueField ? n[t.valueField] : n;
16
+ c.current.value = String(i);
17
+ } else e || (c.current.value = "");
18
+ }
19
+ f(!1), v(!1);
20
+ },
21
+ [D, t]
22
+ ), X = I(
23
+ (e, s) => {
24
+ t.readonly || (F(e.value), x(""), A(s), j(e), v(!1), f(!1), r.current && r.current.focusItemAtIndex(s));
25
+ },
26
+ [F, x, t.readonly]
27
+ );
28
+ R(() => {
29
+ const e = r.current;
30
+ if (!e) return;
31
+ const s = (a) => {
32
+ const { startIndex: l, endIndex: o } = a.detail;
33
+ z({ start: l, end: o });
34
+ }, n = (a) => {
35
+ const l = a.detail;
36
+ if (U(l ? [...l] : []), !p && b != null && l) {
37
+ const o = l.find((G) => G.value === b);
38
+ o && j(o);
39
+ }
40
+ }, i = (a) => {
41
+ const l = a.detail.index;
42
+ A(l);
43
+ }, h = (a) => {
44
+ const l = a.detail.value;
45
+ F(l), j(C.find((o) => o.value === l)), v(!1), f(!1);
46
+ };
47
+ return e.addEventListener("gui-range-change", s), e.addEventListener("gui-update-items", n), e.addEventListener("gui-focus-change", i), e.addEventListener("change", h), () => {
48
+ e.removeEventListener("gui-range-change", s), e.removeEventListener("gui-update-items", n), e.removeEventListener("gui-focus-change", i), e.removeEventListener("change", h);
49
+ };
50
+ }, [F, C, D]), R(() => {
51
+ const e = (s) => {
52
+ if (!m) return;
53
+ const n = s.target, i = c.current && c.current.contains(n), h = r.current && r.current.contains(n);
54
+ !i && !h && S();
55
+ };
56
+ return document.addEventListener("click", e), () => document.removeEventListener("click", e);
57
+ }, [S, m]), R(() => {
58
+ const s = p?.template !== null && typeof p?.template == "object" ? t.labelField ?? "label" : null, n = s ? p?.template[s] : p?.template;
59
+ c.current.value = n ?? "";
60
+ }, [p, t.labelField]), R(() => {
61
+ O.current && c.current && r.current && (O.current.targetElement = [c.current, r.current]);
62
+ }, []);
63
+ const Y = async (e) => {
64
+ switch (e.key) {
65
+ case "ArrowDown":
66
+ e.preventDefault(), f(!0), setTimeout(() => {
67
+ r.current && (r.current.focus(), r.current.scrollToSelectedIndex());
68
+ }, 0);
69
+ break;
70
+ case "Enter":
71
+ c.current?.value || F(null);
72
+ break;
73
+ }
74
+ }, ee = I(
75
+ (e) => {
76
+ const s = !!y.on?.filter;
77
+ if (x(e), e && !s) {
78
+ v(!0), f(!0);
79
+ const n = t.searchFields ?? [t.labelField, t.valueField].filter(
80
+ (l) => !!l
81
+ ), i = n.length > 0, a = (t.items || []).filter((l) => {
82
+ const o = Object.keys(l);
83
+ if (!o.length)
84
+ return l.toString().toLowerCase().includes(e.toLowerCase());
85
+ const K = ($, ce) => $ || l[ce].toString().toLowerCase().includes(e.toLowerCase());
86
+ return i ? o.filter(($) => n.includes($)).reduce(K, !1) : o.reduce(K, !1);
87
+ });
88
+ N(a);
89
+ } else
90
+ v(!1), N([...t.items || []]);
91
+ },
92
+ [
93
+ y.on?.filter,
94
+ x,
95
+ t.items,
96
+ t.labelField,
97
+ t.searchFields,
98
+ t.valueField
99
+ ]
100
+ ), te = oe(ee, t.inputDebounce ?? 500), ne = (e) => {
101
+ const s = e.target.value;
102
+ m || f(!0), te(s);
103
+ }, H = I(() => {
104
+ m || (f(!0), setTimeout(() => {
105
+ r.current && r.current.scrollToSelectedIndex();
106
+ }, 0));
107
+ }, [m]), V = (e) => {
108
+ const s = e.relatedTarget, n = c.current && c.current.contains(s), i = r.current && r.current.contains(s);
109
+ n || i || S();
110
+ }, se = de(t.itemRenderer) || fe, le = t.label, T = t.validator?.required, _ = t.disabled, E = t.readonly, ie = !!y.on?.filter, re = L && w && w.length > 0;
111
+ return /* @__PURE__ */ M("div", { className: "gui-dropdown gui-field", style: { flex: t.size }, children: [
112
+ /* @__PURE__ */ u(
113
+ "gui-label",
114
+ {
115
+ ref: O,
116
+ uid: d,
117
+ label: le,
118
+ hint: t.hint,
119
+ errors: w,
120
+ touched: L,
121
+ required: T,
122
+ native: !1
123
+ }
124
+ ),
125
+ /* @__PURE__ */ M("div", { className: "gui-widget", "aria-expanded": m, children: [
126
+ /* @__PURE__ */ u(
127
+ "input",
128
+ {
129
+ ref: c,
130
+ type: "text",
131
+ id: d,
132
+ "data-cy": `${d}_textinput`,
133
+ defaultValue: b ?? "",
134
+ required: T,
135
+ disabled: _,
136
+ readOnly: E,
137
+ placeholder: t.placeholder ?? "",
138
+ autoComplete: t.autocomplete ?? void 0,
139
+ onKeyDown: Y,
140
+ onInput: ne,
141
+ onFocus: H,
142
+ onBlur: V,
143
+ "aria-labelledby": t.label ? `${d}_label` : void 0,
144
+ "aria-describedby": t.hint ? `${d}_hint` : void 0
145
+ }
146
+ ),
147
+ /* @__PURE__ */ u("span", { className: "gui-dropdown__arrow", children: /* @__PURE__ */ u("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 256 256", children: /* @__PURE__ */ u("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" }) }) }),
148
+ /* @__PURE__ */ u(
149
+ "gui-list",
150
+ {
151
+ ref: r,
152
+ id: `${d}-list`,
153
+ uid: d,
154
+ value: b ?? "",
155
+ valueField: t.valueField,
156
+ items: J && !ie ? W : t.items,
157
+ itemHeight: t.itemHeight,
158
+ height: t.height,
159
+ required: T,
160
+ touched: L,
161
+ disabled: _ || E,
162
+ readOnly: E,
163
+ hidden: !m,
164
+ onFocus: H,
165
+ onBlur: V,
166
+ children: Q.map((e, s) => {
167
+ const n = k.start + s, i = b === e.value, h = Z === n, a = t.labelField ?? "label", o = e.template !== null && typeof e.template == "object" && a && !t.itemRenderer ? e.template[a] : e.template;
168
+ return /* @__PURE__ */ u(
169
+ "div",
170
+ {
171
+ role: "option",
172
+ tabIndex: -1,
173
+ className: "gui-list__item-wrapper",
174
+ id: `${d}-item-${n}`,
175
+ style: { height: `${t.itemHeight || 40}px` },
176
+ "aria-selected": i,
177
+ onClick: () => X(e, n),
178
+ children: /* @__PURE__ */ u(
179
+ se,
180
+ {
181
+ template: o,
182
+ value: e.value,
183
+ index: n,
184
+ selected: i,
185
+ disabled: _ || E,
186
+ focused: h
187
+ }
188
+ )
189
+ },
190
+ n
191
+ );
192
+ })
193
+ }
194
+ )
195
+ ] }),
196
+ re && /* @__PURE__ */ u("gui-errors", { uid: d, errors: w, touched: L })
197
+ ] });
198
+ }
199
+ export {
200
+ pe as Dropdown
201
+ };
@@ -0,0 +1,16 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ function i({ errors: o, uid: r }) {
3
+ return /* @__PURE__ */ a("ul", { className: "gui-validator", id: `${r}_errors`, "data-cy": `${r}_validator-errors`, children: o.map((e, l) => /* @__PURE__ */ a(
4
+ "li",
5
+ {
6
+ className: "gui-validator__error",
7
+ role: "alert",
8
+ "data-cy": `${r}_validator-error`,
9
+ children: e
10
+ },
11
+ l
12
+ )) });
13
+ }
14
+ export {
15
+ i as E
16
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useLayoutWidget as a, WidgetRenderer as c } from "@golemui/react";
3
+ import { useCallback as f } from "react";
4
+ /* empty css */
5
+ function $(l) {
6
+ const n = l.widget, { uid: d, children: i, templateData: e } = a(n), s = f(() => i ? i.map((r) => /* @__PURE__ */ t(c, { widget: r }, r.uid)) : null, [i]), g = `gui-flex__widget--${e.direction ?? "column"}`, u = `gui-flex__widget--justify-${e.justify ?? "stretch"}`, o = `gui-flex__widget--align-${e.align ?? "start"}`;
7
+ return /* @__PURE__ */ t("div", { className: "gui-flex gui-field", style: { flex: e.size }, children: /* @__PURE__ */ t(
8
+ "div",
9
+ {
10
+ className: `gui-flex__widget ${g} ${u} ${o}`,
11
+ style: e.gap ? { gap: `${e.gap}px` } : {},
12
+ id: d,
13
+ children: s()
14
+ }
15
+ ) });
16
+ }
17
+ export {
18
+ $ as Flex
19
+ };
@@ -0,0 +1,30 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useLayoutWidget as p, WidgetRenderer as w } from "@golemui/react";
3
+ import { useCallback as _ } from "react";
4
+ /* empty css */
5
+ function h(g) {
6
+ const n = g.widget, { uid: s, children: d, templateData: i } = p(n), o = i.direction !== "column", u = _(() => d.map((m) => {
7
+ const r = m;
8
+ return /* @__PURE__ */ t(
9
+ "div",
10
+ {
11
+ className: "gui-grid__cell",
12
+ style: { gridColumn: `span ${r.size || 1}` },
13
+ children: /* @__PURE__ */ t(w, { widget: r })
14
+ },
15
+ r.uid
16
+ );
17
+ }), [d]), c = o ? "gui-grid__widget--row" : "gui-grid__widget--column", l = `gui-grid__widget--align-${i.align ?? "stretch"}`, a = i.justify ? `gui-grid__widget--justify-${i.justify}` : "", e = {};
18
+ return i.columnGap !== void 0 && (e.columnGap = `${i.columnGap}px`), i.rowGap !== void 0 && (e.rowGap = `${i.rowGap}px`), /* @__PURE__ */ t("div", { className: "gui-grid gui-field", style: { flex: i.size }, children: /* @__PURE__ */ t(
19
+ "div",
20
+ {
21
+ className: `gui-grid__widget ${c} ${o && (i.autoFit ?? !0) ? "gui-grid__widget--row--auto-fit" : ""} ${l} ${a}`,
22
+ style: e,
23
+ id: s,
24
+ children: u()
25
+ }
26
+ ) });
27
+ }
28
+ export {
29
+ h as Grid
30
+ };