@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,247 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as q } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as O } from "react";
|
|
5
|
+
import { i as S, A as d, b as D, n as o, t as _ } from "./directive-1yd1wdny.js";
|
|
6
|
+
import { G, b as B, c as k } from "./templates-DBGyvZtc.js";
|
|
7
|
+
import { o as I } from "./style-map-C_0XzJlx.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
var P = Object.defineProperty, M = Object.getOwnPropertyDescriptor, u = (t, s, e, a) => {
|
|
10
|
+
for (var l = a > 1 ? void 0 : a ? M(s, e) : s, n = t.length - 1, r; n >= 0; n--)
|
|
11
|
+
(r = t[n]) && (l = (a ? r(s, e, l) : r(l)) || l);
|
|
12
|
+
return a && l && P(s, e, l), l;
|
|
13
|
+
};
|
|
14
|
+
let i = class extends S {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.step = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimum = void 0, this.maximum = void 0, this.autoGrow = !1, this.ariaController = new G(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 t = this.querySelector(`input[id="${this.uid}"]`), s = {
|
|
39
|
+
"min-width": "23px"
|
|
40
|
+
};
|
|
41
|
+
if (this.autoGrow)
|
|
42
|
+
if (t) {
|
|
43
|
+
t.style.width = "0px";
|
|
44
|
+
const a = Math.max(23, t.scrollWidth);
|
|
45
|
+
s.width = `${a}px`, s.maxWidth = `${a}px`, t.style.width = "";
|
|
46
|
+
} else
|
|
47
|
+
s.width = "47px";
|
|
48
|
+
const e = {
|
|
49
|
+
uid: this.uid,
|
|
50
|
+
label: this.label,
|
|
51
|
+
hint: this.hint,
|
|
52
|
+
errors: this.errors,
|
|
53
|
+
touched: this.touched,
|
|
54
|
+
required: this.required,
|
|
55
|
+
disabled: this.disabled,
|
|
56
|
+
readonly: this.readOnly,
|
|
57
|
+
value: this.value,
|
|
58
|
+
step: this.step,
|
|
59
|
+
placeholder: this.placeholder,
|
|
60
|
+
autocomplete: this.autocomplete
|
|
61
|
+
};
|
|
62
|
+
return D`
|
|
63
|
+
${B(this.uid, e)}
|
|
64
|
+
|
|
65
|
+
<div class="gui-widget">
|
|
66
|
+
<button
|
|
67
|
+
type="button"
|
|
68
|
+
tabindex="-1"
|
|
69
|
+
class="gui-button gui-number__minus"
|
|
70
|
+
?disabled=${this.value <= this.minimum || this.disabled}
|
|
71
|
+
@click=${this.minus}
|
|
72
|
+
>
|
|
73
|
+
-
|
|
74
|
+
</button>
|
|
75
|
+
|
|
76
|
+
<input
|
|
77
|
+
type="number"
|
|
78
|
+
inputmode="decimal"
|
|
79
|
+
id=${this.uid}
|
|
80
|
+
data-cy=${`${this.uid}_number`}
|
|
81
|
+
style=${I(s)}
|
|
82
|
+
value=${this.value}
|
|
83
|
+
?required=${this.required}
|
|
84
|
+
?disabled=${this.disabled}
|
|
85
|
+
?readonly=${this.readOnly}
|
|
86
|
+
step=${typeof this.step == "number" ? this.step : d}
|
|
87
|
+
placeholder=${this.placeholder || d}
|
|
88
|
+
autocomplete=${this.autocomplete || d}
|
|
89
|
+
@input=${this.valueChanged}
|
|
90
|
+
@keydown=${this.keyDown}
|
|
91
|
+
@blur=${this.onBlur}
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
tabindex="-1"
|
|
97
|
+
class="gui-button gui-number__plus"
|
|
98
|
+
?disabled=${this.value >= this.maximum || this.disabled}
|
|
99
|
+
@click=${this.plus}
|
|
100
|
+
>
|
|
101
|
+
+
|
|
102
|
+
</button>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
${k(this.uid, e)}
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
keyDown(t) {
|
|
109
|
+
switch (t.stopPropagation(), t.key) {
|
|
110
|
+
case "ArrowUp":
|
|
111
|
+
t.preventDefault(), this.plus();
|
|
112
|
+
break;
|
|
113
|
+
case "ArrowDown":
|
|
114
|
+
t.preventDefault(), this.minus();
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
minus() {
|
|
119
|
+
if (!this.readOnly) {
|
|
120
|
+
const t = this.querySelector(`input[id="${this.uid}"]`), s = typeof this.step == "number" ? this.step : 1;
|
|
121
|
+
let e = Number(t.valueAsNumber) || Number(t.valueAsNumber) === 0 ? t.valueAsNumber - s : 1;
|
|
122
|
+
e = Number(this.maximum) ? Math.min(e, this.maximum) : e, e = Number(this.minimum) ? Math.max(e, this.minimum) : e, t.valueAsNumber = e, this.value = e, this.dispatchEvent(
|
|
123
|
+
new CustomEvent("input", {
|
|
124
|
+
detail: { value: this.value },
|
|
125
|
+
bubbles: !0,
|
|
126
|
+
composed: !0
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
plus() {
|
|
132
|
+
if (!this.readOnly) {
|
|
133
|
+
const t = this.querySelector(`input[id="${this.uid}"]`), s = typeof this.step == "number" ? this.step : 1;
|
|
134
|
+
let e = Number(t.valueAsNumber) || Number(t.valueAsNumber) === 0 ? t.valueAsNumber + s : 1;
|
|
135
|
+
e = Number(this.maximum) ? Math.min(e, this.maximum) : e, e = Number(this.minimum) ? Math.max(e, this.minimum) : e, t.valueAsNumber = e, this.value = e, this.dispatchEvent(
|
|
136
|
+
new CustomEvent("input", {
|
|
137
|
+
detail: { value: this.value },
|
|
138
|
+
bubbles: !0,
|
|
139
|
+
composed: !0
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
valueChanged(t) {
|
|
145
|
+
if (t.stopPropagation(), !this.readOnly) {
|
|
146
|
+
const s = t.target;
|
|
147
|
+
this.dispatchEvent(
|
|
148
|
+
new CustomEvent("input", {
|
|
149
|
+
detail: { value: s.valueAsNumber },
|
|
150
|
+
bubbles: !0,
|
|
151
|
+
composed: !0
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
onBlur() {
|
|
157
|
+
this.dispatchEvent(
|
|
158
|
+
new CustomEvent("blur", {
|
|
159
|
+
bubbles: !0,
|
|
160
|
+
composed: !0
|
|
161
|
+
})
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
u([
|
|
166
|
+
o({ type: String })
|
|
167
|
+
], i.prototype, "uid", 2);
|
|
168
|
+
u([
|
|
169
|
+
o({ type: String })
|
|
170
|
+
], i.prototype, "label", 2);
|
|
171
|
+
u([
|
|
172
|
+
o({ type: String })
|
|
173
|
+
], i.prototype, "hint", 2);
|
|
174
|
+
u([
|
|
175
|
+
o({ type: String, attribute: "locale-id" })
|
|
176
|
+
], i.prototype, "localeId", 2);
|
|
177
|
+
u([
|
|
178
|
+
o({ type: Array })
|
|
179
|
+
], i.prototype, "errors", 2);
|
|
180
|
+
u([
|
|
181
|
+
o({ type: Boolean })
|
|
182
|
+
], i.prototype, "touched", 2);
|
|
183
|
+
u([
|
|
184
|
+
o({ type: Boolean })
|
|
185
|
+
], i.prototype, "required", 2);
|
|
186
|
+
u([
|
|
187
|
+
o({ type: Boolean })
|
|
188
|
+
], i.prototype, "disabled", 2);
|
|
189
|
+
u([
|
|
190
|
+
o({ type: Boolean, attribute: "readonly" })
|
|
191
|
+
], i.prototype, "readOnly", 2);
|
|
192
|
+
u([
|
|
193
|
+
o({ type: Number })
|
|
194
|
+
], i.prototype, "value", 2);
|
|
195
|
+
u([
|
|
196
|
+
o({ type: Number })
|
|
197
|
+
], i.prototype, "step", 2);
|
|
198
|
+
u([
|
|
199
|
+
o({ type: String })
|
|
200
|
+
], i.prototype, "placeholder", 2);
|
|
201
|
+
u([
|
|
202
|
+
o({ type: String })
|
|
203
|
+
], i.prototype, "autocomplete", 2);
|
|
204
|
+
u([
|
|
205
|
+
o({ type: Number })
|
|
206
|
+
], i.prototype, "minimum", 2);
|
|
207
|
+
u([
|
|
208
|
+
o({ type: Number })
|
|
209
|
+
], i.prototype, "maximum", 2);
|
|
210
|
+
u([
|
|
211
|
+
o({ type: Number })
|
|
212
|
+
], i.prototype, "autoGrow", 2);
|
|
213
|
+
i = u([
|
|
214
|
+
_("gui-number")
|
|
215
|
+
], i);
|
|
216
|
+
typeof customElements < "u" && !customElements.get("gui-number") && customElements.define("gui-number", i);
|
|
217
|
+
function F(t) {
|
|
218
|
+
const s = t.widget, { uid: e, errors: a, value: l, isTouched: n, templateData: r, onValueChanged: p, onBlur: h } = q(s), c = O(
|
|
219
|
+
(E) => p(E.nativeEvent.detail.value),
|
|
220
|
+
[p]
|
|
221
|
+
), b = r.label, y = r.hint, v = r.placeholder, g = r.step, f = r.minimum, w = r.maximum, $ = r.autocomplete, N = r.autoGrow, x = r.disabled, A = r.readonly, C = r.validator?.required;
|
|
222
|
+
return /* @__PURE__ */ m("div", { className: "gui-number gui-field", style: { flex: r.size }, children: /* @__PURE__ */ m(
|
|
223
|
+
"gui-number",
|
|
224
|
+
{
|
|
225
|
+
uid: e,
|
|
226
|
+
label: b,
|
|
227
|
+
hint: y,
|
|
228
|
+
errors: a,
|
|
229
|
+
touched: n,
|
|
230
|
+
required: C,
|
|
231
|
+
disabled: x,
|
|
232
|
+
readOnly: A,
|
|
233
|
+
value: l,
|
|
234
|
+
step: g,
|
|
235
|
+
minimum: f,
|
|
236
|
+
maximum: w,
|
|
237
|
+
autoGrow: N,
|
|
238
|
+
autocomplete: $ ?? void 0,
|
|
239
|
+
placeholder: v ?? void 0,
|
|
240
|
+
onInput: c,
|
|
241
|
+
onBlur: h
|
|
242
|
+
}
|
|
243
|
+
) });
|
|
244
|
+
}
|
|
245
|
+
export {
|
|
246
|
+
F as NumberInput
|
|
247
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as E } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as _ } from "react";
|
|
5
|
+
import { i as B, A as n, b as u, n as i, t as x } from "./directive-1yd1wdny.js";
|
|
6
|
+
import { r as D } from "./state-DI9ZsB5W.js";
|
|
7
|
+
import { e as A } from "./class-map-DrTVAYz_.js";
|
|
8
|
+
import { G as R, a as j, b as G, c as T } from "./templates-DBGyvZtc.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
var z = Object.defineProperty, H = Object.getOwnPropertyDescriptor, o = (s, r, d, l) => {
|
|
11
|
+
for (var a = l > 1 ? void 0 : l ? H(r, d) : r, h = s.length - 1, t; h >= 0; h--)
|
|
12
|
+
(t = s[h]) && (a = (l ? t(r, d, a) : t(a)) || a);
|
|
13
|
+
return l && a && z(r, d, a), a;
|
|
14
|
+
};
|
|
15
|
+
let e = class extends B {
|
|
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.icon = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.showPasswordIcon = void 0, this.hidePasswordIcon = void 0, this.showPasswordLabel = void 0, this.hidePasswordLabel = void 0, this.showPassword = !1, this.ariaController = new R(this, {
|
|
18
|
+
getTargets: () => this.querySelectorAll(`input[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 s = {
|
|
40
|
+
uid: this.uid,
|
|
41
|
+
label: this.label,
|
|
42
|
+
hint: this.hint,
|
|
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
|
+
icon: this.icon,
|
|
50
|
+
placeholder: this.placeholder,
|
|
51
|
+
autocomplete: this.autocomplete,
|
|
52
|
+
showPasswordIcon: this.showPasswordIcon,
|
|
53
|
+
hidePasswordIcon: this.hidePasswordIcon,
|
|
54
|
+
showPasswordLabel: this.showPasswordLabel,
|
|
55
|
+
hidePasswordLabel: this.hidePasswordLabel
|
|
56
|
+
}, r = j("password", s), d = {
|
|
57
|
+
"gui-password--icon": !!this.icon
|
|
58
|
+
};
|
|
59
|
+
return u`
|
|
60
|
+
${G(this.uid, s)}
|
|
61
|
+
|
|
62
|
+
<div class="gui-widget">
|
|
63
|
+
<input
|
|
64
|
+
type=${this.showPassword ? "text" : "password"}
|
|
65
|
+
id=${this.uid}
|
|
66
|
+
data-cy=${`${this.uid}_password`}
|
|
67
|
+
class=${A(d)}
|
|
68
|
+
value=${this.value}
|
|
69
|
+
?required=${this.disabled}
|
|
70
|
+
?disabled=${this.disabled}
|
|
71
|
+
?readonly=${this.readOnly}
|
|
72
|
+
placeholder=${this.placeholder || n}
|
|
73
|
+
autocomplete=${this.autocomplete || n}
|
|
74
|
+
@input=${this.valueChanged}
|
|
75
|
+
@blur=${this.onBlur}
|
|
76
|
+
/>
|
|
77
|
+
${r.html}
|
|
78
|
+
<button
|
|
79
|
+
class=${`gui-password__toggle gui-widget-icon ${this.showPassword && s.showPasswordIcon ? s.showPasswordIcon : ""} ${!this.showPassword && s.hidePasswordIcon ? s.hidePasswordIcon : ""}`}
|
|
80
|
+
data-icon=${this.showPassword ? s.showPasswordIcon : s.hidePasswordIcon}
|
|
81
|
+
type="button"
|
|
82
|
+
tabindex="-1"
|
|
83
|
+
@click=${() => this.showPassword = !this.showPassword}
|
|
84
|
+
>
|
|
85
|
+
${s.showPasswordIcon || s.hidePasswordIcon ? n : u`<span
|
|
86
|
+
>${this.showPassword ? s.hidePasswordLabel ?? "Hide" : s.showPasswordLabel ?? "Show"}</span
|
|
87
|
+
>`}
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
${T(this.uid, s)}
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
valueChanged(s) {
|
|
95
|
+
if (s.stopPropagation(), !this.readOnly) {
|
|
96
|
+
const r = s.target;
|
|
97
|
+
this.dispatchEvent(
|
|
98
|
+
new CustomEvent("input", {
|
|
99
|
+
detail: { value: r.value },
|
|
100
|
+
bubbles: !0,
|
|
101
|
+
composed: !0
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
onBlur() {
|
|
107
|
+
this.dispatchEvent(
|
|
108
|
+
new CustomEvent("blur", {
|
|
109
|
+
bubbles: !0,
|
|
110
|
+
composed: !0
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
o([
|
|
116
|
+
i({ type: String })
|
|
117
|
+
], e.prototype, "uid", 2);
|
|
118
|
+
o([
|
|
119
|
+
i({ type: String })
|
|
120
|
+
], e.prototype, "label", 2);
|
|
121
|
+
o([
|
|
122
|
+
i({ type: String, attribute: "locale-id" })
|
|
123
|
+
], e.prototype, "localeId", 2);
|
|
124
|
+
o([
|
|
125
|
+
i({ type: Array })
|
|
126
|
+
], e.prototype, "errors", 2);
|
|
127
|
+
o([
|
|
128
|
+
i({ type: Boolean })
|
|
129
|
+
], e.prototype, "touched", 2);
|
|
130
|
+
o([
|
|
131
|
+
i({ type: Boolean })
|
|
132
|
+
], e.prototype, "required", 2);
|
|
133
|
+
o([
|
|
134
|
+
i({ type: Boolean })
|
|
135
|
+
], e.prototype, "disabled", 2);
|
|
136
|
+
o([
|
|
137
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
138
|
+
], e.prototype, "readOnly", 2);
|
|
139
|
+
o([
|
|
140
|
+
i({ type: String })
|
|
141
|
+
], e.prototype, "value", 2);
|
|
142
|
+
o([
|
|
143
|
+
i({ type: String })
|
|
144
|
+
], e.prototype, "hint", 2);
|
|
145
|
+
o([
|
|
146
|
+
i({ type: String })
|
|
147
|
+
], e.prototype, "icon", 2);
|
|
148
|
+
o([
|
|
149
|
+
i({ type: String })
|
|
150
|
+
], e.prototype, "placeholder", 2);
|
|
151
|
+
o([
|
|
152
|
+
i({ type: String })
|
|
153
|
+
], e.prototype, "autocomplete", 2);
|
|
154
|
+
o([
|
|
155
|
+
i({ type: String })
|
|
156
|
+
], e.prototype, "showPasswordIcon", 2);
|
|
157
|
+
o([
|
|
158
|
+
i({ type: String })
|
|
159
|
+
], e.prototype, "hidePasswordIcon", 2);
|
|
160
|
+
o([
|
|
161
|
+
i({ type: String })
|
|
162
|
+
], e.prototype, "showPasswordLabel", 2);
|
|
163
|
+
o([
|
|
164
|
+
i({ type: String })
|
|
165
|
+
], e.prototype, "hidePasswordLabel", 2);
|
|
166
|
+
o([
|
|
167
|
+
D()
|
|
168
|
+
], e.prototype, "showPassword", 2);
|
|
169
|
+
e = o([
|
|
170
|
+
x("gui-password")
|
|
171
|
+
], e);
|
|
172
|
+
typeof customElements < "u" && !customElements.get("gui-password") && customElements.define("gui-password", e);
|
|
173
|
+
function X(s) {
|
|
174
|
+
const r = s.widget, { uid: d, errors: l, value: a, isTouched: h, templateData: t, onValueChanged: p, onBlur: w } = E(r), y = _(
|
|
175
|
+
(q) => p(q.nativeEvent.detail.value),
|
|
176
|
+
[p]
|
|
177
|
+
), b = t.label, P = t.hint, g = t.placeholder, m = t.autocomplete, v = t.showPasswordIcon, f = t.hidePasswordIcon, I = t.showPasswordLabel, $ = t.hidePasswordLabel, L = t.icon, S = t.disabled, C = t.readonly, O = t.validator?.required;
|
|
178
|
+
return /* @__PURE__ */ c("div", { className: "gui-password gui-field", style: { flex: t.size }, children: /* @__PURE__ */ c(
|
|
179
|
+
"gui-password",
|
|
180
|
+
{
|
|
181
|
+
uid: d,
|
|
182
|
+
label: b,
|
|
183
|
+
hint: P,
|
|
184
|
+
errors: l,
|
|
185
|
+
touched: h,
|
|
186
|
+
required: O,
|
|
187
|
+
disabled: S,
|
|
188
|
+
readOnly: C,
|
|
189
|
+
value: a,
|
|
190
|
+
icon: L,
|
|
191
|
+
placeholder: g ?? void 0,
|
|
192
|
+
autocomplete: m ?? void 0,
|
|
193
|
+
showPasswordIcon: v,
|
|
194
|
+
hidePasswordIcon: f,
|
|
195
|
+
showPasswordLabel: I,
|
|
196
|
+
hidePasswordLabel: $,
|
|
197
|
+
onInput: y,
|
|
198
|
+
onBlur: w
|
|
199
|
+
}
|
|
200
|
+
) });
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
X as Password
|
|
204
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useInputWidget as q } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
4
|
+
import { useCallback as w } from "react";
|
|
5
|
+
import { i as E, b as h, A as c, n as r, t as B } from "./directive-1yd1wdny.js";
|
|
6
|
+
import { c as D } from "./repeat-BucBfSPF.js";
|
|
7
|
+
import { G as R, b as V, c as L } from "./templates-DBGyvZtc.js";
|
|
8
|
+
import { u as P, i as A } from "./one-of-DifUsEYY.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
var G = Object.defineProperty, I = Object.getOwnPropertyDescriptor, o = (t, l, n, s) => {
|
|
11
|
+
for (var a = s > 1 ? void 0 : s ? I(l, n) : l, d = t.length - 1, i; d >= 0; d--)
|
|
12
|
+
(i = t[d]) && (a = (s ? i(l, n, a) : i(a)) || a);
|
|
13
|
+
return s && a && G(l, n, a), a;
|
|
14
|
+
};
|
|
15
|
+
let e = class extends E {
|
|
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.options = [], this.labelField = void 0, this.valueField = void 0, this.direction = "column", this.optionsLoading = !1, this.hasMatchingValue = !1, this.ariaController = new R(this, {
|
|
18
|
+
getTargets: () => this.querySelectorAll(`input[name="${this.uid}"]`),
|
|
19
|
+
getState: () => ({
|
|
20
|
+
uid: this.uid,
|
|
21
|
+
templateData: {
|
|
22
|
+
hint: this.hint,
|
|
23
|
+
errors: this.errors,
|
|
24
|
+
touched: this.touched,
|
|
25
|
+
// Radiogroup inputs can't be readonly
|
|
26
|
+
readonly: !1,
|
|
27
|
+
disabled: !1
|
|
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 t = {
|
|
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
|
+
options: this.options,
|
|
51
|
+
labelField: this.labelField,
|
|
52
|
+
valueField: this.valueField,
|
|
53
|
+
direction: this.direction
|
|
54
|
+
};
|
|
55
|
+
this.options = P(this.options, {
|
|
56
|
+
labelField: this.labelField,
|
|
57
|
+
valueField: this.valueField
|
|
58
|
+
});
|
|
59
|
+
const l = this.value;
|
|
60
|
+
this.hasMatchingValue = this.options?.length ? this.options.find(({ value: s }) => s === l) !== void 0 : !1;
|
|
61
|
+
const n = this.optionsLoading ? h`<span>Loading...</span>` : h`
|
|
62
|
+
${D(
|
|
63
|
+
this.options || [],
|
|
64
|
+
(s) => s?.value,
|
|
65
|
+
(s, a) => {
|
|
66
|
+
const d = this.hasMatchingValue && s.value === t.value, i = !this.hasMatchingValue && a === 0, u = d || i;
|
|
67
|
+
return h`<label for=${`${this.uid}_${a}`}>
|
|
68
|
+
<input
|
|
69
|
+
type="radio"
|
|
70
|
+
tabindex=${u ? "0" : "-1"}
|
|
71
|
+
id=${`${this.uid}_${a}`}
|
|
72
|
+
data-cy=${`${this.uid}_radiogroup_${a}`}
|
|
73
|
+
name=${this.uid}
|
|
74
|
+
value=${s.value}
|
|
75
|
+
?checked=${d}
|
|
76
|
+
?required=${t.required}
|
|
77
|
+
?disabled=${t.disabled || t.readonly}
|
|
78
|
+
@change=${this.valueChanged}
|
|
79
|
+
@blur=${this.onBlur}
|
|
80
|
+
/>
|
|
81
|
+
${s.label}
|
|
82
|
+
</label>`;
|
|
83
|
+
}
|
|
84
|
+
)}
|
|
85
|
+
`;
|
|
86
|
+
return h`
|
|
87
|
+
${V(this.uid, t, !1, void 0, !1)}
|
|
88
|
+
|
|
89
|
+
<div
|
|
90
|
+
class="gui-widget${this.direction === "row" ? " gui-widget--horizontal" : ""}"
|
|
91
|
+
role="radiogroup"
|
|
92
|
+
id=${this.uid}
|
|
93
|
+
aria-labelledby=${t.label ? `${this.uid}_label` : c}
|
|
94
|
+
aria-describedby=${t.hint ? `${this.uid}_hint` : c}
|
|
95
|
+
>
|
|
96
|
+
${n}
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
${L(this.uid, t)}
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
valueChanged(t) {
|
|
103
|
+
if (t.stopPropagation(), !this.readOnly) {
|
|
104
|
+
const l = t.target;
|
|
105
|
+
this.dispatchEvent(
|
|
106
|
+
new CustomEvent("change", {
|
|
107
|
+
detail: { value: A(l.value, this.options) },
|
|
108
|
+
bubbles: !0,
|
|
109
|
+
composed: !0
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
onBlur() {
|
|
115
|
+
this.dispatchEvent(
|
|
116
|
+
new CustomEvent("blur", {
|
|
117
|
+
bubbles: !0,
|
|
118
|
+
composed: !0
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
o([
|
|
124
|
+
r({ type: String })
|
|
125
|
+
], e.prototype, "uid", 2);
|
|
126
|
+
o([
|
|
127
|
+
r({ type: String })
|
|
128
|
+
], e.prototype, "label", 2);
|
|
129
|
+
o([
|
|
130
|
+
r({ type: String, attribute: "locale-id" })
|
|
131
|
+
], e.prototype, "localeId", 2);
|
|
132
|
+
o([
|
|
133
|
+
r({ type: Array })
|
|
134
|
+
], e.prototype, "errors", 2);
|
|
135
|
+
o([
|
|
136
|
+
r({ type: Boolean })
|
|
137
|
+
], e.prototype, "touched", 2);
|
|
138
|
+
o([
|
|
139
|
+
r({ type: Boolean })
|
|
140
|
+
], e.prototype, "required", 2);
|
|
141
|
+
o([
|
|
142
|
+
r({ type: Boolean })
|
|
143
|
+
], e.prototype, "disabled", 2);
|
|
144
|
+
o([
|
|
145
|
+
r({ type: Boolean, attribute: "readonly" })
|
|
146
|
+
], e.prototype, "readOnly", 2);
|
|
147
|
+
o([
|
|
148
|
+
r({ type: String })
|
|
149
|
+
], e.prototype, "value", 2);
|
|
150
|
+
o([
|
|
151
|
+
r({ type: String })
|
|
152
|
+
], e.prototype, "hint", 2);
|
|
153
|
+
o([
|
|
154
|
+
r({ type: String })
|
|
155
|
+
], e.prototype, "options", 2);
|
|
156
|
+
o([
|
|
157
|
+
r({ type: String })
|
|
158
|
+
], e.prototype, "labelField", 2);
|
|
159
|
+
o([
|
|
160
|
+
r({ type: String })
|
|
161
|
+
], e.prototype, "valueField", 2);
|
|
162
|
+
o([
|
|
163
|
+
r({ type: String })
|
|
164
|
+
], e.prototype, "direction", 2);
|
|
165
|
+
e = o([
|
|
166
|
+
B("gui-radiogroup")
|
|
167
|
+
], e);
|
|
168
|
+
typeof customElements < "u" && !customElements.get("gui-radiogroup") && customElements.define("gui-radiogroup", e);
|
|
169
|
+
function H(t) {
|
|
170
|
+
const l = t.widget, { uid: n, errors: s, value: a, isTouched: d, templateData: i, onValueChanged: u, onBlur: g } = q(l), b = w(
|
|
171
|
+
(S) => u(S.nativeEvent.detail.value),
|
|
172
|
+
[u]
|
|
173
|
+
), v = i.label, y = i.hint, f = i.options, m = i.labelField, $ = i.valueField, F = i.direction, C = i.disabled, _ = i.readonly, O = i.validator?.required;
|
|
174
|
+
return /* @__PURE__ */ p("div", { className: "gui-radiogroup gui-field", style: { flex: i.size }, children: /* @__PURE__ */ p(
|
|
175
|
+
"gui-radiogroup",
|
|
176
|
+
{
|
|
177
|
+
uid: n,
|
|
178
|
+
label: v,
|
|
179
|
+
errors: s,
|
|
180
|
+
touched: d,
|
|
181
|
+
required: O,
|
|
182
|
+
disabled: C,
|
|
183
|
+
readOnly: _,
|
|
184
|
+
value: a,
|
|
185
|
+
hint: y,
|
|
186
|
+
options: f,
|
|
187
|
+
labelField: m,
|
|
188
|
+
valueField: $,
|
|
189
|
+
direction: F,
|
|
190
|
+
onChange: b,
|
|
191
|
+
onBlur: g
|
|
192
|
+
}
|
|
193
|
+
) });
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
H as RadioGroup
|
|
197
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useInputWidget as P } from "@golemui/react";
|
|
3
|
+
import "@golemui/gui-shared";
|
|
3
4
|
import { useCallback as H } from "react";
|
|
5
|
+
import "./range-calendar-SAyiW3EF.js";
|
|
4
6
|
/* empty css */
|
|
5
|
-
function
|
|
7
|
+
function W(d) {
|
|
6
8
|
const c = d.widget, { uid: m, errors: u, value: h, isTouched: b, templateData: e, onBlur: t, onValueChanged: a } = P(c), g = H(
|
|
7
9
|
(o) => {
|
|
8
|
-
const n = o, r = (
|
|
10
|
+
const n = o, r = (i) => a(i.detail.value), l = (i) => {
|
|
9
11
|
t();
|
|
10
12
|
};
|
|
11
13
|
return o && (n.addEventListener("blur", l), n.addEventListener("change", r)), () => {
|
|
@@ -13,21 +15,21 @@ function T(d) {
|
|
|
13
15
|
};
|
|
14
16
|
},
|
|
15
17
|
[a, t]
|
|
16
|
-
), v = e.label,
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
+
), v = e.label, p = e.hint, f = 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;
|
|
19
|
+
return /* @__PURE__ */ s("div", { className: "gui-range-calendar gui-field", style: { flex: e.size }, children: /* @__PURE__ */ s(
|
|
18
20
|
"gui-range-calendar",
|
|
19
21
|
{
|
|
20
22
|
ref: g,
|
|
21
23
|
uid: m,
|
|
22
24
|
label: v,
|
|
23
|
-
hint:
|
|
25
|
+
hint: p,
|
|
24
26
|
errors: u,
|
|
25
27
|
touched: b,
|
|
26
28
|
required: O,
|
|
27
29
|
disabled: q,
|
|
28
30
|
readOnly: C,
|
|
29
31
|
value: h,
|
|
30
|
-
prevMonthIcon:
|
|
32
|
+
prevMonthIcon: f,
|
|
31
33
|
nextMonthIcon: L,
|
|
32
34
|
prevMonthAriaLabel: M,
|
|
33
35
|
nextMonthAriaLabel: x,
|
|
@@ -45,5 +47,5 @@ function T(d) {
|
|
|
45
47
|
) });
|
|
46
48
|
}
|
|
47
49
|
export {
|
|
48
|
-
|
|
50
|
+
W as RangeCalendar
|
|
49
51
|
};
|