blue-web 1.16.1 → 1.17.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.
@@ -0,0 +1 @@
1
+ (()=>{"use strict";class t extends HTMLElement{#t;#e=[];#s=[];#i=!1;get lightDom(){return this.#i}set lightDom(t){this.#i=t,!0===this.lightDom?this.innerHTML=this.#r:(this.shadowRoot||this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot.innerHTML=this.#r),this.#l()}#h="";get value(){return this.#h}set value(t){const e=this.#h;this.#h=t,this.#e=this.value.split("");for(let t=0;t<this.length;t++)this.#s[t]&&(this.#s[t].value=this.#e[t]||"");e!==t&&this.dispatchEvent(new CustomEvent("changeValue",{bubbles:!0,detail:t}))}#o=0;get length(){return this.#o}set length(t){if(this.#o=t,this.length>this.#s.length)for(let t=0;t<this.length;t++)!this.#s[t]&&this.didInit&&this.#n(this.#s.length);else if(this.length<this.#s.length){const t=Math.abs(this.#s.length-this.length);for(let e=0;e<t;e++){const t=this.#s.pop();t?.remove()}}this.#s=[...this.#s]}#a="";get controlClass(){return this.#a}set controlClass(t){this.#a=t;for(const t of this.#s)t.className=this.controlClass}#u="";get control1Id(){return this.#u}set control1Id(t){this.#u=t,this.#s[0]&&(this.#s[0].id=this.control1Id)}#r="<style>\n input {\n display: var(--blue-input-splitted-display, revert);\n background-color: var(--blue-input-splitted-background-color, revert);\n border: var(--blue-input-splitted-border, revert);\n border-radius: var(--blue-input-splitted-border-radius, revert);\n box-shadow: var(--blue-input-splitted-box-shadow, revert);\n color: var(--blue-input-splitted-color, revert);\n margin: var(--blue-input-splitted-margin, revert);\n padding: var(--blue-input-splitted-padding, revert);\n text-align: var(--blue-input-splitted-text-align, revert);\n width: var(--blue-input-splitted-width, revert);\n }\n</style>";didInit=!1;constructor(){super(),this.onFocus=this.onFocus.bind(this)}connectedCallback(){this.didInit=!0,this.lightDom=null!==this.getAttribute("light-dom"),this.#l(),this.value=this.getAttribute("value")||this.value,this.length=e(this),this.controlClass=this.getAttribute("control-class")||this.controlClass,this.control1Id=this.getAttribute("control-1-id")||this.control1Id,this.#d()}#n(t){const e=document.createElement("input");this.#s.push(e),e.type="text",e.className=this.controlClass,0===t&&(e.id=this.control1Id),e.maxLength=1,e.value=this.#e[t]||"",e.addEventListener("input",(e=>{let{target:s}=e;const i=s;""!==i.value&&this.#s[t+1]&&this.#s[t+1].focus(),this.#e[t]=i.value,this.value=this.#e.join("")})),e.addEventListener("keydown",(e=>{let{key:s,target:i}=e;"Backspace"===s&&""===i.value&&void 0!==this.#s[t-1]&&this.#s[t-1].focus()})),e.addEventListener("paste",(e=>{let{clipboardData:s}=e;const i=s.getData("Text");let r=0;for(let e=t;e<this.length;e++)this.#e[e]=i.split("")[r],this.#s[e].focus(),r+=1;this.value=this.#e.join("")})),this.lightDom?this.appendChild(e):this.shadowRoot.appendChild(e)}onFocus(){this.#s[0]&&this.#s[0].focus()}#l(){this.value=this.getAttribute("value")||"",this.length=e(this),this.lightDom?(this.innerHTML=this.#r,this.addEventListener("focus",this.onFocus)):(this.shadowRoot.innerHTML=this.#r,this.shadowRoot.addEventListener("focus",this.onFocus)),this.#e=this.value.split(""),this.#s=[];for(let t=0;t<this.length;t++)this.#n(t)}#d(){this.#t=this.#t||new MutationObserver((t=>{t.forEach((t=>{"value"===t.attributeName&&(this.value=this.getAttribute("value")||this.value),"length"===t.attributeName&&(this.length=e(this)),"control-class"===t.attributeName&&(this.controlClass=this.getAttribute("control-class")||this.controlClass),"control-1-id"===t.attributeName&&(this.control1Id=this.getAttribute("control-1-id")||this.control1Id),"light-dom"===t.attributeName&&(this.lightDom=null!==this.getAttribute("light-dom"))}))})),this.#t.observe(this,{attributeFilter:["value","length","control-class","control-1-id","light-dom"],attributeOldValue:!0,childList:!0,subtree:!0})}#c(){this.#t&&(this.#t.takeRecords(),this.#t.disconnect())}disconnectedCallback(){this.#c()}static get formAssociated(){return!0}}function e(t){const e=t.getAttribute("length");if(e)return parseInt(e)}customElements.define("bl-input-splitted",t)})();
@@ -0,0 +1,19 @@
1
+ export declare class InputSplitted extends HTMLElement {
2
+ #private;
3
+ get lightDom(): boolean;
4
+ set lightDom(_lightDom: boolean);
5
+ get value(): string;
6
+ set value(_value: string);
7
+ get length(): number;
8
+ set length(_length: number);
9
+ get controlClass(): string;
10
+ set controlClass(value: string);
11
+ get control1Id(): string;
12
+ set control1Id(value: string);
13
+ didInit: boolean;
14
+ constructor();
15
+ connectedCallback(): void;
16
+ onFocus(): void;
17
+ disconnectedCallback(): void;
18
+ static get formAssociated(): boolean;
19
+ }
@@ -0,0 +1,229 @@
1
+ export class InputSplitted extends HTMLElement {
2
+ #observer;
3
+ #valueArray = [];
4
+ #refArray = [];
5
+ #lightDom = false;
6
+ get lightDom() {
7
+ return this.#lightDom;
8
+ }
9
+ set lightDom(_lightDom) {
10
+ this.#lightDom = _lightDom;
11
+ if (this.lightDom === true) {
12
+ this.innerHTML = this.#styling;
13
+ } else {
14
+ if (!this.shadowRoot) this.attachShadow({
15
+ mode: "open",
16
+ delegatesFocus: true
17
+ });
18
+ this.shadowRoot.innerHTML = this.#styling;
19
+ }
20
+ this.#initDom();
21
+ }
22
+ #value = "";
23
+ get value() {
24
+ return this.#value;
25
+ }
26
+ set value(_value) {
27
+ const oldValue = this.#value;
28
+ this.#value = _value;
29
+ this.#valueArray = this.value.split("");
30
+ for (let i = 0; i < this.length; i++) {
31
+ if (this.#refArray[i]) this.#refArray[i].value = this.#valueArray[i] || "";
32
+ }
33
+ if (oldValue !== _value) {
34
+ this.dispatchEvent(new CustomEvent("changeValue", {
35
+ bubbles: true,
36
+ detail: _value
37
+ }));
38
+ }
39
+ }
40
+ #length = 0;
41
+ get length() {
42
+ return this.#length;
43
+ }
44
+ set length(_length) {
45
+ this.#length = _length;
46
+ if (this.length > this.#refArray.length) {
47
+ // Added length
48
+
49
+ for (let j = 0; j < this.length; j++) {
50
+ if (!this.#refArray[j] && this.didInit) {
51
+ this.#addInput(this.#refArray.length);
52
+ }
53
+ }
54
+ } else if (this.length < this.#refArray.length) {
55
+ // Removed length
56
+
57
+ const difference = Math.abs(this.#refArray.length - this.length);
58
+ for (let j = 0; j < difference; j++) {
59
+ const el = this.#refArray.pop();
60
+ el?.remove();
61
+ }
62
+ }
63
+ this.#refArray = [...this.#refArray];
64
+ }
65
+ #controlClass = "";
66
+ get controlClass() {
67
+ return this.#controlClass;
68
+ }
69
+ set controlClass(value) {
70
+ this.#controlClass = value;
71
+ for (const el of this.#refArray) {
72
+ el.className = this.controlClass;
73
+ }
74
+ }
75
+ #control1Id = "";
76
+ get control1Id() {
77
+ return this.#control1Id;
78
+ }
79
+ set control1Id(value) {
80
+ this.#control1Id = value;
81
+ if (this.#refArray[0]) {
82
+ this.#refArray[0].id = this.control1Id;
83
+ }
84
+ }
85
+ #styling = /* html */`<style>
86
+ input {
87
+ display: var(--blue-input-splitted-display, revert);
88
+ background-color: var(--blue-input-splitted-background-color, revert);
89
+ border: var(--blue-input-splitted-border, revert);
90
+ border-radius: var(--blue-input-splitted-border-radius, revert);
91
+ box-shadow: var(--blue-input-splitted-box-shadow, revert);
92
+ color: var(--blue-input-splitted-color, revert);
93
+ margin: var(--blue-input-splitted-margin, revert);
94
+ padding: var(--blue-input-splitted-padding, revert);
95
+ text-align: var(--blue-input-splitted-text-align, revert);
96
+ width: var(--blue-input-splitted-width, revert);
97
+ }
98
+ </style>`;
99
+ didInit = false;
100
+ constructor() {
101
+ super();
102
+ this.onFocus = this.onFocus.bind(this);
103
+ }
104
+ connectedCallback() {
105
+ this.didInit = true;
106
+ this.lightDom = this.getAttribute("light-dom") !== null;
107
+ this.#initDom();
108
+ this.value = this.getAttribute("value") || this.value;
109
+ this.length = getLength(this);
110
+ this.controlClass = this.getAttribute("control-class") || this.controlClass;
111
+ this.control1Id = this.getAttribute("control-1-id") || this.control1Id;
112
+ this.#observe();
113
+ }
114
+ #addInput(i) {
115
+ const input = document.createElement("input");
116
+ this.#refArray.push(input);
117
+ input.type = "text";
118
+ input.className = this.controlClass;
119
+ if (i === 0) {
120
+ input.id = this.control1Id;
121
+ }
122
+ input.maxLength = 1;
123
+ input.value = this.#valueArray[i] || "";
124
+ input.addEventListener("input", _ref => {
125
+ let {
126
+ target
127
+ } = _ref;
128
+ const inputTarget = target;
129
+ if (inputTarget.value !== "" && this.#refArray[i + 1]) {
130
+ this.#refArray[i + 1].focus();
131
+ }
132
+ this.#valueArray[i] = inputTarget.value;
133
+ this.value = this.#valueArray.join("");
134
+ });
135
+ input.addEventListener("keydown", _ref2 => {
136
+ let {
137
+ key,
138
+ target
139
+ } = _ref2;
140
+ const inputTarget = target;
141
+ if (key === "Backspace" && inputTarget.value === "" && this.#refArray[i - 1] !== undefined) {
142
+ this.#refArray[i - 1].focus();
143
+ }
144
+ });
145
+ input.addEventListener("paste", _ref3 => {
146
+ let {
147
+ clipboardData
148
+ } = _ref3;
149
+ const pastedData = clipboardData.getData("Text");
150
+ let k = 0;
151
+ for (let j = i; j < this.length; j++) {
152
+ this.#valueArray[j] = pastedData.split("")[k];
153
+ this.#refArray[j].focus();
154
+ k = k + 1;
155
+ }
156
+ this.value = this.#valueArray.join("");
157
+ });
158
+ if (this.lightDom) {
159
+ this.appendChild(input);
160
+ } else {
161
+ this.shadowRoot.appendChild(input);
162
+ }
163
+ }
164
+ onFocus() {
165
+ if (this.#refArray[0]) this.#refArray[0].focus();
166
+ }
167
+ #initDom() {
168
+ this.value = this.getAttribute("value") || "";
169
+ this.length = getLength(this);
170
+ if (this.lightDom) {
171
+ this.innerHTML = this.#styling;
172
+ this.addEventListener("focus", this.onFocus);
173
+ } else {
174
+ this.shadowRoot.innerHTML = this.#styling;
175
+ this.shadowRoot.addEventListener("focus", this.onFocus);
176
+ }
177
+ this.#valueArray = this.value.split("");
178
+ this.#refArray = [];
179
+ for (let i = 0; i < this.length; i++) {
180
+ this.#addInput(i);
181
+ }
182
+ }
183
+ #observe() {
184
+ // Observer prüft, ob sich HTML-Attribute geändert haben.
185
+ // Props-Änderungen werden ohne bemerkt.
186
+ this.#observer = this.#observer || new MutationObserver(mutations => {
187
+ mutations.forEach(m => {
188
+ if (m.attributeName === "value") {
189
+ this.value = this.getAttribute("value") || this.value;
190
+ }
191
+ if (m.attributeName === "length") {
192
+ this.length = getLength(this);
193
+ }
194
+ if (m.attributeName === "control-class") {
195
+ this.controlClass = this.getAttribute("control-class") || this.controlClass;
196
+ }
197
+ if (m.attributeName === "control-1-id") {
198
+ this.control1Id = this.getAttribute("control-1-id") || this.control1Id;
199
+ }
200
+ if (m.attributeName === "light-dom") {
201
+ this.lightDom = this.getAttribute("light-dom") !== null;
202
+ }
203
+ });
204
+ });
205
+ this.#observer.observe(this, {
206
+ attributeFilter: ["value", "length", "control-class", "control-1-id", "light-dom"],
207
+ attributeOldValue: true,
208
+ childList: true,
209
+ subtree: true
210
+ });
211
+ }
212
+ #unobserve() {
213
+ if (this.#observer) {
214
+ this.#observer.takeRecords();
215
+ this.#observer.disconnect();
216
+ }
217
+ }
218
+ disconnectedCallback() {
219
+ this.#unobserve();
220
+ }
221
+ static get formAssociated() {
222
+ return true;
223
+ }
224
+ }
225
+ function getLength(element) {
226
+ const attr = element.getAttribute("length");
227
+ if (attr) return parseInt(attr);
228
+ }
229
+ customElements.define("bl-input-splitted", InputSplitted);
@@ -1 +1 @@
1
- (()=>{"use strict";class t extends HTMLElement{startX=0;startY=0;constructor(){super(),this.attachShadow({mode:"open"})}static get observedAttributes(){return["disabled"]}connectedCallback(){this.render()}attributeChangedCallback(t,e,n){"disabled"===t&&this.updateDisabledState()}render(){this.shadowRoot&&(this.shadowRoot.innerHTML='\n <style>\n button {\n display: block;\n margin: 0;\n padding: 0;\n appearance: none;\n background-color: transparent;\n border: none;\n line-height: 1;\n outline: 0;\n }\n\n button:focus-visible + div {\n outline: 0;\n box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 25%);\n border-color: rgba(var(--bs-primary-rgb), 50%);\n }\n\n div {\n display: inline-block;\n box-sizing: border-box;\n width: auto;\n max-width: 100%;\n border-color: transparent;\n border-radius: var(--bs-border-radius-sm, 3px);\n border: 1px solid transparent;\n transition: background 0.2s;\n }\n\n div:hover {\n background-color: var(--bs-secondary-bg-subtle);\n }\n\n :host([disabled]) div {\n background-color: transparent;\n }\n </style>\n <button aria-label="Edit"></button>\n <div role="presentation">\n <slot></slot>\n </div>\n ',this.button=this.shadowRoot.querySelector("button"),this.container=this.shadowRoot.querySelector("div"),this.button.addEventListener("click",this.onEditRequested.bind(this)),this.container.addEventListener("click",this.onReadViewClick.bind(this)),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),this.updateDisabledState())}updateDisabledState(){const t=this.hasAttribute("disabled");this.button?.setAttribute("aria-disabled",String(t)),this.container?.setAttribute("aria-disabled",String(t))}onEditRequested(){this.hasAttribute("disabled")||this.dispatchEvent(new CustomEvent("EditRequested",{bubbles:!0,composed:!0}))}onMouseDown(t){this.hasAttribute("disabled")||(this.startX=t.clientX,this.startY=t.clientY)}mouseHasMovedAfterMouseDown(t){return Math.abs(this.startX-t.clientX)>=5||Math.abs(this.startY-t.clientY)>=5}onReadViewClick(t){this.hasAttribute("disabled")||"a"===t.target.tagName.toLowerCase()||this.mouseHasMovedAfterMouseDown(t)||(t.preventDefault(),this.onEditRequested())}}customElements.define("read-view",t)})();
1
+ (()=>{"use strict";class t extends HTMLElement{startX=0;startY=0;constructor(){super(),this.attachShadow({mode:"open"})}static get observedAttributes(){return["disabled"]}connectedCallback(){this.render()}attributeChangedCallback(t,e,n){"disabled"===t&&this.updateDisabledState()}render(){this.shadowRoot&&(this.shadowRoot.innerHTML='\n <style>\n button {\n display: block;\n margin: 0;\n padding: 0;\n appearance: none;\n background-color: transparent;\n border: none;\n line-height: 1;\n outline: 0;\n }\n\n button:focus-visible + div {\n outline: 0;\n box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 25%);\n border-color: rgba(var(--bs-primary-rgb), 50%);\n }\n\n div {\n display: inline-block;\n box-sizing: border-box;\n width: auto;\n max-width: 100%;\n border-color: transparent;\n border-radius: var(--bs-border-radius-sm, 3px);\n border: 1px solid transparent;\n transition: background 0.2s;\n }\n\n div:hover {\n background-color: var(--bs-secondary-bg-subtle);\n }\n\n :host([disabled]) div {\n background-color: transparent;\n }\n </style>\n <button aria-label="Edit"></button>\n <div role="presentation">\n <slot></slot>\n </div>\n ',this.button=this.shadowRoot.querySelector("button"),this.container=this.shadowRoot.querySelector("div"),this.button.addEventListener("click",this.onEditRequested.bind(this)),this.container.addEventListener("click",this.onReadViewClick.bind(this)),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),this.updateDisabledState())}updateDisabledState(){const t=this.hasAttribute("disabled");this.button?.setAttribute("aria-disabled",String(t)),this.container?.setAttribute("aria-disabled",String(t))}onEditRequested(){this.hasAttribute("disabled")||this.dispatchEvent(new CustomEvent("EditRequested",{bubbles:!0,composed:!0}))}onMouseDown(t){this.hasAttribute("disabled")||(this.startX=t.clientX,this.startY=t.clientY)}mouseHasMovedAfterMouseDown(t){return Math.abs(this.startX-t.clientX)>=5||Math.abs(this.startY-t.clientY)>=5}onReadViewClick(t){this.hasAttribute("disabled")||"a"===t.target.tagName.toLowerCase()||this.mouseHasMovedAfterMouseDown(t)||(t.preventDefault(),this.onEditRequested())}}customElements.define("bl-read-view",t)})();
@@ -9,9 +9,9 @@
9
9
  * @cssprop --bs-border-radius-sm - The border radius for the read view.
10
10
  * @slot - The content to display in the read view.
11
11
  * @example
12
- * <read-view id="my-read-view" onEditRequested="setEditing(true)">
12
+ * <bl-read-view id="my-read-view" onEditRequested="setEditing(true)">
13
13
  * <a href="#">bla</a> {value}
14
- * </read-view>
14
+ * </bl-read-view>
15
15
  * @example
16
16
  * document.getElementById("my-read-view").addEventListener("EditRequested", () => {
17
17
  * setEditing(true)
@@ -11,9 +11,9 @@ const DRAG_THRESHOLD = 5;
11
11
  * @cssprop --bs-border-radius-sm - The border radius for the read view.
12
12
  * @slot - The content to display in the read view.
13
13
  * @example
14
- * <read-view id="my-read-view" onEditRequested="setEditing(true)">
14
+ * <bl-read-view id="my-read-view" onEditRequested="setEditing(true)">
15
15
  * <a href="#">bla</a> {value}
16
- * </read-view>
16
+ * </bl-read-view>
17
17
  * @example
18
18
  * document.getElementById("my-read-view").addEventListener("EditRequested", () => {
19
19
  * setEditing(true)
@@ -120,4 +120,4 @@ export class ReadView extends HTMLElement {
120
120
  }
121
121
  }
122
122
  }
123
- customElements.define("read-view", ReadView);
123
+ customElements.define("bl-read-view", ReadView);
@@ -0,0 +1 @@
1
+ (()=>{"use strict";class t extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='<slot style="border-radius: inherit"></slot>',this.activeIndex=-1,this.items=[],this.inputElement=null}connectedCallback(){this.setAttribute("role","listbox"),this.tabIndex=-1,this.updateItems();const t=this.getAttribute("for");this.inputElement=t?document.getElementById(t):null,this.inputElement&&(this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-controls",this.id),this.inputElement.setAttribute("aria-expanded","true"),this.inputElement.addEventListener("keydown",this.onKeyDown.bind(this))),this.addEventListener("keydown",this.onKeyDown.bind(this)),this.addEventListener("click",(t=>{const e=t.target instanceof Element?t.target.closest("[data-blue-select-list-index]"):null;if(e&&e.hasAttribute("data-blue-select-list-index")){const t=Number(e.getAttribute("data-blue-select-list-index"));this.select(t)}}))}updateItems(){this.items=Array.from(this.children),this.items.forEach(((t,e)=>{t.hasAttribute("id")||t.setAttribute("id",`${this.id}-option-${e}`),t.setAttribute("data-blue-select-list-index",e.toString()),t.setAttribute("aria-selected","false"),t.setAttribute("role","option"),t.tabIndex=-1}))}onKeyDown(t){if(console.log("select-list onKeyDown"),this.items.length)if("ArrowDown"===t.key)t.preventDefault(),this.activeIndex=(this.activeIndex+1)%this.items.length,this.updateActiveItem();else if("ArrowUp"===t.key)t.preventDefault(),this.activeIndex=(this.activeIndex-1+this.items.length)%this.items.length,this.updateActiveItem();else if("Enter"===t.key&&this.activeIndex>=0){const t=this.items[this.activeIndex];t?.click()}}updateActiveItem(){this.items.forEach(((t,e)=>{const i=e===this.activeIndex;t.classList.toggle("active",i),t.setAttribute("aria-selected",i.toString())}));const t=this.items[this.activeIndex];t&&this.inputElement&&(this.inputElement.setAttribute("aria-activedescendant",t.id),t.scrollIntoView({block:"nearest"}))}select(t){this.activeIndex=t,this.updateActiveItem();const e=this.items[t];e&&(this.dispatchEvent(new CustomEvent("bl-select",{detail:{index:t,item:e},bubbles:!0,composed:!0})),e.click())}}customElements.define("bl-select-list",t)})();
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A Web Component that provides a keyboard-accessible selectable list, typically used for dropdowns or autocomplete lists.
3
+ * Together with `popover` and CSS Anchoring, it's also useful to create a dropdown list.
4
+ * Supports keyboard navigation and selection, and integrates with an input element for combobox behavior.
5
+ *
6
+ * The Web Component will automatically set attributes for accessibility.
7
+ *
8
+ * @element blue-select-list
9
+ * @attr {string} for - The id of the input element to associate as the combobox controller.
10
+ * @slot - The list options.
11
+ * @example
12
+ * <input id="my-input" />
13
+ * <blue-select-list for="my-input">
14
+ * <div>Option 1</div>
15
+ * <div>Option 2</div>
16
+ * </blue-select-list>
17
+ */
18
+ export declare class SelectList extends HTMLElement {
19
+ activeIndex: number;
20
+ items: HTMLElement[];
21
+ inputElement: HTMLElement | null;
22
+ constructor();
23
+ connectedCallback(): void;
24
+ updateItems(): void;
25
+ onKeyDown(e: {
26
+ key: string;
27
+ preventDefault: () => void;
28
+ }): void;
29
+ updateActiveItem(): void;
30
+ select(index: number): void;
31
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * A Web Component that provides a keyboard-accessible selectable list, typically used for dropdowns or autocomplete lists.
3
+ * Together with `popover` and CSS Anchoring, it's also useful to create a dropdown list.
4
+ * Supports keyboard navigation and selection, and integrates with an input element for combobox behavior.
5
+ *
6
+ * The Web Component will automatically set attributes for accessibility.
7
+ *
8
+ * @element blue-select-list
9
+ * @attr {string} for - The id of the input element to associate as the combobox controller.
10
+ * @slot - The list options.
11
+ * @example
12
+ * <input id="my-input" />
13
+ * <blue-select-list for="my-input">
14
+ * <div>Option 1</div>
15
+ * <div>Option 2</div>
16
+ * </blue-select-list>
17
+ */
18
+ export class SelectList extends HTMLElement {
19
+ constructor() {
20
+ super();
21
+ this.attachShadow({
22
+ mode: "open"
23
+ });
24
+ this.shadowRoot.innerHTML = `<slot style="border-radius: inherit"></slot>`;
25
+ this.activeIndex = -1;
26
+ this.items = [];
27
+ this.inputElement = null;
28
+ }
29
+ connectedCallback() {
30
+ this.setAttribute("role", "listbox");
31
+ this.tabIndex = -1;
32
+ this.updateItems();
33
+
34
+ // Input zuweisen über Attribut oder fallback
35
+ const inputId = this.getAttribute("for");
36
+ this.inputElement = inputId ? document.getElementById(inputId) : null;
37
+ if (this.inputElement) {
38
+ this.inputElement.setAttribute("role", "combobox");
39
+ this.inputElement.setAttribute("aria-controls", this.id);
40
+ this.inputElement.setAttribute("aria-expanded", "true");
41
+ this.inputElement.addEventListener("keydown", this.onKeyDown.bind(this));
42
+ }
43
+ this.addEventListener("keydown", this.onKeyDown.bind(this));
44
+ this.addEventListener("click", e => {
45
+ const target = e.target instanceof Element ? e.target.closest("[data-blue-select-list-index]") : null;
46
+ if (target && target.hasAttribute("data-blue-select-list-index")) {
47
+ const index = Number(target.getAttribute("data-blue-select-list-index"));
48
+ this.select(index);
49
+ }
50
+ });
51
+ }
52
+ updateItems() {
53
+ this.items = Array.from(this.children);
54
+ this.items.forEach((el, i) => {
55
+ if (!el.hasAttribute("id")) {
56
+ el.setAttribute("id", `${this.id}-option-${i}`);
57
+ }
58
+ el.setAttribute("data-blue-select-list-index", i.toString());
59
+ el.setAttribute("aria-selected", "false");
60
+ el.setAttribute("role", "option");
61
+ el.tabIndex = -1;
62
+ });
63
+ }
64
+ onKeyDown(e) {
65
+ console.log("select-list onKeyDown");
66
+ if (!this.items.length) return;
67
+ if (e.key === "ArrowDown") {
68
+ e.preventDefault();
69
+ this.activeIndex = (this.activeIndex + 1) % this.items.length;
70
+ this.updateActiveItem();
71
+ } else if (e.key === "ArrowUp") {
72
+ e.preventDefault();
73
+ this.activeIndex = (this.activeIndex - 1 + this.items.length) % this.items.length;
74
+ this.updateActiveItem();
75
+ } else if (e.key === "Enter" && this.activeIndex >= 0) {
76
+ const item = this.items[this.activeIndex];
77
+ item?.click();
78
+ }
79
+ }
80
+ updateActiveItem() {
81
+ this.items.forEach((el, i) => {
82
+ const active = i === this.activeIndex;
83
+ el.classList.toggle("active", active);
84
+ el.setAttribute("aria-selected", active.toString());
85
+ });
86
+ const activeItem = this.items[this.activeIndex];
87
+ if (activeItem && this.inputElement) {
88
+ this.inputElement.setAttribute("aria-activedescendant", activeItem.id);
89
+ activeItem.scrollIntoView({
90
+ block: "nearest"
91
+ });
92
+ }
93
+ }
94
+ select(index) {
95
+ this.activeIndex = index;
96
+ this.updateActiveItem();
97
+ const selectedItem = this.items[index];
98
+ if (selectedItem) {
99
+ // Fire a custom event with the selected item and index
100
+ this.dispatchEvent(new CustomEvent("bl-select", {
101
+ detail: {
102
+ index,
103
+ item: selectedItem
104
+ },
105
+ bubbles: true,
106
+ composed: true
107
+ }));
108
+ selectedItem.click();
109
+ }
110
+ }
111
+ }
112
+ customElements.define("bl-select-list", SelectList);
@@ -1 +1 @@
1
- (()=>{"use strict";class n extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.addEventListeners()}render(){if(!this.shadowRoot)return;const n=(document.documentElement.lang||navigator.language).startsWith("de")?"Seitenleiste umschalten":"Toggle sidebar";this.shadowRoot.innerHTML=`\n <style>\n :host {\n --spacing: 0.25rem;\n --drawer-side-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,\n rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,\n rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;\n --toggler-size: calc(\n var(--bs-btn-border-width, 1px) + var(--bs-btn-padding-y, 0.375rem) +\n (var(--bs-btn-font-size, 1rem) * var(--bs-btn-line-height, 1.5)) +\n var(--bs-btn-padding-y, 0.375rem) + var(--bs-btn-border-width, 1px)\n );\n --side-width: 18rem;\n --base-z-index: 0;\n }\n\n .root {\n position: relative;\n display: grid;\n height: 100%;\n grid-template-columns:\n 0 var(--toggler-size) calc(var(--side-width) - var(--toggler-size))\n auto;\n grid-template-rows: var(--toggler-size) auto;\n }\n\n .hidden-input {\n position: fixed;\n --size: 0;\n height: var(--size);\n width: var(--size);\n appearance: none;\n opacity: 0;\n }\n\n .toggler {\n grid-column-start: 2;\n }\n\n .hidden-input:focus-visible + .toggler ::slotted(*) {\n --trigger-box-shadow: var(--trigger-focus-box-shadow, inset 0 0 0.25rem);\n }\n\n @media (width < 64rem) {\n .toggler[for="layout-expand"] {\n display: none;\n }\n }\n\n @media (width >= 64rem) {\n .toggler[for="layout-drawer"] {\n display: none;\n }\n }\n\n .header {\n grid-column-start: 3;\n grid-column-end: 5;\n }\n\n .side {\n overflow: auto;\n }\n\n @media (width < 64rem) {\n .side {\n translate: -100% 0;\n height: 100%;\n transition: translate 0.2s ease;\n }\n\n #layout-drawer:checked ~ .side {\n position: fixed;\n top: 0;\n left: 0;\n z-index: calc(var(--base-z-index) + 1);\n translate: 0;\n width: calc(var(--spacing) * 80);\n box-shadow: var(--drawer-side-shadow);\n }\n }\n\n @media (width >= 64rem) {\n #layout-expand:checked ~ .side {\n grid-column-start: 2;\n grid-column-end: 4;\n }\n }\n\n .main {\n overflow: auto;\n grid-column-start: 2;\n grid-column-end: 5;\n }\n\n @media (width >= 64rem) {\n #layout-expand:checked ~ .main {\n grid-column-start: 4;\n }\n }\n\n .overlay {\n position: fixed;\n z-index: var(--base-z-index);\n inset: 0;\n display: none;\n }\n\n @media (width < 64rem) {\n #layout-drawer:checked ~ .overlay {\n display: block;\n }\n }\n </style>\n\n <div class="root">\n <input\n id="layout-expand"\n type="checkbox"\n class="hidden-input"\n ${localStorage.getItem("side-layout-shrink")?"":"checked"}\n />\n <label class="toggler" for="layout-expand" title="${n}" role="button">\n <slot name="expand-toggler">🍔</slot>\n </label>\n\n <input id="layout-drawer" type="checkbox" class="hidden-input" />\n <label class="toggler" for="layout-drawer" title="${n}" role="button">\n <slot name="drawer-toggler">🍔</slot>\n </label>\n\n <header class="header"><slot name="header"></slot></header>\n <div class="side"><slot name="side"></slot></div>\n <main class="main"><slot></slot></main>\n <label aria-label="Close sidebar" for="layout-drawer" class="overlay"\n ><slot name="overlay"></slot\n ></label>\n </div>\n `}addEventListeners(){this.shadowRoot&&this.shadowRoot.querySelector("#layout-expand").addEventListener("change",this.handleLayoutExpandChange.bind(this))}handleLayoutExpandChange(n){n.target.checked?localStorage.removeItem("side-layout-shrink"):localStorage.setItem("side-layout-shrink","true")}}customElements.define("side-layout",n)})();
1
+ (()=>{"use strict";class n extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.addEventListeners()}render(){if(!this.shadowRoot)return;const n=(document.documentElement.lang||navigator.language).startsWith("de")?"Seitenleiste umschalten":"Toggle sidebar";this.shadowRoot.innerHTML=`\n <style>\n :host {\n --spacing: 0.25rem;\n --drawer-side-shadow:\n rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,\n rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,\n rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;\n --toggler-size: calc(\n var(--bs-btn-border-width, 1px) + var(--bs-btn-padding-y, 0.375rem) +\n (var(--bs-btn-font-size, 1rem) * var(--bs-btn-line-height, 1.5)) +\n var(--bs-btn-padding-y, 0.375rem) + var(--bs-btn-border-width, 1px)\n );\n --side-width: 18rem;\n --base-z-index: 0;\n }\n\n .root {\n position: relative;\n display: grid;\n height: 100%;\n grid-template-columns:\n 0 var(--toggler-size) calc(var(--side-width) - var(--toggler-size))\n auto;\n grid-template-rows: var(--toggler-size) auto;\n }\n\n .hidden-input {\n position: fixed;\n --size: 0;\n height: var(--size);\n width: var(--size);\n appearance: none;\n opacity: 0;\n }\n\n .toggler {\n grid-column-start: 2;\n }\n\n .hidden-input:focus-visible + .toggler ::slotted(*) {\n --trigger-box-shadow: var(--trigger-focus-box-shadow, inset 0 0 0.25rem);\n }\n\n @media (width < 64rem) {\n .toggler[for="layout-expand"] {\n display: none;\n }\n }\n\n @media (width >= 64rem) {\n .toggler[for="layout-drawer"] {\n display: none;\n }\n }\n\n .header {\n grid-column-start: 3;\n grid-column-end: 5;\n }\n\n .side {\n overflow: auto;\n }\n\n @media (width < 64rem) {\n .side {\n translate: -100% 0;\n height: 100%;\n transition: translate 0.2s ease;\n }\n\n #layout-drawer:checked ~ .side {\n position: fixed;\n top: 0;\n left: 0;\n z-index: calc(var(--base-z-index) + 1);\n translate: 0;\n width: calc(var(--spacing) * 80);\n box-shadow: var(--drawer-side-shadow);\n }\n }\n\n @media (width >= 64rem) {\n #layout-expand:checked ~ .side {\n grid-column-start: 2;\n grid-column-end: 4;\n }\n }\n\n .main {\n overflow: auto;\n grid-column-start: 2;\n grid-column-end: 5;\n }\n\n @media (width >= 64rem) {\n #layout-expand:checked ~ .main {\n grid-column-start: 4;\n }\n }\n\n .overlay {\n position: fixed;\n z-index: var(--base-z-index);\n inset: 0;\n display: none;\n }\n\n @media (width < 64rem) {\n #layout-drawer:checked ~ .overlay {\n display: block;\n }\n }\n </style>\n\n <div class="root">\n <input\n id="layout-expand"\n type="checkbox"\n class="hidden-input"\n ${localStorage.getItem("side-layout-shrink")?"":"checked"}\n />\n <label class="toggler" for="layout-expand" title="${n}" role="button">\n <slot name="expand-toggler">🍔</slot>\n </label>\n\n <input id="layout-drawer" type="checkbox" class="hidden-input" />\n <label class="toggler" for="layout-drawer" title="${n}" role="button">\n <slot name="drawer-toggler">🍔</slot>\n </label>\n\n <header class="header"><slot name="header"></slot></header>\n <div class="side"><slot name="side"></slot></div>\n <main class="main"><slot></slot></main>\n <label aria-label="Close sidebar" for="layout-drawer" class="overlay"\n ><slot name="overlay"></slot\n ></label>\n </div>\n `}addEventListeners(){this.shadowRoot&&this.shadowRoot.querySelector("#layout-expand").addEventListener("change",this.handleLayoutExpandChange.bind(this))}handleLayoutExpandChange(n){n.target.checked?localStorage.removeItem("side-layout-shrink"):localStorage.setItem("side-layout-shrink","true")}}customElements.define("bl-side-layout",n)})();
@@ -17,7 +17,8 @@ export class SideLayout extends HTMLElement {
17
17
  <style>
18
18
  :host {
19
19
  --spacing: 0.25rem;
20
- --drawer-side-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,
20
+ --drawer-side-shadow:
21
+ rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,
21
22
  rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,
22
23
  rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;
23
24
  --toggler-size: calc(
@@ -167,4 +168,4 @@ export class SideLayout extends HTMLElement {
167
168
  }
168
169
  }
169
170
  }
170
- customElements.define("side-layout", SideLayout);
171
+ customElements.define("bl-side-layout", SideLayout);
package/dist/merged.scss CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Blue Web v1.16.1 (https://bruegmann.github.io/blue-web)
2
+ * Blue Web v1.17.1 (https://bruegmann.github.io/blue-web)
3
3
  * Licensed under GNU General Public License v3.0 (https://github.com/bruegmann/blue-web/blob/master/LICENSE).
4
4
  */
5
5
 
@@ -12366,6 +12366,7 @@ dialog.blue-modal:has(.offcanvas-start) {
12366
12366
  --dxbl-toolbar-btn-border-radius: var(--bs-border-radius) !important;
12367
12367
  --dxbl-dropdown-border-radius: var(--bs-border-radius) !important;
12368
12368
  --dxbl-btn-border-radius: var(--bs-border-radius) !important;
12369
+ --dxbl-context-menu-border-radius: var(--bs-border-radius) !important;
12369
12370
  --dxbl-btn-padding-x: 0.75rem !important;
12370
12371
  --dxbl-btn-padding-y: 0.375rem !important;
12371
12372
  }
@@ -12392,6 +12393,21 @@ body.modal-open .dxbl-popup-cell[style="z-index: 1050;"] {
12392
12393
  z-index: 1056 !important;
12393
12394
  }
12394
12395
 
12396
+ @if ($enable-button-pointers: false) {
12397
+ .dxbl-context-menu.dxbl-context-menu-dropdown
12398
+ > .dxbl-dropdown-body
12399
+ ul
12400
+ li:not(.dxbl-context-menu-separator)
12401
+ > .dxbl-context-menu-item,
12402
+ .dxbl-context-menu-submenu.dxbl-context-menu-dropdown
12403
+ > .dxbl-dropdown-body
12404
+ ul
12405
+ li:not(.dxbl-context-menu-separator)
12406
+ > .dxbl-context-menu-item {
12407
+ cursor: default;
12408
+ }
12409
+ }
12410
+
12395
12411
  :root {
12396
12412
  --bs-font-sans-serif: Inter, #{$font-family-sans-serif};
12397
12413
  font-feature-settings:
@@ -12401,6 +12417,7 @@ body.modal-open .dxbl-popup-cell[style="z-index: 1050;"] {
12401
12417
  "cv07" 1,
12402
12418
  "tnum" 1,
12403
12419
  "zero" 1;
12420
+ font-size: 14px;
12404
12421
  }
12405
12422
  @supports (font-variation-settings: normal) {
12406
12423
  :root {