wj-elements 0.4.1 → 0.4.3
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/base-path.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +2 -2
- package/dist/packages/wje-avatar/service/service.d.ts +0 -1
- package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +1 -2
- package/dist/packages/wje-carousel/carousel.element.d.ts +6 -6
- package/dist/packages/wje-copy-button/copy-button.element.d.ts +5 -3
- package/dist/packages/wje-dropdown/dropdown.element.d.ts +29 -1
- package/dist/packages/wje-element/element.d.ts +1 -1
- package/dist/packages/wje-input/input.element.d.ts +1 -0
- package/dist/packages/wje-option/option.element.d.ts +3 -0
- package/dist/packages/wje-select/select.element.d.ts +17 -0
- package/dist/{popup.element-DklicGea.js → popup.element-C8-g3WLs.js} +3 -3
- package/dist/{popup.element-DklicGea.js.map → popup.element-C8-g3WLs.js.map} +1 -1
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-breadcrumb.js +0 -1
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-carousel.js +6 -6
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-copy-button.js +21 -12
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dropdown.js +67 -2
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +1 -1
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload.js +0 -1
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-input.js +50 -6
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-master.js +1 -1
- package/dist/wje-option.js +8 -2
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +15 -2
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-popup.js +1 -1
- package/dist/wje-select.js +187 -28
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-tooltip.js +1 -1
- package/package.json +5 -4
package/dist/base-path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-path.js","sources":["../packages/utils/base-path.js"],"sourcesContent":["let basePath = '';\n\nfunction resolveBasePathFromModuleUrl() {\n if (typeof import.meta?.url !== 'string' || import.meta.url === '') {\n return '';\n }\n\n try {\n return new URL(/* @vite-ignore */ '.', import.meta.url).href;\n } catch {\n return '';\n }\n}\n\n/**\n * Sets the base path for the application.\n * @param {string} path The base path to be set.\n * @returns {void} This function does not return anything.\n */\nexport function setBasePath(path) {\n basePath = path;\n}\n\n/**\n * Returns the base path of the application, optionally appending a specified relative path.\n * If the base path has not been set, it determines the base path from the first script element\n * with a `base-path` attribute or generates it based on the current script location.\n * @param {string} [appendedPath] The relative path to append to the base path. Defaults to an empty string.\n * @returns {string} The complete base path, with the appended relative path if specified.\n */\nexport function getBasePath(appendedPath = '') {\n if (!basePath) {\n const scripts = [...document.getElementsByTagName('script')];\n const basePathScript = scripts.find(script => script.hasAttribute('data-base-path'));\n\n if (basePathScript) {\n setBasePath(basePathScript.dataset.basePath || '');\n } else {\n setBasePath(resolveBasePathFromModuleUrl());\n }\n }\n\n const subPath = appendedPath.replace(/^\\//, '');\n\n return basePath.replace(/\\/$/, '') + (appendedPath ? '/' + subPath : '');\n}\n"],"names":[],"mappings":"AAAA,IAAI,WAAW;AAEf,SAAS,+BAA+B;AAFxC;AAGE,MAAI,SAAO,wCAAa,SAAQ,YAAY,YAAY,QAAQ,IAAI;AAClE,WAAO;AAAA,EACT;AAEA,MAAI;
|
|
1
|
+
{"version":3,"file":"base-path.js","sources":["../packages/utils/base-path.js"],"sourcesContent":["let basePath = '';\n\nfunction resolveBasePathFromModuleUrl() {\n if (typeof import.meta?.url !== 'string' || import.meta.url === '') {\n return '';\n }\n\n try {\n // eslint-disable-next-line jsdoc/no-bad-blocks\n return new URL(/* @vite-ignore */ '.', import.meta.url).href;\n } catch {\n return '';\n }\n}\n\n/**\n * Sets the base path for the application.\n * @param {string} path The base path to be set.\n * @returns {void} This function does not return anything.\n */\nexport function setBasePath(path) {\n basePath = path;\n}\n\n/**\n * Returns the base path of the application, optionally appending a specified relative path.\n * If the base path has not been set, it determines the base path from the first script element\n * with a `base-path` attribute or generates it based on the current script location.\n * @param {string} [appendedPath] The relative path to append to the base path. Defaults to an empty string.\n * @returns {string} The complete base path, with the appended relative path if specified.\n */\nexport function getBasePath(appendedPath = '') {\n if (!basePath) {\n const scripts = [...document.getElementsByTagName('script')];\n const basePathScript = scripts.find(script => script.hasAttribute('data-base-path'));\n\n if (basePathScript) {\n setBasePath(basePathScript.dataset.basePath || '');\n } else {\n setBasePath(resolveBasePathFromModuleUrl());\n }\n }\n\n const subPath = appendedPath.replace(/^\\//, '');\n\n return basePath.replace(/\\/$/, '') + (appendedPath ? '/' + subPath : '');\n}\n"],"names":[],"mappings":"AAAA,IAAI,WAAW;AAEf,SAAS,+BAA+B;AAFxC;AAGE,MAAI,SAAO,wCAAa,SAAQ,YAAY,YAAY,QAAQ,IAAI;AAClE,WAAO;AAAA,EACT;AAEA,MAAI;AAEF,WAAO,IAAI;AAAA;AAAA,MAAuB;AAAA,MAAK,YAAY;AAAA,IAAG,EAAE;AAAA,EAC1D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,YAAY,MAAM;AAChC,aAAW;AACb;AASO,SAAS,YAAY,eAAe,IAAI;AAC7C,MAAI,CAAC,UAAU;AACb,UAAM,UAAU,CAAC,GAAG,SAAS,qBAAqB,QAAQ,CAAC;AAC3D,UAAM,iBAAiB,QAAQ,KAAK,YAAU,OAAO,aAAa,gBAAgB,CAAC;AAEnF,QAAI,gBAAgB;AAClB,kBAAY,eAAe,QAAQ,YAAa,EAAE;AAAA,IACpD,OAAO;AACL,kBAAY,6BAA4B,CAAE;AAAA,IAC5C;AAAA,EACF;AAEA,QAAM,UAAU,aAAa,QAAQ,OAAO,EAAE;AAE9C,SAAO,SAAS,QAAQ,OAAO,EAAE,KAAK,eAAe,MAAM,UAAU;AACvE;"}
|
|
@@ -24,8 +24,8 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
24
24
|
* @cssproperty [--wje-accordion-headline-color=var(--wje-color-contrast-11)] - Text color of the headline area.
|
|
25
25
|
* @cssproperty [--wje-accordion-content-color=var(--wje-color-contrast-6)] - Text color of the expandable content area.
|
|
26
26
|
* @cssproperty [--wje-accordion-marker-rotate=0deg] - Rotation applied to the toggle marker icon.
|
|
27
|
-
* @fires wje-accordion-item:open - Dispatched when the item is expanded.
|
|
28
|
-
* @fires wje-accordion-item:close - Dispatched when the item is collapsed.
|
|
27
|
+
* // @fires wje-accordion-item:open - Dispatched when the item is expanded.
|
|
28
|
+
* // @fires wje-accordion-item:close - Dispatched when the item is collapsed.
|
|
29
29
|
* @tag wje-accordion-item
|
|
30
30
|
*/
|
|
31
31
|
export default class AccordionItem extends WJElement {
|
|
@@ -21,7 +21,6 @@ export function getHsl(text: string, s?: number, l?: number): string;
|
|
|
21
21
|
* Generates background and text HSL colors for avatars based on input text.
|
|
22
22
|
* The text color is a darker, more saturated variant of the background color
|
|
23
23
|
* to ensure sufficient contrast while keeping the same hue.
|
|
24
|
-
*
|
|
25
24
|
* @param {string} text The input text (e.g. initials or name).
|
|
26
25
|
* @returns {{ background: string, color: string }}
|
|
27
26
|
*/
|
|
@@ -55,9 +55,8 @@ export default class Breadcrumb extends WJElement {
|
|
|
55
55
|
* @param {string} name The name of the attribute that was changed.
|
|
56
56
|
* @param {string|null} oldValue The previous value of the attribute before it was changed. Null if the attribute was not previously set.
|
|
57
57
|
* @param {string|null} newValue The new value of the attribute after it was changed. Null if the attribute was removed.
|
|
58
|
-
* @returns {boolean} Returns false to signal no default behavior is implemented.
|
|
59
58
|
*/
|
|
60
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null):
|
|
59
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
61
60
|
active: boolean;
|
|
62
61
|
syncAria(): void;
|
|
63
62
|
/**
|
|
@@ -88,9 +88,9 @@ export default class Carousel extends WJElement {
|
|
|
88
88
|
* Returns the interaction scroll behavior for UI controls.
|
|
89
89
|
* Continuous multi-slide loops use instant snapping to avoid blank edge states
|
|
90
90
|
* while the browser is still animating a previous smooth scroll.
|
|
91
|
-
* @returns {
|
|
91
|
+
* @returns {string}
|
|
92
92
|
*/
|
|
93
|
-
getControlBehavior():
|
|
93
|
+
getControlBehavior(): string;
|
|
94
94
|
/**
|
|
95
95
|
* Sets up the IntersectionObserver for the Carousel.
|
|
96
96
|
*/
|
|
@@ -138,9 +138,9 @@ export default class Carousel extends WJElement {
|
|
|
138
138
|
/**
|
|
139
139
|
* Scrolls the carousel to a visual slide index.
|
|
140
140
|
* @param {number} vIndex
|
|
141
|
-
* @param {
|
|
141
|
+
* @param {string} behavior
|
|
142
142
|
*/
|
|
143
|
-
scrollToVisualIndex(vIndex: number, behavior?:
|
|
143
|
+
scrollToVisualIndex(vIndex: number, behavior?: string): void;
|
|
144
144
|
snapRestoreFrame: any;
|
|
145
145
|
/**
|
|
146
146
|
* Goes to the next slide.
|
|
@@ -192,9 +192,9 @@ export default class Carousel extends WJElement {
|
|
|
192
192
|
* @returns {Array}
|
|
193
193
|
*/
|
|
194
194
|
getSlidesWithClones(): any[];
|
|
195
|
-
/** Maps logical index
|
|
195
|
+
/** Maps logical index to visual index, including leading clones when loop is enabled. */
|
|
196
196
|
getVisualIndexForLogical(index: any): any;
|
|
197
|
-
/** Maps visual index
|
|
197
|
+
/** Maps visual index to logical index, including edge clones when loop is enabled. */
|
|
198
198
|
getLogicalIndexForVisual(vIndex: any): any;
|
|
199
199
|
/**
|
|
200
200
|
* Returns the maximum logical slide index that can still render a full viewport.
|
|
@@ -8,6 +8,9 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
8
8
|
* @status stable
|
|
9
9
|
* @augments WJElement
|
|
10
10
|
* @attribute {string} for - The id of the element to copy content from.
|
|
11
|
+
* @attribute {string} label - Accessible label for the button. Also used as fallback tooltip text when the `tooltip` attribute is present without a value.
|
|
12
|
+
* @attribute {string} label-success - Text displayed in the tooltip after a successful copy. Used only when the `tooltip` attribute is present.
|
|
13
|
+
* @attribute {string} tooltip - Enables the tooltip. When set to a string, the value is used as the default tooltip content.
|
|
11
14
|
* @attribute {string} value - The text to be copied.
|
|
12
15
|
* @slot - This is a default/unnamed slot.
|
|
13
16
|
* @csspart button - Styles the button element.
|
|
@@ -43,8 +46,8 @@ export default class CopyButton extends WJElement {
|
|
|
43
46
|
* @returns {DocumentFragment} The created document fragment.
|
|
44
47
|
*/
|
|
45
48
|
draw(): DocumentFragment;
|
|
49
|
+
_tooltipElement: HTMLElement;
|
|
46
50
|
icon: HTMLElement;
|
|
47
|
-
tooltip: HTMLElement;
|
|
48
51
|
/**
|
|
49
52
|
* Adds event listeners for the click, focus, and blur events.
|
|
50
53
|
*/
|
|
@@ -76,9 +79,8 @@ export default class CopyButton extends WJElement {
|
|
|
76
79
|
/**
|
|
77
80
|
* Handles the copied event.
|
|
78
81
|
* You can override this method to customize the behavior when the text is copied.
|
|
79
|
-
* @param {Event} e The event object.
|
|
80
82
|
*/
|
|
81
|
-
copied: (
|
|
83
|
+
copied: () => void;
|
|
82
84
|
/**
|
|
83
85
|
* Copies the specified text or node.
|
|
84
86
|
* @param {HTMLElement} button The button element.
|
|
@@ -77,7 +77,35 @@ export default class Dropdown extends WJElement {
|
|
|
77
77
|
*/
|
|
78
78
|
afterDraw(): void;
|
|
79
79
|
onSlotChange: () => void;
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Handles popup hide events and closes only the dropdown that owns the popup.
|
|
82
|
+
* This prevents nested dropdowns from collapsing their parent dropdown when the
|
|
83
|
+
* child popup is hidden.
|
|
84
|
+
* @param {Event} e The popup hide event.
|
|
85
|
+
*/
|
|
86
|
+
popupHideCallback: (e: Event) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Assigns the current dropdown instance as the owner of its popup layers.
|
|
89
|
+
* Owner metadata is later used to resolve which dropdown should react to
|
|
90
|
+
* delegated menu-item clicks, including portaled popup content.
|
|
91
|
+
*/
|
|
92
|
+
syncPopupOwner(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Recursively assigns owner metadata to the dropdown content subtree while
|
|
95
|
+
* leaving nested dropdown roots untouched, so each nested dropdown can keep
|
|
96
|
+
* its own ownership boundary.
|
|
97
|
+
* @param {HTMLElement} [root] The subtree root whose children should inherit this dropdown owner. Defaults to the current dropdown.
|
|
98
|
+
*/
|
|
99
|
+
syncOwnedContentOwner(root?: HTMLElement): void;
|
|
100
|
+
/**
|
|
101
|
+
* Resolves the dropdown that owns a clicked menu item. The lookup prefers
|
|
102
|
+
* explicit owner metadata and falls back to DOM traversal so both regular
|
|
103
|
+
* and portaled dropdown content can be scoped correctly.
|
|
104
|
+
* @param {EventTarget[]} path The composed event path.
|
|
105
|
+
* @param {HTMLElement} item The clicked menu item element.
|
|
106
|
+
* @returns {HTMLElement|null} The owning dropdown element or null when it cannot be resolved.
|
|
107
|
+
*/
|
|
108
|
+
getMenuItemOwner(path: EventTarget[], item: HTMLElement): HTMLElement | null;
|
|
81
109
|
/**
|
|
82
110
|
* Handles delegated clicks from inside the popup and closes the dropdown when a leaf menu item is selected.
|
|
83
111
|
* This works even when the menu is portaled, because we rely on the composed path.
|
|
@@ -130,7 +130,7 @@ export default class WJElement extends HTMLElement {
|
|
|
130
130
|
/**
|
|
131
131
|
* Sets ARIA state via attributes.
|
|
132
132
|
* Accepts camelCase keys without the "aria" prefix, plus "role".
|
|
133
|
-
* Example: setAriaState({ role: 'tab', selected: true, controls: 'panel-1' })
|
|
133
|
+
* Example: setAriaState({ role: 'tab', selected: true, controls: 'panel-1' }).
|
|
134
134
|
* @param {object} state
|
|
135
135
|
*/
|
|
136
136
|
setAriaState(state?: object): void;
|
|
@@ -54,6 +54,9 @@ export default class Option extends WJElement {
|
|
|
54
54
|
* @returns {boolean} Returns true if the 'wje-select' element has the 'multiple' attribute, otherwise false.
|
|
55
55
|
*/
|
|
56
56
|
get multiple(): boolean;
|
|
57
|
+
set ownerSelect(value: any);
|
|
58
|
+
get ownerSelect(): any;
|
|
59
|
+
_ownerSelect: any;
|
|
57
60
|
/**
|
|
58
61
|
* Sets the value attribute of the option.
|
|
59
62
|
* @param {string} value The value to set.
|
|
@@ -11,6 +11,7 @@ import { default as Options } from '../wje-options/options.js';
|
|
|
11
11
|
import { default as Checkbox } from '../wje-checkbox/checkbox.js';
|
|
12
12
|
export class Select extends FormAssociatedElement {
|
|
13
13
|
static _instanceId: number;
|
|
14
|
+
static portalStyles: string;
|
|
14
15
|
/**
|
|
15
16
|
* Returns the CSS styles for the component.
|
|
16
17
|
* @static
|
|
@@ -143,6 +144,22 @@ export class Select extends FormAssociatedElement {
|
|
|
143
144
|
* @returns {string} The default value of the input element.
|
|
144
145
|
*/
|
|
145
146
|
get defaultValue(): string;
|
|
147
|
+
/**
|
|
148
|
+
* Sets or removes the `portaled` attribute on the select.
|
|
149
|
+
* Mirrors the dropdown API so popup content can be rendered in a portal root.
|
|
150
|
+
* @param {boolean|string} value Determines whether and where the popup should be portaled.
|
|
151
|
+
*/
|
|
152
|
+
set portaled(value: boolean | string);
|
|
153
|
+
/**
|
|
154
|
+
* Getter for the `portaled` attribute value.
|
|
155
|
+
* @returns {string} The configured portal target or an empty string for the default body portal.
|
|
156
|
+
*/
|
|
157
|
+
get portaled(): string;
|
|
158
|
+
/**
|
|
159
|
+
* Checks whether popup content should be portaled.
|
|
160
|
+
* @returns {boolean} True when the `portaled` attribute is present.
|
|
161
|
+
*/
|
|
162
|
+
get isPortaled(): boolean;
|
|
146
163
|
/**
|
|
147
164
|
* Sets the trigger value.
|
|
148
165
|
* @param {string} value The trigger value to set.
|
|
@@ -1693,7 +1693,7 @@ class Popup extends WJElement {
|
|
|
1693
1693
|
for (const n of defNodes) {
|
|
1694
1694
|
const ph = document.createComment("wje-portal-default");
|
|
1695
1695
|
this._defPlaceholders.push({ node: n, ph });
|
|
1696
|
-
n.parentNode
|
|
1696
|
+
if (n.parentNode) n.parentNode.insertBefore(ph, n.nextSibling);
|
|
1697
1697
|
this._portalContainer.append(n);
|
|
1698
1698
|
}
|
|
1699
1699
|
const arrowNodes = (this.slotArrow instanceof HTMLSlotElement ? this.slotArrow.assignedNodes({ flatten: true }) : []).filter((n) => n && n.nodeType === Node.ELEMENT_NODE || n && n.nodeType === Node.TEXT_NODE);
|
|
@@ -1701,7 +1701,7 @@ class Popup extends WJElement {
|
|
|
1701
1701
|
for (const n of arrowNodes) {
|
|
1702
1702
|
const ph = document.createComment("wje-portal-arrow");
|
|
1703
1703
|
this._arrowPlaceholders.push({ node: n, ph });
|
|
1704
|
-
n.parentNode
|
|
1704
|
+
if (n.parentNode) n.parentNode.insertBefore(ph, n.nextSibling);
|
|
1705
1705
|
this._portalContainer.append(n);
|
|
1706
1706
|
}
|
|
1707
1707
|
this._floatingEl = this._portalNative;
|
|
@@ -1898,4 +1898,4 @@ class Popup extends WJElement {
|
|
|
1898
1898
|
export {
|
|
1899
1899
|
Popup as P
|
|
1900
1900
|
};
|
|
1901
|
-
//# sourceMappingURL=popup.element-
|
|
1901
|
+
//# sourceMappingURL=popup.element-C8-g3WLs.js.map
|