@golemui/gui-lit 1.3.0-rc.0 → 1.4.0-rc.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/CHANGELOG.md +20 -0
- package/accordion.element-BEenQrCh.js +102 -0
- package/{alert.element-CHn49Yaf.js → alert.element-Dzv49O-1.js} +19 -19
- package/{button.element-C9fHivSw.js → button.element-CKYv0Glr.js} +14 -14
- package/{calendar.element-XkojKTJk.js → calendar.element-DkHZFBNr.js} +16 -16
- package/{checkbox.element-DU_tVMXu.js → checkbox.element-MukoziRw.js} +16 -16
- package/{currency.element-BmAH5KS_.js → currency.element-DNumeSKA.js} +13 -13
- package/{date-picker.element-Bg3rF95F.js → date-picker.element-DpQmremq.js} +5 -5
- package/{date-time-calendar.element-sywQCeQQ.js → date-time-calendar.element-GAr8VMGa.js} +5 -5
- package/{date-time-picker.element-HHpwjWTQ.js → date-time-picker.element-Bt0GYSpS.js} +5 -5
- package/{date-time.element-ucETvSTC.js → date-time.element-WfLnY_Cb.js} +14 -14
- package/{date.element-BEHGxRFF.js → date.element-ChpTi2AQ.js} +15 -15
- package/default-multi-list-item-renderer-Cv-guvEX.js +31 -0
- package/{dropdown.element-Dg80G2PL.js → dropdown.element-D9wMyqWQ.js} +76 -55
- package/{flex.element-pwba7621.js → flex.element-DiZWJBwt.js} +14 -14
- package/{grid.element-C8K7_Qi3.js → grid.element-DJ9ACsqZ.js} +22 -22
- package/index.js +79 -77
- package/index.umd.cjs +374 -117
- package/lib/components/accordion.element.d.ts +3 -2
- package/lib/components/default-multi-list-item-renderer.d.ts +2 -0
- package/lib/components/dropdown.element.d.ts +3 -2
- package/lib/components/multi-dropdown.element.d.ts +48 -0
- package/lib/components/multi-list.element.d.ts +27 -0
- package/lib/components/tabs.element.d.ts +3 -0
- package/{list.element-ZtEMKE2x.js → list.element-DD5IL4QB.js} +7 -7
- package/{markdown-text.element-DDm36qD0.js → markdown-text.element-DflCQwAo.js} +16 -16
- package/{markdown.element-DWz3U9rG.js → markdown.element-DUHHoi2Y.js} +13 -13
- package/multi-dropdown.element-iEOlPvux.js +312 -0
- package/multi-list.element-CCX3i3k6.js +162 -0
- package/{number.element-VkG5wScD.js → number.element-mQSFQsYC.js} +16 -16
- package/package.json +6 -6
- package/{password.element-C5vQHq5P.js → password.element-xw5gugEg.js} +13 -13
- package/{radiogroup.element-CKdO9HwO.js → radiogroup.element-TqfrxVyI.js} +15 -15
- package/{range-calendar.element-BznGrej5.js → range-calendar.element-BJr97SVA.js} +13 -5
- package/{range-date-input.element-BloTHRDl.js → range-date-input.element-DDRYvP9h.js} +23 -15
- package/{range-date-picker.element-DKhwFasW.js → range-date-picker.element-rdEr0_wu.js} +25 -17
- package/{range-date-time-calendar.element-CZCET-sb.js → range-date-time-calendar.element-UlL1BBRJ.js} +25 -17
- package/{range-date-time-input.element-Dr2VrYhG.js → range-date-time-input.element-Cq4IdW7N.js} +17 -9
- package/{range-date-time-picker.element-CYeIMWLp.js → range-date-time-picker.element-CnJcIN9C.js} +27 -19
- package/{range-time-input.element-7OZhPQqx.js → range-time-input.element-Cq0TrGe9.js} +17 -9
- package/{range-time-picker.element-D0mRFZkK.js → range-time-picker.element-BzlIuZ6m.js} +24 -16
- package/{renderer.element-DbsFoBba.js → renderer.element-BVwerbtL.js} +15 -15
- package/repeater.element-DQNI4b7I.js +133 -0
- package/{select.element-Bb_9jAVB.js → select.element-RBtbAvLx.js} +12 -11
- package/tabs.element-BiVaQlvt.js +171 -0
- package/{tags.element-BSN3i9Gx.js → tags.element-CGvxhMmX.js} +18 -19
- package/{textarea.element-Dl1ZEOqO.js → textarea.element-E2ntRBtE.js} +13 -13
- package/{textinput.element-C5Vbbkxq.js → textinput.element-0q5F5ol3.js} +16 -16
- package/{time-picker.element-Crmj9YDy.js → time-picker.element-BiLaLr_c.js} +5 -5
- package/{time.element-DfSeAZp4.js → time.element-92goKRwJ.js} +15 -15
- package/{toggle.element-ORsprZ2M.js → toggle.element-zDUc9Vja.js} +16 -16
- package/accordion.element-C9GzfKrY.js +0 -103
- package/repeater.element-DGEbwvhY.js +0 -138
- package/tabs.element-BYDNF_pm.js +0 -161
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { getItemKey as c } from "@golemui/gui-shared/internals";
|
|
2
|
-
import { InputWidgetAdapter as l, formContext as h, inputContext as m } from "@golemui/lit";
|
|
3
|
-
import { consume as g, provide as b } from "@lit/context";
|
|
4
|
-
import { LitElement as f, nothing as i, html as a } from "lit";
|
|
5
|
-
import { repeat as $ } from "lit-html/directives/repeat.js";
|
|
6
|
-
import { property as v, state as _, query as I } from "lit/decorators.js";
|
|
7
|
-
import { safeDefine as C } from "@golemui/lit/internals";
|
|
8
|
-
import "rxjs";
|
|
9
|
-
import "@golemui/gui-components/label";
|
|
10
|
-
import "@golemui/gui-components/errors";
|
|
11
|
-
var w = Object.defineProperty, n = (d, e, r, o) => {
|
|
12
|
-
for (var t = void 0, u = d.length - 1, p; u >= 0; u--)
|
|
13
|
-
(p = d[u]) && (t = p(e, r, t) || t);
|
|
14
|
-
return t && w(e, r, t), t;
|
|
15
|
-
};
|
|
16
|
-
let y = 0;
|
|
17
|
-
const x = () => y++;
|
|
18
|
-
class s extends f {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments), this.adapter = new l(), this.isFocused = !1, this.subscriptions = [];
|
|
21
|
-
}
|
|
22
|
-
createRenderRoot() {
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
updated(e) {
|
|
26
|
-
super.updated(e);
|
|
27
|
-
const r = this.adapter.templateData.size;
|
|
28
|
-
r ? this.style.flex = String(r) : this.style.removeProperty("flex");
|
|
29
|
-
}
|
|
30
|
-
connectedCallback() {
|
|
31
|
-
super.connectedCallback(), this.classList.add("gui-repeater", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
32
|
-
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
onFocusIn(e) {
|
|
36
|
-
e.stopPropagation(), this.isFocused = !0;
|
|
37
|
-
}
|
|
38
|
-
onFocusOut(e) {
|
|
39
|
-
e.stopPropagation(), this.adapter.onBlur(), this.isFocused = !1;
|
|
40
|
-
}
|
|
41
|
-
render() {
|
|
42
|
-
const e = this.adapter.templateData, r = e.touched && e.errors && e.errors.length > 0;
|
|
43
|
-
return a`
|
|
44
|
-
<div
|
|
45
|
-
id=${this.widget.uid}
|
|
46
|
-
class=${`gui-repeater__main-card gui-repeater__card ${this.isFocused ? "gui-repeater__card--focused" : ""}`}
|
|
47
|
-
@focusin=${this.onFocusIn}
|
|
48
|
-
@focusout=${this.onFocusOut}
|
|
49
|
-
>
|
|
50
|
-
<gui-label
|
|
51
|
-
.targetElement=${[this._repeaterRef]}
|
|
52
|
-
.uid=${this.widget.uid}
|
|
53
|
-
.label=${e.label}
|
|
54
|
-
.errors=${e.errors}
|
|
55
|
-
.touched=${e.touched}
|
|
56
|
-
.required=${e.validator?.required}
|
|
57
|
-
.native=${!1}
|
|
58
|
-
></gui-label>
|
|
59
|
-
${e.value ? $(
|
|
60
|
-
e.value,
|
|
61
|
-
(o) => c(o, x),
|
|
62
|
-
(o, t) => a`
|
|
63
|
-
<div class="gui-repeater__card">
|
|
64
|
-
<div class="gui-repeater__card-header">
|
|
65
|
-
${e.title ? a`<span class="gui-repeater__card-title"
|
|
66
|
-
>${e.title} ${t + 1}</span
|
|
67
|
-
>` : i}
|
|
68
|
-
<button
|
|
69
|
-
type="button"
|
|
70
|
-
tabindex="0"
|
|
71
|
-
class="gui-button gui-button--sm gui-repeater__remove-btn"
|
|
72
|
-
@click=${() => this.removeItem(t)}
|
|
73
|
-
>
|
|
74
|
-
${e.removeButtonIcon ? a`<span
|
|
75
|
-
class="gui-widget-icon gui-button-icon ${e.removeButtonIcon}"
|
|
76
|
-
data-icon=${e.removeButtonIcon}
|
|
77
|
-
></span>` : i}
|
|
78
|
-
${e.removeLabel ?? "Remove"}
|
|
79
|
-
</button>
|
|
80
|
-
</div>
|
|
81
|
-
<gui-repeater-widget
|
|
82
|
-
.repeaterIndex=${t}
|
|
83
|
-
.widget=${e.template}
|
|
84
|
-
></gui-repeater-widget>
|
|
85
|
-
</div>
|
|
86
|
-
`
|
|
87
|
-
) : i}
|
|
88
|
-
|
|
89
|
-
<button
|
|
90
|
-
type="button"
|
|
91
|
-
tabindex="0"
|
|
92
|
-
class="gui-button gui-repeater__add-btn"
|
|
93
|
-
@click=${() => this.addItem()}
|
|
94
|
-
?disabled=${!!(e.limit && e.limit === e.value?.length)}
|
|
95
|
-
>
|
|
96
|
-
${e.addButtonIcon ? a`<span
|
|
97
|
-
class="gui-widget-icon gui-button-icon ${e.addButtonIcon}"
|
|
98
|
-
data-icon=${e.addButtonIcon}
|
|
99
|
-
></span>` : i}
|
|
100
|
-
${e.addLabel ?? "Add"}
|
|
101
|
-
</button>
|
|
102
|
-
</div>
|
|
103
|
-
${r ? a`<gui-errors
|
|
104
|
-
.uid=${this.widget.uid}
|
|
105
|
-
.errors=${e.errors}
|
|
106
|
-
.touched=${e.touched}
|
|
107
|
-
></gui-errors>` : i}
|
|
108
|
-
`;
|
|
109
|
-
}
|
|
110
|
-
disconnectedCallback() {
|
|
111
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
112
|
-
}
|
|
113
|
-
addItem() {
|
|
114
|
-
const e = [...this.adapter.templateData.value ?? [], {}];
|
|
115
|
-
this.adapter.valueChanged(e), this.requestUpdate();
|
|
116
|
-
}
|
|
117
|
-
removeItem(e) {
|
|
118
|
-
const r = (this.adapter.templateData.value ?? []).filter((o, t) => e !== t);
|
|
119
|
-
"structuredClone" in window ? this.adapter.valueChanged(structuredClone(r)) : this.adapter.valueChanged(JSON.parse(JSON.stringify(r))), this.requestUpdate();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
n([
|
|
123
|
-
g({ context: h }),
|
|
124
|
-
v({ attribute: !1 })
|
|
125
|
-
], s.prototype, "formContext");
|
|
126
|
-
n([
|
|
127
|
-
b({ context: m })
|
|
128
|
-
], s.prototype, "adapter");
|
|
129
|
-
n([
|
|
130
|
-
_()
|
|
131
|
-
], s.prototype, "isFocused");
|
|
132
|
-
n([
|
|
133
|
-
I(".gui-repeater__main-card")
|
|
134
|
-
], s.prototype, "_repeaterRef");
|
|
135
|
-
C("gui-repeater-input", s);
|
|
136
|
-
export {
|
|
137
|
-
s as RepeaterElement
|
|
138
|
-
};
|
package/tabs.element-BYDNF_pm.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { LayoutWidgetAdapter as f, formContext as m, layoutContext as v } from "@golemui/lit";
|
|
2
|
-
import { createIntersectionObserver as c } from "@golemui/gui-components/internals";
|
|
3
|
-
import { safeDefine as $ } from "@golemui/lit/internals";
|
|
4
|
-
import { consume as y, provide as w } from "@lit/context";
|
|
5
|
-
import { LitElement as T, html as d, nothing as _ } from "lit";
|
|
6
|
-
import { repeat as p } from "lit-html/directives/repeat.js";
|
|
7
|
-
import { query as h, state as b, queryAll as x, property as g } from "lit/decorators.js";
|
|
8
|
-
import { classMap as u } from "lit/directives/class-map.js";
|
|
9
|
-
import "rxjs";
|
|
10
|
-
var k = Object.defineProperty, o = (l, s, e, i) => {
|
|
11
|
-
for (var t = void 0, n = l.length - 1, a; n >= 0; n--)
|
|
12
|
-
(a = l[n]) && (t = a(s, e, t) || t);
|
|
13
|
-
return t && k(s, e, t), t;
|
|
14
|
-
};
|
|
15
|
-
class r extends T {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments), this.activeTab = "", this.adapter = new f(), this.subscriptions = [];
|
|
18
|
-
}
|
|
19
|
-
createRenderRoot() {
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
updated(s) {
|
|
23
|
-
super.updated(s);
|
|
24
|
-
const e = this.adapter.templateData.size;
|
|
25
|
-
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
26
|
-
}
|
|
27
|
-
connectedCallback() {
|
|
28
|
-
super.connectedCallback(), this.classList.add("gui-tabs", "gui-field");
|
|
29
|
-
const s = this.widget.props;
|
|
30
|
-
this.adapter.context = this.formContext, this.adapter.init(this.widget), this.activeTab = s.defaultOpen ?? s.tabs[0].uid, this.subscriptions.push(
|
|
31
|
-
this.adapter.templateDataChanged$.subscribe(() => {
|
|
32
|
-
this.requestUpdate();
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
firstUpdated(s) {
|
|
37
|
-
this.startObserver = c(
|
|
38
|
-
this.startSentinel,
|
|
39
|
-
(t) => this.isStartVisible = t
|
|
40
|
-
), this.endObserver = c(
|
|
41
|
-
this.endSentinel,
|
|
42
|
-
(t) => this.isEndVisible = t
|
|
43
|
-
);
|
|
44
|
-
const i = this.widget.props.tabs.findIndex((t) => t.uid === this.activeTab);
|
|
45
|
-
this.tabButtons[i].scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
46
|
-
}
|
|
47
|
-
render() {
|
|
48
|
-
if (!this.adapter.templateData) return d``;
|
|
49
|
-
const s = this.widget.children.filter(
|
|
50
|
-
(i) => i.uid === this.activeTab || this.adapter.templateData.renderMode !== "activeOnly"
|
|
51
|
-
), e = {
|
|
52
|
-
"gui-widget": !0,
|
|
53
|
-
"gui-widget--horizontal": !0,
|
|
54
|
-
"gui-tabs--start-shadow": !this.isStartVisible,
|
|
55
|
-
"gui-tabs--end-shadow": !this.isEndVisible
|
|
56
|
-
};
|
|
57
|
-
return d`<nav class=${u(e)} id=${this.widget.uid}>
|
|
58
|
-
<ul role="tablist">
|
|
59
|
-
<li role="presentation" id="start-sentinel" class="gui-sentinel"></li>
|
|
60
|
-
${this.adapter.templateData.tabs ? p(
|
|
61
|
-
this.adapter.templateData.tabs,
|
|
62
|
-
(i, t) => d`
|
|
63
|
-
<li role="presentation">
|
|
64
|
-
<button
|
|
65
|
-
type="button"
|
|
66
|
-
role="tab"
|
|
67
|
-
tabindex=${i.uid === this.activeTab ? "0" : "-1"}
|
|
68
|
-
data-cy=${`tab_${this.widget.uid}_${t}`}
|
|
69
|
-
id=${`tab_${this.widget.uid}_${t}`}
|
|
70
|
-
aria-controls=${`tabpanel_${this.widget.uid}_${t}`}
|
|
71
|
-
aria-selected=${i.uid === this.activeTab ? "true" : "false"}
|
|
72
|
-
class=${u({ active: i.uid === this.activeTab })}
|
|
73
|
-
@click=${() => this.onClickTab(i.uid)}
|
|
74
|
-
@keydown=${this.onKeyDown}
|
|
75
|
-
@focus=${(n) => n.target.scrollIntoView({
|
|
76
|
-
block: "nearest",
|
|
77
|
-
inline: "nearest"
|
|
78
|
-
})}
|
|
79
|
-
>
|
|
80
|
-
${i.label}
|
|
81
|
-
</button>
|
|
82
|
-
</li>
|
|
83
|
-
`
|
|
84
|
-
) : _}
|
|
85
|
-
<li role="presentation" id="end-sentinel" class="gui-sentinel gui-sentinel__end"></li>
|
|
86
|
-
</ul>
|
|
87
|
-
</nav>
|
|
88
|
-
${p(
|
|
89
|
-
s,
|
|
90
|
-
(i) => i?.uid,
|
|
91
|
-
(i, t) => d`<section
|
|
92
|
-
role="tabpanel"
|
|
93
|
-
tabindex="0"
|
|
94
|
-
data-cy=${`tabpanel_${this.widget.uid}_${t}`}
|
|
95
|
-
id=${`tabpanel_${this.widget.uid}_${t}`}
|
|
96
|
-
?hidden=${i.uid !== this.activeTab && this.adapter.templateData.renderMode !== "activeOnly"}
|
|
97
|
-
aria-labelledby=${`tab_${this.widget.uid}_${t}`}
|
|
98
|
-
>
|
|
99
|
-
<gui-widget .widget=${i}></gui-widget>
|
|
100
|
-
</section>`
|
|
101
|
-
)}`;
|
|
102
|
-
}
|
|
103
|
-
disconnectedCallback() {
|
|
104
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((s) => s.unsubscribe()), this.startObserver?.disconnect(), this.endObserver?.disconnect();
|
|
105
|
-
}
|
|
106
|
-
onClickTab(s) {
|
|
107
|
-
this.activeTab = s, this.adapter.change(s), this.requestUpdate();
|
|
108
|
-
}
|
|
109
|
-
onKeyDown(s) {
|
|
110
|
-
const e = this.widget.props.tabs, i = e.findIndex((a) => a.uid === this.activeTab), t = Array.from(this.tabButtons), n = window.getComputedStyle(this).direction === "rtl";
|
|
111
|
-
switch (s.key) {
|
|
112
|
-
case "ArrowLeft": {
|
|
113
|
-
const a = i + (n ? 1 : -1);
|
|
114
|
-
a >= 0 && a < e.length && (this.activeTab = e[a].uid, t[a].focus());
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
case "ArrowRight": {
|
|
118
|
-
const a = i + (n ? -1 : 1);
|
|
119
|
-
a >= 0 && a < e.length && (this.activeTab = e[a].uid, t[a].focus());
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
case "Home":
|
|
123
|
-
this.activeTab = e[0].uid, t[0].focus();
|
|
124
|
-
break;
|
|
125
|
-
case "End":
|
|
126
|
-
this.activeTab = e[e.length - 1].uid, t[e.length - 1].focus();
|
|
127
|
-
break;
|
|
128
|
-
default:
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
o([
|
|
134
|
-
h("#start-sentinel")
|
|
135
|
-
], r.prototype, "startSentinel");
|
|
136
|
-
o([
|
|
137
|
-
h("#end-sentinel")
|
|
138
|
-
], r.prototype, "endSentinel");
|
|
139
|
-
o([
|
|
140
|
-
b()
|
|
141
|
-
], r.prototype, "isStartVisible");
|
|
142
|
-
o([
|
|
143
|
-
b()
|
|
144
|
-
], r.prototype, "isEndVisible");
|
|
145
|
-
o([
|
|
146
|
-
x('button[role="tab"]')
|
|
147
|
-
], r.prototype, "tabButtons");
|
|
148
|
-
o([
|
|
149
|
-
g({ type: String })
|
|
150
|
-
], r.prototype, "activeTab");
|
|
151
|
-
o([
|
|
152
|
-
y({ context: m }),
|
|
153
|
-
g({ attribute: !1 })
|
|
154
|
-
], r.prototype, "formContext");
|
|
155
|
-
o([
|
|
156
|
-
w({ context: v })
|
|
157
|
-
], r.prototype, "adapter");
|
|
158
|
-
$("gui-tabs-layout", r);
|
|
159
|
-
export {
|
|
160
|
-
r as TabsElement
|
|
161
|
-
};
|