@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,232 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-11cd0b60.js';
|
|
2
|
+
import { c as createRandomString } from './random-string-2246b81e.js';
|
|
3
|
+
import { b as ESCAPE } from './keycodes-9f971b46.js';
|
|
4
|
+
import { z as zipObject } from './zipObject-2bb1968e.js';
|
|
5
|
+
import './_assignValue-fb2bf80a.js';
|
|
6
|
+
import './_defineProperty-2105cb48.js';
|
|
7
|
+
import './_getNative-93d6bfe9.js';
|
|
8
|
+
import './eq-c1c7f528.js';
|
|
9
|
+
import './isObject-c74e273c.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Check if an element is a descendant of another
|
|
13
|
+
*
|
|
14
|
+
* If the child element is a descendant of a limel-portal, this function will
|
|
15
|
+
* go back through the portal and check the original tree recursively
|
|
16
|
+
*
|
|
17
|
+
* @param {HTMLElement} element the parent element
|
|
18
|
+
* @param {HTMLElement} child the child element to check
|
|
19
|
+
* @returns {boolean} `true` if child is a descendant of element, taking
|
|
20
|
+
* portals into account
|
|
21
|
+
*/
|
|
22
|
+
function portalContains(element, child) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (element.contains(child) || ((_a = element.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(child))) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
const parent = findParent(child);
|
|
28
|
+
if (!parent) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return portalContains(element, parent);
|
|
32
|
+
}
|
|
33
|
+
function findParent(element) {
|
|
34
|
+
const portal = element.closest('.limel-portal--container');
|
|
35
|
+
if (portal) {
|
|
36
|
+
return portal.portalSource;
|
|
37
|
+
}
|
|
38
|
+
const rootNode = element.getRootNode();
|
|
39
|
+
return rootNode.host;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const popoverCss = ".trigger-anchor{display:inline-block;position:relative}";
|
|
43
|
+
|
|
44
|
+
const Popover = class {
|
|
45
|
+
constructor(hostRef) {
|
|
46
|
+
registerInstance(this, hostRef);
|
|
47
|
+
this.close = createEvent(this, "close", 7);
|
|
48
|
+
/**
|
|
49
|
+
* True if the content within the popover should be visible
|
|
50
|
+
*/
|
|
51
|
+
this.open = false;
|
|
52
|
+
this.handleGlobalKeyPress = (event) => {
|
|
53
|
+
if (event.key !== ESCAPE) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
this.close.emit();
|
|
59
|
+
};
|
|
60
|
+
this.portalId = createRandomString();
|
|
61
|
+
this.globalClickListener = this.globalClickListener.bind(this);
|
|
62
|
+
}
|
|
63
|
+
watchOpen() {
|
|
64
|
+
this.setupGlobalHandlers();
|
|
65
|
+
}
|
|
66
|
+
componentWillLoad() {
|
|
67
|
+
this.setupGlobalHandlers();
|
|
68
|
+
}
|
|
69
|
+
setupGlobalHandlers() {
|
|
70
|
+
if (this.open) {
|
|
71
|
+
document.addEventListener('click', this.globalClickListener, {
|
|
72
|
+
capture: true,
|
|
73
|
+
});
|
|
74
|
+
document.addEventListener('keyup', this.handleGlobalKeyPress);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
document.removeEventListener('click', this.globalClickListener);
|
|
78
|
+
document.removeEventListener('keyup', this.handleGlobalKeyPress);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const cssProperties = this.getCssProperties();
|
|
83
|
+
const popoverZIndex = getComputedStyle(this.host).getPropertyValue('--popover-z-index');
|
|
84
|
+
return (h("div", { class: "trigger-anchor" }, h("slot", { name: "trigger" }), h("limel-portal", { visible: this.open, containerId: this.portalId, containerStyle: { 'z-index': popoverZIndex }, openDirection: this.openDirection }, h("limel-popover-surface", { contentCollection: this.host.children, style: cssProperties }))));
|
|
85
|
+
}
|
|
86
|
+
globalClickListener(event) {
|
|
87
|
+
const element = event.target;
|
|
88
|
+
const clickedInside = portalContains(this.host, element);
|
|
89
|
+
if (this.open && !clickedInside) {
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
this.close.emit();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
getCssProperties() {
|
|
96
|
+
const propertyNames = [
|
|
97
|
+
'--popover-surface-width',
|
|
98
|
+
'--popover-body-background-color',
|
|
99
|
+
'--popover-border-radius',
|
|
100
|
+
];
|
|
101
|
+
const style = getComputedStyle(this.host);
|
|
102
|
+
const values = propertyNames.map((property) => {
|
|
103
|
+
return style.getPropertyValue(property);
|
|
104
|
+
});
|
|
105
|
+
return zipObject(propertyNames, values);
|
|
106
|
+
}
|
|
107
|
+
get host() { return getElement(this); }
|
|
108
|
+
static get watchers() { return {
|
|
109
|
+
"open": ["watchOpen"]
|
|
110
|
+
}; }
|
|
111
|
+
};
|
|
112
|
+
Popover.style = popoverCss;
|
|
113
|
+
|
|
114
|
+
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)}";
|
|
115
|
+
|
|
116
|
+
const PopoverSurface = class {
|
|
117
|
+
constructor(hostRef) {
|
|
118
|
+
registerInstance(this, hostRef);
|
|
119
|
+
}
|
|
120
|
+
componentDidLoad() {
|
|
121
|
+
this.appendElement();
|
|
122
|
+
}
|
|
123
|
+
render() {
|
|
124
|
+
return h("div", { class: "limel-popover-surface", tabindex: "0" });
|
|
125
|
+
}
|
|
126
|
+
appendElement() {
|
|
127
|
+
const portalContainer = this.host.shadowRoot.querySelector('.limel-popover-surface');
|
|
128
|
+
Array.from(this.contentCollection).forEach((child) => {
|
|
129
|
+
if (child.slot === 'trigger') {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
portalContainer.appendChild(child);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
get host() { return getElement(this); }
|
|
136
|
+
};
|
|
137
|
+
PopoverSurface.style = popoverSurfaceCss;
|
|
138
|
+
|
|
139
|
+
const tooltipCss = ".trigger-anchor{position:relative}";
|
|
140
|
+
|
|
141
|
+
const DEFAULT_MAX_LENGTH = 50;
|
|
142
|
+
const Tooltip = class {
|
|
143
|
+
constructor(hostRef) {
|
|
144
|
+
registerInstance(this, hostRef);
|
|
145
|
+
/**
|
|
146
|
+
* The maximum amount of characters before rendering 'label' and
|
|
147
|
+
* 'helperLabel' in two rows.
|
|
148
|
+
*/
|
|
149
|
+
this.maxlength = DEFAULT_MAX_LENGTH;
|
|
150
|
+
this.showTooltip = () => {
|
|
151
|
+
const tooltipDelay = 500;
|
|
152
|
+
this.showTooltipTimeoutHandle = window.setTimeout(() => {
|
|
153
|
+
this.open = true;
|
|
154
|
+
}, tooltipDelay);
|
|
155
|
+
};
|
|
156
|
+
this.hideTooltip = () => {
|
|
157
|
+
clearTimeout(this.showTooltipTimeoutHandle);
|
|
158
|
+
this.open = false;
|
|
159
|
+
};
|
|
160
|
+
this.portalId = createRandomString();
|
|
161
|
+
this.tooltipId = createRandomString();
|
|
162
|
+
}
|
|
163
|
+
connectedCallback() {
|
|
164
|
+
this.setOwnerAriaLabel();
|
|
165
|
+
this.addListeners();
|
|
166
|
+
}
|
|
167
|
+
disconnectedCallback() {
|
|
168
|
+
this.removeListeners();
|
|
169
|
+
}
|
|
170
|
+
render() {
|
|
171
|
+
const tooltipZIndex = getComputedStyle(this.host).getPropertyValue('--tooltip-z-index');
|
|
172
|
+
return (h("div", { class: "trigger-anchor" }, h("limel-portal", { openDirection: "bottom-start", visible: this.open, containerId: this.portalId, containerStyle: {
|
|
173
|
+
'z-index': tooltipZIndex,
|
|
174
|
+
'pointer-events': 'none',
|
|
175
|
+
} }, h("limel-tooltip-content", { label: this.label, helperLabel: this.helperLabel, maxlength: this.maxlength, role: "tooltip", "aria-hidden": !this.open, id: this.tooltipId }))));
|
|
176
|
+
}
|
|
177
|
+
setOwnerAriaLabel() {
|
|
178
|
+
const owner = this.getOwnerElement();
|
|
179
|
+
owner === null || owner === void 0 ? void 0 : owner.setAttribute('aria-describedby', this.tooltipId);
|
|
180
|
+
}
|
|
181
|
+
addListeners() {
|
|
182
|
+
const owner = this.getOwnerElement();
|
|
183
|
+
owner === null || owner === void 0 ? void 0 : owner.addEventListener('mouseover', this.showTooltip);
|
|
184
|
+
owner === null || owner === void 0 ? void 0 : owner.addEventListener('mouseout', this.hideTooltip);
|
|
185
|
+
owner === null || owner === void 0 ? void 0 : owner.addEventListener('click', this.hideTooltip);
|
|
186
|
+
}
|
|
187
|
+
removeListeners() {
|
|
188
|
+
const owner = this.getOwnerElement();
|
|
189
|
+
owner === null || owner === void 0 ? void 0 : owner.removeEventListener('mouseover', this.showTooltip);
|
|
190
|
+
owner === null || owner === void 0 ? void 0 : owner.removeEventListener('mouseout', this.hideTooltip);
|
|
191
|
+
owner === null || owner === void 0 ? void 0 : owner.removeEventListener('click', this.hideTooltip);
|
|
192
|
+
}
|
|
193
|
+
getOwnerElement() {
|
|
194
|
+
var _a;
|
|
195
|
+
let element = this.host;
|
|
196
|
+
do {
|
|
197
|
+
element = element.parentNode;
|
|
198
|
+
} while (element &&
|
|
199
|
+
element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&
|
|
200
|
+
element.nodeType !== Node.DOCUMENT_NODE);
|
|
201
|
+
return (_a = element) === null || _a === void 0 ? void 0 : _a.getElementById(this.elementId);
|
|
202
|
+
}
|
|
203
|
+
get host() { return getElement(this); }
|
|
204
|
+
};
|
|
205
|
+
Tooltip.style = tooltipCss;
|
|
206
|
+
|
|
207
|
+
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)}}";
|
|
208
|
+
|
|
209
|
+
const TooltipContent = class {
|
|
210
|
+
constructor(hostRef) {
|
|
211
|
+
registerInstance(this, hostRef);
|
|
212
|
+
}
|
|
213
|
+
render() {
|
|
214
|
+
let isLabelsTextLong = false;
|
|
215
|
+
if (this.helperLabel && this.maxlength) {
|
|
216
|
+
isLabelsTextLong =
|
|
217
|
+
this.label.length + this.helperLabel.length > this.maxlength;
|
|
218
|
+
}
|
|
219
|
+
const props = {};
|
|
220
|
+
if (this.maxlength) {
|
|
221
|
+
props.style = {
|
|
222
|
+
'--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return [
|
|
226
|
+
h("text", Object.assign({ class: { 'has-column-layout': isLabelsTextLong } }, props), h("div", { class: "label" }, this.label), h("div", { class: "helper-label" }, this.helperLabel)),
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
TooltipContent.style = tooltipContentCss;
|
|
231
|
+
|
|
232
|
+
export { Popover as limel_popover, PopoverSurface as limel_popover_surface, Tooltip as limel_tooltip, TooltipContent as limel_tooltip_content };
|