@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.
- package/Accordion-Btp_b0xA.js +59 -0
- package/{Alert-B71lVm89.js → Alert-CBgIsMKO.js} +1 -1
- package/Button-DN0G-MUb.js +21 -0
- package/{Calendar-BtYEcLJH.js → Calendar-Dxavv2c7.js} +12 -12
- package/Checkbox-ViM9MktI.js +30 -0
- package/Currency-C4QFWO7Y.js +37 -0
- package/{DateInput-B4S5ssKR.js → DateInput-CdkyyAhc.js} +4 -4
- package/DatePicker-TkMCndrw.js +138 -0
- package/Dropdown-jKk4TyOa.js +201 -0
- package/Errors-D7gxq0y6.js +16 -0
- package/Flex-gD893rrB.js +19 -0
- package/Grid-DREMTVQI.js +30 -0
- package/List-BjMIo577.js +103 -0
- package/Markdown-Ck_88HOR.js +47 -0
- package/MarkdownText-kJVkmihW.js +9 -0
- package/Number-CnQ95aLO.js +35 -0
- package/Password-Bg97DYW3.js +36 -0
- package/README.md +17 -4
- package/RadioGroup-Dldom5ja.js +33 -0
- package/RangeCalendar-u2vxIhna.js +49 -0
- package/RangeDateInput-CopLdb6J.js +54 -0
- package/RangeDatePicker-DXpV-B_G.js +146 -0
- package/Renderer-B6WmwKDv.js +9 -0
- package/Repeater-BYgXVfbl.js +111 -0
- package/Select-BLUX_W91.js +55 -0
- package/Tabs-C2qqi8xO.js +129 -0
- package/TextArea-cw3Q2v97.js +35 -0
- package/TextInput-geLoAA0c.js +32 -0
- package/{Toggle-CCzdFjkq.js → Toggle-a7L71GwR.js} +5 -5
- package/index.js +790 -698
- package/index.umd.cjs +2 -2
- package/lib/components/Form.d.ts +7 -13
- package/lib/components/Grid.d.ts +2 -0
- package/lib/components/Markdown.d.ts +2 -0
- package/lib/components/MarkdownText.d.ts +2 -0
- package/lib/components/RangeDateInput.d.ts +2 -0
- package/lib/components/RangeDatePicker.d.ts +2 -0
- package/lib/widget.loaders.d.ts +2 -2
- package/package.json +11 -6
- package/Accordion-F768Nqhg.js +0 -58
- package/Button-BctTVpNg.js +0 -20
- package/CHANGELOG.md +0 -529
- package/Checkbox-CezJrTAx.js +0 -30
- package/Currency-Bj2yx0JY.js +0 -36
- package/DatePicker-C1Qiridi.js +0 -130
- package/Dropdown-Dd50Psea.js +0 -196
- package/Flex-DPIzOItG.js +0 -11
- package/List-CLplkkLa.js +0 -103
- package/Number-DsIN4V1r.js +0 -34
- package/Password-B_QkZ1WU.js +0 -35
- package/RadioGroup-BPhyHxKf.js +0 -32
- package/RangeCalendar-B-FeEowl.js +0 -47
- package/Renderer-CRWbM4oE.js +0 -9
- package/Repeater-D1koXq-v.js +0 -46
- package/Select-DvFmJB1_.js +0 -54
- package/Tabs-CsmJz1Vs.js +0 -115
- package/TextArea-z99jVJ4-.js +0 -35
- package/TextInput-BTkEyMEv.js +0 -31
package/List-BjMIo577.js
ADDED
|
@@ -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
|
+
};
|
|
@@ -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 I } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function j(i) {
|
|
6
|
+
const n = i.widget, { uid: a, errors: l, value: u, isTouched: r, templateData: e, onValueChanged: t, onBlur: s } = C(n), d = I(
|
|
7
|
+
(q) => t(q.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.autocomplete, f = e.autoGrow, x = e.disabled, w = e.readonly, y = e.validator?.required;
|
|
10
|
+
return /* @__PURE__ */ o("div", { className: "gui-number gui-field", style: { flex: e.size }, children: /* @__PURE__ */ o(
|
|
11
|
+
"gui-number",
|
|
12
|
+
{
|
|
13
|
+
uid: a,
|
|
14
|
+
label: m,
|
|
15
|
+
hint: c,
|
|
16
|
+
errors: l,
|
|
17
|
+
touched: r,
|
|
18
|
+
required: y,
|
|
19
|
+
disabled: x,
|
|
20
|
+
readOnly: w,
|
|
21
|
+
value: u,
|
|
22
|
+
step: h,
|
|
23
|
+
minimum: b,
|
|
24
|
+
maximum: g,
|
|
25
|
+
autoGrow: f,
|
|
26
|
+
autocomplete: v ?? void 0,
|
|
27
|
+
placeholder: p ?? void 0,
|
|
28
|
+
onInput: d,
|
|
29
|
+
onBlur: s
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
j as NumberInput
|
|
35
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as q } from "@golemui/react";
|
|
3
|
+
import { useCallback as x } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function k(a) {
|
|
6
|
+
const d = a.widget, { uid: t, errors: n, value: i, isTouched: l, templateData: o, onValueChanged: e, onBlur: r } = q(d), c = x(
|
|
7
|
+
(L) => e(L.nativeEvent.detail.value),
|
|
8
|
+
[e]
|
|
9
|
+
), u = o.label, h = o.hint, w = o.placeholder, p = o.autocomplete, m = o.showPasswordIcon, b = o.hidePasswordIcon, P = o.showPasswordLabel, g = o.hidePasswordLabel, v = o.icon, f = o.disabled, I = o.readonly, y = o.validator?.required;
|
|
10
|
+
return /* @__PURE__ */ s("div", { className: "gui-password gui-field", style: { flex: o.size }, children: /* @__PURE__ */ s(
|
|
11
|
+
"gui-password",
|
|
12
|
+
{
|
|
13
|
+
uid: t,
|
|
14
|
+
label: u,
|
|
15
|
+
hint: h,
|
|
16
|
+
errors: n,
|
|
17
|
+
touched: l,
|
|
18
|
+
required: y,
|
|
19
|
+
disabled: f,
|
|
20
|
+
readOnly: I,
|
|
21
|
+
value: i,
|
|
22
|
+
icon: v,
|
|
23
|
+
placeholder: w ?? void 0,
|
|
24
|
+
autocomplete: p ?? void 0,
|
|
25
|
+
showPasswordIcon: m,
|
|
26
|
+
hidePasswordIcon: b,
|
|
27
|
+
showPasswordLabel: P,
|
|
28
|
+
hidePasswordLabel: g,
|
|
29
|
+
onInput: c,
|
|
30
|
+
onBlur: r
|
|
31
|
+
}
|
|
32
|
+
) });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
k as Password
|
|
36
|
+
};
|
package/README.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
# gui-react
|
|
1
|
+
# @golemui/gui-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Golem UI](https://golemui.com): the declarative form engine.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @golemui/gui-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
- Website: https://golemui.com
|
|
14
|
+
- Repository: https://github.com/golemui/golemui
|
|
15
|
+
- Source: https://github.com/golemui/golemui/tree/main/libs/gui/react
|
|
16
|
+
- Issues: https://github.com/golemui/golemui/issues
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
MIT
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as F } from "@golemui/react";
|
|
3
|
+
import { useCallback as q } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function j(t) {
|
|
6
|
+
const l = t.widget, { uid: n, errors: a, value: d, isTouched: r, templateData: e, onValueChanged: i, onBlur: s } = F(l), u = q(
|
|
7
|
+
(C) => i(C.nativeEvent.detail.value),
|
|
8
|
+
[i]
|
|
9
|
+
), c = e.label, p = e.hint, g = e.options, h = e.labelField, m = e.valueField, b = e.direction, v = e.disabled, f = e.readonly, y = e.validator?.required;
|
|
10
|
+
return /* @__PURE__ */ o("div", { className: "gui-radiogroup gui-field", style: { flex: e.size }, children: /* @__PURE__ */ o(
|
|
11
|
+
"gui-radiogroup",
|
|
12
|
+
{
|
|
13
|
+
uid: n,
|
|
14
|
+
label: c,
|
|
15
|
+
errors: a,
|
|
16
|
+
touched: r,
|
|
17
|
+
required: y,
|
|
18
|
+
disabled: v,
|
|
19
|
+
readOnly: f,
|
|
20
|
+
value: d,
|
|
21
|
+
hint: p,
|
|
22
|
+
options: g,
|
|
23
|
+
labelField: h,
|
|
24
|
+
valueField: m,
|
|
25
|
+
direction: b,
|
|
26
|
+
onChange: u,
|
|
27
|
+
onBlur: s
|
|
28
|
+
}
|
|
29
|
+
) });
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
j as RadioGroup
|
|
33
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as P } from "@golemui/react";
|
|
3
|
+
import { useCallback as H } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function T(d) {
|
|
6
|
+
const c = d.widget, { uid: m, errors: u, value: h, isTouched: b, templateData: e, onBlur: t, onValueChanged: a } = P(c), g = H(
|
|
7
|
+
(o) => {
|
|
8
|
+
const n = o, r = (s) => a(s.detail.value), l = (s) => {
|
|
9
|
+
t();
|
|
10
|
+
};
|
|
11
|
+
return o && (n.addEventListener("blur", l), n.addEventListener("change", r)), () => {
|
|
12
|
+
n.removeEventListener("blur", l), n.removeEventListener("change", r);
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
[a, t]
|
|
16
|
+
), v = e.label, f = e.hint, p = e.prevMonthIcon, L = e.nextMonthIcon, M = e.prevMonthAriaLabel, x = e.nextMonthAriaLabel, y = e.dayFormat, A = e.weekdayFormat, D = e.monthFormat, F = e.minDate, I = e.maxDate, R = e.disabledRanges, w = e.numberOfMonths, E = e.removePillAriaLabel, k = e.lang, q = e.disabled, C = e.readonly, O = e.validator?.required;
|
|
17
|
+
return /* @__PURE__ */ i("div", { className: "gui-range-calendar gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i(
|
|
18
|
+
"gui-range-calendar",
|
|
19
|
+
{
|
|
20
|
+
ref: g,
|
|
21
|
+
uid: m,
|
|
22
|
+
label: v,
|
|
23
|
+
hint: f,
|
|
24
|
+
errors: u,
|
|
25
|
+
touched: b,
|
|
26
|
+
required: O,
|
|
27
|
+
disabled: q,
|
|
28
|
+
readOnly: C,
|
|
29
|
+
value: h,
|
|
30
|
+
prevMonthIcon: p,
|
|
31
|
+
nextMonthIcon: L,
|
|
32
|
+
prevMonthAriaLabel: M,
|
|
33
|
+
nextMonthAriaLabel: x,
|
|
34
|
+
dayFormat: y,
|
|
35
|
+
weekdayFormat: A,
|
|
36
|
+
monthFormat: D,
|
|
37
|
+
minDate: F,
|
|
38
|
+
maxDate: I,
|
|
39
|
+
disabledRanges: R,
|
|
40
|
+
numberOfMonths: w,
|
|
41
|
+
hidePills: !1,
|
|
42
|
+
removePillAriaLabel: E,
|
|
43
|
+
localeId: k
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
T as RangeCalendar
|
|
49
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as j } from "@golemui/react";
|
|
3
|
+
import { useCallback as w } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function z(u) {
|
|
6
|
+
const g = u.widget, {
|
|
7
|
+
uid: b,
|
|
8
|
+
errors: m,
|
|
9
|
+
value: v,
|
|
10
|
+
isTouched: p,
|
|
11
|
+
templateData: e,
|
|
12
|
+
onBlur: n,
|
|
13
|
+
onValueChanged: i,
|
|
14
|
+
injectValidationIssues: a
|
|
15
|
+
} = j(g), L = w(
|
|
16
|
+
(l) => {
|
|
17
|
+
const t = l, o = (r) => {
|
|
18
|
+
a(null), i(r.detail.value);
|
|
19
|
+
}, s = () => {
|
|
20
|
+
n();
|
|
21
|
+
}, d = (r) => {
|
|
22
|
+
a([r.detail.message]);
|
|
23
|
+
};
|
|
24
|
+
return l && (t.addEventListener("blur", s), t.addEventListener("change", o), t.addEventListener("inputError", d)), () => {
|
|
25
|
+
t.removeEventListener("blur", s), t.removeEventListener("change", o), t.removeEventListener("inputError", d);
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
[i, n, a]
|
|
29
|
+
), h = e.label, f = e.hint, E = e.icon, D = e.lang, A = e.separator, y = e.removePillAriaLabel, I = e.startDateAriaLabel, R = e.endDateAriaLabel, q = e.disabled, x = e.readonly, H = e.validator?.required;
|
|
30
|
+
return /* @__PURE__ */ c("div", { className: "gui-range-date-input gui-field", style: { flex: e.size }, children: /* @__PURE__ */ c(
|
|
31
|
+
"gui-range-date",
|
|
32
|
+
{
|
|
33
|
+
ref: L,
|
|
34
|
+
uid: b,
|
|
35
|
+
label: h,
|
|
36
|
+
hint: f,
|
|
37
|
+
errors: m,
|
|
38
|
+
touched: p,
|
|
39
|
+
required: H,
|
|
40
|
+
disabled: q,
|
|
41
|
+
readOnly: x,
|
|
42
|
+
value: v,
|
|
43
|
+
icon: E,
|
|
44
|
+
localeId: D,
|
|
45
|
+
separator: A,
|
|
46
|
+
removePillAriaLabel: y,
|
|
47
|
+
startDateAriaLabel: I,
|
|
48
|
+
endDateAriaLabel: R
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
z as RangeDateInput
|
|
54
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsxs as k, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as te } from "@golemui/react";
|
|
3
|
+
import { useState as A, useRef as C, useCallback as M, useEffect as ne } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { E as ae } from "./Errors-D7gxq0y6.js";
|
|
6
|
+
function ce(R) {
|
|
7
|
+
const F = R.widget, {
|
|
8
|
+
uid: d,
|
|
9
|
+
errors: h,
|
|
10
|
+
value: w,
|
|
11
|
+
isTouched: v,
|
|
12
|
+
templateData: t,
|
|
13
|
+
onValueChanged: m,
|
|
14
|
+
onBlur: u,
|
|
15
|
+
injectValidationIssues: g
|
|
16
|
+
} = te(F), [i, r] = A(!1), [_, O] = A(void 0), D = C(null), b = C(null), L = C(null), P = M(
|
|
17
|
+
(n) => {
|
|
18
|
+
const e = n, a = (o) => {
|
|
19
|
+
g(null), m(o.detail.value);
|
|
20
|
+
}, s = (o) => {
|
|
21
|
+
g([o.detail.message]);
|
|
22
|
+
}, l = () => {
|
|
23
|
+
r(!0);
|
|
24
|
+
}, p = (o) => {
|
|
25
|
+
O(o.detail.range.start), r(!0);
|
|
26
|
+
};
|
|
27
|
+
return b.current = n, n && (e.addEventListener("change", a), e.addEventListener("focus", l), e.addEventListener("blur", u), e.addEventListener("inputError", s), e.addEventListener("pillClick", p)), () => {
|
|
28
|
+
e.removeEventListener("change", a), e.removeEventListener("focus", l), e.removeEventListener("blur", u), e.removeEventListener("inputError", s), e.removeEventListener("pillClick", p);
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
[m, u, g]
|
|
32
|
+
), H = M(
|
|
33
|
+
(n) => {
|
|
34
|
+
const e = n, a = (l) => {
|
|
35
|
+
g(null), m(l.detail.value);
|
|
36
|
+
}, s = (l) => {
|
|
37
|
+
u(), r(!1);
|
|
38
|
+
};
|
|
39
|
+
return L.current = n, n && (e.addEventListener("blur", s), e.addEventListener("change", a)), () => {
|
|
40
|
+
e.addEventListener("blur", s), e.addEventListener("change", a);
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
[m, g, u]
|
|
44
|
+
);
|
|
45
|
+
ne(() => {
|
|
46
|
+
const n = (e) => {
|
|
47
|
+
if (!i) return;
|
|
48
|
+
const a = e.composedPath(), s = b.current && a.includes(b.current), l = L.current && a.includes(L.current);
|
|
49
|
+
!s && !l && r(!1);
|
|
50
|
+
};
|
|
51
|
+
return document.addEventListener("click", n), () => {
|
|
52
|
+
document.removeEventListener("click", n);
|
|
53
|
+
};
|
|
54
|
+
}, [i]);
|
|
55
|
+
const N = (n) => {
|
|
56
|
+
if (!i) return;
|
|
57
|
+
const e = n.relatedTarget;
|
|
58
|
+
e && D.current?.contains(e) || r(!1);
|
|
59
|
+
}, q = (n) => {
|
|
60
|
+
const e = n.target, a = e.closest(".gui-range-date-input__part"), s = e.closest("gui-range-calendar"), l = e.closest(".gui-range-date-input__pill"), p = e.closest(".gui-range-date-input__pill--count");
|
|
61
|
+
a || s || l ? i || r(!0) : p ? i && r(!1) : r((o) => !o);
|
|
62
|
+
}, f = t.hint, T = t.icon, j = t.separator, B = t.removePillAriaLabel, V = t.startDateAriaLabel, $ = t.endDateAriaLabel, z = t.prevMonthIcon, K = t.nextMonthIcon, S = t.prevMonthAriaLabel, U = t.nextMonthAriaLabel, W = t.dayFormat, Z = t.weekdayFormat, G = t.monthFormat, J = t.minDate, Q = t.maxDate, X = t.disabledRanges, Y = t.numberOfMonths, ee = v && h && h.length > 0, x = t.disabled, y = t.readonly, E = t.validator?.required, I = t.lang;
|
|
63
|
+
return /* @__PURE__ */ k(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
ref: D,
|
|
67
|
+
className: "gui-range-date-picker gui-field",
|
|
68
|
+
style: { flex: t.size },
|
|
69
|
+
onBlur: N,
|
|
70
|
+
children: [
|
|
71
|
+
t.label && /* @__PURE__ */ k("label", { className: "gui-label", htmlFor: d, "data-cy": `${d}_label`, children: [
|
|
72
|
+
t.label + (E ? " *" : ""),
|
|
73
|
+
f && /* @__PURE__ */ c("div", { className: "gui-widget-hint", id: `${d}_hint`, children: f })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ k(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
role: "button",
|
|
79
|
+
tabIndex: -1,
|
|
80
|
+
className: "gui-widget",
|
|
81
|
+
onClick: q,
|
|
82
|
+
onKeyUp: (n) => {
|
|
83
|
+
n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && r((e) => !e);
|
|
84
|
+
},
|
|
85
|
+
"aria-expanded": i,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ c(
|
|
88
|
+
"gui-range-date",
|
|
89
|
+
{
|
|
90
|
+
ref: P,
|
|
91
|
+
uid: d,
|
|
92
|
+
hint: f,
|
|
93
|
+
showErrors: !1,
|
|
94
|
+
errors: h,
|
|
95
|
+
touched: v,
|
|
96
|
+
required: E,
|
|
97
|
+
disabled: x,
|
|
98
|
+
readOnly: y,
|
|
99
|
+
value: w,
|
|
100
|
+
icon: T,
|
|
101
|
+
localeId: I,
|
|
102
|
+
separator: j,
|
|
103
|
+
removePillAriaLabel: B,
|
|
104
|
+
startDateAriaLabel: V,
|
|
105
|
+
endDateAriaLabel: $
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ c("span", { className: "gui-range-date-picker__arrow", children: /* @__PURE__ */ c("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 256 256", children: /* @__PURE__ */ c("path", { d: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" }) }) }),
|
|
109
|
+
i && /* @__PURE__ */ c(
|
|
110
|
+
"gui-range-calendar",
|
|
111
|
+
{
|
|
112
|
+
ref: H,
|
|
113
|
+
uid: d,
|
|
114
|
+
hint: f,
|
|
115
|
+
touched: v,
|
|
116
|
+
required: E,
|
|
117
|
+
disabled: x,
|
|
118
|
+
readOnly: y,
|
|
119
|
+
value: w,
|
|
120
|
+
focusDate: _,
|
|
121
|
+
prevMonthIcon: z,
|
|
122
|
+
nextMonthIcon: K,
|
|
123
|
+
prevMonthAriaLabel: S,
|
|
124
|
+
nextMonthAriaLabel: U,
|
|
125
|
+
dayFormat: W,
|
|
126
|
+
weekdayFormat: Z,
|
|
127
|
+
monthFormat: G,
|
|
128
|
+
minDate: J,
|
|
129
|
+
maxDate: Q,
|
|
130
|
+
disabledRanges: X,
|
|
131
|
+
numberOfMonths: Y,
|
|
132
|
+
localeId: I,
|
|
133
|
+
hidePills: !0
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
ee && /* @__PURE__ */ c(ae, { errors: h, uid: d })
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
ce as RangeDatePicker
|
|
146
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useDisplayWdiget as s } from "@golemui/react";
|
|
3
|
+
function a(r) {
|
|
4
|
+
const t = r.widget, { uid: d, templateData: e } = s(t), n = e?.render;
|
|
5
|
+
return /* @__PURE__ */ i("div", { className: "gui-renderer gui-field", style: { flex: e.size }, children: /* @__PURE__ */ i("div", { className: "gui-widget", id: d, children: n }) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
a as Renderer
|
|
9
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as n, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { getItemKey as C } from "@golemui/gui-shared";
|
|
3
|
+
import { useInputWidget as y, useRepeaterIndexes as F, RepeaterIndexesContext as k, WidgetRenderer as q } from "@golemui/react";
|
|
4
|
+
import { useRef as O, useCallback as u, useState as P } from "react";
|
|
5
|
+
/* empty css */
|
|
6
|
+
let S = 0;
|
|
7
|
+
const W = () => S++;
|
|
8
|
+
function z(I) {
|
|
9
|
+
const f = I.widget, { uid: o, value: i, onValueChanged: s, templateData: e, errors: c, isTouched: l, onBlur: v } = y(f), m = O(null), _ = u(
|
|
10
|
+
(t) => {
|
|
11
|
+
const r = [...t ?? [], {}];
|
|
12
|
+
s(r);
|
|
13
|
+
},
|
|
14
|
+
[s]
|
|
15
|
+
), g = u(
|
|
16
|
+
(t, r) => {
|
|
17
|
+
const d = (t ?? []).filter((j, B) => r !== B);
|
|
18
|
+
"structuredClone" in window ? s(structuredClone(d)) : s(JSON.parse(JSON.stringify(d)));
|
|
19
|
+
},
|
|
20
|
+
[s]
|
|
21
|
+
), [h, p] = P(!1), N = u((t) => {
|
|
22
|
+
t.stopPropagation(), p(!0);
|
|
23
|
+
}, []), x = u((t) => {
|
|
24
|
+
t.stopPropagation(), v(), p(!1);
|
|
25
|
+
}, []), b = F(), w = u(() => i?.map((t, r) => {
|
|
26
|
+
const d = C(t, W);
|
|
27
|
+
return /* @__PURE__ */ n(
|
|
28
|
+
k.Provider,
|
|
29
|
+
{
|
|
30
|
+
value: [...b, r],
|
|
31
|
+
children: /* @__PURE__ */ a("div", { className: "gui-repeater__card", children: [
|
|
32
|
+
/* @__PURE__ */ a("div", { className: "gui-repeater__card-header", children: [
|
|
33
|
+
e.title && /* @__PURE__ */ n("span", { className: "gui-repeater__card-title", children: `${e.title} ${r + 1}` }),
|
|
34
|
+
/* @__PURE__ */ a(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
tabIndex: 0,
|
|
39
|
+
className: "gui-button gui-button--sm gui-repeater__remove-btn",
|
|
40
|
+
onClick: () => g(i, r),
|
|
41
|
+
children: [
|
|
42
|
+
e.removeButtonIcon && /* @__PURE__ */ n(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: `gui-widget-icon gui-button-icon ${e.removeButtonIcon}`,
|
|
46
|
+
"data-icon": e.removeButtonIcon
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
e.removeLabel ?? "Remove"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ n(q, { widget: e.template }, `${o}-${d}`)
|
|
55
|
+
] })
|
|
56
|
+
},
|
|
57
|
+
`${o}-${d}`
|
|
58
|
+
);
|
|
59
|
+
}), [e, i, o, g, b]), R = e.validator?.required, $ = l && c && c.length > 0;
|
|
60
|
+
return /* @__PURE__ */ a("div", { className: "gui-repeater gui-field", style: { flex: e.size }, children: [
|
|
61
|
+
/* @__PURE__ */ a(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
ref: m,
|
|
65
|
+
id: o,
|
|
66
|
+
className: `gui-repeater__main-card gui-repeater__card${h ? " gui-repeater__card--focused" : ""}`,
|
|
67
|
+
onFocus: N,
|
|
68
|
+
onBlur: x,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ n(
|
|
71
|
+
"gui-label",
|
|
72
|
+
{
|
|
73
|
+
targetElement: m.current || void 0,
|
|
74
|
+
uid: o,
|
|
75
|
+
label: e.label,
|
|
76
|
+
errors: c,
|
|
77
|
+
touched: l,
|
|
78
|
+
required: R,
|
|
79
|
+
native: !1
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
w(),
|
|
83
|
+
/* @__PURE__ */ a(
|
|
84
|
+
"button",
|
|
85
|
+
{
|
|
86
|
+
type: "button",
|
|
87
|
+
tabIndex: 0,
|
|
88
|
+
className: "gui-button gui-repeater__add-btn",
|
|
89
|
+
onClick: () => _(i || []),
|
|
90
|
+
disabled: e.limit ? e.limit === (i?.length ?? 0) : !1,
|
|
91
|
+
children: [
|
|
92
|
+
e.addButtonIcon && /* @__PURE__ */ n(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: `gui-widget-icon gui-button-icon ${e.addButtonIcon}`,
|
|
96
|
+
"data-icon": e.addButtonIcon
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
e.addLabel ?? "Add"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
$ && /* @__PURE__ */ n("gui-errors", { uid: o, errors: c, touched: l })
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
z as Repeater
|
|
111
|
+
};
|