@golemui/gui-react 0.0.2 → 0.12.1

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/CHANGELOG.md +2 -528
  5. package/{Calendar-BtYEcLJH.js → Calendar-Dxavv2c7.js} +12 -12
  6. package/Checkbox-ViM9MktI.js +30 -0
  7. package/Currency-C4QFWO7Y.js +37 -0
  8. package/{DateInput-B4S5ssKR.js → DateInput-CdkyyAhc.js} +4 -4
  9. package/DatePicker-TkMCndrw.js +138 -0
  10. package/Dropdown-jKk4TyOa.js +201 -0
  11. package/Errors-D7gxq0y6.js +16 -0
  12. package/Flex-gD893rrB.js +19 -0
  13. package/Grid-DREMTVQI.js +30 -0
  14. package/List-BjMIo577.js +103 -0
  15. package/Markdown-Ck_88HOR.js +47 -0
  16. package/MarkdownText-kJVkmihW.js +9 -0
  17. package/Number-CnQ95aLO.js +35 -0
  18. package/Password-Bg97DYW3.js +36 -0
  19. package/README.md +17 -4
  20. package/RadioGroup-Dldom5ja.js +33 -0
  21. package/RangeCalendar-u2vxIhna.js +49 -0
  22. package/RangeDateInput-CopLdb6J.js +54 -0
  23. package/RangeDatePicker-DXpV-B_G.js +146 -0
  24. package/Renderer-B6WmwKDv.js +9 -0
  25. package/Repeater-BYgXVfbl.js +111 -0
  26. package/Select-BLUX_W91.js +55 -0
  27. package/Tabs-C2qqi8xO.js +129 -0
  28. package/TextArea-cw3Q2v97.js +35 -0
  29. package/TextInput-geLoAA0c.js +32 -0
  30. package/{Toggle-CCzdFjkq.js → Toggle-a7L71GwR.js} +5 -5
  31. package/index.js +790 -698
  32. package/index.umd.cjs +2 -2
  33. package/lib/components/Form.d.ts +7 -13
  34. package/lib/components/Grid.d.ts +2 -0
  35. package/lib/components/Markdown.d.ts +2 -0
  36. package/lib/components/MarkdownText.d.ts +2 -0
  37. package/lib/components/RangeDateInput.d.ts +2 -0
  38. package/lib/components/RangeDatePicker.d.ts +2 -0
  39. package/lib/widget.loaders.d.ts +2 -2
  40. package/package.json +11 -6
  41. package/Accordion-F768Nqhg.js +0 -58
  42. package/Button-BctTVpNg.js +0 -20
  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,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
+ };
@@ -0,0 +1,103 @@
1
+ import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
+ import { useCallback as R, useRef as $, useState as b, useMemo as S, useEffect as _ } from "react";
3
+ import { useInputWidget as z, useItemRenderer as A } from "@golemui/react";
4
+ import { D as M } from "./DefaultListItemRenderer-lNc9Kk7x.js";
5
+ function J(C) {
6
+ const F = C.widget, { uid: d, errors: c, value: I, isTouched: u, templateData: t, onValueChanged: m, onBlur: x } = z(F), y = R(
7
+ (e) => {
8
+ r.current && e.relatedTarget && r.current.contains(e.relatedTarget) || x();
9
+ },
10
+ [x]
11
+ ), [g, j] = b({ start: 0, end: 10 }), [v, w] = b([]), [q, E] = b(-1), r = $(null), D = S(() => (v.length > 0 ? v : t.items || []).slice(g.start, g.end), [v, t.items, g]);
12
+ _(() => {
13
+ const e = r.current;
14
+ if (!e) return;
15
+ const i = (n) => {
16
+ const { startIndex: s, endIndex: p } = n.detail;
17
+ j({ start: s, end: p });
18
+ }, a = (n) => {
19
+ const s = n.detail;
20
+ w(s ? [...s] : []);
21
+ }, o = (n) => {
22
+ const s = n.detail.index;
23
+ E(s);
24
+ }, h = (n) => {
25
+ const s = n.detail.value;
26
+ m(s);
27
+ };
28
+ return e.addEventListener("change", h), e.addEventListener("gui-update-items", a), e.addEventListener("gui-range-change", i), e.addEventListener("gui-focus-change", o), () => {
29
+ e.removeEventListener("change", h), e.removeEventListener("gui-update-items", a), e.removeEventListener("gui-range-change", i), e.removeEventListener("gui-focus-change", o);
30
+ };
31
+ }, [m]);
32
+ const O = R(
33
+ (e, i) => {
34
+ t.disabled || (m(e.value), E(i), r.current && r.current.focusItemAtIndex(i));
35
+ },
36
+ [m]
37
+ ), k = A(t.itemRenderer) || M, B = t.label, L = t.validator?.required, f = t.disabled, H = t.readonly, N = u && c && c.length > 0;
38
+ return /* @__PURE__ */ T("div", { className: "gui-list gui-field", style: { flex: t.size }, children: [
39
+ /* @__PURE__ */ l(
40
+ "gui-label",
41
+ {
42
+ targetElement: r.current || void 0,
43
+ uid: d,
44
+ label: B,
45
+ hint: t.hint,
46
+ errors: c,
47
+ touched: u,
48
+ required: L,
49
+ native: !1
50
+ }
51
+ ),
52
+ /* @__PURE__ */ l("div", { className: "gui-widget", children: /* @__PURE__ */ l(
53
+ "gui-list",
54
+ {
55
+ ref: r,
56
+ id: d,
57
+ uid: d,
58
+ value: I ?? "",
59
+ valueField: t.valueField,
60
+ items: t.items,
61
+ itemHeight: t.itemHeight,
62
+ height: t.height,
63
+ required: L,
64
+ touched: u,
65
+ disabled: f,
66
+ readOnly: H,
67
+ onBlur: y,
68
+ children: D.map((e, i) => {
69
+ const a = g.start + i, o = I === e.value, h = q === a, n = t.labelField ?? "label", p = e.template !== null && typeof e.template == "object" && n && !t.itemRenderer ? e.template[n] : e.template;
70
+ return /* @__PURE__ */ l(
71
+ "div",
72
+ {
73
+ role: "option",
74
+ tabIndex: -1,
75
+ id: `${d}-item-${a}`,
76
+ className: "gui-list__item-wrapper",
77
+ style: { height: `${t.itemHeight || 40}px` },
78
+ "aria-selected": o,
79
+ "aria-disabled": f ? "true" : "false",
80
+ onClick: () => O(e, a),
81
+ children: /* @__PURE__ */ l(
82
+ k,
83
+ {
84
+ template: p,
85
+ value: e.value,
86
+ index: i,
87
+ selected: o,
88
+ disabled: f,
89
+ focused: h
90
+ }
91
+ )
92
+ },
93
+ a
94
+ );
95
+ })
96
+ }
97
+ ) }),
98
+ N && /* @__PURE__ */ l("gui-errors", { uid: d, errors: c, touched: u })
99
+ ] });
100
+ }
101
+ export {
102
+ J as List
103
+ };
@@ -0,0 +1,47 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useInputWidget as P } from "@golemui/react";
3
+ import { useCallback as R } from "react";
4
+ /* empty css */
5
+ function N(o) {
6
+ const l = o.widget, { uid: n, errors: s, value: d, isTouched: r, templateData: e, onValueChanged: t, onBlur: a } = P(l), c = R(
7
+ (I) => t(I.nativeEvent.detail.value),
8
+ [t]
9
+ ), u = e.label, m = e.hint, h = e.placeholder, p = e.autocomplete, T = e.validator?.maxLength, g = e.counterMode, w = e.autoGrow, v = e.minimumHeight, b = e.tools, f = e.defaultOpenPreview, k = e.headingTitle, L = e.boldTitle, q = e.italicTitle, x = e.strikethroughTitle, y = e.quoteTitle, C = e.linkTitle, M = e.orderedListTitle, O = e.unorderedListTitle, V = e.splitViewTitle, D = e.disabled, G = e.readonly, H = e.validator?.required;
10
+ return /* @__PURE__ */ i("div", { className: "gui-markdown gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i(
11
+ "gui-markdown",
12
+ {
13
+ uid: n,
14
+ label: u,
15
+ errors: s,
16
+ touched: r,
17
+ required: H,
18
+ disabled: D,
19
+ readOnly: G,
20
+ value: d,
21
+ hint: m,
22
+ placeholder: h,
23
+ autocomplete: p ?? void 0,
24
+ counterMode: g,
25
+ minimumHeight: v,
26
+ autoGrow: w,
27
+ maxLength: T,
28
+ tools: b,
29
+ defaultOpenPreview: f,
30
+ headingTitle: k,
31
+ boldTitle: L,
32
+ italicTitle: q,
33
+ strikethroughTitle: x,
34
+ quoteTitle: y,
35
+ linkTitle: C,
36
+ orderedListTitle: M,
37
+ unorderedListTitle: O,
38
+ splitViewTitle: V,
39
+ dependencies: e.deps,
40
+ onInput: c,
41
+ onBlur: a
42
+ }
43
+ ) });
44
+ }
45
+ export {
46
+ N as Markdown
47
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useDisplayWdiget as n } from "@golemui/react";
3
+ function m(t) {
4
+ const d = t.widget, { uid: s, templateData: e } = n(d);
5
+ return /* @__PURE__ */ i("div", { className: "gui-markdown-text gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i("div", { className: "gui-widget", id: s, children: /* @__PURE__ */ i("gui-markdown-text", { md: e.md, dependencies: e.deps }) }) });
6
+ }
7
+ export {
8
+ m as MarkdownText
9
+ };