@limetech/lime-elements 36.0.0-next.4 → 36.0.0-next.7
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/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-button.cjs.entry.js +2 -2
- package/dist/cjs/{limel-color-picker-palette_2.cjs.entry.js → limel-color-picker-palette.cjs.entry.js} +0 -112
- package/dist/cjs/limel-dock-button.cjs.entry.js +79 -0
- package/dist/cjs/limel-dock.cjs.entry.js +105 -0
- package/dist/cjs/{limel-list_3.cjs.entry.js → limel-list_2.cjs.entry.js} +0 -2018
- package/dist/cjs/limel-popover_4.cjs.entry.js +239 -0
- package/dist/cjs/limel-portal.cjs.entry.js +2024 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/button/button.css +3 -0
- package/dist/collection/components/button/button.js +1 -2
- package/dist/collection/components/dock/dock-button/dock-button.css +71 -0
- package/dist/collection/components/dock/dock-button/dock-button.js +187 -0
- package/dist/collection/components/dock/dock.css +107 -0
- package/dist/collection/components/dock/dock.js +254 -0
- package/dist/collection/components/dock/dock.types.js +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-button.entry.js +2 -2
- package/dist/esm/{limel-color-picker-palette_2.entry.js → limel-color-picker-palette.entry.js} +2 -113
- package/dist/esm/limel-dock-button.entry.js +75 -0
- package/dist/esm/limel-dock.entry.js +101 -0
- package/dist/esm/{limel-list_3.entry.js → limel-list_2.entry.js} +1 -2018
- package/dist/esm/limel-popover_4.entry.js +232 -0
- package/dist/esm/limel-portal.entry.js +2020 -0
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-009de50e.entry.js +1 -0
- package/dist/lime-elements/{p-08251941.entry.js → p-19f72dab.entry.js} +1 -1
- package/dist/lime-elements/p-1dfccbc5.entry.js +1 -0
- package/dist/lime-elements/p-93cd2268.entry.js +1 -0
- package/dist/lime-elements/p-b9af1b40.entry.js +1 -0
- package/dist/lime-elements/p-bd098a11.entry.js +1 -0
- package/dist/lime-elements/p-fabea4b5.entry.js +1 -0
- package/dist/types/components/dock/dock-button/dock-button.d.ts +36 -0
- package/dist/types/components/dock/dock.d.ts +71 -0
- package/dist/types/components/dock/dock.types.d.ts +53 -0
- package/dist/types/components.d.ts +108 -0
- package/dist/types/interface.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/limel-popover-surface.cjs.entry.js +0 -32
- package/dist/cjs/limel-tooltip_2.cjs.entry.js +0 -102
- package/dist/esm/limel-popover-surface.entry.js +0 -28
- package/dist/esm/limel-tooltip_2.entry.js +0 -97
- package/dist/lime-elements/p-22569fb6.entry.js +0 -1
- package/dist/lime-elements/p-2fbfc1ea.entry.js +0 -1
- package/dist/lime-elements/p-705334c1.entry.js +0 -1
- package/dist/lime-elements/p-87453b45.entry.js +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-2a28697b.js');
|
|
6
|
+
const randomString = require('./random-string-4c3b7f1c.js');
|
|
7
|
+
const keycodes = require('./keycodes-3949f425.js');
|
|
8
|
+
const zipObject = require('./zipObject-93a471fa.js');
|
|
9
|
+
require('./_assignValue-7c18d8d6.js');
|
|
10
|
+
require('./_defineProperty-8f56146d.js');
|
|
11
|
+
require('./_getNative-60328036.js');
|
|
12
|
+
require('./eq-9a943b00.js');
|
|
13
|
+
require('./isObject-e28b7997.js');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Check if an element is a descendant of another
|
|
17
|
+
*
|
|
18
|
+
* If the child element is a descendant of a limel-portal, this function will
|
|
19
|
+
* go back through the portal and check the original tree recursively
|
|
20
|
+
*
|
|
21
|
+
* @param {HTMLElement} element the parent element
|
|
22
|
+
* @param {HTMLElement} child the child element to check
|
|
23
|
+
* @returns {boolean} `true` if child is a descendant of element, taking
|
|
24
|
+
* portals into account
|
|
25
|
+
*/
|
|
26
|
+
function portalContains(element, child) {
|
|
27
|
+
var _a;
|
|
28
|
+
if (element.contains(child) || ((_a = element.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(child))) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
const parent = findParent(child);
|
|
32
|
+
if (!parent) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return portalContains(element, parent);
|
|
36
|
+
}
|
|
37
|
+
function findParent(element) {
|
|
38
|
+
const portal = element.closest('.limel-portal--container');
|
|
39
|
+
if (portal) {
|
|
40
|
+
return portal.portalSource;
|
|
41
|
+
}
|
|
42
|
+
const rootNode = element.getRootNode();
|
|
43
|
+
return rootNode.host;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const popoverCss = ".trigger-anchor{display:inline-block;position:relative}";
|
|
47
|
+
|
|
48
|
+
const Popover = class {
|
|
49
|
+
constructor(hostRef) {
|
|
50
|
+
index.registerInstance(this, hostRef);
|
|
51
|
+
this.close = index.createEvent(this, "close", 7);
|
|
52
|
+
/**
|
|
53
|
+
* True if the content within the popover should be visible
|
|
54
|
+
*/
|
|
55
|
+
this.open = false;
|
|
56
|
+
this.handleGlobalKeyPress = (event) => {
|
|
57
|
+
if (event.key !== keycodes.ESCAPE) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
this.close.emit();
|
|
63
|
+
};
|
|
64
|
+
this.portalId = randomString.createRandomString();
|
|
65
|
+
this.globalClickListener = this.globalClickListener.bind(this);
|
|
66
|
+
}
|
|
67
|
+
watchOpen() {
|
|
68
|
+
this.setupGlobalHandlers();
|
|
69
|
+
}
|
|
70
|
+
componentWillLoad() {
|
|
71
|
+
this.setupGlobalHandlers();
|
|
72
|
+
}
|
|
73
|
+
setupGlobalHandlers() {
|
|
74
|
+
if (this.open) {
|
|
75
|
+
document.addEventListener('click', this.globalClickListener, {
|
|
76
|
+
capture: true,
|
|
77
|
+
});
|
|
78
|
+
document.addEventListener('keyup', this.handleGlobalKeyPress);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
document.removeEventListener('click', this.globalClickListener);
|
|
82
|
+
document.removeEventListener('keyup', this.handleGlobalKeyPress);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
const cssProperties = this.getCssProperties();
|
|
87
|
+
const popoverZIndex = getComputedStyle(this.host).getPropertyValue('--popover-z-index');
|
|
88
|
+
return (index.h("div", { class: "trigger-anchor" }, index.h("slot", { name: "trigger" }), index.h("limel-portal", { visible: this.open, containerId: this.portalId, containerStyle: { 'z-index': popoverZIndex }, openDirection: this.openDirection }, index.h("limel-popover-surface", { contentCollection: this.host.children, style: cssProperties }))));
|
|
89
|
+
}
|
|
90
|
+
globalClickListener(event) {
|
|
91
|
+
const element = event.target;
|
|
92
|
+
const clickedInside = portalContains(this.host, element);
|
|
93
|
+
if (this.open && !clickedInside) {
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
this.close.emit();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
getCssProperties() {
|
|
100
|
+
const propertyNames = [
|
|
101
|
+
'--popover-surface-width',
|
|
102
|
+
'--popover-body-background-color',
|
|
103
|
+
'--popover-border-radius',
|
|
104
|
+
];
|
|
105
|
+
const style = getComputedStyle(this.host);
|
|
106
|
+
const values = propertyNames.map((property) => {
|
|
107
|
+
return style.getPropertyValue(property);
|
|
108
|
+
});
|
|
109
|
+
return zipObject.zipObject(propertyNames, values);
|
|
110
|
+
}
|
|
111
|
+
get host() { return index.getElement(this); }
|
|
112
|
+
static get watchers() { return {
|
|
113
|
+
"open": ["watchOpen"]
|
|
114
|
+
}; }
|
|
115
|
+
};
|
|
116
|
+
Popover.style = popoverCss;
|
|
117
|
+
|
|
118
|
+
const popoverSurfaceCss = ".limel-popover-surface{position:relative;display:flex;flex-direction:column;width:var(--popover-surface-width, auto);max-height:calc(100vh - 2rem);max-width:calc(100vw - 2rem);margin:0 0.25rem;border-radius:var(--popover-border-radius, 0.75rem);box-shadow:var(--shadow-depth-16);backdrop-filter:blur(0.3125rem);-webkit-backdrop-filter:blur(0.3125rem)}.limel-popover-surface:after{transition:opacity 0.4s ease;pointer-events:none;content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;opacity:0.75;border-radius:var(--popover-border-radius, 0.75rem);background-color:var(--popover-body-background-color, rgb(var(--contrast-100)))}.limel-popover-surface:focus,.limel-popover-surface:focus-within{outline:none}.limel-popover-surface:focus:after,.limel-popover-surface:focus-within:after{opacity:1}.limel-popover-surface:focus-visible{box-shadow:var(--shadow-depth-16-focused)}";
|
|
119
|
+
|
|
120
|
+
const PopoverSurface = class {
|
|
121
|
+
constructor(hostRef) {
|
|
122
|
+
index.registerInstance(this, hostRef);
|
|
123
|
+
}
|
|
124
|
+
componentDidLoad() {
|
|
125
|
+
this.appendElement();
|
|
126
|
+
}
|
|
127
|
+
render() {
|
|
128
|
+
return index.h("div", { class: "limel-popover-surface", tabindex: "0" });
|
|
129
|
+
}
|
|
130
|
+
appendElement() {
|
|
131
|
+
const portalContainer = this.host.shadowRoot.querySelector('.limel-popover-surface');
|
|
132
|
+
Array.from(this.contentCollection).forEach((child) => {
|
|
133
|
+
if (child.slot === 'trigger') {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
portalContainer.appendChild(child);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
get host() { return index.getElement(this); }
|
|
140
|
+
};
|
|
141
|
+
PopoverSurface.style = popoverSurfaceCss;
|
|
142
|
+
|
|
143
|
+
const tooltipCss = ".trigger-anchor{position:relative}";
|
|
144
|
+
|
|
145
|
+
const DEFAULT_MAX_LENGTH = 50;
|
|
146
|
+
const Tooltip = class {
|
|
147
|
+
constructor(hostRef) {
|
|
148
|
+
index.registerInstance(this, hostRef);
|
|
149
|
+
/**
|
|
150
|
+
* The maximum amount of characters before rendering 'label' and
|
|
151
|
+
* 'helperLabel' in two rows.
|
|
152
|
+
*/
|
|
153
|
+
this.maxlength = DEFAULT_MAX_LENGTH;
|
|
154
|
+
this.showTooltip = () => {
|
|
155
|
+
const tooltipDelay = 500;
|
|
156
|
+
this.showTooltipTimeoutHandle = window.setTimeout(() => {
|
|
157
|
+
this.open = true;
|
|
158
|
+
}, tooltipDelay);
|
|
159
|
+
};
|
|
160
|
+
this.hideTooltip = () => {
|
|
161
|
+
clearTimeout(this.showTooltipTimeoutHandle);
|
|
162
|
+
this.open = false;
|
|
163
|
+
};
|
|
164
|
+
this.portalId = randomString.createRandomString();
|
|
165
|
+
this.tooltipId = randomString.createRandomString();
|
|
166
|
+
}
|
|
167
|
+
connectedCallback() {
|
|
168
|
+
this.setOwnerAriaLabel();
|
|
169
|
+
this.addListeners();
|
|
170
|
+
}
|
|
171
|
+
disconnectedCallback() {
|
|
172
|
+
this.removeListeners();
|
|
173
|
+
}
|
|
174
|
+
render() {
|
|
175
|
+
const tooltipZIndex = getComputedStyle(this.host).getPropertyValue('--tooltip-z-index');
|
|
176
|
+
return (index.h("div", { class: "trigger-anchor" }, index.h("limel-portal", { openDirection: "bottom-start", visible: this.open, containerId: this.portalId, containerStyle: {
|
|
177
|
+
'z-index': tooltipZIndex,
|
|
178
|
+
'pointer-events': 'none',
|
|
179
|
+
} }, index.h("limel-tooltip-content", { label: this.label, helperLabel: this.helperLabel, maxlength: this.maxlength, role: "tooltip", "aria-hidden": !this.open, id: this.tooltipId }))));
|
|
180
|
+
}
|
|
181
|
+
setOwnerAriaLabel() {
|
|
182
|
+
const owner = this.getOwnerElement();
|
|
183
|
+
owner === null || owner === void 0 ? void 0 : owner.setAttribute('aria-describedby', this.tooltipId);
|
|
184
|
+
}
|
|
185
|
+
addListeners() {
|
|
186
|
+
const owner = this.getOwnerElement();
|
|
187
|
+
owner === null || owner === void 0 ? void 0 : owner.addEventListener('mouseover', this.showTooltip);
|
|
188
|
+
owner === null || owner === void 0 ? void 0 : owner.addEventListener('mouseout', this.hideTooltip);
|
|
189
|
+
owner === null || owner === void 0 ? void 0 : owner.addEventListener('click', this.hideTooltip);
|
|
190
|
+
}
|
|
191
|
+
removeListeners() {
|
|
192
|
+
const owner = this.getOwnerElement();
|
|
193
|
+
owner === null || owner === void 0 ? void 0 : owner.removeEventListener('mouseover', this.showTooltip);
|
|
194
|
+
owner === null || owner === void 0 ? void 0 : owner.removeEventListener('mouseout', this.hideTooltip);
|
|
195
|
+
owner === null || owner === void 0 ? void 0 : owner.removeEventListener('click', this.hideTooltip);
|
|
196
|
+
}
|
|
197
|
+
getOwnerElement() {
|
|
198
|
+
var _a;
|
|
199
|
+
let element = this.host;
|
|
200
|
+
do {
|
|
201
|
+
element = element.parentNode;
|
|
202
|
+
} while (element &&
|
|
203
|
+
element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&
|
|
204
|
+
element.nodeType !== Node.DOCUMENT_NODE);
|
|
205
|
+
return (_a = element) === null || _a === void 0 ? void 0 : _a.getElementById(this.elementId);
|
|
206
|
+
}
|
|
207
|
+
get host() { return index.getElement(this); }
|
|
208
|
+
};
|
|
209
|
+
Tooltip.style = tooltipCss;
|
|
210
|
+
|
|
211
|
+
const tooltipContentCss = ":host{animation:display-tooltip 0.2s ease;display:flex;border-radius:0.25rem;padding:0.25rem 0.5rem;background-color:rgb(var(--contrast-1300));box-shadow:var(--shadow-depth-16)}text{font-size:0.875rem;line-height:1.25;display:flex;column-gap:1rem}text.has-column-layout{display:table-cell;width:fit-content;max-width:min(var(--tooltip-max-width-of-text), 80vw)}text.has-column-layout .label{padding-bottom:0.5rem}text.has-column-layout .helper-label{padding-bottom:0.25rem}.label{color:rgb(var(--contrast-200))}.helper-label{color:rgb(var(--contrast-800))}.helper-label:empty{display:none}@keyframes display-tooltip{0%{opacity:0;transform:translate3d(0, 0, 0) scale(0.94)}100%{opacity:1;transform:translate3d(0, 0, 0) scale(1)}}";
|
|
212
|
+
|
|
213
|
+
const TooltipContent = class {
|
|
214
|
+
constructor(hostRef) {
|
|
215
|
+
index.registerInstance(this, hostRef);
|
|
216
|
+
}
|
|
217
|
+
render() {
|
|
218
|
+
let isLabelsTextLong = false;
|
|
219
|
+
if (this.helperLabel && this.maxlength) {
|
|
220
|
+
isLabelsTextLong =
|
|
221
|
+
this.label.length + this.helperLabel.length > this.maxlength;
|
|
222
|
+
}
|
|
223
|
+
const props = {};
|
|
224
|
+
if (this.maxlength) {
|
|
225
|
+
props.style = {
|
|
226
|
+
'--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return [
|
|
230
|
+
index.h("text", Object.assign({ class: { 'has-column-layout': isLabelsTextLong } }, props), index.h("div", { class: "label" }, this.label), index.h("div", { class: "helper-label" }, this.helperLabel)),
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
TooltipContent.style = tooltipContentCss;
|
|
235
|
+
|
|
236
|
+
exports.limel_popover = Popover;
|
|
237
|
+
exports.limel_popover_surface = PopoverSurface;
|
|
238
|
+
exports.limel_tooltip = Tooltip;
|
|
239
|
+
exports.limel_tooltip_content = TooltipContent;
|