@golemui/gui-react 0.12.2 → 0.13.1
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 +16 -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
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as B } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as H } from "react";
|
|
5
|
+
import { i as O, b as u, A as c, n as r, t as E } from "./directive-1yd1wdny.js";
|
|
6
|
+
import { e as M } from "./class-map-DrTVAYz_.js";
|
|
7
|
+
import { G as _, b as D, c as P } from "./templates-DBGyvZtc.js";
|
|
8
|
+
import { o as T } from "./style-map-C_0XzJlx.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
var A = Object.defineProperty, I = Object.getOwnPropertyDescriptor, i = (t, s, d, n) => {
|
|
11
|
+
for (var a = n > 1 ? void 0 : n ? I(s, d) : s, l = t.length - 1, o; l >= 0; l--)
|
|
12
|
+
(o = t[l]) && (a = (n ? o(s, d, a) : o(a)) || a);
|
|
13
|
+
return n && a && A(s, d, a), a;
|
|
14
|
+
};
|
|
15
|
+
let e = class extends O {
|
|
16
|
+
constructor() {
|
|
17
|
+
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.placeholder = void 0, this.autocomplete = void 0, this.minimumHeight = void 0, this.autoGrow = !1, this.maxLength = void 0, this.ariaController = new _(this, {
|
|
18
|
+
getTargets: () => this.querySelectorAll(`textarea[id="${this.uid}"]`),
|
|
19
|
+
getState: () => ({
|
|
20
|
+
uid: this.uid,
|
|
21
|
+
templateData: {
|
|
22
|
+
hint: this.hint,
|
|
23
|
+
errors: this.errors,
|
|
24
|
+
readonly: this.readOnly,
|
|
25
|
+
disabled: this.disabled,
|
|
26
|
+
touched: this.touched
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
createRenderRoot() {
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
super.render();
|
|
39
|
+
const t = {
|
|
40
|
+
uid: this.uid,
|
|
41
|
+
label: this.label,
|
|
42
|
+
errors: this.errors,
|
|
43
|
+
touched: this.touched,
|
|
44
|
+
required: this.required,
|
|
45
|
+
disabled: this.disabled,
|
|
46
|
+
readonly: this.readOnly,
|
|
47
|
+
value: this.value,
|
|
48
|
+
hint: this.hint,
|
|
49
|
+
placeholder: this.placeholder,
|
|
50
|
+
autocomplete: this.autocomplete,
|
|
51
|
+
counterMode: this.counterMode ?? "remaining",
|
|
52
|
+
minimumHeight: this.minimumHeight ?? 120,
|
|
53
|
+
autoGrow: this.autoGrow ?? !1,
|
|
54
|
+
maxLength: this.maxLength
|
|
55
|
+
};
|
|
56
|
+
let s = u``;
|
|
57
|
+
if (t.counterMode && t.maxLength) {
|
|
58
|
+
const a = {
|
|
59
|
+
"gui-textarea--counter": !0,
|
|
60
|
+
"gui-textarea--counter__error": (t.value?.length ?? 0) > t.maxLength
|
|
61
|
+
}, l = t.counterMode === "current" ? u`<span>${t.value?.length ?? 0}</span>` : u`<span>${t.maxLength - (t.value?.length ?? 0)}</span>`;
|
|
62
|
+
s = u`<div class=${M(a)}>
|
|
63
|
+
${l}
|
|
64
|
+
<span> / ${t.maxLength}</span>
|
|
65
|
+
</div>`;
|
|
66
|
+
}
|
|
67
|
+
const d = {
|
|
68
|
+
height: `${t.minimumHeight}px`,
|
|
69
|
+
"min-height": `${t.minimumHeight}px`
|
|
70
|
+
}, n = this.querySelector(`textarea[id="${this.uid}"]`);
|
|
71
|
+
if (this.autoGrow && n) {
|
|
72
|
+
const a = window.getComputedStyle(n), l = parseFloat(a.paddingTop), o = parseFloat(a.paddingBottom), h = l + o;
|
|
73
|
+
n.style.height = "auto", d.height = `${Math.max(this.minimumHeight ?? 120, n.scrollHeight - h)}px`;
|
|
74
|
+
}
|
|
75
|
+
return u`
|
|
76
|
+
${D(this.uid, t)}
|
|
77
|
+
|
|
78
|
+
<div class="gui-widget">
|
|
79
|
+
<textarea
|
|
80
|
+
id=${this.uid}
|
|
81
|
+
data-cy=${`${this.uid}_textarea`}
|
|
82
|
+
style=${T(d)}
|
|
83
|
+
?required=${t.required}
|
|
84
|
+
?disabled=${t.disabled}
|
|
85
|
+
?readonly=${t.readonly}
|
|
86
|
+
placeholder=${t.placeholder || c}
|
|
87
|
+
autocomplete=${this.autocomplete || c}
|
|
88
|
+
@input=${this.valueChanged}
|
|
89
|
+
@blur=${this.onBlur}
|
|
90
|
+
></textarea>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div class="gui-textarea--validation">
|
|
94
|
+
<div>${P(this.uid, t)}</div>
|
|
95
|
+
${s}
|
|
96
|
+
</div>
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
valueChanged(t) {
|
|
100
|
+
if (t.stopPropagation(), !this.readOnly) {
|
|
101
|
+
const s = t.target;
|
|
102
|
+
this.dispatchEvent(
|
|
103
|
+
new CustomEvent("input", {
|
|
104
|
+
detail: { value: s.value },
|
|
105
|
+
bubbles: !0,
|
|
106
|
+
composed: !0
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
onBlur() {
|
|
112
|
+
this.dispatchEvent(
|
|
113
|
+
new CustomEvent("blur", {
|
|
114
|
+
bubbles: !0,
|
|
115
|
+
composed: !0
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
i([
|
|
121
|
+
r({ type: String })
|
|
122
|
+
], e.prototype, "uid", 2);
|
|
123
|
+
i([
|
|
124
|
+
r({ type: String })
|
|
125
|
+
], e.prototype, "label", 2);
|
|
126
|
+
i([
|
|
127
|
+
r({ type: String, attribute: "locale-id" })
|
|
128
|
+
], e.prototype, "localeId", 2);
|
|
129
|
+
i([
|
|
130
|
+
r({ type: Array })
|
|
131
|
+
], e.prototype, "errors", 2);
|
|
132
|
+
i([
|
|
133
|
+
r({ type: Boolean })
|
|
134
|
+
], e.prototype, "touched", 2);
|
|
135
|
+
i([
|
|
136
|
+
r({ type: Boolean })
|
|
137
|
+
], e.prototype, "required", 2);
|
|
138
|
+
i([
|
|
139
|
+
r({ type: Boolean })
|
|
140
|
+
], e.prototype, "disabled", 2);
|
|
141
|
+
i([
|
|
142
|
+
r({ type: Boolean, attribute: "readonly" })
|
|
143
|
+
], e.prototype, "readOnly", 2);
|
|
144
|
+
i([
|
|
145
|
+
r({ type: String })
|
|
146
|
+
], e.prototype, "value", 2);
|
|
147
|
+
i([
|
|
148
|
+
r({ type: String })
|
|
149
|
+
], e.prototype, "hint", 2);
|
|
150
|
+
i([
|
|
151
|
+
r({ type: String })
|
|
152
|
+
], e.prototype, "placeholder", 2);
|
|
153
|
+
i([
|
|
154
|
+
r({ type: String })
|
|
155
|
+
], e.prototype, "autocomplete", 2);
|
|
156
|
+
i([
|
|
157
|
+
r({ type: String, attribute: "countermode" })
|
|
158
|
+
], e.prototype, "counterMode", 2);
|
|
159
|
+
i([
|
|
160
|
+
r({ type: Number, attribute: "minimumheight" })
|
|
161
|
+
], e.prototype, "minimumHeight", 2);
|
|
162
|
+
i([
|
|
163
|
+
r({ type: Boolean, attribute: "autogrow" })
|
|
164
|
+
], e.prototype, "autoGrow", 2);
|
|
165
|
+
i([
|
|
166
|
+
r({ type: Number, attribute: "maxlength" })
|
|
167
|
+
], e.prototype, "maxLength", 2);
|
|
168
|
+
e = i([
|
|
169
|
+
E("gui-textarea")
|
|
170
|
+
], e);
|
|
171
|
+
typeof customElements < "u" && !customElements.get("gui-textarea") && customElements.define("gui-textarea", e);
|
|
172
|
+
function K(t) {
|
|
173
|
+
const s = t.widget, { uid: d, errors: n, value: a, isTouched: l, templateData: o, onValueChanged: h, onBlur: m } = B(s), g = H(
|
|
174
|
+
(G) => h(G.nativeEvent.detail.value),
|
|
175
|
+
[h]
|
|
176
|
+
), y = o.label, v = o.hint, b = o.placeholder, x = o.validator?.maxLength, f = o.counterMode, $ = o.autocomplete, w = o.autoGrow, C = o.minimumHeight, S = o.disabled, L = o.readonly, q = o.validator?.required;
|
|
177
|
+
return /* @__PURE__ */ p("div", { className: "gui-textarea gui-field", style: { flex: o.size }, children: /* @__PURE__ */ p(
|
|
178
|
+
"gui-textarea",
|
|
179
|
+
{
|
|
180
|
+
uid: d,
|
|
181
|
+
label: y,
|
|
182
|
+
errors: n,
|
|
183
|
+
touched: l,
|
|
184
|
+
required: q,
|
|
185
|
+
disabled: S,
|
|
186
|
+
readOnly: L,
|
|
187
|
+
value: a,
|
|
188
|
+
hint: v,
|
|
189
|
+
placeholder: b,
|
|
190
|
+
autocomplete: $ ?? void 0,
|
|
191
|
+
counterMode: f,
|
|
192
|
+
minimumHeight: C,
|
|
193
|
+
autoGrow: w,
|
|
194
|
+
maxLength: x,
|
|
195
|
+
onInput: g,
|
|
196
|
+
onBlur: m
|
|
197
|
+
}
|
|
198
|
+
) });
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
K as TextArea
|
|
202
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as S } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as q } from "react";
|
|
5
|
+
import { i as E, A as h, b as w, n as o, t as I } from "./directive-1yd1wdny.js";
|
|
6
|
+
import { e as B } from "./class-map-DrTVAYz_.js";
|
|
7
|
+
import { G as _, a as D, b as P, c as A } from "./templates-DBGyvZtc.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
var R = Object.defineProperty, T = Object.getOwnPropertyDescriptor, e = (r, s, a, d) => {
|
|
10
|
+
for (var l = d > 1 ? void 0 : d ? T(s, a) : s, n = r.length - 1, i; n >= 0; n--)
|
|
11
|
+
(i = r[n]) && (l = (d ? i(s, a, l) : i(l)) || l);
|
|
12
|
+
return d && l && R(s, a, l), l;
|
|
13
|
+
};
|
|
14
|
+
let t = class extends E {
|
|
15
|
+
constructor() {
|
|
16
|
+
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.placeholder = void 0, this.autocomplete = void 0, this.ariaController = new _(this, {
|
|
17
|
+
getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
|
|
18
|
+
getState: () => ({
|
|
19
|
+
uid: this.uid,
|
|
20
|
+
templateData: {
|
|
21
|
+
hint: this.hint,
|
|
22
|
+
errors: this.errors,
|
|
23
|
+
readonly: this.readOnly,
|
|
24
|
+
disabled: this.disabled,
|
|
25
|
+
touched: this.touched
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
createRenderRoot() {
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
super.render();
|
|
38
|
+
const r = {
|
|
39
|
+
uid: this.uid,
|
|
40
|
+
label: this.label,
|
|
41
|
+
hint: this.hint,
|
|
42
|
+
errors: this.errors,
|
|
43
|
+
touched: this.touched,
|
|
44
|
+
required: this.required,
|
|
45
|
+
disabled: this.disabled,
|
|
46
|
+
readonly: this.readOnly,
|
|
47
|
+
value: this.value,
|
|
48
|
+
icon: this.icon,
|
|
49
|
+
placeholder: this.placeholder,
|
|
50
|
+
autocomplete: this.autocomplete
|
|
51
|
+
}, s = D("textinput", r), a = {
|
|
52
|
+
"gui-textinput--icon": !!this.icon
|
|
53
|
+
};
|
|
54
|
+
return w`
|
|
55
|
+
${P(this.uid, r)}
|
|
56
|
+
|
|
57
|
+
<div class="gui-widget">
|
|
58
|
+
<input
|
|
59
|
+
type="text"
|
|
60
|
+
id=${this.uid}
|
|
61
|
+
data-cy=${`${this.uid}_textinput`}
|
|
62
|
+
class=${B(a)}
|
|
63
|
+
value=${this.value}
|
|
64
|
+
?required=${this.disabled}
|
|
65
|
+
?disabled=${this.disabled}
|
|
66
|
+
?readonly=${this.readOnly}
|
|
67
|
+
placeholder=${this.placeholder || h}
|
|
68
|
+
autocomplete=${this.autocomplete || h}
|
|
69
|
+
@input=${this.valueChanged}
|
|
70
|
+
@blur=${this.onBlur}
|
|
71
|
+
/>
|
|
72
|
+
${s.html}
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
${A(this.uid, r)}
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
valueChanged(r) {
|
|
79
|
+
if (r.stopPropagation(), !this.readOnly) {
|
|
80
|
+
const s = r.target;
|
|
81
|
+
this.dispatchEvent(
|
|
82
|
+
new CustomEvent("input", {
|
|
83
|
+
detail: { value: s.value },
|
|
84
|
+
bubbles: !0,
|
|
85
|
+
composed: !0
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
onBlur() {
|
|
91
|
+
this.dispatchEvent(
|
|
92
|
+
new CustomEvent("blur", {
|
|
93
|
+
bubbles: !0,
|
|
94
|
+
composed: !0
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
e([
|
|
100
|
+
o({ type: String })
|
|
101
|
+
], t.prototype, "uid", 2);
|
|
102
|
+
e([
|
|
103
|
+
o({ type: String })
|
|
104
|
+
], t.prototype, "label", 2);
|
|
105
|
+
e([
|
|
106
|
+
o({ type: String, attribute: "locale-id" })
|
|
107
|
+
], t.prototype, "localeId", 2);
|
|
108
|
+
e([
|
|
109
|
+
o({ type: Array })
|
|
110
|
+
], t.prototype, "errors", 2);
|
|
111
|
+
e([
|
|
112
|
+
o({ type: Boolean })
|
|
113
|
+
], t.prototype, "touched", 2);
|
|
114
|
+
e([
|
|
115
|
+
o({ type: Boolean })
|
|
116
|
+
], t.prototype, "required", 2);
|
|
117
|
+
e([
|
|
118
|
+
o({ type: Boolean })
|
|
119
|
+
], t.prototype, "disabled", 2);
|
|
120
|
+
e([
|
|
121
|
+
o({ type: Boolean, attribute: "readonly" })
|
|
122
|
+
], t.prototype, "readOnly", 2);
|
|
123
|
+
e([
|
|
124
|
+
o({ type: String })
|
|
125
|
+
], t.prototype, "value", 2);
|
|
126
|
+
e([
|
|
127
|
+
o({ type: String })
|
|
128
|
+
], t.prototype, "hint", 2);
|
|
129
|
+
e([
|
|
130
|
+
o({ type: String })
|
|
131
|
+
], t.prototype, "icon", 2);
|
|
132
|
+
e([
|
|
133
|
+
o({ type: String })
|
|
134
|
+
], t.prototype, "placeholder", 2);
|
|
135
|
+
e([
|
|
136
|
+
o({ type: String })
|
|
137
|
+
], t.prototype, "autocomplete", 2);
|
|
138
|
+
t = e([
|
|
139
|
+
I("gui-textinput")
|
|
140
|
+
], t);
|
|
141
|
+
typeof customElements < "u" && !customElements.get("gui-textinput") && customElements.define("gui-textinput", t);
|
|
142
|
+
function F(r) {
|
|
143
|
+
const s = r.widget, { uid: a, errors: d, value: l, isTouched: n, templateData: i, onValueChanged: u, onBlur: c } = S(s), y = q(
|
|
144
|
+
(O) => u(O.nativeEvent.detail.value),
|
|
145
|
+
[u]
|
|
146
|
+
), m = i.label, b = i.hint, v = i.placeholder, g = i.autocomplete, f = i.icon, x = i.disabled, $ = i.readonly, C = i.validator?.required;
|
|
147
|
+
return /* @__PURE__ */ p("div", { className: "gui-textinput gui-field", style: { flex: i.size }, children: /* @__PURE__ */ p(
|
|
148
|
+
"gui-textinput",
|
|
149
|
+
{
|
|
150
|
+
uid: a,
|
|
151
|
+
label: m,
|
|
152
|
+
hint: b,
|
|
153
|
+
errors: d,
|
|
154
|
+
touched: n,
|
|
155
|
+
required: C,
|
|
156
|
+
disabled: x,
|
|
157
|
+
readOnly: $,
|
|
158
|
+
value: l,
|
|
159
|
+
icon: f,
|
|
160
|
+
placeholder: v ?? void 0,
|
|
161
|
+
autocomplete: g ?? void 0,
|
|
162
|
+
onInput: y,
|
|
163
|
+
onBlur: c
|
|
164
|
+
}
|
|
165
|
+
) });
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
F as TextInput
|
|
169
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as C } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as P } from "react";
|
|
5
|
+
import { G as _, c as q } from "./templates-DBGyvZtc.js";
|
|
6
|
+
import { i as w, A as E, b as O, n as o, t as S } from "./directive-1yd1wdny.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
var B = Object.defineProperty, x = Object.getOwnPropertyDescriptor, i = (e, l, d, a) => {
|
|
9
|
+
for (var s = a > 1 ? void 0 : a ? x(l, d) : l, n = e.length - 1, u; n >= 0; n--)
|
|
10
|
+
(u = e[n]) && (s = (a ? u(l, d, s) : u(s)) || s);
|
|
11
|
+
return a && s && B(l, d, s), s;
|
|
12
|
+
};
|
|
13
|
+
let t = class extends w {
|
|
14
|
+
constructor() {
|
|
15
|
+
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.togglePosition = "left", this.ariaController = new _(this, {
|
|
16
|
+
getTargets: () => this.querySelectorAll('span[role="presentation"]'),
|
|
17
|
+
getState: () => ({
|
|
18
|
+
uid: this.uid,
|
|
19
|
+
templateData: {
|
|
20
|
+
hint: this.hint,
|
|
21
|
+
errors: this.errors,
|
|
22
|
+
touched: this.touched,
|
|
23
|
+
// Checkboxes can't have aria-readonly
|
|
24
|
+
readonly: !1,
|
|
25
|
+
disabled: !1
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
createRenderRoot() {
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
super.render();
|
|
38
|
+
const e = {
|
|
39
|
+
uid: this.uid,
|
|
40
|
+
label: this.label,
|
|
41
|
+
hint: this.hint,
|
|
42
|
+
errors: this.errors,
|
|
43
|
+
touched: this.touched,
|
|
44
|
+
required: this.required,
|
|
45
|
+
disabled: this.disabled,
|
|
46
|
+
readonly: this.readOnly,
|
|
47
|
+
value: this.value,
|
|
48
|
+
togglePosition: this.togglePosition
|
|
49
|
+
};
|
|
50
|
+
return e.togglePosition === "right" ? this.classList.add("gui-toggle--right") : this.classList.contains("gui-toggle--right") && this.classList.remove("gui-toggle--right"), O`
|
|
51
|
+
<label
|
|
52
|
+
class="gui-label"
|
|
53
|
+
for=${this.uid}
|
|
54
|
+
data-cy=${`${this.uid}_label`}
|
|
55
|
+
id=${`${this.uid}_label`}
|
|
56
|
+
>
|
|
57
|
+
<div class="gui-widget gui-widget--horizontal gui-toggle--switch">
|
|
58
|
+
<input
|
|
59
|
+
type="checkbox"
|
|
60
|
+
tabindex="0"
|
|
61
|
+
id=${this.uid}
|
|
62
|
+
data-cy=${`${this.uid}_toggle`}
|
|
63
|
+
?checked=${e.value}
|
|
64
|
+
?required=${e.required}
|
|
65
|
+
?disabled=${e.disabled || e.readonly}
|
|
66
|
+
@change=${this.valueChanged}
|
|
67
|
+
@blur=${this.onBlur}
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<span class="gui-toggle--slider" role="presentation"></span>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<span class="gui-label__container">
|
|
74
|
+
${e.label + (e.required ? " *" : "")}
|
|
75
|
+
</span>
|
|
76
|
+
</label>
|
|
77
|
+
|
|
78
|
+
<div class="gui-widget-hint" id=${`${e.uid}_hint`}>
|
|
79
|
+
${e.hint ?? E} ${q(this.uid, e)}
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
valueChanged(e) {
|
|
84
|
+
if (e?.stopPropagation(), !this.readOnly) {
|
|
85
|
+
const l = e?.target;
|
|
86
|
+
this.dispatchEvent(
|
|
87
|
+
new CustomEvent("change", {
|
|
88
|
+
detail: { value: l.checked },
|
|
89
|
+
bubbles: !0,
|
|
90
|
+
composed: !0
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
onBlur() {
|
|
96
|
+
this.dispatchEvent(
|
|
97
|
+
new CustomEvent("blur", {
|
|
98
|
+
bubbles: !0,
|
|
99
|
+
composed: !0
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
i([
|
|
105
|
+
o({ type: String })
|
|
106
|
+
], t.prototype, "uid", 2);
|
|
107
|
+
i([
|
|
108
|
+
o({ type: String })
|
|
109
|
+
], t.prototype, "label", 2);
|
|
110
|
+
i([
|
|
111
|
+
o({ type: String, attribute: "locale-id" })
|
|
112
|
+
], t.prototype, "localeId", 2);
|
|
113
|
+
i([
|
|
114
|
+
o({ type: Array })
|
|
115
|
+
], t.prototype, "errors", 2);
|
|
116
|
+
i([
|
|
117
|
+
o({ type: Boolean })
|
|
118
|
+
], t.prototype, "touched", 2);
|
|
119
|
+
i([
|
|
120
|
+
o({ type: Boolean })
|
|
121
|
+
], t.prototype, "required", 2);
|
|
122
|
+
i([
|
|
123
|
+
o({ type: Boolean })
|
|
124
|
+
], t.prototype, "disabled", 2);
|
|
125
|
+
i([
|
|
126
|
+
o({ type: Boolean, attribute: "readonly" })
|
|
127
|
+
], t.prototype, "readOnly", 2);
|
|
128
|
+
i([
|
|
129
|
+
o({ type: String })
|
|
130
|
+
], t.prototype, "value", 2);
|
|
131
|
+
i([
|
|
132
|
+
o({ type: String })
|
|
133
|
+
], t.prototype, "hint", 2);
|
|
134
|
+
i([
|
|
135
|
+
o({ type: String })
|
|
136
|
+
], t.prototype, "togglePosition", 2);
|
|
137
|
+
t = i([
|
|
138
|
+
S("gui-toggle")
|
|
139
|
+
], t);
|
|
140
|
+
typeof customElements < "u" && !customElements.get("gui-toggle") && customElements.define("gui-toggle", t);
|
|
141
|
+
function G(e) {
|
|
142
|
+
const l = e.widget, { uid: d, errors: a, value: s, onValueChanged: n, onBlur: u, templateData: r, isTouched: h } = C(l), c = P(
|
|
143
|
+
($) => n($.nativeEvent.detail.value),
|
|
144
|
+
[n]
|
|
145
|
+
), p = r.label, b = r.hint, y = r.togglePosition, v = r.disabled, f = r.readonly, m = r.validator?.required;
|
|
146
|
+
return /* @__PURE__ */ g("div", { className: "gui-toggle gui-field", style: { flex: r.size }, children: /* @__PURE__ */ g(
|
|
147
|
+
"gui-toggle",
|
|
148
|
+
{
|
|
149
|
+
uid: d,
|
|
150
|
+
label: p,
|
|
151
|
+
errors: a,
|
|
152
|
+
touched: h,
|
|
153
|
+
required: m,
|
|
154
|
+
disabled: v,
|
|
155
|
+
readOnly: f,
|
|
156
|
+
value: s,
|
|
157
|
+
hint: b,
|
|
158
|
+
togglePosition: y,
|
|
159
|
+
onChange: c,
|
|
160
|
+
onBlur: u
|
|
161
|
+
}
|
|
162
|
+
) });
|
|
163
|
+
}
|
|
164
|
+
export {
|
|
165
|
+
G as Toggle
|
|
166
|
+
};
|