@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.
Files changed (58) hide show
  1. package/Accordion-Btp_b0xA.js +59 -0
  2. package/{Alert-B71lVm89.js → Alert-CBgIsMKO.js} +1 -1
  3. package/Button-DN0G-MUb.js +21 -0
  4. package/{Calendar-BtYEcLJH.js → Calendar-Dxavv2c7.js} +12 -12
  5. package/Checkbox-ViM9MktI.js +30 -0
  6. package/Currency-C4QFWO7Y.js +37 -0
  7. package/{DateInput-B4S5ssKR.js → DateInput-CdkyyAhc.js} +4 -4
  8. package/DatePicker-TkMCndrw.js +138 -0
  9. package/Dropdown-jKk4TyOa.js +201 -0
  10. package/Errors-D7gxq0y6.js +16 -0
  11. package/Flex-gD893rrB.js +19 -0
  12. package/Grid-DREMTVQI.js +30 -0
  13. package/List-BjMIo577.js +103 -0
  14. package/Markdown-Ck_88HOR.js +47 -0
  15. package/MarkdownText-kJVkmihW.js +9 -0
  16. package/Number-CnQ95aLO.js +35 -0
  17. package/Password-Bg97DYW3.js +36 -0
  18. package/README.md +17 -4
  19. package/RadioGroup-Dldom5ja.js +33 -0
  20. package/RangeCalendar-u2vxIhna.js +49 -0
  21. package/RangeDateInput-CopLdb6J.js +54 -0
  22. package/RangeDatePicker-DXpV-B_G.js +146 -0
  23. package/Renderer-B6WmwKDv.js +9 -0
  24. package/Repeater-BYgXVfbl.js +111 -0
  25. package/Select-BLUX_W91.js +55 -0
  26. package/Tabs-C2qqi8xO.js +129 -0
  27. package/TextArea-cw3Q2v97.js +35 -0
  28. package/TextInput-geLoAA0c.js +32 -0
  29. package/{Toggle-CCzdFjkq.js → Toggle-a7L71GwR.js} +5 -5
  30. package/index.js +790 -698
  31. package/index.umd.cjs +2 -2
  32. package/lib/components/Form.d.ts +7 -13
  33. package/lib/components/Grid.d.ts +2 -0
  34. package/lib/components/Markdown.d.ts +2 -0
  35. package/lib/components/MarkdownText.d.ts +2 -0
  36. package/lib/components/RangeDateInput.d.ts +2 -0
  37. package/lib/components/RangeDatePicker.d.ts +2 -0
  38. package/lib/widget.loaders.d.ts +2 -2
  39. package/package.json +11 -6
  40. package/Accordion-F768Nqhg.js +0 -58
  41. package/Button-BctTVpNg.js +0 -20
  42. package/CHANGELOG.md +0 -529
  43. package/Checkbox-CezJrTAx.js +0 -30
  44. package/Currency-Bj2yx0JY.js +0 -36
  45. package/DatePicker-C1Qiridi.js +0 -130
  46. package/Dropdown-Dd50Psea.js +0 -196
  47. package/Flex-DPIzOItG.js +0 -11
  48. package/List-CLplkkLa.js +0 -103
  49. package/Number-DsIN4V1r.js +0 -34
  50. package/Password-B_QkZ1WU.js +0 -35
  51. package/RadioGroup-BPhyHxKf.js +0 -32
  52. package/RangeCalendar-B-FeEowl.js +0 -47
  53. package/Renderer-CRWbM4oE.js +0 -9
  54. package/Repeater-D1koXq-v.js +0 -46
  55. package/Select-DvFmJB1_.js +0 -54
  56. package/Tabs-CsmJz1Vs.js +0 -115
  57. package/TextArea-z99jVJ4-.js +0 -35
  58. package/TextInput-BTkEyMEv.js +0 -31
@@ -0,0 +1,55 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useInputWidget as I } from "@golemui/react";
3
+ import { useCallback as s } from "react";
4
+ /* empty css */
5
+ function B(r) {
6
+ const d = r.widget, {
7
+ uid: c,
8
+ errors: u,
9
+ value: p,
10
+ isTouched: m,
11
+ templateData: e,
12
+ onValueChanged: o,
13
+ onBlur: h,
14
+ injectValidationIssues: n
15
+ } = I(d), v = s(
16
+ (t) => o(t.nativeEvent.detail.value),
17
+ [o]
18
+ ), g = s(
19
+ (t) => {
20
+ const i = t, l = (D) => {
21
+ n([D.detail.message]);
22
+ };
23
+ return t && i.addEventListener("inputError", l), () => {
24
+ i.removeEventListener("inputError", l);
25
+ };
26
+ },
27
+ [n]
28
+ ), f = e.options, b = e.label, E = e.hint, y = e.placeholder, C = e.autocomplete, F = e.icon, q = e.valueField, x = e.labelField, R = e.disabled, j = e.readonly, w = e.validator?.required;
29
+ return /* @__PURE__ */ a("div", { className: "gui-select gui-field", style: { flex: e.size }, children: /* @__PURE__ */ a(
30
+ "gui-select",
31
+ {
32
+ ref: g,
33
+ uid: c,
34
+ label: b,
35
+ errors: u,
36
+ touched: m,
37
+ required: w,
38
+ disabled: R,
39
+ readOnly: j,
40
+ value: p,
41
+ hint: E,
42
+ placeholder: y,
43
+ autocomplete: C ?? void 0,
44
+ icon: F,
45
+ options: f,
46
+ labelField: x,
47
+ valueField: q,
48
+ onChange: v,
49
+ onBlur: h
50
+ }
51
+ ) });
52
+ }
53
+ export {
54
+ B as Select
55
+ };
@@ -0,0 +1,129 @@
1
+ import { jsx as o, 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 _ = 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
+ b(() => {
8
+ const a = $.current, t = w.current, i = x(
9
+ a,
10
+ (n) => S(n)
11
+ ), d = x(
12
+ t,
13
+ (n) => T(n)
14
+ );
15
+ return () => {
16
+ i.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((i) => i.uid === s);
24
+ t > -1 && c.current[t].scrollIntoView({ block: "nearest", inline: "nearest" });
25
+ }, [s, e.tabs]);
26
+ const l = f(
27
+ (a) => {
28
+ p(a), m(a);
29
+ },
30
+ [m]
31
+ ), I = f(
32
+ (a) => {
33
+ const t = e.tabs.findIndex((n) => n.uid === s), i = c.current, d = _.current ? window.getComputedStyle(_.current).direction === "rtl" : !1;
34
+ switch (a.key) {
35
+ case "ArrowLeft": {
36
+ const n = t + (d ? 1 : -1);
37
+ n >= 0 && n < e.tabs.length && (l(e.tabs[n].uid), i[n]?.focus());
38
+ break;
39
+ }
40
+ case "ArrowRight": {
41
+ const n = t + (d ? -1 : 1);
42
+ n >= 0 && n < e.tabs.length && (l(e.tabs[n].uid), i[n]?.focus());
43
+ break;
44
+ }
45
+ case "Home":
46
+ l(e.tabs[0].uid), i[0]?.focus();
47
+ break;
48
+ case "End":
49
+ l(e.tabs[e.tabs.length - 1].uid), i[e.tabs.length - 1]?.focus();
50
+ break;
51
+ default:
52
+ return;
53
+ }
54
+ },
55
+ [s, e.tabs, l]
56
+ ), V = f(() => (e.tabs || []).map((t, i) => /* @__PURE__ */ o("li", { role: "presentation", children: /* @__PURE__ */ o(
57
+ "button",
58
+ {
59
+ ref: (d) => {
60
+ c.current[i] = d;
61
+ },
62
+ type: "button",
63
+ role: "tab",
64
+ tabIndex: t.uid === s ? 0 : -1,
65
+ "data-cy": `tab_${r.uid}_${i}`,
66
+ id: `tab_${r.uid}_${i}`,
67
+ "aria-controls": `tabpanel_${r.uid}_${i}`,
68
+ "aria-selected": t.uid === s ? "true" : "false",
69
+ className: `${t.uid === s ? "active" : ""}`,
70
+ onClick: () => l(t.uid),
71
+ onKeyDown: (d) => I(d),
72
+ onFocus: (d) => {
73
+ d.target.scrollIntoView({ block: "nearest", inline: "nearest" });
74
+ },
75
+ children: t.label
76
+ }
77
+ ) }, `tab_${r.uid}_${t.uid}`)), [e, s, r, c, l, I]), C = f(() => {
78
+ const a = g.findIndex((t) => t.uid === s);
79
+ return g.filter((t) => t.uid === s || e.renderMode !== "activeOnly").map((t) => /* @__PURE__ */ o(
80
+ "section",
81
+ {
82
+ role: "tabpanel",
83
+ "data-cy": `tabpanel_${r.uid}_${a}`,
84
+ id: `tabpanel_${r.uid}_${a}`,
85
+ hidden: t.uid !== s && e.renderMode !== "activeOnly",
86
+ "aria-labelledby": `tab_${r.uid}_${a}`,
87
+ children: /* @__PURE__ */ o(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 gui-field", style: { flex: e.size }, children: [
93
+ /* @__PURE__ */ o(
94
+ "nav",
95
+ {
96
+ className: A({
97
+ "gui-widget": !0,
98
+ "gui-widget--horizontal": !0,
99
+ "gui-tabs--start-shadow": !O,
100
+ "gui-tabs--end-shadow": !R
101
+ }),
102
+ id: k,
103
+ children: /* @__PURE__ */ v("ul", { role: "tablist", children: [
104
+ /* @__PURE__ */ o(
105
+ "li",
106
+ {
107
+ role: "presentation",
108
+ ref: $,
109
+ className: "gui-sentinel gui-sentinel__start"
110
+ }
111
+ ),
112
+ V(),
113
+ /* @__PURE__ */ o(
114
+ "li",
115
+ {
116
+ role: "presentation",
117
+ ref: w,
118
+ className: "gui-sentinel gui-sentinel__end"
119
+ }
120
+ )
121
+ ] })
122
+ }
123
+ ),
124
+ C()
125
+ ] });
126
+ }
127
+ export {
128
+ z as Tabs
129
+ };
@@ -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(a) {
6
+ const i = a.widget, { uid: n, errors: l, value: r, isTouched: d, templateData: e, onValueChanged: t, onBlur: s } = C(i), u = D(
7
+ (q) => t(q.nativeEvent.detail.value),
8
+ [t]
9
+ ), c = e.label, m = e.hint, h = e.placeholder, p = e.validator?.maxLength, g = e.counterMode, v = e.autocomplete, x = e.autoGrow, b = e.minimumHeight, f = e.disabled, w = e.readonly, y = e.validator?.required;
10
+ return /* @__PURE__ */ o("div", { className: "gui-textarea gui-field", style: { flex: e.size }, children: /* @__PURE__ */ o(
11
+ "gui-textarea",
12
+ {
13
+ uid: n,
14
+ label: c,
15
+ errors: l,
16
+ touched: d,
17
+ required: y,
18
+ disabled: f,
19
+ readOnly: w,
20
+ value: r,
21
+ hint: m,
22
+ placeholder: h,
23
+ autocomplete: v ?? void 0,
24
+ counterMode: g,
25
+ minimumHeight: b,
26
+ autoGrow: x,
27
+ maxLength: p,
28
+ onInput: u,
29
+ onBlur: s
30
+ }
31
+ ) });
32
+ }
33
+ export {
34
+ M as TextArea
35
+ };
@@ -0,0 +1,32 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useInputWidget as y } from "@golemui/react";
3
+ import { useCallback as q } from "react";
4
+ /* empty css */
5
+ function R(i) {
6
+ const n = i.widget, { uid: l, errors: a, value: d, isTouched: r, templateData: e, onValueChanged: t, onBlur: s } = y(n), c = q(
7
+ (x) => t(x.nativeEvent.detail.value),
8
+ [t]
9
+ ), u = e.label, p = e.hint, m = e.placeholder, h = e.autocomplete, g = e.icon, v = e.disabled, b = e.readonly, f = e.validator?.required;
10
+ return /* @__PURE__ */ o("div", { className: "gui-textinput gui-field", style: { flex: e.size }, children: /* @__PURE__ */ o(
11
+ "gui-textinput",
12
+ {
13
+ uid: l,
14
+ label: u,
15
+ hint: p,
16
+ errors: a,
17
+ touched: r,
18
+ required: f,
19
+ disabled: v,
20
+ readOnly: b,
21
+ value: d,
22
+ icon: g,
23
+ placeholder: m ?? void 0,
24
+ autocomplete: h ?? void 0,
25
+ onInput: c,
26
+ onBlur: s
27
+ }
28
+ ) });
29
+ }
30
+ export {
31
+ R as TextInput
32
+ };
@@ -1,16 +1,16 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { useInputWidget as f } from "@golemui/react";
2
+ import { useInputWidget as v } from "@golemui/react";
3
3
  import { useCallback as y } from "react";
4
4
  /* empty css */
5
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),
6
+ const l = i.widget, { uid: n, errors: a, value: s, onValueChanged: t, onBlur: d, templateData: e, isTouched: r } = v(l), g = y(
7
+ (f) => t(f.nativeEvent.detail.value),
8
8
  [t]
9
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(
10
+ return /* @__PURE__ */ o("div", { className: "gui-toggle gui-field", style: { flex: e.size }, children: /* @__PURE__ */ o(
11
11
  "gui-toggle",
12
12
  {
13
- uid: l,
13
+ uid: n,
14
14
  label: u,
15
15
  errors: a,
16
16
  touched: r,