@golemui/gui-react 0.12.2 → 0.13.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-BU3skkjb.js +58 -0
- package/Alert-DpUiDxQT.js +17 -0
- package/Button-BYVR5EKG.js +86 -0
- package/CHANGELOG.md +4 -0
- package/{Calendar-Dxavv2c7.js → Calendar-BmMkpTcV.js} +13 -11
- package/Checkbox-B1Tsf-vi.js +164 -0
- package/Currency-D0pOQwU4.js +233 -0
- package/{DateInput-CdkyyAhc.js → DateInput-CqFHtc9F.js} +12 -10
- package/{DatePicker-TkMCndrw.js → DatePicker-BmW3TO0X.js} +18 -15
- package/{Dropdown-jKk4TyOa.js → Dropdown-C-_zDFCe.js} +5 -3
- package/Flex-Rs-RvIcq.js +20 -0
- package/{Grid-DREMTVQI.js → Grid-BcPUrfRL.js} +3 -2
- package/{List-BjMIo577.js → List-YkH8gdMh.js} +5 -3
- package/Markdown-DeAW4y3P.js +571 -0
- package/MarkdownText-BdISjAsE.js +11 -0
- package/Number-GsGZMR5a.js +247 -0
- package/Password-B8QjtpUe.js +204 -0
- package/RadioGroup-Cd1_Zkkz.js +197 -0
- package/{RangeCalendar-u2vxIhna.js → RangeCalendar-9IJoFEXw.js} +10 -8
- package/{RangeDateInput-CopLdb6J.js → RangeDateInput-DrVR4T_z.js} +21 -19
- package/{RangeDatePicker-DXpV-B_G.js → RangeDatePicker-Cq_Tt6NE.js} +38 -35
- package/{Renderer-B6WmwKDv.js → Renderer-CWqudTUu.js} +4 -2
- package/Repeater-DE-DAylQ.js +124 -0
- package/Select-CCCPYQW6.js +238 -0
- package/{Tabs-C2qqi8xO.js → Tabs-BVgVVvnu.js} +4 -3
- package/TextArea-BlRaVCon.js +202 -0
- package/TextInput-KuHLSN2X.js +169 -0
- package/Toggle-D-bglMPv.js +166 -0
- package/abstract-calendar-JfbbRwFb.js +528 -0
- package/calendar-BgptByan.js +95 -0
- package/class-map-DrTVAYz_.js +26 -0
- package/date-BS1lA1xg.js +786 -0
- package/date-input-Dux0mFJw.js +266 -0
- package/directive-1yd1wdny.js +555 -0
- package/errors-6UKoJh8Y.js +108 -0
- package/index.js +2705 -1171
- package/index.umd.cjs +878 -2
- package/lib/components/Accordion.d.ts +2 -2
- package/lib/components/Alert.d.ts +2 -2
- package/lib/components/Button.d.ts +2 -2
- package/lib/components/Calendar.d.ts +2 -2
- package/lib/components/Checkbox.d.ts +2 -2
- package/lib/components/Currency.d.ts +2 -2
- package/lib/components/DateInput.d.ts +2 -2
- package/lib/components/DatePicker.d.ts +2 -2
- package/lib/components/Dropdown.d.ts +2 -2
- package/lib/components/Flex.d.ts +2 -2
- package/lib/components/Form.d.ts +5 -5
- package/lib/components/Grid.d.ts +2 -2
- package/lib/components/List.d.ts +2 -2
- package/lib/components/Markdown.d.ts +2 -2
- package/lib/components/MarkdownText.d.ts +2 -2
- package/lib/components/Number.d.ts +2 -2
- package/lib/components/Password.d.ts +2 -2
- package/lib/components/RadioGroup.d.ts +2 -2
- package/lib/components/RangeCalendar.d.ts +2 -2
- package/lib/components/RangeDateInput.d.ts +2 -2
- package/lib/components/RangeDatePicker.d.ts +2 -2
- package/lib/components/Renderer.d.ts +2 -2
- package/lib/components/Repeater.d.ts +2 -2
- package/lib/components/Select.d.ts +2 -2
- package/lib/components/Tabs.d.ts +2 -2
- package/lib/components/TextArea.d.ts +2 -2
- package/lib/components/TextInput.d.ts +2 -2
- package/lib/components/Toggle.d.ts +2 -2
- package/lib/widget.loaders.d.ts +2 -2
- package/list-DHX7bG4r.js +282 -0
- package/live-BfTBpQrp.js +24 -0
- package/markdown-text-BUv0K0WF.js +44 -0
- package/one-of-DifUsEYY.js +48 -0
- package/package.json +6 -6
- package/query-h1h36oxg.js +12 -0
- package/range-calendar-SAyiW3EF.js +326 -0
- package/range-date-input-8WtB1urD.js +507 -0
- package/repeat-BucBfSPF.js +79 -0
- package/state-DI9ZsB5W.js +7 -0
- package/style-map-C_0XzJlx.js +29 -0
- package/tabs-DzSCq_98.js +13 -0
- package/templates-DBGyvZtc.js +75 -0
- package/Accordion-Btp_b0xA.js +0 -59
- package/Alert-CBgIsMKO.js +0 -16
- package/Button-DN0G-MUb.js +0 -21
- package/Checkbox-ViM9MktI.js +0 -30
- package/Currency-C4QFWO7Y.js +0 -37
- package/DefaultListItemRenderer-lNc9Kk7x.js +0 -18
- package/Flex-gD893rrB.js +0 -19
- package/Markdown-Ck_88HOR.js +0 -47
- package/MarkdownText-kJVkmihW.js +0 -9
- package/Number-CnQ95aLO.js +0 -35
- package/Password-Bg97DYW3.js +0 -36
- package/RadioGroup-Dldom5ja.js +0 -33
- package/Repeater-BYgXVfbl.js +0 -111
- package/Select-BLUX_W91.js +0 -55
- package/TextArea-cw3Q2v97.js +0 -35
- package/TextInput-geLoAA0c.js +0 -32
- package/Toggle-a7L71GwR.js +0 -30
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { useInputWidget as j } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
3
4
|
import { useCallback as w } from "react";
|
|
5
|
+
import "./range-date-input-8WtB1urD.js";
|
|
4
6
|
/* empty css */
|
|
5
|
-
function
|
|
7
|
+
function N(u) {
|
|
6
8
|
const g = u.widget, {
|
|
7
|
-
uid:
|
|
8
|
-
errors:
|
|
9
|
-
value:
|
|
10
|
-
isTouched:
|
|
9
|
+
uid: m,
|
|
10
|
+
errors: b,
|
|
11
|
+
value: p,
|
|
12
|
+
isTouched: v,
|
|
11
13
|
templateData: e,
|
|
12
14
|
onBlur: n,
|
|
13
15
|
onValueChanged: i,
|
|
14
|
-
injectValidationIssues:
|
|
16
|
+
injectValidationIssues: r
|
|
15
17
|
} = j(g), L = w(
|
|
16
|
-
(
|
|
17
|
-
const t =
|
|
18
|
-
|
|
18
|
+
(o) => {
|
|
19
|
+
const t = o, l = (a) => {
|
|
20
|
+
r(null), i(a.detail.value);
|
|
19
21
|
}, s = () => {
|
|
20
22
|
n();
|
|
21
|
-
}, d = (
|
|
22
|
-
|
|
23
|
+
}, d = (a) => {
|
|
24
|
+
r([a.detail.message]);
|
|
23
25
|
};
|
|
24
|
-
return
|
|
25
|
-
t.removeEventListener("blur", s), t.removeEventListener("change",
|
|
26
|
+
return o && (t.addEventListener("blur", s), t.addEventListener("change", l), t.addEventListener("inputError", d)), () => {
|
|
27
|
+
t.removeEventListener("blur", s), t.removeEventListener("change", l), t.removeEventListener("inputError", d);
|
|
26
28
|
};
|
|
27
29
|
},
|
|
28
|
-
[i, n,
|
|
30
|
+
[i, n, r]
|
|
29
31
|
), 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
32
|
return /* @__PURE__ */ c("div", { className: "gui-range-date-input gui-field", style: { flex: e.size }, children: /* @__PURE__ */ c(
|
|
31
33
|
"gui-range-date",
|
|
32
34
|
{
|
|
33
35
|
ref: L,
|
|
34
|
-
uid:
|
|
36
|
+
uid: m,
|
|
35
37
|
label: h,
|
|
36
38
|
hint: f,
|
|
37
|
-
errors:
|
|
38
|
-
touched:
|
|
39
|
+
errors: b,
|
|
40
|
+
touched: v,
|
|
39
41
|
required: H,
|
|
40
42
|
disabled: q,
|
|
41
43
|
readOnly: x,
|
|
42
|
-
value:
|
|
44
|
+
value: p,
|
|
43
45
|
icon: E,
|
|
44
46
|
localeId: D,
|
|
45
47
|
separator: A,
|
|
@@ -50,5 +52,5 @@ function z(u) {
|
|
|
50
52
|
) });
|
|
51
53
|
}
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
N as RangeDateInput
|
|
54
56
|
};
|
|
@@ -1,65 +1,68 @@
|
|
|
1
1
|
import { jsxs as k, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { useInputWidget as te } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
3
4
|
import { useState as A, useRef as C, useCallback as M, useEffect as ne } from "react";
|
|
5
|
+
import "./range-date-input-8WtB1urD.js";
|
|
6
|
+
import "./range-calendar-SAyiW3EF.js";
|
|
4
7
|
/* empty css */
|
|
5
|
-
import { E as
|
|
6
|
-
function
|
|
8
|
+
import { E as re } from "./Errors-D7gxq0y6.js";
|
|
9
|
+
function ge(R) {
|
|
7
10
|
const F = R.widget, {
|
|
8
11
|
uid: d,
|
|
9
|
-
errors:
|
|
12
|
+
errors: m,
|
|
10
13
|
value: w,
|
|
11
14
|
isTouched: v,
|
|
12
15
|
templateData: t,
|
|
13
|
-
onValueChanged:
|
|
16
|
+
onValueChanged: h,
|
|
14
17
|
onBlur: u,
|
|
15
18
|
injectValidationIssues: g
|
|
16
|
-
} = te(F), [
|
|
19
|
+
} = te(F), [l, a] = A(!1), [_, O] = A(void 0), D = C(null), b = C(null), L = C(null), P = M(
|
|
17
20
|
(n) => {
|
|
18
|
-
const e = n,
|
|
19
|
-
g(null),
|
|
21
|
+
const e = n, r = (o) => {
|
|
22
|
+
g(null), h(o.detail.value);
|
|
20
23
|
}, s = (o) => {
|
|
21
24
|
g([o.detail.message]);
|
|
22
|
-
},
|
|
23
|
-
|
|
25
|
+
}, i = () => {
|
|
26
|
+
a(!0);
|
|
24
27
|
}, p = (o) => {
|
|
25
|
-
O(o.detail.range.start),
|
|
28
|
+
O(o.detail.range.start), a(!0);
|
|
26
29
|
};
|
|
27
|
-
return b.current = n, n && (e.addEventListener("change",
|
|
28
|
-
e.removeEventListener("change",
|
|
30
|
+
return b.current = n, n && (e.addEventListener("change", r), e.addEventListener("focus", i), e.addEventListener("blur", u), e.addEventListener("inputError", s), e.addEventListener("pillClick", p)), () => {
|
|
31
|
+
e.removeEventListener("change", r), e.removeEventListener("focus", i), e.removeEventListener("blur", u), e.removeEventListener("inputError", s), e.removeEventListener("pillClick", p);
|
|
29
32
|
};
|
|
30
33
|
},
|
|
31
|
-
[
|
|
34
|
+
[h, u, g]
|
|
32
35
|
), H = M(
|
|
33
36
|
(n) => {
|
|
34
|
-
const e = n,
|
|
35
|
-
g(null),
|
|
36
|
-
}, s = (
|
|
37
|
-
u(),
|
|
37
|
+
const e = n, r = (i) => {
|
|
38
|
+
g(null), h(i.detail.value);
|
|
39
|
+
}, s = (i) => {
|
|
40
|
+
u(), a(!1);
|
|
38
41
|
};
|
|
39
|
-
return L.current = n, n && (e.addEventListener("blur", s), e.addEventListener("change",
|
|
40
|
-
e.addEventListener("blur", s), e.addEventListener("change",
|
|
42
|
+
return L.current = n, n && (e.addEventListener("blur", s), e.addEventListener("change", r)), () => {
|
|
43
|
+
e.addEventListener("blur", s), e.addEventListener("change", r);
|
|
41
44
|
};
|
|
42
45
|
},
|
|
43
|
-
[
|
|
46
|
+
[h, g, u]
|
|
44
47
|
);
|
|
45
48
|
ne(() => {
|
|
46
49
|
const n = (e) => {
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
!s && !
|
|
50
|
+
if (!l) return;
|
|
51
|
+
const r = e.composedPath(), s = b.current && r.includes(b.current), i = L.current && r.includes(L.current);
|
|
52
|
+
!s && !i && a(!1);
|
|
50
53
|
};
|
|
51
54
|
return document.addEventListener("click", n), () => {
|
|
52
55
|
document.removeEventListener("click", n);
|
|
53
56
|
};
|
|
54
|
-
}, [
|
|
57
|
+
}, [l]);
|
|
55
58
|
const N = (n) => {
|
|
56
|
-
if (!
|
|
59
|
+
if (!l) return;
|
|
57
60
|
const e = n.relatedTarget;
|
|
58
|
-
e && D.current?.contains(e) ||
|
|
61
|
+
e && D.current?.contains(e) || a(!1);
|
|
59
62
|
}, q = (n) => {
|
|
60
|
-
const e = n.target,
|
|
61
|
-
|
|
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 &&
|
|
63
|
+
const e = n.target, r = e.closest(".gui-range-date-input__part"), s = e.closest("gui-range-calendar"), i = e.closest(".gui-range-date-input__pill"), p = e.closest(".gui-range-date-input__pill--count");
|
|
64
|
+
r || s || i ? l || a(!0) : p ? l && a(!1) : a((o) => !o);
|
|
65
|
+
}, 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 && m && m.length > 0, x = t.disabled, y = t.readonly, E = t.validator?.required, I = t.lang;
|
|
63
66
|
return /* @__PURE__ */ k(
|
|
64
67
|
"div",
|
|
65
68
|
{
|
|
@@ -80,9 +83,9 @@ function ce(R) {
|
|
|
80
83
|
className: "gui-widget",
|
|
81
84
|
onClick: q,
|
|
82
85
|
onKeyUp: (n) => {
|
|
83
|
-
n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") &&
|
|
86
|
+
n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && a((e) => !e);
|
|
84
87
|
},
|
|
85
|
-
"aria-expanded":
|
|
88
|
+
"aria-expanded": l,
|
|
86
89
|
children: [
|
|
87
90
|
/* @__PURE__ */ c(
|
|
88
91
|
"gui-range-date",
|
|
@@ -91,7 +94,7 @@ function ce(R) {
|
|
|
91
94
|
uid: d,
|
|
92
95
|
hint: f,
|
|
93
96
|
showErrors: !1,
|
|
94
|
-
errors:
|
|
97
|
+
errors: m,
|
|
95
98
|
touched: v,
|
|
96
99
|
required: E,
|
|
97
100
|
disabled: x,
|
|
@@ -106,7 +109,7 @@ function ce(R) {
|
|
|
106
109
|
}
|
|
107
110
|
),
|
|
108
111
|
/* @__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
|
-
|
|
112
|
+
l && /* @__PURE__ */ c(
|
|
110
113
|
"gui-range-calendar",
|
|
111
114
|
{
|
|
112
115
|
ref: H,
|
|
@@ -136,11 +139,11 @@ function ce(R) {
|
|
|
136
139
|
]
|
|
137
140
|
}
|
|
138
141
|
),
|
|
139
|
-
ee && /* @__PURE__ */ c(
|
|
142
|
+
ee && /* @__PURE__ */ c(re, { errors: m, uid: d })
|
|
140
143
|
]
|
|
141
144
|
}
|
|
142
145
|
);
|
|
143
146
|
}
|
|
144
147
|
export {
|
|
145
|
-
|
|
148
|
+
ge as RangeDatePicker
|
|
146
149
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useDisplayWdiget as s } from "@golemui/react";
|
|
3
|
-
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import "react";
|
|
5
|
+
function c(r) {
|
|
4
6
|
const t = r.widget, { uid: d, templateData: e } = s(t), n = e?.render;
|
|
5
7
|
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
8
|
}
|
|
7
9
|
export {
|
|
8
|
-
|
|
10
|
+
c as Renderer
|
|
9
11
|
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import "@golemui/gui-shared";
|
|
3
|
+
import "@golemui/core";
|
|
4
|
+
import "./index.js";
|
|
5
|
+
import { useInputWidget as B, useRepeaterIndexes as C, RepeaterIndexesContext as F, WidgetRenderer as j } from "@golemui/react";
|
|
6
|
+
import { useRef as O, useCallback as c, useState as P } from "react";
|
|
7
|
+
import "./errors-6UKoJh8Y.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
function k(n, m) {
|
|
10
|
+
if (n != null && typeof n == "object" && "__rid" in n)
|
|
11
|
+
return n.__rid;
|
|
12
|
+
const t = m();
|
|
13
|
+
return Object.defineProperty(n, "__rid", {
|
|
14
|
+
value: t,
|
|
15
|
+
enumerable: !1,
|
|
16
|
+
configurable: !1
|
|
17
|
+
}), t;
|
|
18
|
+
}
|
|
19
|
+
let q = 0;
|
|
20
|
+
const S = () => q++;
|
|
21
|
+
function T(n) {
|
|
22
|
+
const m = n.widget, { uid: t, value: s, onValueChanged: u, templateData: e, errors: l, isTouched: p, onBlur: I } = B(m), g = O(null), v = c(
|
|
23
|
+
(r) => {
|
|
24
|
+
const o = [...r ?? [], {}];
|
|
25
|
+
u(o);
|
|
26
|
+
},
|
|
27
|
+
[u]
|
|
28
|
+
), b = c(
|
|
29
|
+
(r, o) => {
|
|
30
|
+
const d = (r ?? []).filter((W, y) => o !== y);
|
|
31
|
+
"structuredClone" in window ? u(structuredClone(d)) : u(JSON.parse(JSON.stringify(d)));
|
|
32
|
+
},
|
|
33
|
+
[u]
|
|
34
|
+
), [h, f] = P(!1), N = c((r) => {
|
|
35
|
+
r.stopPropagation(), f(!0);
|
|
36
|
+
}, []), x = c((r) => {
|
|
37
|
+
r.stopPropagation(), I(), f(!1);
|
|
38
|
+
}, []), _ = C(), w = c(() => s?.map((r, o) => {
|
|
39
|
+
const d = k(r, S);
|
|
40
|
+
return /* @__PURE__ */ a(
|
|
41
|
+
F.Provider,
|
|
42
|
+
{
|
|
43
|
+
value: [..._, o],
|
|
44
|
+
children: /* @__PURE__ */ i("div", { className: "gui-repeater__card", children: [
|
|
45
|
+
/* @__PURE__ */ i("div", { className: "gui-repeater__card-header", children: [
|
|
46
|
+
e.title && /* @__PURE__ */ a("span", { className: "gui-repeater__card-title", children: `${e.title} ${o + 1}` }),
|
|
47
|
+
/* @__PURE__ */ i(
|
|
48
|
+
"button",
|
|
49
|
+
{
|
|
50
|
+
type: "button",
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
className: "gui-button gui-button--sm gui-repeater__remove-btn",
|
|
53
|
+
onClick: () => b(s, o),
|
|
54
|
+
children: [
|
|
55
|
+
e.removeButtonIcon && /* @__PURE__ */ a(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
className: `gui-widget-icon gui-button-icon ${e.removeButtonIcon}`,
|
|
59
|
+
"data-icon": e.removeButtonIcon
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
e.removeLabel ?? "Remove"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ a(j, { widget: e.template }, `${t}-${d}`)
|
|
68
|
+
] })
|
|
69
|
+
},
|
|
70
|
+
`${t}-${d}`
|
|
71
|
+
);
|
|
72
|
+
}), [e, s, t, b, _]), R = e.validator?.required, $ = p && l && l.length > 0;
|
|
73
|
+
return /* @__PURE__ */ i("div", { className: "gui-repeater gui-field", style: { flex: e.size }, children: [
|
|
74
|
+
/* @__PURE__ */ i(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
ref: g,
|
|
78
|
+
id: t,
|
|
79
|
+
className: `gui-repeater__main-card gui-repeater__card${h ? " gui-repeater__card--focused" : ""}`,
|
|
80
|
+
onFocus: N,
|
|
81
|
+
onBlur: x,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ a(
|
|
84
|
+
"gui-label",
|
|
85
|
+
{
|
|
86
|
+
targetElement: g.current || void 0,
|
|
87
|
+
uid: t,
|
|
88
|
+
label: e.label,
|
|
89
|
+
errors: l,
|
|
90
|
+
touched: p,
|
|
91
|
+
required: R,
|
|
92
|
+
native: !1
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
w(),
|
|
96
|
+
/* @__PURE__ */ i(
|
|
97
|
+
"button",
|
|
98
|
+
{
|
|
99
|
+
type: "button",
|
|
100
|
+
tabIndex: 0,
|
|
101
|
+
className: "gui-button gui-repeater__add-btn",
|
|
102
|
+
onClick: () => v(s || []),
|
|
103
|
+
disabled: e.limit ? e.limit === (s?.length ?? 0) : !1,
|
|
104
|
+
children: [
|
|
105
|
+
e.addButtonIcon && /* @__PURE__ */ a(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
className: `gui-widget-icon gui-button-icon ${e.addButtonIcon}`,
|
|
109
|
+
"data-icon": e.addButtonIcon
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
e.addLabel ?? "Add"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
$ && /* @__PURE__ */ a("gui-errors", { uid: t, errors: l, touched: p })
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
T as Repeater
|
|
124
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as D } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as m } from "react";
|
|
5
|
+
import { i as M, b as p, A as u, n as s, t as A } from "./directive-1yd1wdny.js";
|
|
6
|
+
import { c as P } from "./repeat-BucBfSPF.js";
|
|
7
|
+
import { e as R } from "./class-map-DrTVAYz_.js";
|
|
8
|
+
import { G as j, a as G, b as T, c as z } from "./templates-DBGyvZtc.js";
|
|
9
|
+
import { u as H, i as N } from "./one-of-DifUsEYY.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
var U = Object.defineProperty, W = Object.getOwnPropertyDescriptor, t = (i, a, n, l) => {
|
|
12
|
+
for (var r = l > 1 ? void 0 : l ? W(a, n) : a, d = i.length - 1, o; d >= 0; d--)
|
|
13
|
+
(o = i[d]) && (r = (l ? o(a, n, r) : o(r)) || r);
|
|
14
|
+
return l && r && U(a, n, r), r;
|
|
15
|
+
};
|
|
16
|
+
let e = class extends M {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.icon = void 0, this.autocomplete = void 0, this.options = [], this.placeholder = void 0, this.labelField = void 0, this.valueField = void 0, this.optionsLoading = !1, this.hasMatchingValue = !1, this.ariaController = new j(this, {
|
|
19
|
+
getTargets: () => this.querySelectorAll(`select[id="${this.uid}"]`),
|
|
20
|
+
getState: () => ({
|
|
21
|
+
uid: this.uid,
|
|
22
|
+
templateData: {
|
|
23
|
+
hint: this.hint,
|
|
24
|
+
errors: this.errors,
|
|
25
|
+
readonly: this.readOnly,
|
|
26
|
+
disabled: this.disabled,
|
|
27
|
+
touched: this.touched
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
createRenderRoot() {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
super.render();
|
|
40
|
+
const i = {
|
|
41
|
+
uid: this.uid,
|
|
42
|
+
label: this.label,
|
|
43
|
+
errors: this.errors,
|
|
44
|
+
touched: this.touched,
|
|
45
|
+
required: this.required,
|
|
46
|
+
disabled: this.disabled,
|
|
47
|
+
readonly: this.readOnly,
|
|
48
|
+
value: this.value,
|
|
49
|
+
hint: this.hint,
|
|
50
|
+
icon: this.icon,
|
|
51
|
+
autocomplete: this.autocomplete,
|
|
52
|
+
options: this.options,
|
|
53
|
+
placeholder: this.placeholder,
|
|
54
|
+
labelField: this.labelField,
|
|
55
|
+
valueField: this.valueField
|
|
56
|
+
}, a = G("select", i);
|
|
57
|
+
this.options = H(this.options, {
|
|
58
|
+
labelField: this.labelField,
|
|
59
|
+
valueField: this.valueField
|
|
60
|
+
}), this.hasMatchingValue = this.options?.length ? this.options.find(({ value: l }) => l === this.value) !== void 0 : !1;
|
|
61
|
+
const n = this.optionsLoading ? p`<span>Loading...</span>` : p`
|
|
62
|
+
<option value="" disabled selected=${this.hasMatchingValue ? u : ""}>
|
|
63
|
+
${this.placeholder ?? "Select an option"}
|
|
64
|
+
</option>
|
|
65
|
+
${P(
|
|
66
|
+
this.options || [],
|
|
67
|
+
(l) => l?.value,
|
|
68
|
+
(l) => p`<option
|
|
69
|
+
value=${l.value}
|
|
70
|
+
selected=${this.hasMatchingValue && l.value === this.value ? "" : u}
|
|
71
|
+
>
|
|
72
|
+
${l.label}
|
|
73
|
+
</option>`
|
|
74
|
+
)}
|
|
75
|
+
`;
|
|
76
|
+
return p`
|
|
77
|
+
${T(this.uid, i)}
|
|
78
|
+
|
|
79
|
+
<div class="gui-widget">
|
|
80
|
+
<select
|
|
81
|
+
id=${this.uid}
|
|
82
|
+
tabindex="0"
|
|
83
|
+
data-cy=${`${this.uid}_select`}
|
|
84
|
+
class=${R(a.widgetClasses)}
|
|
85
|
+
?required=${i.required}
|
|
86
|
+
?disabled=${i.disabled || i.readonly}
|
|
87
|
+
autocomplete=${this.autocomplete || u}
|
|
88
|
+
@change=${this.valueChanged}
|
|
89
|
+
@blur=${this.onBlur}
|
|
90
|
+
>
|
|
91
|
+
${n}
|
|
92
|
+
</select>
|
|
93
|
+
<span class="gui-select__arrow"
|
|
94
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
95
|
+
<path
|
|
96
|
+
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"
|
|
97
|
+
></path></svg
|
|
98
|
+
></span>
|
|
99
|
+
${a.html}
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
${z(this.uid, i)}
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
updated(i) {
|
|
106
|
+
i.has("value") && !this.hasMatchingValue && this.value && this.dispatchEvent(
|
|
107
|
+
new CustomEvent("inputError", {
|
|
108
|
+
detail: {
|
|
109
|
+
message: `Invalid selection: '${this.value}' is not a valid option.`
|
|
110
|
+
},
|
|
111
|
+
bubbles: !0
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
valueChanged(i) {
|
|
116
|
+
if (i.stopPropagation(), !this.readOnly) {
|
|
117
|
+
const a = i.target;
|
|
118
|
+
this.dispatchEvent(
|
|
119
|
+
new CustomEvent("change", {
|
|
120
|
+
detail: { value: N(a.value, this.options) },
|
|
121
|
+
bubbles: !0,
|
|
122
|
+
composed: !0
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
onBlur() {
|
|
128
|
+
this.dispatchEvent(
|
|
129
|
+
new CustomEvent("blur", {
|
|
130
|
+
bubbles: !0,
|
|
131
|
+
composed: !0
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
t([
|
|
137
|
+
s({ type: String })
|
|
138
|
+
], e.prototype, "uid", 2);
|
|
139
|
+
t([
|
|
140
|
+
s({ type: String })
|
|
141
|
+
], e.prototype, "label", 2);
|
|
142
|
+
t([
|
|
143
|
+
s({ type: String, attribute: "locale-id" })
|
|
144
|
+
], e.prototype, "localeId", 2);
|
|
145
|
+
t([
|
|
146
|
+
s({ type: Array })
|
|
147
|
+
], e.prototype, "errors", 2);
|
|
148
|
+
t([
|
|
149
|
+
s({ type: Boolean })
|
|
150
|
+
], e.prototype, "touched", 2);
|
|
151
|
+
t([
|
|
152
|
+
s({ type: Boolean })
|
|
153
|
+
], e.prototype, "required", 2);
|
|
154
|
+
t([
|
|
155
|
+
s({ type: Boolean })
|
|
156
|
+
], e.prototype, "disabled", 2);
|
|
157
|
+
t([
|
|
158
|
+
s({ type: Boolean, attribute: "readonly" })
|
|
159
|
+
], e.prototype, "readOnly", 2);
|
|
160
|
+
t([
|
|
161
|
+
s({ type: String })
|
|
162
|
+
], e.prototype, "value", 2);
|
|
163
|
+
t([
|
|
164
|
+
s({ type: String })
|
|
165
|
+
], e.prototype, "hint", 2);
|
|
166
|
+
t([
|
|
167
|
+
s({ type: String })
|
|
168
|
+
], e.prototype, "icon", 2);
|
|
169
|
+
t([
|
|
170
|
+
s({ type: String })
|
|
171
|
+
], e.prototype, "autocomplete", 2);
|
|
172
|
+
t([
|
|
173
|
+
s({ type: String })
|
|
174
|
+
], e.prototype, "options", 2);
|
|
175
|
+
t([
|
|
176
|
+
s({ type: String })
|
|
177
|
+
], e.prototype, "placeholder", 2);
|
|
178
|
+
t([
|
|
179
|
+
s({ type: String })
|
|
180
|
+
], e.prototype, "labelField", 2);
|
|
181
|
+
t([
|
|
182
|
+
s({ type: String })
|
|
183
|
+
], e.prototype, "valueField", 2);
|
|
184
|
+
e = t([
|
|
185
|
+
A("gui-select")
|
|
186
|
+
], e);
|
|
187
|
+
typeof customElements < "u" && !customElements.get("gui-select") && customElements.define("gui-select", e);
|
|
188
|
+
function oe(i) {
|
|
189
|
+
const a = i.widget, {
|
|
190
|
+
uid: n,
|
|
191
|
+
errors: l,
|
|
192
|
+
value: r,
|
|
193
|
+
isTouched: d,
|
|
194
|
+
templateData: o,
|
|
195
|
+
onValueChanged: c,
|
|
196
|
+
onBlur: f,
|
|
197
|
+
injectValidationIssues: v
|
|
198
|
+
} = D(a), $ = m(
|
|
199
|
+
(h) => c(h.nativeEvent.detail.value),
|
|
200
|
+
[c]
|
|
201
|
+
), w = m(
|
|
202
|
+
(h) => {
|
|
203
|
+
const g = h, b = (x) => {
|
|
204
|
+
v([x.detail.message]);
|
|
205
|
+
};
|
|
206
|
+
return h && g.addEventListener("inputError", b), () => {
|
|
207
|
+
g.removeEventListener("inputError", b);
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
[v]
|
|
211
|
+
), E = o.options, F = o.label, S = o.hint, C = o.placeholder, O = o.autocomplete, q = o.icon, _ = o.valueField, B = o.labelField, I = o.disabled, L = o.readonly, V = o.validator?.required;
|
|
212
|
+
return /* @__PURE__ */ y("div", { className: "gui-select gui-field", style: { flex: o.size }, children: /* @__PURE__ */ y(
|
|
213
|
+
"gui-select",
|
|
214
|
+
{
|
|
215
|
+
ref: w,
|
|
216
|
+
uid: n,
|
|
217
|
+
label: F,
|
|
218
|
+
errors: l,
|
|
219
|
+
touched: d,
|
|
220
|
+
required: V,
|
|
221
|
+
disabled: I,
|
|
222
|
+
readOnly: L,
|
|
223
|
+
value: r,
|
|
224
|
+
hint: S,
|
|
225
|
+
placeholder: C,
|
|
226
|
+
autocomplete: O ?? void 0,
|
|
227
|
+
icon: q,
|
|
228
|
+
options: E,
|
|
229
|
+
labelField: B,
|
|
230
|
+
valueField: _,
|
|
231
|
+
onChange: $,
|
|
232
|
+
onBlur: f
|
|
233
|
+
}
|
|
234
|
+
) });
|
|
235
|
+
}
|
|
236
|
+
export {
|
|
237
|
+
oe as Select
|
|
238
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as o, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutWidget as N, WidgetRenderer as E, cn as A } from "@golemui/react";
|
|
3
|
-
import {
|
|
3
|
+
import { c as x } from "./tabs-DzSCq_98.js";
|
|
4
|
+
import "@golemui/gui-shared";
|
|
4
5
|
import { useRef as u, useState as h, useEffect as b, useCallback as f } from "react";
|
|
5
|
-
function
|
|
6
|
+
function K(y) {
|
|
6
7
|
const _ = u(null), r = y.widget, { uid: k, children: g, templateData: e, onChange: m } = N(r), c = u([]), $ = u(null), w = u(null), [O, S] = h(!1), [R, T] = h(!1), [s, p] = h(e.defaultOpen);
|
|
7
8
|
b(() => {
|
|
8
9
|
const a = $.current, t = w.current, i = x(
|
|
@@ -125,5 +126,5 @@ function z(y) {
|
|
|
125
126
|
] });
|
|
126
127
|
}
|
|
127
128
|
export {
|
|
128
|
-
|
|
129
|
+
K as Tabs
|
|
129
130
|
};
|