blue-web 1.36.3 → 1.37.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/dist/js/701.bundle.js +1 -0
- package/dist/js/776.bundle.js +1 -0
- package/dist/js/actions.js +48 -57
- package/dist/js/color-mode.js +23 -29
- package/dist/js/dialog.js +82 -64
- package/dist/js/edit-view.js +52 -55
- package/dist/js/input-splitted.js +193 -244
- package/dist/js/layout.js +151 -192
- package/dist/js/modal-responsive.js +35 -48
- package/dist/js/odometer.js +132 -131
- package/dist/js/overflow-detector.js +51 -62
- package/dist/js/progress.js +41 -59
- package/dist/js/quick-look.bundle.js +1 -0
- package/dist/js/quick-look.d.ts +15 -0
- package/dist/js/quick-look.js +168 -0
- package/dist/js/read-view.js +125 -91
- package/dist/js/select-list.js +168 -177
- package/dist/js/shared.js +21 -26
- package/dist/js/utils.d.ts +1 -1
- package/dist/js/utils.js +4 -106
- package/dist/merged.scss +58 -1
- package/dist/style.css +53 -2
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +3 -3
- package/dist/style.scss +2 -1
- package/dist/styles/_quick-look.scss +56 -0
- package/package.json +7 -6
package/dist/js/read-view.js
CHANGED
|
@@ -1,92 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
-
const DRAG_THRESHOLD = 5;
|
|
5
|
-
|
|
1
|
+
// src/js/read-view.ts
|
|
2
|
+
var DRAG_THRESHOLD = 5;
|
|
6
3
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
4
|
+
* A Web Component that displays a read view of its content and allows the user to switch to an edit view.
|
|
5
|
+
* Fires event "EditRequested" when the user clicks the read view.
|
|
6
|
+
* @element read-view
|
|
7
|
+
* @fires EditRequested
|
|
8
|
+
* @attr {boolean} disabled - Disables the component, preventing interactions and removing hover effects.
|
|
9
|
+
* @cssprop --bs-primary-rgb - The primary color as an RGB value.
|
|
10
|
+
* @cssprop --bs-secondary-bg-subtle - The subtle background color for the read view.
|
|
11
|
+
* @cssprop --bs-border-radius-sm - The border radius for the read view.
|
|
12
|
+
* @slot - The content to display in the read view.
|
|
13
|
+
* @example
|
|
14
|
+
* <bl-read-view id="my-read-view" onEditRequested="setEditing(true)">
|
|
15
|
+
* <a href="#">bla</a> {value}
|
|
16
|
+
* </bl-read-view>
|
|
17
|
+
* @example
|
|
18
|
+
* document.getElementById("my-read-view").addEventListener("EditRequested", () => {
|
|
19
|
+
* setEditing(true)
|
|
20
|
+
* })
|
|
21
|
+
*/
|
|
22
|
+
var ReadView = class extends HTMLElement {
|
|
23
|
+
button;
|
|
24
|
+
container;
|
|
25
|
+
startX = 0;
|
|
26
|
+
startY = 0;
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.attachShadow({ mode: "open" });
|
|
30
|
+
}
|
|
31
|
+
static get observedAttributes() {
|
|
32
|
+
return ["disabled"];
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this.render();
|
|
36
|
+
}
|
|
37
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
38
|
+
if (name === "disabled") this.updateDisabledState();
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
if (!this.shadowRoot) return;
|
|
42
|
+
this.shadowRoot.innerHTML = `
|
|
43
|
+
<style>
|
|
44
|
+
button {
|
|
45
|
+
display: block;
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
appearance: none;
|
|
49
|
+
background-color: transparent;
|
|
50
|
+
border: none;
|
|
51
|
+
line-height: 1;
|
|
52
|
+
outline: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
button:focus-visible + div {
|
|
56
|
+
outline: 0;
|
|
57
|
+
box-shadow:
|
|
58
|
+
0 0 0 0.25rem rgba(var(--bs-primary-rgb), 25%),
|
|
59
|
+
inset 0 0 0 1px rgba(var(--bs-primary-rgb), 50%);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
div {
|
|
63
|
+
display: var(--display, flex);
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
width: auto;
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
border-color: transparent;
|
|
68
|
+
border-radius: calc(var(--bs-border-radius-sm, 3px) + var(--blue-read-view-padding-y));
|
|
69
|
+
background: var(--bg, transparent);
|
|
70
|
+
transition: var(--transition, background 0.2s);
|
|
71
|
+
|
|
72
|
+
padding: var(--blue-read-view-padding-y) var(--blue-read-view-padding-x);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
div:hover {
|
|
76
|
+
background: var(--hover-bg, var(--bs-secondary-bg));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([disabled]) div {
|
|
80
|
+
background-color: transparent;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
<button aria-label="Edit"></button>
|
|
84
|
+
<div role="presentation" part="presentation">
|
|
85
|
+
<slot></slot>
|
|
86
|
+
</div>
|
|
87
|
+
`;
|
|
88
|
+
this.button = this.shadowRoot.querySelector("button");
|
|
89
|
+
this.container = this.shadowRoot.querySelector("div");
|
|
90
|
+
this.button.addEventListener("click", this.onEditRequested.bind(this));
|
|
91
|
+
this.container.addEventListener("click", this.onReadViewClick.bind(this));
|
|
92
|
+
this.container.addEventListener("mousedown", this.onMouseDown.bind(this));
|
|
93
|
+
this.updateDisabledState();
|
|
94
|
+
}
|
|
95
|
+
updateDisabledState() {
|
|
96
|
+
const isDisabled = this.hasAttribute("disabled");
|
|
97
|
+
this.button?.setAttribute("aria-disabled", String(isDisabled));
|
|
98
|
+
if (isDisabled) this.button?.setAttribute("tabindex", "-1");
|
|
99
|
+
else this.button?.removeAttribute("tabindex");
|
|
100
|
+
this.container?.setAttribute("aria-disabled", String(isDisabled));
|
|
101
|
+
}
|
|
102
|
+
onEditRequested() {
|
|
103
|
+
if (this.hasAttribute("disabled")) return;
|
|
104
|
+
this.dispatchEvent(new CustomEvent("EditRequested", {
|
|
105
|
+
bubbles: true,
|
|
106
|
+
composed: true
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
onMouseDown(event) {
|
|
110
|
+
if (this.hasAttribute("disabled")) return;
|
|
111
|
+
this.startX = event.clientX;
|
|
112
|
+
this.startY = event.clientY;
|
|
113
|
+
}
|
|
114
|
+
mouseHasMovedAfterMouseDown(event) {
|
|
115
|
+
return Math.abs(this.startX - event.clientX) >= DRAG_THRESHOLD || Math.abs(this.startY - event.clientY) >= DRAG_THRESHOLD;
|
|
116
|
+
}
|
|
117
|
+
onReadViewClick(event) {
|
|
118
|
+
if (this.hasAttribute("disabled")) return;
|
|
119
|
+
if (event.target.tagName.toLowerCase() !== "a" && !this.mouseHasMovedAfterMouseDown(event)) {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
this.onEditRequested();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
customElements.define("bl-read-view", ReadView);
|
|
126
|
+
export { ReadView };
|
package/dist/js/select-list.js
CHANGED
|
@@ -1,178 +1,169 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
// src/js/select-list.ts
|
|
2
|
+
var BlSelectEvent = class BlSelectEvent extends Event {
|
|
3
|
+
static eventName = "bl-select";
|
|
4
|
+
index;
|
|
5
|
+
item;
|
|
6
|
+
constructor(index, item) {
|
|
7
|
+
super(BlSelectEvent.eventName, {
|
|
8
|
+
bubbles: true,
|
|
9
|
+
composed: true
|
|
10
|
+
});
|
|
11
|
+
this.index = index;
|
|
12
|
+
this.item = item;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this.updateActiveItem();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (!customElements.get("bl-select-list")) {
|
|
175
|
-
customElements.define("bl-select-list", SelectList);
|
|
176
|
-
}
|
|
177
|
-
export { SelectList, BlSelectEvent };
|
|
178
|
-
export default SelectList;
|
|
16
|
+
* A Web Component that provides a keyboard-accessible selectable list, typically used for dropdowns or autocomplete lists.
|
|
17
|
+
* Together with `popover` and CSS Anchoring, it's also useful to create a dropdown list.
|
|
18
|
+
* Supports keyboard navigation and selection, and integrates with an input element for combobox behavior.
|
|
19
|
+
*
|
|
20
|
+
* The Web Component will automatically set attributes for accessibility.
|
|
21
|
+
*
|
|
22
|
+
* @element bl-select-list
|
|
23
|
+
* @attr {string} for - The id of the input element to associate as the combobox controller.
|
|
24
|
+
* @attr {string} active-class - The CSS class name to apply to the active item (default: "active").
|
|
25
|
+
* @slot - The list options.
|
|
26
|
+
* @example
|
|
27
|
+
* <input id="my-input" />
|
|
28
|
+
* <bl-select-list for="my-input">
|
|
29
|
+
* <div>Option 1</div>
|
|
30
|
+
* <div>Option 2</div>
|
|
31
|
+
* </bl-select-list>
|
|
32
|
+
*/
|
|
33
|
+
var SelectList = class extends HTMLElement {
|
|
34
|
+
activeIndex;
|
|
35
|
+
items;
|
|
36
|
+
inputElement;
|
|
37
|
+
slotElement;
|
|
38
|
+
observer;
|
|
39
|
+
constructor() {
|
|
40
|
+
super();
|
|
41
|
+
this.attachShadow({ mode: "open" });
|
|
42
|
+
this.shadowRoot.innerHTML = `<slot style="border-radius: inherit"></slot>`;
|
|
43
|
+
this.activeIndex = -1;
|
|
44
|
+
this.items = [];
|
|
45
|
+
this.inputElement = null;
|
|
46
|
+
this.slotElement = null;
|
|
47
|
+
this.observer = null;
|
|
48
|
+
}
|
|
49
|
+
get activeClass() {
|
|
50
|
+
return this.getAttribute("active-class") || "active";
|
|
51
|
+
}
|
|
52
|
+
connectedCallback() {
|
|
53
|
+
this.setAttribute("role", "listbox");
|
|
54
|
+
this.tabIndex = -1;
|
|
55
|
+
this.updateItems();
|
|
56
|
+
this.syncActiveIndexFromDataSelected();
|
|
57
|
+
this.updateActiveItem();
|
|
58
|
+
const inputId = this.getAttribute("for");
|
|
59
|
+
this.inputElement = inputId ? document.getElementById(inputId) : null;
|
|
60
|
+
if (this.inputElement) {
|
|
61
|
+
this.inputElement.setAttribute("role", "combobox");
|
|
62
|
+
this.inputElement.setAttribute("aria-controls", this.id);
|
|
63
|
+
this.inputElement.setAttribute("aria-expanded", "true");
|
|
64
|
+
this.inputElement.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
65
|
+
}
|
|
66
|
+
this.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
67
|
+
this.addEventListener("click", (e) => {
|
|
68
|
+
const target = e.target instanceof Element ? e.target.closest("[data-select-list-index]") : null;
|
|
69
|
+
if (target && target.hasAttribute("data-select-list-index")) {
|
|
70
|
+
const index = Number(target.getAttribute("data-select-list-index"));
|
|
71
|
+
this.select(index);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
this.observer = new MutationObserver((mutations) => {
|
|
75
|
+
if (mutations.some((m) => m.type === "childList")) this.handleChildrenChanged();
|
|
76
|
+
if (mutations.some((m) => m.type === "attributes" && m.attributeName === "data-selected")) {
|
|
77
|
+
this.syncActiveIndexFromDataSelected();
|
|
78
|
+
this.updateActiveItem();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
this.observer.observe(this, {
|
|
82
|
+
childList: true,
|
|
83
|
+
subtree: true,
|
|
84
|
+
attributes: true,
|
|
85
|
+
attributeFilter: ["data-selected"]
|
|
86
|
+
});
|
|
87
|
+
this.slotElement = this.shadowRoot?.querySelector("slot");
|
|
88
|
+
this.slotElement?.addEventListener("slotchange", this.handleChildrenChanged);
|
|
89
|
+
}
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
this.observer?.disconnect();
|
|
92
|
+
this.observer = null;
|
|
93
|
+
this.slotElement?.removeEventListener("slotchange", this.handleChildrenChanged);
|
|
94
|
+
}
|
|
95
|
+
handleChildrenChanged = () => {
|
|
96
|
+
const previousActiveId = this.items[this.activeIndex]?.id;
|
|
97
|
+
this.updateItems();
|
|
98
|
+
if (previousActiveId) {
|
|
99
|
+
const newIndex = this.items.findIndex((el) => el.id === previousActiveId);
|
|
100
|
+
this.activeIndex = newIndex >= 0 ? newIndex : -1;
|
|
101
|
+
} else this.activeIndex = -1;
|
|
102
|
+
this.updateActiveItem();
|
|
103
|
+
};
|
|
104
|
+
syncActiveIndexFromDataSelected() {
|
|
105
|
+
const selectedIndex = this.items.findIndex((el) => el.hasAttribute("data-selected"));
|
|
106
|
+
if (selectedIndex >= 0) this.activeIndex = selectedIndex;
|
|
107
|
+
}
|
|
108
|
+
updateItems() {
|
|
109
|
+
const selectableSelectors = [
|
|
110
|
+
"button:not([disabled])",
|
|
111
|
+
"a[href]",
|
|
112
|
+
"input:not([disabled])",
|
|
113
|
+
"select:not([disabled])",
|
|
114
|
+
"textarea:not([disabled])",
|
|
115
|
+
"[tabindex]:not([tabindex=\"-1\"])",
|
|
116
|
+
"[role=\"option\"]"
|
|
117
|
+
].join(", ");
|
|
118
|
+
this.items = Array.from(this.querySelectorAll(selectableSelectors));
|
|
119
|
+
this.items.forEach((el, i) => {
|
|
120
|
+
if (!el.hasAttribute("id")) el.setAttribute("id", `${this.id}-option-${i}`);
|
|
121
|
+
el.setAttribute("data-select-list-index", i.toString());
|
|
122
|
+
el.setAttribute("aria-selected", "false");
|
|
123
|
+
el.setAttribute("role", "option");
|
|
124
|
+
el.tabIndex = -1;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
onKeyDown(e) {
|
|
128
|
+
if (!this.items.length) return;
|
|
129
|
+
if (e.key === "ArrowDown") {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
this.activeIndex = (this.activeIndex + 1) % this.items.length;
|
|
132
|
+
this.updateActiveItem();
|
|
133
|
+
} else if (e.key === "ArrowUp") {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
this.activeIndex = (this.activeIndex - 1 + this.items.length) % this.items.length;
|
|
136
|
+
this.updateActiveItem();
|
|
137
|
+
} else if (e.key === "Enter" && this.activeIndex >= 0) {
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
this.items[this.activeIndex]?.click();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
updateActiveItem() {
|
|
143
|
+
const activeClassNames = this.activeClass.split(" ");
|
|
144
|
+
this.items.forEach((el, i) => {
|
|
145
|
+
const active = i === this.activeIndex;
|
|
146
|
+
activeClassNames.forEach((activeClassName) => {
|
|
147
|
+
el.classList.toggle(activeClassName, active);
|
|
148
|
+
});
|
|
149
|
+
el.setAttribute("aria-selected", active.toString());
|
|
150
|
+
});
|
|
151
|
+
const activeItem = this.items[this.activeIndex];
|
|
152
|
+
if (activeItem && this.inputElement) {
|
|
153
|
+
this.inputElement.setAttribute("aria-activedescendant", activeItem.id);
|
|
154
|
+
activeItem.scrollIntoView({ block: "nearest" });
|
|
155
|
+
} else if (this.inputElement) this.inputElement.removeAttribute("aria-activedescendant");
|
|
156
|
+
}
|
|
157
|
+
select(index) {
|
|
158
|
+
this.activeIndex = index;
|
|
159
|
+
this.items.forEach((el) => el.removeAttribute("data-selected"));
|
|
160
|
+
const selectedItem = this.items[index];
|
|
161
|
+
if (selectedItem) {
|
|
162
|
+
selectedItem.setAttribute("data-selected", "");
|
|
163
|
+
this.dispatchEvent(new BlSelectEvent(index, selectedItem));
|
|
164
|
+
this.updateActiveItem();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
if (!customElements.get("bl-select-list")) customElements.define("bl-select-list", SelectList);
|
|
169
|
+
export { BlSelectEvent, SelectList, SelectList as default };
|
package/dist/js/shared.js
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
// src/js/shared.ts
|
|
2
|
+
var phrases = {
|
|
3
|
+
Cancel: ["Cancel", "Abbrechen"],
|
|
4
|
+
Message: ["Message", "Nachricht"],
|
|
5
|
+
Question: ["Question", "Frage"],
|
|
6
|
+
Confirm: ["Confirm", "Bestätigen"],
|
|
7
|
+
"Toggle menu": ["Toggle menu", "Menü umschalten"],
|
|
8
|
+
"Close all": ["Close all", "Alle schließen"],
|
|
9
|
+
Error: ["Error", "Fehler"],
|
|
10
|
+
Information: ["Information", "Information"],
|
|
11
|
+
Loading: ["Loading", "Laden"],
|
|
12
|
+
Successful: ["Successful", "Erfolgreich"]
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return _phrases[keyword][0];
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
return keyword;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
14
|
+
function getPhrase(keyword, countryCode = void 0, _phrases = void 0) {
|
|
15
|
+
countryCode = countryCode || navigator.language.toLowerCase().indexOf("de") > -1 ? "de-DE" : "en-US";
|
|
16
|
+
_phrases = _phrases || phrases;
|
|
17
|
+
if (_phrases[keyword]) {
|
|
18
|
+
if (countryCode.indexOf("de-") > -1) return _phrases[keyword][1];
|
|
19
|
+
else return _phrases[keyword][0];
|
|
20
|
+
} else return keyword;
|
|
21
|
+
}
|
|
22
|
+
export { getPhrase };
|
package/dist/js/utils.d.ts
CHANGED