bromcom-ui 3.0.0-alpha.3 → 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-dc8b7bd5.entry.js → p-0b7de283.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ff8adde6.entry.js → p-0e75f6ba.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3a6e9576.entry.js → p-112b9a62.entry.js} +1 -1
- package/dist/bromcom-ui/{p-be96827e.js → p-1535f9b1.js} +1 -1
- package/dist/bromcom-ui/{p-ef839034.entry.js → p-32ce6cf6.entry.js} +1 -1
- package/dist/bromcom-ui/{p-33d97b3f.entry.js → p-33b2ed75.entry.js} +1 -1
- package/dist/bromcom-ui/p-3ddd3c83.entry.js +5 -0
- package/dist/bromcom-ui/{p-e115af8a.entry.js → p-4545a13d.entry.js} +1 -1
- package/dist/bromcom-ui/{p-f1de8ed5.entry.js → p-5532696c.entry.js} +1 -1
- package/dist/bromcom-ui/{p-f6e710ff.entry.js → p-69adb859.entry.js} +1 -1
- package/dist/bromcom-ui/{p-d0647951.js → p-6ce02d0a.js} +1 -1
- package/dist/bromcom-ui/p-7c08789d.entry.js +5 -0
- package/dist/bromcom-ui/{p-b7f449ff.entry.js → p-803739bc.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3b988ad1.entry.js → p-8390dd02.entry.js} +1 -1
- package/dist/bromcom-ui/p-91197b04.js +5 -0
- package/dist/bromcom-ui/{p-b9b9d753.entry.js → p-a80e6310.entry.js} +1 -1
- package/dist/bromcom-ui/p-aa67918a.entry.js +5 -0
- package/dist/bromcom-ui/{p-91aa21af.entry.js → p-acab07ec.entry.js} +1 -1
- package/dist/bromcom-ui/{p-a53c3682.entry.js → p-b333a3d7.entry.js} +1 -1
- package/dist/bromcom-ui/{p-b386e9c9.entry.js → p-b7787c11.entry.js} +1 -1
- package/dist/bromcom-ui/{p-2e7ffc5a.entry.js → p-b7c56cbe.entry.js} +1 -1
- package/dist/bromcom-ui/{p-221095a9.entry.js → p-c36a7889.entry.js} +1 -1
- package/dist/bromcom-ui/p-ce0ab4e3.entry.js +5 -0
- package/dist/bromcom-ui/{p-ee75cd00.js → p-d3cf91a9.js} +1 -1
- package/dist/bromcom-ui/p-d5464577.entry.js +16 -0
- package/dist/bromcom-ui/{p-bd77f532.entry.js → p-d7a619c5.entry.js} +1 -1
- package/dist/bromcom-ui/{p-baa4193d.entry.js → p-e36b6b08.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6c7fdf95.entry.js → p-f15c1d3d.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8001040c.js → p-fc29c94d.js} +1 -1
- package/dist/cjs/bcm-accordion_69.cjs.entry.js +722 -66
- package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +4 -4
- package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +4 -4
- package/dist/cjs/bcm-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/bcm-caption.cjs.entry.js +4 -4
- package/dist/cjs/bcm-card.cjs.entry.js +2 -2
- package/dist/cjs/bcm-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/bcm-datetime-picker.cjs.entry.js +2 -2
- package/dist/cjs/bcm-default.cjs.entry.js +2 -2
- package/dist/cjs/bcm-file-upload.cjs.entry.js +578 -0
- package/dist/cjs/bcm-form-2.cjs.entry.js +3 -2
- package/dist/cjs/bcm-input-2.cjs.entry.js +2 -2
- package/dist/cjs/bcm-input-custom.cjs.entry.js +2 -2
- package/dist/cjs/bcm-input-dropdown.cjs.entry.js +4 -4
- package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +4 -4
- package/dist/cjs/bcm-modal-2-header.cjs.entry.js +4 -4
- package/dist/cjs/bcm-modal-2.cjs.entry.js +4 -4
- package/dist/cjs/bcm-number-input.cjs.entry.js +12 -6
- package/dist/cjs/bcm-skeleton.cjs.entry.js +4 -4
- package/dist/cjs/bcm-table.cjs.entry.js +4 -4
- package/dist/cjs/bcm-tag.cjs.entry.js +3 -3
- package/dist/cjs/bcm-time-picker.cjs.entry.js +2 -2
- package/dist/cjs/bcm-toast.cjs.entry.js +17 -11
- package/dist/cjs/bromcom-ui.cjs.js +3 -3
- package/dist/cjs/{generate-554f54dc.js → generate-9d1bf6b3.js} +1 -1
- package/dist/cjs/{global-90b5dbce.js → global-d69a64ec.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{number-helper-677e9c02.js → number-helper-ae28b255.js} +1 -1
- package/dist/cjs/old-bcm-popover-box.cjs.entry.js +3 -3
- package/dist/cjs/old-bcm-popover.cjs.entry.js +2 -2
- package/dist/cjs/{package-8445ccd4.js → package-6de220be.js} +1 -1
- package/dist/cjs/{validators-92f2f1ef.js → validators-3381bee2.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/color-input/color-input.js +5 -22
- package/dist/collection/components/molecules/color-palette/color-palette.js +4 -4
- 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 +227 -27
- package/dist/collection/components/other/toast/toast.js +15 -9
- 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 +6 -5
- package/dist/collection/templates/list-template.js +2 -2
- package/dist/components/bcm-color-input.js +5 -22
- 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/bcm-toast.js +15 -9
- package/dist/components/button.js +7 -0
- package/dist/components/color-palette.js +2 -2
- package/dist/components/form.js +1 -0
- package/dist/components/generate.js +1 -1
- 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 +567 -39
- package/dist/esm/bcm-accordion_69.entry.js +722 -66
- package/dist/esm/bcm-attendance-actions-comment.entry.js +4 -4
- package/dist/esm/bcm-attendance-actions-dropdown.entry.js +4 -4
- package/dist/esm/bcm-breadcrumb.entry.js +2 -2
- package/dist/esm/bcm-caption.entry.js +4 -4
- package/dist/esm/bcm-card.entry.js +2 -2
- package/dist/esm/bcm-date-picker.entry.js +2 -2
- package/dist/esm/bcm-datetime-picker.entry.js +2 -2
- package/dist/esm/bcm-default.entry.js +2 -2
- package/dist/esm/bcm-file-upload.entry.js +574 -0
- package/dist/esm/bcm-form-2.entry.js +3 -2
- package/dist/esm/bcm-input-2.entry.js +2 -2
- package/dist/esm/bcm-input-custom.entry.js +2 -2
- package/dist/esm/bcm-input-dropdown.entry.js +4 -4
- package/dist/esm/bcm-modal-2-footer.entry.js +4 -4
- package/dist/esm/bcm-modal-2-header.entry.js +4 -4
- package/dist/esm/bcm-modal-2.entry.js +4 -4
- package/dist/esm/bcm-number-input.entry.js +12 -6
- package/dist/esm/bcm-skeleton.entry.js +4 -4
- package/dist/esm/bcm-table.entry.js +4 -4
- package/dist/esm/bcm-tag.entry.js +3 -3
- package/dist/esm/bcm-time-picker.entry.js +2 -2
- package/dist/esm/bcm-toast.entry.js +17 -11
- package/dist/esm/bromcom-ui.js +3 -3
- package/dist/esm/{generate-8a394b83.js → generate-56d49b70.js} +1 -1
- package/dist/esm/{global-7919f57f.js → global-97c42a5f.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{number-helper-a86adc72.js → number-helper-455ab41e.js} +1 -1
- package/dist/esm/old-bcm-popover-box.entry.js +3 -3
- package/dist/esm/old-bcm-popover.entry.js +2 -2
- package/dist/esm/{package-278e08d9.js → package-edee14d5.js} +1 -1
- package/dist/esm/{validators-89e791a1.js → validators-cc882165.js} +1 -1
- package/dist/types/components/atoms/button/types.d.ts +8 -1
- package/dist/types/components/molecules/color-input/color-input.d.ts +1 -4
- 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/other/toast/toast.d.ts +1 -0
- package/dist/types/components.d.ts +417 -1
- package/dist/types/templates/list-item-template.d.ts +2 -0
- package/dist/types/templates/list-template.d.ts +2 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/p-16b8a312.entry.js +0 -16
- package/dist/bromcom-ui/p-839b6fd5.entry.js +0 -5
- package/dist/bromcom-ui/p-be8aa3b8.entry.js +0 -5
- package/dist/bromcom-ui/p-d0aa71e1.entry.js +0 -5
- package/dist/bromcom-ui/p-df92d838.js +0 -5
- package/dist/bromcom-ui/p-dfd73f7c.entry.js +0 -5
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
6
|
import { c as classnames } from './index2.js';
|
|
7
7
|
import { G as Generate } from './generate.js';
|
|
8
|
-
import { S as StringHelper } from './string-helper.js';
|
|
9
8
|
import { a as Bcm } from './bcm.js';
|
|
10
9
|
import { d as delay } from './utils.js';
|
|
11
10
|
|
|
@@ -29,6 +28,13 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
29
28
|
this.visible = false;
|
|
30
29
|
this.visibleContainer = false;
|
|
31
30
|
}
|
|
31
|
+
renderMultiline(text) {
|
|
32
|
+
if (!text) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const lines = text.split("\n");
|
|
36
|
+
return lines.map((line, index) => [index > 0 && h("br", null), line]);
|
|
37
|
+
}
|
|
32
38
|
async show() {
|
|
33
39
|
const toast = document.getElementById(this._id + "-container");
|
|
34
40
|
if (toast) {
|
|
@@ -84,7 +90,7 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
84
90
|
return container;
|
|
85
91
|
}
|
|
86
92
|
render() {
|
|
87
|
-
return (h(Host, { class: "tw-hidden" }, h("div", { class: classnames({ "tw-hidden": !this.visible }), id: this._id + "-container", onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: classnames("tw-pointer-events-auto tw-transform tw-transition tw-duration-300 tw-ease-in-out", "tw-flex tw-min-w-[256px] tw-max-w-[420px] tw-flex-col tw-gap-2 tw-rounded-lg tw-border tw-font-sans tw-font-normal tw-shadow-2", "tw-border-
|
|
93
|
+
return (h(Host, { class: "tw-hidden" }, h("div", { class: classnames({ "tw-hidden": !this.visible }), id: this._id + "-container", onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: classnames("tw-pointer-events-auto tw-transform tw-transition tw-duration-300 tw-ease-in-out", "tw-flex tw-min-w-[256px] tw-max-w-[420px] tw-flex-col tw-gap-2 tw-rounded-lg tw-border tw-font-sans tw-font-normal tw-shadow-2", "tw-border-gray-300 tw-bg-white tw-text-slate-600", {
|
|
88
94
|
"tw-p-4": !this.description,
|
|
89
95
|
"tw-p-6": this.description,
|
|
90
96
|
}, "tw-transform tw-transition tw-duration-300 tw-ease-in-out ", {
|
|
@@ -92,11 +98,11 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
92
98
|
"tw-opacity-0": !this.visibleContainer,
|
|
93
99
|
"tw-translate-y-[-100%]": !this.visibleContainer && this.position.split("-")[0] === "top",
|
|
94
100
|
"tw-translate-y-[100%]": !this.visibleContainer && this.position.split("-")[0] === "bottom",
|
|
95
|
-
}) }, h("div", { class: "tw-flex tw-items-
|
|
96
|
-
"tw-text-
|
|
97
|
-
"tw-text-
|
|
98
|
-
"tw-text-
|
|
99
|
-
"tw-text-
|
|
101
|
+
}) }, h("div", { class: "tw-flex tw-items-start tw-justify-between tw-gap-5" }, h("div", { class: "tw-flex tw-items-start tw-gap-3 " }, this.status && (h("i", { class: classnames("tw-text-6 tw-pt-0.5", this.messageIcon ? this.messageIcon : "far", {
|
|
102
|
+
"tw-text-emerald-500": this.status === "success",
|
|
103
|
+
"tw-text-red-500": this.status === "error",
|
|
104
|
+
"tw-text-amber-500": this.status === "warning",
|
|
105
|
+
"tw-text-blue-500": this.status === "info",
|
|
100
106
|
}, {
|
|
101
107
|
"fa-check-circle": !this.messageIcon && this.status === "success",
|
|
102
108
|
"fa-exclamation-circle": !this.messageIcon && this.status === "error",
|
|
@@ -105,9 +111,9 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
105
111
|
}) })), h("span", { class: classnames({
|
|
106
112
|
"tw-text-4": !this.description,
|
|
107
113
|
"tw-text-6 tw-font-medium": this.description,
|
|
108
|
-
}) },
|
|
114
|
+
}) }, this.renderMultiline(this.message))), h("div", { class: "tw-flex tw-items-baseline tw-gap-2" }, this.viewButton && (h("button", { onClick: () => this.bcmToastView.emit(), title: "View details", class: classnames("tw-cursor-pointer tw-rounded tw-bg-transparent tw-p-0 tw-px-1 tw-text-4 tw-text-inherit", "hover:tw-bg-gray-100 hover:tw-text-slate-800", "active:tw-bg-gray-200", "tw-transition tw-duration-300 tw-ease-in-out", {
|
|
109
115
|
"tw-font-medium": this.description,
|
|
110
|
-
}) }, "View")), this.closeButton && (h("button", { title: "Close", onClick: () => this.hide(), class: classnames("tw-
|
|
116
|
+
}) }, "View")), this.closeButton && (h("button", { title: "Close", onClick: () => this.hide(), class: classnames("tw-rounded tw-bg-transparent tw-p-0", "tw-flex tw-h-6 tw-w-6 tw-cursor-pointer tw-items-center tw-justify-center tw-text-3 tw-text-inherit", "hover:tw-bg-gray-100 hover:tw-text-slate-800", "active:tw-bg-gray-200") }, h("i", { class: "fal fa-times" }))))), this.description && h("div", { class: "tw-text-3 " }, this.renderMultiline(this.description)), h("slot", null)))));
|
|
111
117
|
}
|
|
112
118
|
get el() { return this; }
|
|
113
119
|
}, [4, "bcm-toast", {
|
|
@@ -148,6 +148,12 @@ const variantOptions = {
|
|
|
148
148
|
icon: 'far fa-download',
|
|
149
149
|
iconPosition: 'prefix',
|
|
150
150
|
},
|
|
151
|
+
upload: {
|
|
152
|
+
text: 'Upload',
|
|
153
|
+
color: 'blue',
|
|
154
|
+
icon: 'far fa-cloud-arrow-up',
|
|
155
|
+
iconPosition: 'prefix',
|
|
156
|
+
},
|
|
151
157
|
};
|
|
152
158
|
var VariantProps;
|
|
153
159
|
(function (VariantProps) {
|
|
@@ -174,6 +180,7 @@ var VariantProps;
|
|
|
174
180
|
VariantProps["update"] = "update";
|
|
175
181
|
VariantProps["reset"] = "Reset";
|
|
176
182
|
VariantProps["download"] = "download";
|
|
183
|
+
VariantProps["upload"] = "upload";
|
|
177
184
|
})(VariantProps || (VariantProps = {}));
|
|
178
185
|
|
|
179
186
|
const { state } = createStore({
|
|
@@ -37,8 +37,8 @@ const BcmColorPalette = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
37
37
|
this.bcmChange.emit(hex);
|
|
38
38
|
};
|
|
39
39
|
this.value = undefined;
|
|
40
|
-
this.paletteKeys = ["orange", "yellow", "lime", "green", "teal", "cyan", "sky", "indigo", "violet", "purple", "fuchsia", "pink"];
|
|
41
|
-
this.shades = [900, 800, 700, 600,
|
|
40
|
+
this.paletteKeys = ["orange", "yellow", "lime", "green", "teal", "cyan", "sky", "indigo", "violet", "purple", "fuchsia", "pink", "rose", "stone", "slate"];
|
|
41
|
+
this.shades = [950, 900, 800, 700, 600, 400, 300, 200, 100, 50];
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
44
|
const { host, column, box } = colorPaletteStyle();
|
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;
|