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