bromcom-ui 3.0.0-alpha.4 → 3.0.0-alpha.5
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/bromcom-ui/bromcom-ui.css +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/p-01eaca9a.entry.js +5 -0
- package/dist/bromcom-ui/p-3ddd3c83.entry.js +5 -0
- package/dist/bromcom-ui/p-aa67918a.entry.js +5 -0
- package/dist/bromcom-ui/p-d5464577.entry.js +16 -0
- package/dist/cjs/bcm-accordion_69.cjs.entry.js +704 -31
- package/dist/cjs/bcm-file-upload.cjs.entry.js +578 -0
- package/dist/cjs/bcm-form-2.cjs.entry.js +1 -0
- package/dist/cjs/bcm-number-input.cjs.entry.js +8 -2
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/button/button.js +1 -1
- package/dist/collection/components/atoms/button/types.js +7 -0
- package/dist/collection/components/molecules/dropdown/dropdown.js +36 -1
- package/dist/collection/components/molecules/linked/linked-focus-manager.js +86 -0
- package/dist/collection/components/molecules/linked/linked.js +43 -1
- package/dist/collection/components/molecules/number-input/number-input.js +8 -2
- package/dist/collection/components/molecules/number-input/react-input.js +1 -1
- package/dist/collection/components/molecules/upload/file-upload.component.js +1060 -0
- package/dist/collection/components/molecules/upload/file-upload.style.js +201 -0
- package/dist/collection/components/organism/form/form.js +1 -0
- package/dist/collection/components/organism/form-2/bcm-form-components.js +1 -0
- package/dist/collection/components/organism/list/list-focus-manager.js +344 -0
- package/dist/collection/components/organism/list/list-key-control.js +9 -4
- package/dist/collection/components/organism/list/list.css +8 -3
- package/dist/collection/components/organism/list/list.js +226 -26
- package/dist/collection/components/other_deprecated/old-tag/old-tag.js +1 -1
- package/dist/collection/components/other_deprecated/tag/tag.js +1 -1
- package/dist/collection/templates/list-item-template.js +2 -1
- package/dist/components/bcm-dropdown.js +35 -0
- package/dist/components/bcm-file-upload.d.ts +11 -0
- package/dist/components/bcm-file-upload.js +625 -0
- package/dist/components/bcm-form-2.js +1 -0
- package/dist/components/bcm-number-input.js +8 -2
- package/dist/components/button.js +7 -0
- package/dist/components/form.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/linked.js +105 -2
- package/dist/components/list.js +559 -31
- package/dist/esm/bcm-accordion_69.entry.js +704 -31
- package/dist/esm/bcm-file-upload.entry.js +574 -0
- package/dist/esm/bcm-form-2.entry.js +1 -0
- package/dist/esm/bcm-number-input.entry.js +8 -2
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/atoms/button/types.d.ts +8 -1
- package/dist/types/components/molecules/dropdown/dropdown.d.ts +7 -0
- package/dist/types/components/molecules/linked/linked-focus-manager.d.ts +13 -0
- package/dist/types/components/molecules/linked/linked.d.ts +3 -0
- package/dist/types/components/molecules/number-input/number-input.d.ts +1 -0
- package/dist/types/components/molecules/upload/file-upload.component.d.ts +233 -0
- package/dist/types/components/molecules/upload/file-upload.style.d.ts +548 -0
- package/dist/types/components/organism/list/list-focus-manager.d.ts +53 -0
- package/dist/types/components/organism/list/list-key-control.d.ts +1 -0
- package/dist/types/components/organism/list/list.d.ts +18 -1
- package/dist/types/components.d.ts +417 -1
- package/package.json +1 -1
- package/dist/bromcom-ui/p-8e7274e4.entry.js +0 -5
- package/dist/bromcom-ui/p-9e0dd503.entry.js +0 -16
- package/dist/bromcom-ui/p-a320cde8.entry.js +0 -5
package/dist/components/form.js
CHANGED
|
@@ -88,6 +88,7 @@ const BcmForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
88
88
|
CHECKBOX: 'checkbox',
|
|
89
89
|
RADIO_GROUP: 'radio-group',
|
|
90
90
|
CHECKBOX_GROUP: 'checkbox-group',
|
|
91
|
+
FILE_UPLOAD: 'file-upload',
|
|
91
92
|
RANGE: 'range',
|
|
92
93
|
// sadece value fırlatıyor
|
|
93
94
|
FORM: 'form',
|
|
@@ -36,6 +36,7 @@ export { BcmDropdown as BcmDropdown } from '../types/components/molecules/dropdo
|
|
|
36
36
|
export { BcmEmpty as BcmEmpty } from '../types/components/molecules/empty/empty';
|
|
37
37
|
export { BcmErrorLayout as BcmErrorLayout } from '../types/components/molecules/error-layout/error-layout';
|
|
38
38
|
export { BcmExpansionPanel as BcmExpansionPanel } from '../types/components/molecules/expansion-panel/expansion-panel';
|
|
39
|
+
export { BcmFileUpload as BcmFileUpload } from '../types/components/molecules/upload/file-upload.component';
|
|
39
40
|
export { BcmForm as BcmForm } from '../types/components/organism/form/form';
|
|
40
41
|
export { BcmForm2 as BcmForm2 } from '../types/components/organism/form-2/form-2';
|
|
41
42
|
export { BcmFormGroup as BcmFormGroup } from '../types/components/organism/form/form-group';
|
package/dist/components/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export { BcmDropdown, defineCustomElement as defineCustomElementBcmDropdown } fr
|
|
|
44
44
|
export { BcmEmpty, defineCustomElement as defineCustomElementBcmEmpty } from './bcm-empty.js';
|
|
45
45
|
export { BcmErrorLayout, defineCustomElement as defineCustomElementBcmErrorLayout } from './bcm-error-layout.js';
|
|
46
46
|
export { BcmExpansionPanel, defineCustomElement as defineCustomElementBcmExpansionPanel } from './bcm-expansion-panel.js';
|
|
47
|
+
export { BcmFileUpload, defineCustomElement as defineCustomElementBcmFileUpload } from './bcm-file-upload.js';
|
|
47
48
|
export { BcmForm, defineCustomElement as defineCustomElementBcmForm } from './bcm-form.js';
|
|
48
49
|
export { BcmForm2, defineCustomElement as defineCustomElementBcmForm2 } from './bcm-form-2.js';
|
|
49
50
|
export { BcmFormGroup, defineCustomElement as defineCustomElementBcmFormGroup } from './bcm-form-group.js';
|
|
@@ -13,11 +13,95 @@ import { d as delay } from './utils.js';
|
|
|
13
13
|
import { F as FloatingUI } from './floating-ui.js';
|
|
14
14
|
import { B as Bcm } from './bcm.js';
|
|
15
15
|
|
|
16
|
+
class LinkedFocusManager {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.focusableSelector = [
|
|
19
|
+
"a[href]",
|
|
20
|
+
"area[href]",
|
|
21
|
+
"button:not([disabled])",
|
|
22
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
23
|
+
"select:not([disabled])",
|
|
24
|
+
"textarea:not([disabled])",
|
|
25
|
+
"iframe",
|
|
26
|
+
"object",
|
|
27
|
+
"embed",
|
|
28
|
+
"[contenteditable='true']",
|
|
29
|
+
"[tabindex]:not([tabindex='-1'])",
|
|
30
|
+
].join(",");
|
|
31
|
+
}
|
|
32
|
+
getFocusableElements(linkedElement) {
|
|
33
|
+
return Array.from(linkedElement.querySelectorAll(this.focusableSelector)).filter(item => {
|
|
34
|
+
const style = window.getComputedStyle(item);
|
|
35
|
+
return style.display !== "none" && style.visibility !== "hidden";
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
handleKeyboardNavigation(params) {
|
|
39
|
+
const { event, isOpen, canKeyboardOpen, linkedElement, targetElement, openLinked, hideLinked } = params;
|
|
40
|
+
const keyCode = event.keyCode || event.which;
|
|
41
|
+
const isSpaceKey = event.key === " " || event.key === "Spacebar" || keyCode === 32;
|
|
42
|
+
const isEnterKey = event.key === "Enter" || keyCode === 13;
|
|
43
|
+
const activeElement = document.activeElement;
|
|
44
|
+
const isTargetFocused = activeElement === targetElement;
|
|
45
|
+
const isFocusInsideTarget = !!(activeElement && targetElement.contains(activeElement));
|
|
46
|
+
const isFocusInsideLinked = !!activeElement && linkedElement.contains(activeElement);
|
|
47
|
+
const isTriggerFocused = isTargetFocused || isFocusInsideTarget;
|
|
48
|
+
if (!isOpen && canKeyboardOpen && isTriggerFocused) {
|
|
49
|
+
if (isSpaceKey || isEnterKey) {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
event.stopImmediatePropagation();
|
|
53
|
+
openLinked();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!isOpen)
|
|
58
|
+
return;
|
|
59
|
+
if (event.key === "Escape") {
|
|
60
|
+
if (isTriggerFocused || isFocusInsideLinked) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
hideLinked();
|
|
63
|
+
targetElement.focus();
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (event.key !== "Tab")
|
|
68
|
+
return;
|
|
69
|
+
const focusableElements = this.getFocusableElements(linkedElement);
|
|
70
|
+
const firstFocusableElement = focusableElements[0];
|
|
71
|
+
const lastFocusableElement = focusableElements[focusableElements.length - 1];
|
|
72
|
+
if (!event.shiftKey && isTargetFocused) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
if (firstFocusableElement) {
|
|
75
|
+
firstFocusableElement.focus();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
linkedElement.focus();
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (event.shiftKey && isFocusInsideLinked && firstFocusableElement && activeElement === firstFocusableElement) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
targetElement.focus();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!event.shiftKey && isFocusInsideLinked && lastFocusableElement && activeElement === lastFocusableElement) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
firstFocusableElement.focus();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (focusableElements.length === 0 && isFocusInsideLinked) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
targetElement.focus();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
16
99
|
const BcmLinked = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
17
100
|
constructor() {
|
|
18
101
|
super();
|
|
19
102
|
this.__registerHost();
|
|
20
103
|
this.bcmOpen = createEvent(this, "bcm-open", 7);
|
|
104
|
+
this.focusManager = new LinkedFocusManager();
|
|
21
105
|
this._id = Generate.UID();
|
|
22
106
|
this.placement = Bcm.Placement["bottom-start"];
|
|
23
107
|
this.trigger = Bcm.TriggerType.click;
|
|
@@ -155,6 +239,9 @@ const BcmLinked = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
155
239
|
}
|
|
156
240
|
return this.isOpen;
|
|
157
241
|
}
|
|
242
|
+
async updateLayout() {
|
|
243
|
+
this.calculatePosition();
|
|
244
|
+
}
|
|
158
245
|
async toggle(wait = true) {
|
|
159
246
|
return this.isOpen ? await this.hide(wait) : await this.show(wait);
|
|
160
247
|
}
|
|
@@ -202,9 +289,24 @@ const BcmLinked = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
202
289
|
this.isMouseOverLink = false;
|
|
203
290
|
this.show();
|
|
204
291
|
}
|
|
292
|
+
keyboardNavigation(e) {
|
|
293
|
+
const target = this.target();
|
|
294
|
+
if (!target)
|
|
295
|
+
return;
|
|
296
|
+
const canKeyboardOpen = this.trigger !== Bcm.TriggerType.hover && this.trigger !== Bcm.TriggerType.custom;
|
|
297
|
+
this.focusManager.handleKeyboardNavigation({
|
|
298
|
+
event: e,
|
|
299
|
+
isOpen: this.isOpen,
|
|
300
|
+
canKeyboardOpen,
|
|
301
|
+
linkedElement: this.el,
|
|
302
|
+
targetElement: target,
|
|
303
|
+
openLinked: () => this.show(false),
|
|
304
|
+
hideLinked: () => this.hide(false),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
205
307
|
render() {
|
|
206
308
|
const openStyle = this.isOpen ? { visibility: "visible", opacity: "1" } : { visibility: "hidden", opacity: "0" };
|
|
207
|
-
return (h(Host, { class: "tw-invisible tw-absolute tw-left-0 tw-top-0 tw-z-tooltip tw-block tw-overscroll-contain tw-scroll-smooth tw-rounded tw-bg-white tw-opacity-0 tw-shadow tw-transition-opacity tw-duration-100", style: Object.assign(Object.assign({}, openStyle), { overflow: "auto" }) }, h("slot", null)));
|
|
309
|
+
return (h(Host, { class: "tw-invisible tw-absolute tw-left-0 tw-top-0 tw-z-tooltip tw-block tw-overscroll-contain tw-scroll-smooth tw-rounded tw-bg-white tw-opacity-0 tw-shadow tw-transition-opacity tw-duration-100", tabindex: "-1", style: Object.assign(Object.assign({}, openStyle), { overflow: "auto" }) }, h("slot", null)));
|
|
208
310
|
}
|
|
209
311
|
get el() { return this; }
|
|
210
312
|
static get watchers() { return {
|
|
@@ -225,8 +327,9 @@ const BcmLinked = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
225
327
|
"isMouseOverLink": [32],
|
|
226
328
|
"show": [64],
|
|
227
329
|
"hide": [64],
|
|
330
|
+
"updateLayout": [64],
|
|
228
331
|
"toggle": [64]
|
|
229
|
-
}, [[4, "linked-data-dismiss", "onLinkedDataDismis"], [4, "bcm-floating-is-hide", "onBcmFloatingIsHide"], [6, "click", "clickListener"]]]);
|
|
332
|
+
}, [[4, "linked-data-dismiss", "onLinkedDataDismis"], [4, "bcm-floating-is-hide", "onBcmFloatingIsHide"], [6, "click", "clickListener"], [6, "keydown", "keyboardNavigation"]]]);
|
|
230
333
|
function defineCustomElement() {
|
|
231
334
|
if (typeof customElements === "undefined") {
|
|
232
335
|
return;
|