@limetech/lime-elements 34.1.0-next.8 → 34.1.0-next.9
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/{_arrayIncludesWith-d69e30af.js → _arrayIncludesWith-36a6fafb.js} +7 -6
- package/dist/cjs/{_assignValue-493aac17.js → _assignValue-c9fc3712.js} +2 -2
- package/dist/cjs/{_defineProperty-c081d04c.js → _defineProperty-8351e789.js} +4 -3
- package/dist/cjs/eq-9a943b00.js +75 -0
- package/dist/cjs/{isArrayLike-2bebb99c.js → isArrayLike-ac53bdac.js} +1 -30
- package/dist/cjs/{isEqual-1ce0c121.js → isEqual-e3b9c27c.js} +21 -19
- package/dist/cjs/{eq-3b43a5ca.js → isObject-e28b7997.js} +0 -71
- package/dist/cjs/isObjectLike-3e3f0cba.js +31 -0
- package/dist/cjs/{isSymbol-4666002c.js → isSymbol-d22b2798.js} +3 -3
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +188 -0
- package/dist/cjs/limel-color-picker.cjs.entry.js +51 -0
- package/dist/cjs/{limel-flatpickr-adapter_2.cjs.entry.js → limel-flatpickr-adapter.cjs.entry.js} +8 -801
- package/dist/cjs/limel-form.cjs.entry.js +14 -12
- package/dist/cjs/limel-input-field.cjs.entry.js +713 -0
- package/dist/cjs/{limel-list_2.cjs.entry.js → limel-list_3.cjs.entry.js} +1929 -0
- package/dist/cjs/limel-menu.cjs.entry.js +5 -4
- package/dist/cjs/limel-tab-bar.cjs.entry.js +7 -5
- package/dist/cjs/limel-table.cjs.entry.js +9 -7
- package/dist/cjs/{limel-tooltip.cjs.entry.js → limel-tooltip_2.cjs.entry.js} +16 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pickBy-64252559.js → pickBy-88b0430a.js} +10 -10
- package/dist/cjs/toNumber-062ea29c.js +99 -0
- package/dist/cjs/{zipObject-2f430e94.js → zipObject-4050a45f.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/color-picker/color-picker-palette.css +1202 -0
- package/dist/collection/components/color-picker/color-picker-palette.js +135 -0
- package/dist/collection/components/color-picker/color-picker.css +71 -0
- package/dist/collection/components/color-picker/color-picker.js +189 -0
- package/dist/collection/components/color-picker/swatches.js +29 -0
- package/dist/esm/{_arrayIncludesWith-3f5ce249.js → _arrayIncludesWith-b5d3fd9e.js} +5 -4
- package/dist/esm/{_assignValue-94fb6adc.js → _assignValue-08fe10bc.js} +2 -2
- package/dist/esm/{_defineProperty-cbf98a2a.js → _defineProperty-8c869077.js} +2 -1
- package/dist/esm/eq-c1c7f528.js +72 -0
- package/dist/esm/{isArrayLike-14db8f02.js → isArrayLike-dd37ba9a.js} +2 -30
- package/dist/esm/{isEqual-4d982635.js → isEqual-4f22635f.js} +5 -3
- package/dist/esm/{eq-f40dd1d6.js → isObject-c74e273c.js} +1 -70
- package/dist/esm/isObjectLike-38996507.js +29 -0
- package/dist/esm/{isSymbol-84252d8e.js → isSymbol-5bf20921.js} +2 -2
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-color-picker-palette_2.entry.js +183 -0
- package/dist/esm/limel-color-picker.entry.js +47 -0
- package/dist/esm/{limel-flatpickr-adapter_2.entry.js → limel-flatpickr-adapter.entry.js} +8 -800
- package/dist/esm/limel-form.entry.js +10 -8
- package/dist/esm/limel-input-field.entry.js +709 -0
- package/dist/esm/{limel-list_2.entry.js → limel-list_3.entry.js} +1929 -1
- package/dist/esm/limel-menu.entry.js +5 -4
- package/dist/esm/limel-tab-bar.entry.js +7 -5
- package/dist/esm/limel-table.entry.js +9 -7
- package/dist/esm/{limel-tooltip.entry.js → limel-tooltip_2.entry.js} +16 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pickBy-c485c1b5.js → pickBy-8a849e46.js} +5 -5
- package/dist/esm/toNumber-a6ed64f0.js +97 -0
- package/dist/esm/{zipObject-53fcafb3.js → zipObject-22e88ce9.js} +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-090bc949.js +1 -0
- package/dist/lime-elements/p-13f0e4f4.entry.js +1 -0
- package/dist/lime-elements/p-18fe2eb1.entry.js +1 -0
- package/dist/lime-elements/{p-425a0596.js → p-1a64b531.js} +1 -1
- package/dist/lime-elements/p-365098fe.js +1 -0
- package/dist/lime-elements/p-379955f4.js +1 -0
- package/dist/lime-elements/p-426d11b4.js +1 -0
- package/dist/lime-elements/p-440084ea.js +1 -0
- package/dist/lime-elements/p-468e940e.entry.js +16 -0
- package/dist/lime-elements/p-4bc5d3fc.entry.js +1 -0
- package/dist/lime-elements/p-511d71e0.entry.js +1 -0
- package/dist/lime-elements/p-7f43b0c4.js +1 -0
- package/dist/lime-elements/p-81258617.entry.js +1 -0
- package/dist/lime-elements/p-858c6b82.js +1 -0
- package/dist/lime-elements/{p-fc691234.entry.js → p-bcafdb7a.entry.js} +2 -2
- package/dist/lime-elements/p-c93050d6.js +1 -0
- package/dist/lime-elements/p-cc154284.entry.js +1 -0
- package/dist/lime-elements/p-d529bb7d.js +1 -0
- package/dist/lime-elements/p-eda23c05.js +1 -0
- package/dist/lime-elements/{p-ff0217b3.entry.js → p-f2c706b8.entry.js} +1 -1
- package/dist/lime-elements/{p-facf936d.entry.js → p-f5a3e526.entry.js} +1 -1
- package/dist/lime-elements/p-f83213b8.js +1 -0
- package/dist/types/components/color-picker/color-picker-palette.d.ts +32 -0
- package/dist/types/components/color-picker/color-picker.d.ts +54 -0
- package/dist/types/components/color-picker/swatches.d.ts +4 -0
- package/dist/types/components.d.ts +114 -0
- package/package.json +1 -1
- package/dist/cjs/limel-popover.cjs.entry.js +0 -116
- package/dist/cjs/limel-portal.cjs.entry.js +0 -1935
- package/dist/cjs/limel-tooltip-content.cjs.entry.js +0 -22
- package/dist/esm/limel-popover.entry.js +0 -112
- package/dist/esm/limel-portal.entry.js +0 -1931
- package/dist/esm/limel-tooltip-content.entry.js +0 -18
- package/dist/lime-elements/p-227d2c5a.entry.js +0 -1
- package/dist/lime-elements/p-3ce2d46a.js +0 -1
- package/dist/lime-elements/p-77afe6dd.entry.js +0 -1
- package/dist/lime-elements/p-7c4d91f5.js +0 -1
- package/dist/lime-elements/p-845e645a.entry.js +0 -1
- package/dist/lime-elements/p-8bbe3720.js +0 -1
- package/dist/lime-elements/p-8e4ff107.js +0 -1
- package/dist/lime-elements/p-acfbf7ac.js +0 -1
- package/dist/lime-elements/p-bbc1bb01.entry.js +0 -1
- package/dist/lime-elements/p-c0765c9b.js +0 -1
- package/dist/lime-elements/p-e28a4246.entry.js +0 -1
- package/dist/lime-elements/p-ee7355e7.js +0 -1
- package/dist/lime-elements/p-f4495f59.entry.js +0 -1
- package/dist/lime-elements/p-fbe32287.entry.js +0 -16
- package/dist/lime-elements/p-fc610f15.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as r,c as n,p as t}from"./p-426d11b4.js";import{d as u}from"./p-379955f4.js";import{S as o}from"./p-c93050d6.js";import{i as a}from"./p-0b1af919.js";import{i}from"./p-7f43b0c4.js";import{i as e}from"./p-858c6b82.js";function f(r,n,t){switch(t.length){case 0:return r.call(n);case 1:return r.call(n,t[0]);case 2:return r.call(n,t[0],t[1]);case 3:return r.call(n,t[0],t[1],t[2])}return r.apply(n,t)}var c,s,v,p=Date.now,m=(c=u?function(r,n){return u(r,"toString",{configurable:!0,enumerable:!1,value:(t=n,function(){return t}),writable:!0});var t}:r,s=0,v=0,function(){var r=p(),n=16-(r-v);if(v=r,n>0){if(++s>=800)return arguments[0]}else s=0;return c.apply(void 0,arguments)});function l(r){return r!=r}function b(r,n){return!(null==r||!r.length)&&function(r,n){return n==n?function(r,n){for(var t=-1,u=r.length;++t<u;)if(r[t]===n)return t;return-1}(r,n):function(r,n){for(var t=r.length,u=-1;++u<t;)if(n(r[u],u,r))return u;return-1}(r,l)}(r,n)>-1}var d=Math.max;function j(n,t){return m(function(r,n,t){return n=d(void 0===n?r.length-1:n,0),function(){for(var u=arguments,o=-1,a=d(u.length-n,0),i=Array(a);++o<a;)i[o]=u[n+o];o=-1;for(var e=Array(n+1);++o<n;)e[o]=u[o];return e[n]=t(i),f(r,this,e)}}(n,t,r),n+"")}var h=o?o.isConcatSpreadable:void 0;function g(r){return a(r)||n(r)||!!(h&&r&&r[h])}function w(r,n,u,o,a){var i=-1,e=r.length;for(u||(u=g),a||(a=[]);++i<e;){var f=r[i];n>0&&u(f)?n>1?w(f,n-1,u,o,a):t(a,f):o||(a[a.length]=f)}return a}function y(r){return e(r)&&i(r)}function A(r,n,t){for(var u=-1,o=null==r?0:r.length;++u<o;)if(t(n,r[u]))return!0;return!1}export{b as a,A as b,j as c,w as d,y as i}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { FormComponent } from '../form/form.types';
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export declare class Palette implements FormComponent {
|
|
7
|
+
/**
|
|
8
|
+
* Color value that is manually typed by the user
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/**
|
|
12
|
+
* Label of the input field
|
|
13
|
+
*/
|
|
14
|
+
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* Helper text of the input field
|
|
17
|
+
*/
|
|
18
|
+
helperText: string;
|
|
19
|
+
/**
|
|
20
|
+
* Set to `true` if a value is required
|
|
21
|
+
*/
|
|
22
|
+
required: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Emits chosen value to the parent component
|
|
25
|
+
*/
|
|
26
|
+
change: EventEmitter<string>;
|
|
27
|
+
render(): any[];
|
|
28
|
+
private renderSwatches;
|
|
29
|
+
private renderSwatch;
|
|
30
|
+
private handleChange;
|
|
31
|
+
private handleClick;
|
|
32
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { FormComponent } from '../form/form.types';
|
|
3
|
+
/**
|
|
4
|
+
* This component enables you to select a swatch from out color palette, simply
|
|
5
|
+
* by clicking on it. You can then copy the css variable name of the chosen color
|
|
6
|
+
* and use it where desired.
|
|
7
|
+
*
|
|
8
|
+
* The color picker can also show you a preview of any valid color name or color value.
|
|
9
|
+
*
|
|
10
|
+
* :::note
|
|
11
|
+
* Make sure to read our [guidelines about usage of colors](/#/DesignGuidelines/color-system.md/) from our palette.
|
|
12
|
+
* :::
|
|
13
|
+
*
|
|
14
|
+
* @exampleComponent limel-example-color-picker
|
|
15
|
+
* @exampleComponent limel-example-color-picker-readonly
|
|
16
|
+
*/
|
|
17
|
+
export declare class ColorPicker implements FormComponent {
|
|
18
|
+
/**
|
|
19
|
+
* Name or code of the chosen color
|
|
20
|
+
*/
|
|
21
|
+
value: string;
|
|
22
|
+
/**
|
|
23
|
+
* The label of the input field
|
|
24
|
+
*/
|
|
25
|
+
label: string;
|
|
26
|
+
/**
|
|
27
|
+
* Helper text of the input field
|
|
28
|
+
*/
|
|
29
|
+
helperText: string;
|
|
30
|
+
/**
|
|
31
|
+
* Displayed as tooltips when picker is hovered.
|
|
32
|
+
*/
|
|
33
|
+
tooltipLabel: string;
|
|
34
|
+
/**
|
|
35
|
+
* Set to `true` if a value is required
|
|
36
|
+
*/
|
|
37
|
+
required: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Set to `true` if a value is readonly. This makes the component un-interactive.
|
|
40
|
+
*/
|
|
41
|
+
readonly: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Emits chosen value to the parent component
|
|
44
|
+
*/
|
|
45
|
+
change: EventEmitter<string>;
|
|
46
|
+
private isOpen;
|
|
47
|
+
render(): any[];
|
|
48
|
+
private renderTooltip;
|
|
49
|
+
private renderPickerPalette;
|
|
50
|
+
private renderPickerTrigger;
|
|
51
|
+
private openPopover;
|
|
52
|
+
private onPopoverClose;
|
|
53
|
+
private handleChange;
|
|
54
|
+
}
|
|
@@ -229,6 +229,50 @@ export namespace Components {
|
|
|
229
229
|
*/
|
|
230
230
|
"isOpen": boolean;
|
|
231
231
|
}
|
|
232
|
+
interface LimelColorPicker {
|
|
233
|
+
/**
|
|
234
|
+
* Helper text of the input field
|
|
235
|
+
*/
|
|
236
|
+
"helperText": string;
|
|
237
|
+
/**
|
|
238
|
+
* The label of the input field
|
|
239
|
+
*/
|
|
240
|
+
"label": string;
|
|
241
|
+
/**
|
|
242
|
+
* Set to `true` if a value is readonly. This makes the component un-interactive.
|
|
243
|
+
*/
|
|
244
|
+
"readonly": boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Set to `true` if a value is required
|
|
247
|
+
*/
|
|
248
|
+
"required": boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Displayed as tooltips when picker is hovered.
|
|
251
|
+
*/
|
|
252
|
+
"tooltipLabel": string;
|
|
253
|
+
/**
|
|
254
|
+
* Name or code of the chosen color
|
|
255
|
+
*/
|
|
256
|
+
"value": string;
|
|
257
|
+
}
|
|
258
|
+
interface LimelColorPickerPalette {
|
|
259
|
+
/**
|
|
260
|
+
* Helper text of the input field
|
|
261
|
+
*/
|
|
262
|
+
"helperText": string;
|
|
263
|
+
/**
|
|
264
|
+
* Label of the input field
|
|
265
|
+
*/
|
|
266
|
+
"label": string;
|
|
267
|
+
/**
|
|
268
|
+
* Set to `true` if a value is required
|
|
269
|
+
*/
|
|
270
|
+
"required": boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Color value that is manually typed by the user
|
|
273
|
+
*/
|
|
274
|
+
"value": string;
|
|
275
|
+
}
|
|
232
276
|
interface LimelConfig {
|
|
233
277
|
/**
|
|
234
278
|
* Global configuration for Lime Elements
|
|
@@ -1022,6 +1066,18 @@ declare global {
|
|
|
1022
1066
|
prototype: HTMLLimelCollapsibleSectionElement;
|
|
1023
1067
|
new (): HTMLLimelCollapsibleSectionElement;
|
|
1024
1068
|
};
|
|
1069
|
+
interface HTMLLimelColorPickerElement extends Components.LimelColorPicker, HTMLStencilElement {
|
|
1070
|
+
}
|
|
1071
|
+
var HTMLLimelColorPickerElement: {
|
|
1072
|
+
prototype: HTMLLimelColorPickerElement;
|
|
1073
|
+
new (): HTMLLimelColorPickerElement;
|
|
1074
|
+
};
|
|
1075
|
+
interface HTMLLimelColorPickerPaletteElement extends Components.LimelColorPickerPalette, HTMLStencilElement {
|
|
1076
|
+
}
|
|
1077
|
+
var HTMLLimelColorPickerPaletteElement: {
|
|
1078
|
+
prototype: HTMLLimelColorPickerPaletteElement;
|
|
1079
|
+
new (): HTMLLimelColorPickerPaletteElement;
|
|
1080
|
+
};
|
|
1025
1081
|
interface HTMLLimelConfigElement extends Components.LimelConfig, HTMLStencilElement {
|
|
1026
1082
|
}
|
|
1027
1083
|
var HTMLLimelConfigElement: {
|
|
@@ -1230,6 +1286,8 @@ declare global {
|
|
|
1230
1286
|
"limel-circular-progress": HTMLLimelCircularProgressElement;
|
|
1231
1287
|
"limel-code-editor": HTMLLimelCodeEditorElement;
|
|
1232
1288
|
"limel-collapsible-section": HTMLLimelCollapsibleSectionElement;
|
|
1289
|
+
"limel-color-picker": HTMLLimelColorPickerElement;
|
|
1290
|
+
"limel-color-picker-palette": HTMLLimelColorPickerPaletteElement;
|
|
1233
1291
|
"limel-config": HTMLLimelConfigElement;
|
|
1234
1292
|
"limel-date-picker": HTMLLimelDatePickerElement;
|
|
1235
1293
|
"limel-dialog": HTMLLimelDialogElement;
|
|
@@ -1496,6 +1554,58 @@ declare namespace LocalJSX {
|
|
|
1496
1554
|
*/
|
|
1497
1555
|
"onOpen"?: (event: CustomEvent<void>) => void;
|
|
1498
1556
|
}
|
|
1557
|
+
interface LimelColorPicker {
|
|
1558
|
+
/**
|
|
1559
|
+
* Helper text of the input field
|
|
1560
|
+
*/
|
|
1561
|
+
"helperText"?: string;
|
|
1562
|
+
/**
|
|
1563
|
+
* The label of the input field
|
|
1564
|
+
*/
|
|
1565
|
+
"label"?: string;
|
|
1566
|
+
/**
|
|
1567
|
+
* Emits chosen value to the parent component
|
|
1568
|
+
*/
|
|
1569
|
+
"onChange"?: (event: CustomEvent<string>) => void;
|
|
1570
|
+
/**
|
|
1571
|
+
* Set to `true` if a value is readonly. This makes the component un-interactive.
|
|
1572
|
+
*/
|
|
1573
|
+
"readonly"?: boolean;
|
|
1574
|
+
/**
|
|
1575
|
+
* Set to `true` if a value is required
|
|
1576
|
+
*/
|
|
1577
|
+
"required"?: boolean;
|
|
1578
|
+
/**
|
|
1579
|
+
* Displayed as tooltips when picker is hovered.
|
|
1580
|
+
*/
|
|
1581
|
+
"tooltipLabel"?: string;
|
|
1582
|
+
/**
|
|
1583
|
+
* Name or code of the chosen color
|
|
1584
|
+
*/
|
|
1585
|
+
"value"?: string;
|
|
1586
|
+
}
|
|
1587
|
+
interface LimelColorPickerPalette {
|
|
1588
|
+
/**
|
|
1589
|
+
* Helper text of the input field
|
|
1590
|
+
*/
|
|
1591
|
+
"helperText"?: string;
|
|
1592
|
+
/**
|
|
1593
|
+
* Label of the input field
|
|
1594
|
+
*/
|
|
1595
|
+
"label"?: string;
|
|
1596
|
+
/**
|
|
1597
|
+
* Emits chosen value to the parent component
|
|
1598
|
+
*/
|
|
1599
|
+
"onChange"?: (event: CustomEvent<string>) => void;
|
|
1600
|
+
/**
|
|
1601
|
+
* Set to `true` if a value is required
|
|
1602
|
+
*/
|
|
1603
|
+
"required"?: boolean;
|
|
1604
|
+
/**
|
|
1605
|
+
* Color value that is manually typed by the user
|
|
1606
|
+
*/
|
|
1607
|
+
"value"?: string;
|
|
1608
|
+
}
|
|
1499
1609
|
interface LimelConfig {
|
|
1500
1610
|
/**
|
|
1501
1611
|
* Global configuration for Lime Elements
|
|
@@ -2375,6 +2485,8 @@ declare namespace LocalJSX {
|
|
|
2375
2485
|
"limel-circular-progress": LimelCircularProgress;
|
|
2376
2486
|
"limel-code-editor": LimelCodeEditor;
|
|
2377
2487
|
"limel-collapsible-section": LimelCollapsibleSection;
|
|
2488
|
+
"limel-color-picker": LimelColorPicker;
|
|
2489
|
+
"limel-color-picker-palette": LimelColorPickerPalette;
|
|
2378
2490
|
"limel-config": LimelConfig;
|
|
2379
2491
|
"limel-date-picker": LimelDatePicker;
|
|
2380
2492
|
"limel-dialog": LimelDialog;
|
|
@@ -2423,6 +2535,8 @@ declare module "@stencil/core" {
|
|
|
2423
2535
|
"limel-circular-progress": LocalJSX.LimelCircularProgress & JSXBase.HTMLAttributes<HTMLLimelCircularProgressElement>;
|
|
2424
2536
|
"limel-code-editor": LocalJSX.LimelCodeEditor & JSXBase.HTMLAttributes<HTMLLimelCodeEditorElement>;
|
|
2425
2537
|
"limel-collapsible-section": LocalJSX.LimelCollapsibleSection & JSXBase.HTMLAttributes<HTMLLimelCollapsibleSectionElement>;
|
|
2538
|
+
"limel-color-picker": LocalJSX.LimelColorPicker & JSXBase.HTMLAttributes<HTMLLimelColorPickerElement>;
|
|
2539
|
+
"limel-color-picker-palette": LocalJSX.LimelColorPickerPalette & JSXBase.HTMLAttributes<HTMLLimelColorPickerPaletteElement>;
|
|
2426
2540
|
"limel-config": LocalJSX.LimelConfig & JSXBase.HTMLAttributes<HTMLLimelConfigElement>;
|
|
2427
2541
|
"limel-date-picker": LocalJSX.LimelDatePicker & JSXBase.HTMLAttributes<HTMLLimelDatePickerElement>;
|
|
2428
2542
|
"limel-dialog": LocalJSX.LimelDialog & JSXBase.HTMLAttributes<HTMLLimelDialogElement>;
|
package/package.json
CHANGED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-e63a89d7.js');
|
|
6
|
-
const randomString = require('./random-string-4c3b7f1c.js');
|
|
7
|
-
const keycodes = require('./keycodes-3949f425.js');
|
|
8
|
-
const zipObject = require('./zipObject-2f430e94.js');
|
|
9
|
-
require('./_assignValue-493aac17.js');
|
|
10
|
-
require('./_defineProperty-c081d04c.js');
|
|
11
|
-
require('./eq-3b43a5ca.js');
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check if an element is a descendant of another
|
|
15
|
-
*
|
|
16
|
-
* If the child element is a descendant of a limel-portal, this function will
|
|
17
|
-
* go back through the portal and check the original tree recursively
|
|
18
|
-
*
|
|
19
|
-
* @param {HTMLElement} element the parent element
|
|
20
|
-
* @param {HTMLElement} child the child element to check
|
|
21
|
-
* @returns {boolean} `true` if child is a descendant of element, taking
|
|
22
|
-
* portals into account
|
|
23
|
-
*/
|
|
24
|
-
function portalContains(element, child) {
|
|
25
|
-
var _a;
|
|
26
|
-
if (element.contains(child) || ((_a = element.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(child))) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
const parent = findParent(child);
|
|
30
|
-
if (!parent) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
return portalContains(element, parent);
|
|
34
|
-
}
|
|
35
|
-
function findParent(element) {
|
|
36
|
-
const portal = element.closest('.limel-portal--container');
|
|
37
|
-
if (portal) {
|
|
38
|
-
return portal.portalSource;
|
|
39
|
-
}
|
|
40
|
-
const rootNode = element.getRootNode();
|
|
41
|
-
return rootNode.host;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const popoverCss = ".trigger-anchor{display:inline-block;position:relative}";
|
|
45
|
-
|
|
46
|
-
let Popover = class {
|
|
47
|
-
constructor(hostRef) {
|
|
48
|
-
index.registerInstance(this, hostRef);
|
|
49
|
-
this.close = index.createEvent(this, "close", 7);
|
|
50
|
-
/**
|
|
51
|
-
* True if the content within the popover should be visible
|
|
52
|
-
*/
|
|
53
|
-
this.open = false;
|
|
54
|
-
this.handleGlobalKeyPress = (event) => {
|
|
55
|
-
if (event.key !== keycodes.ESCAPE) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
event.stopPropagation();
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
this.close.emit();
|
|
61
|
-
};
|
|
62
|
-
this.portalId = randomString.createRandomString();
|
|
63
|
-
this.globalClickListener = this.globalClickListener.bind(this);
|
|
64
|
-
}
|
|
65
|
-
watchOpen() {
|
|
66
|
-
this.setupGlobalHandlers();
|
|
67
|
-
}
|
|
68
|
-
componentWillLoad() {
|
|
69
|
-
this.setupGlobalHandlers();
|
|
70
|
-
}
|
|
71
|
-
setupGlobalHandlers() {
|
|
72
|
-
if (this.open) {
|
|
73
|
-
document.addEventListener('click', this.globalClickListener, {
|
|
74
|
-
capture: true,
|
|
75
|
-
});
|
|
76
|
-
document.addEventListener('keyup', this.handleGlobalKeyPress);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
document.removeEventListener('click', this.globalClickListener);
|
|
80
|
-
document.removeEventListener('keyup', this.handleGlobalKeyPress);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
render() {
|
|
84
|
-
const cssProperties = this.getCssProperties();
|
|
85
|
-
const popoverZIndex = getComputedStyle(this.host).getPropertyValue('--popover-z-index');
|
|
86
|
-
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 } }, index.h("limel-popover-surface", { contentCollection: this.host.children, style: cssProperties }))));
|
|
87
|
-
}
|
|
88
|
-
globalClickListener(event) {
|
|
89
|
-
const element = event.target;
|
|
90
|
-
const clickedInside = portalContains(this.host, element);
|
|
91
|
-
if (this.open && !clickedInside) {
|
|
92
|
-
event.stopPropagation();
|
|
93
|
-
event.preventDefault();
|
|
94
|
-
this.close.emit();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
getCssProperties() {
|
|
98
|
-
const propertyNames = [
|
|
99
|
-
'--popover-surface-width',
|
|
100
|
-
'--popover-body-background-color',
|
|
101
|
-
'--popover-border-radius',
|
|
102
|
-
];
|
|
103
|
-
const style = getComputedStyle(this.host);
|
|
104
|
-
const values = propertyNames.map((property) => {
|
|
105
|
-
return style.getPropertyValue(property);
|
|
106
|
-
});
|
|
107
|
-
return zipObject.zipObject(propertyNames, values);
|
|
108
|
-
}
|
|
109
|
-
get host() { return index.getElement(this); }
|
|
110
|
-
static get watchers() { return {
|
|
111
|
-
"open": ["watchOpen"]
|
|
112
|
-
}; }
|
|
113
|
-
};
|
|
114
|
-
Popover.style = popoverCss;
|
|
115
|
-
|
|
116
|
-
exports.limel_popover = Popover;
|