@limetech/lime-elements 38.39.1 → 38.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/{zipObject-fec9afa6.js → focus-trigger-element-7137b490.js} +35 -1
- package/dist/cjs/focus-trigger-element-7137b490.js.map +1 -0
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js +12 -3
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-popover_2.cjs.entry.js +25 -6
- package/dist/cjs/limel-popover_2.cjs.entry.js.map +1 -1
- package/dist/collection/components/menu/menu.js +11 -1
- package/dist/collection/components/menu/menu.js.map +1 -1
- package/dist/collection/components/popover/popover.js +24 -4
- package/dist/collection/components/popover/popover.js.map +1 -1
- package/dist/collection/util/focus-trigger-element.js +33 -0
- package/dist/collection/util/focus-trigger-element.js.map +1 -0
- package/dist/esm/{zipObject-3ab93f37.js → focus-trigger-element-9701fced.js} +35 -2
- package/dist/esm/focus-trigger-element-9701fced.js.map +1 -0
- package/dist/esm/limel-breadcrumbs_7.entry.js +11 -2
- package/dist/esm/limel-breadcrumbs_7.entry.js.map +1 -1
- package/dist/esm/limel-popover_2.entry.js +24 -5
- package/dist/esm/limel-popover_2.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-6ef23925.entry.js +2 -0
- package/dist/lime-elements/p-6ef23925.entry.js.map +1 -0
- package/dist/lime-elements/p-e904b8b1.entry.js +266 -0
- package/dist/lime-elements/p-e904b8b1.entry.js.map +1 -0
- package/dist/lime-elements/p-fbabe9c1.js +2 -0
- package/dist/lime-elements/p-fbabe9c1.js.map +1 -0
- package/dist/types/components/menu/menu.d.ts +1 -0
- package/dist/types/components/popover/popover.d.ts +5 -0
- package/dist/types/util/focus-trigger-element.d.ts +10 -0
- package/package.json +1 -1
- package/dist/cjs/zipObject-fec9afa6.js.map +0 -1
- package/dist/esm/zipObject-3ab93f37.js.map +0 -1
- package/dist/lime-elements/p-147b0a68.entry.js +0 -2
- package/dist/lime-elements/p-147b0a68.entry.js.map +0 -1
- package/dist/lime-elements/p-19a9b96b.entry.js +0 -266
- package/dist/lime-elements/p-19a9b96b.entry.js.map +0 -1
- package/dist/lime-elements/p-8576ce25.js +0 -2
- package/dist/lime-elements/p-8576ce25.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [38.39.2](https://github.com/Lundalogik/lime-elements/compare/v38.39.1...v38.39.2) (2026-01-26)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **menu:** restore focus to the trigger, when the menu closes due to a dismiss ([b003658](https://github.com/Lundalogik/lime-elements/commit/b00365842a92f345424bb0bd752b777c31bccb93))
|
|
7
|
+
* **menu:** restore focus to the trigger, when the menu closes due to a selection ([ac9fa77](https://github.com/Lundalogik/lime-elements/commit/ac9fa77e9caef2614577327a6a550c9c4baf7e20))
|
|
8
|
+
* **popover:** restore focus to the trigger, when the menu closes ([a840b53](https://github.com/Lundalogik/lime-elements/commit/a840b536bdfdab1ecc9d1b284af451c83018de2a))
|
|
9
|
+
|
|
1
10
|
## [38.39.1](https://github.com/Lundalogik/lime-elements/compare/v38.39.0...v38.39.1) (2026-01-22)
|
|
2
11
|
|
|
3
12
|
### Bug Fixes
|
|
@@ -44,6 +44,40 @@ function zipObject(props, values) {
|
|
|
44
44
|
return baseZipObject(props || [], values || [], _assignValue.assignValue);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
const FOCUSABLE_SELECTOR = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
48
|
+
const isDisabled = (element) => {
|
|
49
|
+
return (element.disabled === true ||
|
|
50
|
+
element.hasAttribute('disabled') ||
|
|
51
|
+
element.getAttribute('aria-disabled') === 'true');
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Focuses the first focusable element inside a trigger element.
|
|
55
|
+
* Supports custom elements by searching both the element's shadow root
|
|
56
|
+
* and its light DOM.
|
|
57
|
+
*
|
|
58
|
+
* @param trigger - The trigger element to focus.
|
|
59
|
+
* @returns `true` if focus was moved, otherwise `false`.
|
|
60
|
+
*/
|
|
61
|
+
const focusTriggerElement = (trigger) => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (!trigger || isDisabled(trigger)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const shadowFocusable = (_a = trigger.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
|
|
67
|
+
if (shadowFocusable) {
|
|
68
|
+
shadowFocusable.focus();
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
const lightDomFocusable = trigger.querySelector(FOCUSABLE_SELECTOR);
|
|
72
|
+
if (lightDomFocusable) {
|
|
73
|
+
lightDomFocusable.focus();
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
trigger.focus();
|
|
77
|
+
return true;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
exports.focusTriggerElement = focusTriggerElement;
|
|
47
81
|
exports.zipObject = zipObject;
|
|
48
82
|
|
|
49
|
-
//# sourceMappingURL=
|
|
83
|
+
//# sourceMappingURL=focus-trigger-element-7137b490.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"focus-trigger-element-7137b490.js","mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE;AAClD,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;AAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM;AAChC,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB;AACA,EAAE,OAAO,EAAE,KAAK,G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AE,CAAC;EAChB,OAAO,IAAI,CAAC;AAChB;;;;;","names":["assignValue"],"sources":["./node_modules/lodash-es/_baseZipObject.js","./node_modules/lodash-es/zipObject.js","./src/util/focus-trigger-element.ts"],"sourcesContent":["/**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\nfunction baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n}\n\nexport default baseZipObject;\n","import assignValue from './_assignValue.js';\nimport baseZipObject from './_baseZipObject.js';\n\n/**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\nfunction zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n}\n\nexport default zipObject;\n","const FOCUSABLE_SELECTOR =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\nconst isDisabled = (element: HTMLElement): boolean => {\n return (\n (element as any).disabled === true ||\n element.hasAttribute('disabled') ||\n element.getAttribute('aria-disabled') === 'true'\n );\n};\n\n/**\n * Focuses the first focusable element inside a trigger element.\n * Supports custom elements by searching both the element's shadow root\n * and its light DOM.\n *\n * @param trigger - The trigger element to focus.\n * @returns `true` if focus was moved, otherwise `false`.\n */\nexport const focusTriggerElement = (trigger?: HTMLElement | null): boolean => {\n if (!trigger || isDisabled(trigger)) {\n return false;\n }\n\n const shadowFocusable =\n trigger.shadowRoot?.querySelector<HTMLElement>(FOCUSABLE_SELECTOR);\n if (shadowFocusable) {\n shadowFocusable.focus();\n return true;\n }\n\n const lightDomFocusable =\n trigger.querySelector<HTMLElement>(FOCUSABLE_SELECTOR);\n if (lightDomFocusable) {\n lightDomFocusable.focus();\n return true;\n }\n\n trigger.focus();\n return true;\n};\n"],"version":3}
|
|
@@ -12,8 +12,8 @@ const config = require('./config-e7e1a299.js');
|
|
|
12
12
|
const component = require('./component-44f52caf.js');
|
|
13
13
|
const debounce = require('./debounce-2e5f4b7e.js');
|
|
14
14
|
const ponyfill = require('./ponyfill-63966294.js');
|
|
15
|
+
const focusTriggerElement = require('./focus-trigger-element-7137b490.js');
|
|
15
16
|
const eq = require('./eq-9a943b00.js');
|
|
16
|
-
const zipObject = require('./zipObject-fec9afa6.js');
|
|
17
17
|
const util = require('./util-9af8948d.js');
|
|
18
18
|
const component$1 = require('./component-a8e11c4c.js');
|
|
19
19
|
const dom = require('./dom-81eaa633.js');
|
|
@@ -2754,6 +2754,7 @@ const Menu = class {
|
|
|
2754
2754
|
this.cancel.emit();
|
|
2755
2755
|
this.open = false;
|
|
2756
2756
|
this.currentSubMenu = null;
|
|
2757
|
+
setTimeout(this.focusTrigger, 0);
|
|
2757
2758
|
};
|
|
2758
2759
|
this.onTriggerClick = (event) => {
|
|
2759
2760
|
event.stopPropagation();
|
|
@@ -2797,7 +2798,7 @@ const Menu = class {
|
|
|
2797
2798
|
this.select.emit(menuItem);
|
|
2798
2799
|
this.open = false;
|
|
2799
2800
|
this.currentSubMenu = null;
|
|
2800
|
-
this.
|
|
2801
|
+
setTimeout(this.focusTrigger, 0);
|
|
2801
2802
|
};
|
|
2802
2803
|
this.onSelect = (event) => {
|
|
2803
2804
|
event.stopPropagation();
|
|
@@ -2814,6 +2815,9 @@ const Menu = class {
|
|
|
2814
2815
|
};
|
|
2815
2816
|
this.setFocus = () => {
|
|
2816
2817
|
setTimeout(() => {
|
|
2818
|
+
if (!this.open) {
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2817
2821
|
if (this.searchInput && this.searcher) {
|
|
2818
2822
|
const observer = new IntersectionObserver(() => {
|
|
2819
2823
|
observer.unobserve(this.searchInput);
|
|
@@ -2833,6 +2837,11 @@ const Menu = class {
|
|
|
2833
2837
|
}
|
|
2834
2838
|
}, 0);
|
|
2835
2839
|
};
|
|
2840
|
+
this.focusTrigger = () => {
|
|
2841
|
+
var _a, _b;
|
|
2842
|
+
const trigger = (_b = (_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.assignedElements()) === null || _b === void 0 ? void 0 : _b[0];
|
|
2843
|
+
focusTriggerElement.focusTriggerElement(trigger);
|
|
2844
|
+
};
|
|
2836
2845
|
this.setSearchElement = (element) => {
|
|
2837
2846
|
this.searchInput = element;
|
|
2838
2847
|
};
|
|
@@ -2994,7 +3003,7 @@ const Menu = class {
|
|
|
2994
3003
|
const values = propertyNames.map((property) => {
|
|
2995
3004
|
return style.getPropertyValue(property);
|
|
2996
3005
|
});
|
|
2997
|
-
return
|
|
3006
|
+
return focusTriggerElement.zipObject(propertyNames, values);
|
|
2998
3007
|
}
|
|
2999
3008
|
isMenuItem(item) {
|
|
3000
3009
|
return !('separator' in item);
|