@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,47 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as O } from "@golemui/react";
|
|
3
|
+
import { useCallback as H } from "react";
|
|
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(
|
|
7
|
+
(o) => {
|
|
8
|
+
const n = o, r = (d) => a(d.detail.value), s = (d) => {
|
|
9
|
+
t();
|
|
10
|
+
};
|
|
11
|
+
return o && (n.addEventListener("blur", s), n.addEventListener("change", r)), () => {
|
|
12
|
+
n.removeEventListener("blur", s), n.removeEventListener("change", r);
|
|
13
|
+
};
|
|
14
|
+
},
|
|
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-range-calendar", children: /* @__PURE__ */ i(
|
|
18
|
+
"gui-range-calendar",
|
|
19
|
+
{
|
|
20
|
+
ref: g,
|
|
21
|
+
uid: m,
|
|
22
|
+
label: v,
|
|
23
|
+
hint: p,
|
|
24
|
+
errors: u,
|
|
25
|
+
touched: b,
|
|
26
|
+
required: C,
|
|
27
|
+
disabled: k,
|
|
28
|
+
readOnly: q,
|
|
29
|
+
value: h,
|
|
30
|
+
prevMonthIcon: M,
|
|
31
|
+
nextMonthIcon: f,
|
|
32
|
+
prevMonthAriaLabel: x,
|
|
33
|
+
nextMonthAriaLabel: L,
|
|
34
|
+
dayFormat: y,
|
|
35
|
+
weekdayFormat: D,
|
|
36
|
+
monthFormat: F,
|
|
37
|
+
minDate: I,
|
|
38
|
+
maxDate: R,
|
|
39
|
+
disabledRanges: w,
|
|
40
|
+
numberOfMonths: A,
|
|
41
|
+
localeId: E
|
|
42
|
+
}
|
|
43
|
+
) });
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
V as RangeCalendar
|
|
47
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useDisplayWdiget as s } from "@golemui/react";
|
|
3
|
+
function c(r) {
|
|
4
|
+
const i = r.widget, { uid: t, templateData: d } = s(i), n = d?.render;
|
|
5
|
+
return /* @__PURE__ */ e("div", { className: "gui-renderer", children: /* @__PURE__ */ e("div", { className: "gui-widget", id: t, children: n }) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
c as Renderer
|
|
9
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as g, RepeaterIndexContext as h, WidgetRenderer as v } from "@golemui/react";
|
|
3
|
+
import { useCallback as o } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function w(m) {
|
|
6
|
+
const u = m.widget, { uid: l, value: a, onValueChanged: i, templateData: e } = g(u), p = o(
|
|
7
|
+
(n) => {
|
|
8
|
+
const t = [...n ?? [], {}];
|
|
9
|
+
i(t);
|
|
10
|
+
},
|
|
11
|
+
[i]
|
|
12
|
+
), d = o(
|
|
13
|
+
(n, t) => {
|
|
14
|
+
const s = [...n ?? []];
|
|
15
|
+
s.splice(t, 1), i(s);
|
|
16
|
+
},
|
|
17
|
+
[i]
|
|
18
|
+
), b = o(() => a?.map((n, t) => /* @__PURE__ */ r(h.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: "card", children: [
|
|
19
|
+
/* @__PURE__ */ r(
|
|
20
|
+
v,
|
|
21
|
+
{
|
|
22
|
+
widget: e.template,
|
|
23
|
+
repeaterIndex: t
|
|
24
|
+
},
|
|
25
|
+
`${l}-${t}`
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ r("button", { type: "button", className: "gui-button", onClick: () => d(a, t), children: e.removeLabel ?? "Remove" })
|
|
28
|
+
] }) }, `${l}-${t}`)), [e, a, l, d]);
|
|
29
|
+
return /* @__PURE__ */ r("div", { className: "gui-repeater", style: { flex: e.size }, children: /* @__PURE__ */ c("div", { id: l, children: [
|
|
30
|
+
e.label && /* @__PURE__ */ r("h2", { children: e.label }, `${l}-title`),
|
|
31
|
+
b(),
|
|
32
|
+
/* @__PURE__ */ r(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
className: "gui-button",
|
|
37
|
+
onClick: () => p(a || []),
|
|
38
|
+
disabled: e.limit ? e.limit === (a?.length ?? 0) : !1,
|
|
39
|
+
children: e.addLabel ?? "Add"
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }) });
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
w as Repeater
|
|
46
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as D } from "@golemui/react";
|
|
3
|
+
import { useCallback as s } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function z(a) {
|
|
6
|
+
const d = a.widget, {
|
|
7
|
+
uid: c,
|
|
8
|
+
errors: u,
|
|
9
|
+
value: p,
|
|
10
|
+
isTouched: h,
|
|
11
|
+
templateData: e,
|
|
12
|
+
onValueChanged: n,
|
|
13
|
+
onBlur: m,
|
|
14
|
+
injectValidationIssues: i
|
|
15
|
+
} = D(d), v = s(
|
|
16
|
+
(t) => n(t.nativeEvent.detail.value),
|
|
17
|
+
[n]
|
|
18
|
+
), g = s(
|
|
19
|
+
(t) => {
|
|
20
|
+
const o = t, l = (w) => {
|
|
21
|
+
i([w.detail.message]);
|
|
22
|
+
};
|
|
23
|
+
return t && o.addEventListener("inputError", l), () => {
|
|
24
|
+
o.removeEventListener("inputError", l);
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
[i]
|
|
28
|
+
), b = e.options, f = e.label, E = e.hint, y = e.placeholder, C = e.icon, F = e.valueField, q = e.labelField, x = e.disabled, R = e.readonly, j = e.validator?.required;
|
|
29
|
+
return /* @__PURE__ */ r("div", { className: "gui-select", style: { flex: e.size }, children: /* @__PURE__ */ r(
|
|
30
|
+
"gui-select",
|
|
31
|
+
{
|
|
32
|
+
ref: g,
|
|
33
|
+
uid: c,
|
|
34
|
+
label: f,
|
|
35
|
+
errors: u,
|
|
36
|
+
touched: h,
|
|
37
|
+
required: j,
|
|
38
|
+
disabled: x,
|
|
39
|
+
readOnly: R,
|
|
40
|
+
value: p,
|
|
41
|
+
hint: E,
|
|
42
|
+
placeholder: y,
|
|
43
|
+
icon: C,
|
|
44
|
+
options: b,
|
|
45
|
+
labelField: q,
|
|
46
|
+
valueField: F,
|
|
47
|
+
onChange: v,
|
|
48
|
+
onBlur: m
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
z as Select
|
|
54
|
+
};
|
package/Tabs-CsmJz1Vs.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as l, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutWidget as N, WidgetRenderer as E, cn as A } from "@golemui/react";
|
|
3
|
+
import { createIntersectionObserver as x } from "@golemui/gui-components";
|
|
4
|
+
import { useRef as u, useState as h, useEffect as b, useCallback as f } from "react";
|
|
5
|
+
function z(y) {
|
|
6
|
+
const m = u(null), r = y.widget, { uid: O, children: g, templateData: e, onChange: $ } = N(r), c = u([]), w = u(null), _ = u(null), [S, R] = h(!1), [k, T] = h(!1), [s, p] = h(e.defaultOpen);
|
|
7
|
+
b(() => {
|
|
8
|
+
const i = w.current, t = _.current, a = x(
|
|
9
|
+
i,
|
|
10
|
+
(n) => R(n)
|
|
11
|
+
), d = x(
|
|
12
|
+
t,
|
|
13
|
+
(n) => T(n)
|
|
14
|
+
);
|
|
15
|
+
return () => {
|
|
16
|
+
a.disconnect(), d.disconnect();
|
|
17
|
+
};
|
|
18
|
+
}, []), b(() => {
|
|
19
|
+
s === void 0 && e.tabs?.length > 0 && p(e.tabs[0].uid);
|
|
20
|
+
}, [e.tabs, s]), b(() => {
|
|
21
|
+
e.defaultOpen && p(e.defaultOpen);
|
|
22
|
+
}, [e.defaultOpen]), b(() => {
|
|
23
|
+
const t = (e.tabs || []).findIndex((a) => a.uid === s);
|
|
24
|
+
t > -1 && c.current[t].scrollIntoView();
|
|
25
|
+
}, [s, e.tabs]);
|
|
26
|
+
const o = f(
|
|
27
|
+
(i) => {
|
|
28
|
+
p(i), $(i);
|
|
29
|
+
},
|
|
30
|
+
[$]
|
|
31
|
+
), I = f(
|
|
32
|
+
(i) => {
|
|
33
|
+
const t = e.tabs.findIndex((n) => n.uid === s), a = c.current, d = m.current ? window.getComputedStyle(m.current).direction === "rtl" : !1;
|
|
34
|
+
switch (i.key) {
|
|
35
|
+
case "ArrowLeft": {
|
|
36
|
+
const n = t + (d ? 1 : -1);
|
|
37
|
+
n >= 0 && n < e.tabs.length && (o(e.tabs[n].uid), a[n]?.focus());
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "ArrowRight": {
|
|
41
|
+
const n = t + (d ? -1 : 1);
|
|
42
|
+
n >= 0 && n < e.tabs.length && (o(e.tabs[n].uid), a[n]?.focus());
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "Home":
|
|
46
|
+
o(e.tabs[0].uid), a[0]?.focus();
|
|
47
|
+
break;
|
|
48
|
+
case "End":
|
|
49
|
+
o(e.tabs[e.tabs.length - 1].uid), a[e.tabs.length - 1]?.focus();
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[s, e.tabs, o]
|
|
56
|
+
), V = f(() => (e.tabs || []).map((t, a) => /* @__PURE__ */ l("li", { role: "presentation", children: /* @__PURE__ */ l(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
ref: (d) => {
|
|
60
|
+
c.current[a] = d;
|
|
61
|
+
},
|
|
62
|
+
type: "button",
|
|
63
|
+
role: "tab",
|
|
64
|
+
tabIndex: t.uid === s ? void 0 : -1,
|
|
65
|
+
"data-cy": `tab_${r.uid}_${a}`,
|
|
66
|
+
id: `tab_${r.uid}_${a}`,
|
|
67
|
+
"aria-controls": `tabpanel_${r.uid}_${a}`,
|
|
68
|
+
"aria-selected": t.uid === s ? "true" : "false",
|
|
69
|
+
className: `${t.uid === s ? "active" : ""}`,
|
|
70
|
+
onClick: () => o(t.uid),
|
|
71
|
+
onKeyDown: (d) => I(d),
|
|
72
|
+
onFocus: (d) => {
|
|
73
|
+
d.target.scrollIntoView();
|
|
74
|
+
},
|
|
75
|
+
children: t.label
|
|
76
|
+
}
|
|
77
|
+
) }, `tab_${r.uid}_${t.uid}`)), [e, s, r, c, o, I]), C = f(() => {
|
|
78
|
+
const i = g.findIndex((t) => t.uid === s);
|
|
79
|
+
return g.filter((t) => t.uid === s || e.renderMode !== "activeOnly").map((t) => /* @__PURE__ */ l(
|
|
80
|
+
"section",
|
|
81
|
+
{
|
|
82
|
+
role: "tabpanel",
|
|
83
|
+
"data-cy": `tabpanel_${r.uid}_${i}`,
|
|
84
|
+
id: `tabpanel_${r.uid}_${i}`,
|
|
85
|
+
hidden: t.uid !== s && e.renderMode !== "activeOnly",
|
|
86
|
+
"aria-labelledby": `tab_${r.uid}_${i}`,
|
|
87
|
+
children: /* @__PURE__ */ l(E, { widget: t }, t.uid)
|
|
88
|
+
},
|
|
89
|
+
`tabpanel_${r.uid}_${t.uid}`
|
|
90
|
+
));
|
|
91
|
+
}, [g, s, r]);
|
|
92
|
+
return /* @__PURE__ */ v("div", { className: "gui-tabs", style: { flex: e.size }, children: [
|
|
93
|
+
/* @__PURE__ */ l(
|
|
94
|
+
"nav",
|
|
95
|
+
{
|
|
96
|
+
className: A({
|
|
97
|
+
"gui-widget": !0,
|
|
98
|
+
"gui-widget--horizontal": !0,
|
|
99
|
+
"gui-tabs--start-shadow": !S,
|
|
100
|
+
"gui-tabs--end-shadow": !k
|
|
101
|
+
}),
|
|
102
|
+
id: O,
|
|
103
|
+
children: /* @__PURE__ */ v("ul", { role: "tablist", children: [
|
|
104
|
+
/* @__PURE__ */ l("li", { role: "presentation", ref: w, className: "gui-sentinel" }),
|
|
105
|
+
V(),
|
|
106
|
+
/* @__PURE__ */ l("li", { role: "presentation", ref: _, className: "gui-sentinel" })
|
|
107
|
+
] })
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
C()
|
|
111
|
+
] });
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
z as Tabs
|
|
115
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as C } from "@golemui/react";
|
|
3
|
+
import { useCallback as D } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function M(n) {
|
|
6
|
+
const a = n.widget, { uid: i, errors: r, value: l, isTouched: s, templateData: e, onValueChanged: t, onBlur: d } = C(a), c = D(
|
|
7
|
+
(q) => t(q.nativeEvent.detail.value),
|
|
8
|
+
[t]
|
|
9
|
+
), u = e.label, m = e.hint, h = e.placeholder, g = e.icon, p = e.validator?.maxLength, x = e.counterMode, v = e.autoGrow, b = e.minimumHeight, f = e.disabled, w = e.readonly, y = e.validator?.required;
|
|
10
|
+
return /* @__PURE__ */ o("div", { className: "gui-textarea", style: { flex: e.size }, children: /* @__PURE__ */ o(
|
|
11
|
+
"gui-textarea",
|
|
12
|
+
{
|
|
13
|
+
uid: i,
|
|
14
|
+
label: u,
|
|
15
|
+
errors: r,
|
|
16
|
+
touched: s,
|
|
17
|
+
required: y,
|
|
18
|
+
disabled: f,
|
|
19
|
+
readOnly: w,
|
|
20
|
+
value: l,
|
|
21
|
+
hint: m,
|
|
22
|
+
placeholder: h,
|
|
23
|
+
icon: g,
|
|
24
|
+
counterMode: x,
|
|
25
|
+
minimumHeight: b,
|
|
26
|
+
autoGrow: v,
|
|
27
|
+
maxLength: p,
|
|
28
|
+
onInput: c,
|
|
29
|
+
onBlur: d
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
M as TextArea
|
|
35
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as f } from "@golemui/react";
|
|
3
|
+
import { useCallback as y } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function D(n) {
|
|
6
|
+
const o = n.widget, { uid: l, errors: a, value: d, isTouched: r, templateData: e, onValueChanged: t, onBlur: s } = f(o), c = y(
|
|
7
|
+
(x) => t(x.nativeEvent.detail.value),
|
|
8
|
+
[t]
|
|
9
|
+
), u = e.label, p = e.hint, h = e.placeholder, m = e.icon, g = e.disabled, v = e.readonly, b = e.validator?.required;
|
|
10
|
+
return /* @__PURE__ */ i("div", { className: "gui-textinput", style: { flex: e.size }, children: /* @__PURE__ */ i(
|
|
11
|
+
"gui-textinput",
|
|
12
|
+
{
|
|
13
|
+
uid: l,
|
|
14
|
+
label: u,
|
|
15
|
+
hint: p,
|
|
16
|
+
errors: a,
|
|
17
|
+
touched: r,
|
|
18
|
+
required: b,
|
|
19
|
+
disabled: g,
|
|
20
|
+
readOnly: v,
|
|
21
|
+
value: d,
|
|
22
|
+
icon: m,
|
|
23
|
+
placeholder: h ?? void 0,
|
|
24
|
+
onInput: c,
|
|
25
|
+
onBlur: s
|
|
26
|
+
}
|
|
27
|
+
) });
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
D as TextInput
|
|
31
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as f } from "@golemui/react";
|
|
3
|
+
import { useCallback as y } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function D(i) {
|
|
6
|
+
const n = i.widget, { uid: l, errors: a, value: s, onValueChanged: t, onBlur: d, templateData: e, isTouched: r } = f(n), g = y(
|
|
7
|
+
(v) => t(v.nativeEvent.detail.value),
|
|
8
|
+
[t]
|
|
9
|
+
), u = e.label, c = e.hint, h = e.togglePosition, m = e.disabled, p = e.readonly, b = e.validator?.required;
|
|
10
|
+
return /* @__PURE__ */ o("div", { className: "gui-toggle", style: { flex: e.size }, children: /* @__PURE__ */ o(
|
|
11
|
+
"gui-toggle",
|
|
12
|
+
{
|
|
13
|
+
uid: l,
|
|
14
|
+
label: u,
|
|
15
|
+
errors: a,
|
|
16
|
+
touched: r,
|
|
17
|
+
required: b,
|
|
18
|
+
disabled: m,
|
|
19
|
+
readOnly: p,
|
|
20
|
+
value: s,
|
|
21
|
+
hint: c,
|
|
22
|
+
togglePosition: h,
|
|
23
|
+
onChange: g,
|
|
24
|
+
onBlur: d
|
|
25
|
+
}
|
|
26
|
+
) });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
D as Toggle
|
|
30
|
+
};
|
package/index.d.ts
ADDED