@limetech/lime-elements 37.1.0-next.2 → 37.1.0-next.21
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/{checkbox.template-5603ad4a.js → checkbox.template-df6fc114.js} +4 -4
- package/dist/cjs/checkbox.template-df6fc114.js.map +1 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-action-bar-item_2.cjs.entry.js +9 -1
- package/dist/cjs/limel-action-bar-item_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-action-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-button.cjs.entry.js +3 -52
- package/dist/cjs/limel-button.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-checkbox.cjs.entry.js +3 -2
- package/dist/cjs/limel-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-circular-progress_2.cjs.entry.js +7 -1
- package/dist/cjs/limel-circular-progress_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +10 -0
- package/dist/cjs/limel-collapsible-section.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-color-picker-palette.cjs.entry.js +2 -2
- package/dist/cjs/limel-color-picker-palette.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/limel-color-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-dock-button.cjs.entry.js +8 -2
- package/dist/cjs/limel-dock-button.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +15 -2
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-icon-button.cjs.entry.js +7 -0
- package/dist/cjs/limel-icon-button.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-icon.cjs.entry.js +90 -8
- package/dist/cjs/limel-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-list_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-list_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-portal.cjs.entry.js +15 -14
- package/dist/cjs/limel-portal.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +136 -127
- package/dist/cjs/limel-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-switch.cjs.entry.js +23 -10
- package/dist/cjs/limel-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +9 -1
- package/dist/cjs/limel-table.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-tooltip_2.cjs.entry.js +16 -14
- package/dist/cjs/limel-tooltip_2.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/make-enter-clickable-59460fd6.js +80 -0
- package/dist/cjs/make-enter-clickable-59460fd6.js.map +1 -0
- package/dist/collection/components/action-bar/action-bar-item/action-bar-item.css +1 -7
- package/dist/collection/components/action-bar/action-bar-item/action-bar-item.js +11 -3
- package/dist/collection/components/action-bar/action-bar-item/action-bar-item.js.map +1 -1
- package/dist/collection/components/action-bar/action-bar-item/action-bar-overflow-menu.js +1 -1
- package/dist/collection/components/action-bar/action-bar.js +1 -2
- package/dist/collection/components/action-bar/action-bar.js.map +1 -1
- package/dist/collection/components/action-bar/action-bar.types.js.map +1 -1
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.js +18 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.template.js +3 -3
- package/dist/collection/components/checkbox/checkbox.template.js.map +1 -1
- package/dist/collection/components/collapsible-section/collapsible-section.js +11 -1
- package/dist/collection/components/collapsible-section/collapsible-section.js.map +1 -1
- package/dist/collection/components/color-picker/color-picker-palette.css +46 -21
- package/dist/collection/components/color-picker/color-picker-palette.js +1 -1
- package/dist/collection/components/color-picker/color-picker-palette.js.map +1 -1
- package/dist/collection/components/color-picker/color-picker.css +29 -21
- package/dist/collection/components/color-picker/color-picker.js +1 -1
- package/dist/collection/components/color-picker/color-picker.js.map +1 -1
- package/dist/collection/components/dock/dock-button/dock-button.js +8 -2
- package/dist/collection/components/dock/dock-button/dock-button.js.map +1 -1
- package/dist/collection/components/form/fields/schema-field.js +13 -1
- package/dist/collection/components/form/fields/schema-field.js.map +1 -1
- package/dist/collection/components/form/form.css +4 -0
- package/dist/collection/components/form/widgets/select.js +1 -0
- package/dist/collection/components/form/widgets/select.js.map +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/icon.js.map +1 -1
- package/dist/collection/components/icon-button/icon-button.js +7 -0
- package/dist/collection/components/icon-button/icon-button.js.map +1 -1
- package/dist/collection/components/linear-progress/linear-progress.js +9 -3
- package/dist/collection/components/linear-progress/linear-progress.js.map +1 -1
- package/dist/collection/components/list/list.js +1 -1
- package/dist/collection/components/list/list.js.map +1 -1
- package/dist/collection/components/portal/portal.js +41 -20
- package/dist/collection/components/portal/portal.js.map +1 -1
- package/dist/collection/components/slider/slider.js +140 -131
- package/dist/collection/components/slider/slider.js.map +1 -1
- package/dist/collection/components/switch/switch.css +22 -1
- package/dist/collection/components/switch/switch.js +50 -10
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/table/table.css +43 -30
- package/dist/collection/components/table/table.js +8 -0
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip-content.css +1 -1
- package/dist/collection/components/tooltip/tooltip.css +3 -2
- package/dist/collection/components/tooltip/tooltip.js +41 -16
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/collection/global/{icon-cache.js → icon-cache/cache-storage-icon-cache.js} +4 -9
- package/dist/collection/global/icon-cache/cache-storage-icon-cache.js.map +1 -0
- package/dist/collection/global/icon-cache/factory.js +16 -0
- package/dist/collection/global/icon-cache/factory.js.map +1 -0
- package/dist/collection/global/icon-cache/in-memory-icon-cache.js +73 -0
- package/dist/collection/global/icon-cache/in-memory-icon-cache.js.map +1 -0
- package/dist/collection/util/make-enter-clickable.js +73 -0
- package/dist/collection/util/make-enter-clickable.js.map +1 -0
- package/dist/esm/{checkbox.template-a5d8a2bc.js → checkbox.template-c2d0fa10.js} +4 -4
- package/dist/esm/checkbox.template-c2d0fa10.js.map +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-action-bar-item_2.entry.js +10 -2
- package/dist/esm/limel-action-bar-item_2.entry.js.map +1 -1
- package/dist/esm/limel-action-bar.entry.js.map +1 -1
- package/dist/esm/limel-button.entry.js +2 -51
- package/dist/esm/limel-button.entry.js.map +1 -1
- package/dist/esm/limel-checkbox.entry.js +3 -2
- package/dist/esm/limel-checkbox.entry.js.map +1 -1
- package/dist/esm/limel-circular-progress_2.entry.js +7 -1
- package/dist/esm/limel-circular-progress_2.entry.js.map +1 -1
- package/dist/esm/limel-collapsible-section.entry.js +11 -1
- package/dist/esm/limel-collapsible-section.entry.js.map +1 -1
- package/dist/esm/limel-color-picker-palette.entry.js +2 -2
- package/dist/esm/limel-color-picker-palette.entry.js.map +1 -1
- package/dist/esm/limel-color-picker.entry.js +2 -2
- package/dist/esm/limel-color-picker.entry.js.map +1 -1
- package/dist/esm/limel-dock-button.entry.js +8 -2
- package/dist/esm/limel-dock-button.entry.js.map +1 -1
- package/dist/esm/limel-form.entry.js +15 -2
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/esm/limel-icon-button.entry.js +7 -0
- package/dist/esm/limel-icon-button.entry.js.map +1 -1
- package/dist/esm/limel-icon.entry.js +90 -8
- package/dist/esm/limel-icon.entry.js.map +1 -1
- package/dist/esm/limel-list_2.entry.js +1 -1
- package/dist/esm/limel-list_2.entry.js.map +1 -1
- package/dist/esm/limel-portal.entry.js +15 -14
- package/dist/esm/limel-portal.entry.js.map +1 -1
- package/dist/esm/limel-slider.entry.js +136 -127
- package/dist/esm/limel-slider.entry.js.map +1 -1
- package/dist/esm/limel-switch.entry.js +24 -11
- package/dist/esm/limel-switch.entry.js.map +1 -1
- package/dist/esm/limel-table.entry.js +9 -1
- package/dist/esm/limel-table.entry.js.map +1 -1
- package/dist/esm/limel-tooltip_2.entry.js +16 -14
- package/dist/esm/limel-tooltip_2.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/make-enter-clickable-0473e94a.js +77 -0
- package/dist/esm/make-enter-clickable-0473e94a.js.map +1 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/{p-c6d57502.entry.js → p-0d823554.entry.js} +2 -2
- package/dist/lime-elements/p-0d823554.entry.js.map +1 -0
- package/dist/lime-elements/p-15e3028f.entry.js +2 -0
- package/dist/lime-elements/p-15e3028f.entry.js.map +1 -0
- package/dist/lime-elements/{p-9c1db0e7.entry.js → p-3bb15bdf.entry.js} +2 -2
- package/dist/lime-elements/p-3bb15bdf.entry.js.map +1 -0
- package/dist/lime-elements/p-4607900f.entry.js +2 -0
- package/dist/lime-elements/p-4607900f.entry.js.map +1 -0
- package/dist/lime-elements/{p-71210c65.entry.js → p-55dcbc35.entry.js} +2 -2
- package/dist/lime-elements/{p-71210c65.entry.js.map → p-55dcbc35.entry.js.map} +1 -1
- package/dist/lime-elements/p-7cfc8998.js +2 -0
- package/dist/lime-elements/p-7cfc8998.js.map +1 -0
- package/dist/lime-elements/{p-bb1b12bb.entry.js → p-88e4eba7.entry.js} +8 -8
- package/dist/lime-elements/p-88e4eba7.entry.js.map +1 -0
- package/dist/lime-elements/{p-eae4f1ed.entry.js → p-8f08ca13.entry.js} +2 -2
- package/dist/lime-elements/p-8f08ca13.entry.js.map +1 -0
- package/dist/lime-elements/{p-7d159ddf.entry.js → p-95769bf5.entry.js} +2 -2
- package/dist/lime-elements/p-95769bf5.entry.js.map +1 -0
- package/dist/lime-elements/p-addb4c84.entry.js +2 -0
- package/dist/lime-elements/p-addb4c84.entry.js.map +1 -0
- package/dist/lime-elements/p-b714596f.entry.js.map +1 -1
- package/dist/lime-elements/p-c3e428ff.entry.js +2 -0
- package/dist/lime-elements/p-c3e428ff.entry.js.map +1 -0
- package/dist/lime-elements/{p-0f1a9472.entry.js → p-c6f8ea40.entry.js} +6 -6
- package/dist/lime-elements/p-c6f8ea40.entry.js.map +1 -0
- package/dist/lime-elements/p-d028b08d.js +2 -0
- package/dist/lime-elements/p-d028b08d.js.map +1 -0
- package/dist/lime-elements/{p-42f06b16.entry.js → p-d5298b7e.entry.js} +2 -2
- package/dist/lime-elements/p-d5298b7e.entry.js.map +1 -0
- package/dist/lime-elements/p-d8826406.entry.js +2 -0
- package/dist/lime-elements/p-d8826406.entry.js.map +1 -0
- package/dist/lime-elements/{p-be492c93.entry.js → p-d9d4b3bf.entry.js} +2 -2
- package/dist/lime-elements/{p-be492c93.entry.js.map → p-d9d4b3bf.entry.js.map} +1 -1
- package/dist/lime-elements/p-db30704e.entry.js +2 -0
- package/dist/lime-elements/p-db30704e.entry.js.map +1 -0
- package/dist/lime-elements/p-e0a0065f.entry.js +2 -0
- package/dist/lime-elements/p-e0a0065f.entry.js.map +1 -0
- package/dist/lime-elements/{p-a4c39571.entry.js → p-f1b0951f.entry.js} +5 -5
- package/dist/lime-elements/p-f1b0951f.entry.js.map +1 -0
- package/dist/types/components/action-bar/action-bar-item/action-bar-item.d.ts +3 -0
- package/dist/types/components/action-bar/action-bar.d.ts +0 -1
- package/dist/types/components/action-bar/action-bar.types.d.ts +12 -6
- package/dist/types/components/checkbox/checkbox.d.ts +17 -0
- package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
- package/dist/types/components/collapsible-section/collapsible-section.d.ts +3 -0
- package/dist/types/components/dock/dock-button/dock-button.d.ts +1 -0
- package/dist/types/components/icon-button/icon-button.d.ts +2 -0
- package/dist/types/components/linear-progress/linear-progress.d.ts +1 -0
- package/dist/types/components/list/list.d.ts +2 -1
- package/dist/types/components/portal/portal.d.ts +8 -3
- package/dist/types/components/slider/slider.d.ts +13 -11
- package/dist/types/components/switch/switch.d.ts +19 -1
- package/dist/types/components/tooltip/tooltip.d.ts +13 -6
- package/dist/types/components.d.ts +129 -29
- package/dist/types/global/{icon-cache.d.ts → icon-cache/cache-storage-icon-cache.d.ts} +2 -4
- package/dist/types/global/icon-cache/factory.d.ts +4 -0
- package/dist/types/global/icon-cache/in-memory-icon-cache.d.ts +15 -0
- package/dist/types/util/make-enter-clickable.d.ts +7 -0
- package/package.json +10 -10
- package/dist/cjs/checkbox.template-5603ad4a.js.map +0 -1
- package/dist/collection/global/icon-cache.js.map +0 -1
- package/dist/collection/util/makeEnterClickable.js +0 -51
- package/dist/collection/util/makeEnterClickable.js.map +0 -1
- package/dist/esm/checkbox.template-a5d8a2bc.js.map +0 -1
- package/dist/lime-elements/p-0f1a9472.entry.js.map +0 -1
- package/dist/lime-elements/p-149f2418.entry.js +0 -2
- package/dist/lime-elements/p-149f2418.entry.js.map +0 -1
- package/dist/lime-elements/p-42f06b16.entry.js.map +0 -1
- package/dist/lime-elements/p-7d159ddf.entry.js.map +0 -1
- package/dist/lime-elements/p-8be4072e.entry.js +0 -2
- package/dist/lime-elements/p-8be4072e.entry.js.map +0 -1
- package/dist/lime-elements/p-908640f6.entry.js +0 -2
- package/dist/lime-elements/p-908640f6.entry.js.map +0 -1
- package/dist/lime-elements/p-9c1db0e7.entry.js.map +0 -1
- package/dist/lime-elements/p-9ceb4364.entry.js +0 -2
- package/dist/lime-elements/p-9ceb4364.entry.js.map +0 -1
- package/dist/lime-elements/p-a4c39571.entry.js.map +0 -1
- package/dist/lime-elements/p-b2d4f3f0.js +0 -2
- package/dist/lime-elements/p-b2d4f3f0.js.map +0 -1
- package/dist/lime-elements/p-b3ff8fef.entry.js +0 -2
- package/dist/lime-elements/p-b3ff8fef.entry.js.map +0 -1
- package/dist/lime-elements/p-bb1b12bb.entry.js.map +0 -1
- package/dist/lime-elements/p-c018e82f.entry.js +0 -2
- package/dist/lime-elements/p-c018e82f.entry.js.map +0 -1
- package/dist/lime-elements/p-c6d57502.entry.js.map +0 -1
- package/dist/lime-elements/p-de4cb1ac.entry.js +0 -2
- package/dist/lime-elements/p-de4cb1ac.entry.js.map +0 -1
- package/dist/lime-elements/p-eae4f1ed.entry.js.map +0 -1
- package/dist/types/util/makeEnterClickable.d.ts +0 -2
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-38eb64b5.js');
|
|
6
6
|
const randomString = require('./random-string-c8445652.js');
|
|
7
7
|
|
|
8
|
-
const tooltipCss = "
|
|
8
|
+
const tooltipCss = ":host(limel-tooltip){position:absolute;pointer-events:none}";
|
|
9
9
|
|
|
10
10
|
const DEFAULT_MAX_LENGTH = 50;
|
|
11
11
|
const Tooltip = class {
|
|
@@ -25,11 +25,13 @@ const Tooltip = class {
|
|
|
25
25
|
this.label = undefined;
|
|
26
26
|
this.helperLabel = undefined;
|
|
27
27
|
this.maxlength = DEFAULT_MAX_LENGTH;
|
|
28
|
+
this.openDirection = 'top';
|
|
28
29
|
this.open = undefined;
|
|
29
30
|
this.portalId = randomString.createRandomString();
|
|
30
31
|
this.tooltipId = randomString.createRandomString();
|
|
31
32
|
}
|
|
32
33
|
connectedCallback() {
|
|
34
|
+
this.ownerElement = this.getOwnerElement();
|
|
33
35
|
this.setOwnerAriaLabel();
|
|
34
36
|
this.addListeners();
|
|
35
37
|
}
|
|
@@ -38,26 +40,26 @@ const Tooltip = class {
|
|
|
38
40
|
}
|
|
39
41
|
render() {
|
|
40
42
|
const tooltipZIndex = getComputedStyle(this.host).getPropertyValue('--tooltip-z-index');
|
|
41
|
-
return (index.h("div", { class: "trigger-anchor" }, index.h("limel-portal", { openDirection:
|
|
43
|
+
return (index.h("div", { class: "trigger-anchor" }, index.h("limel-portal", { openDirection: this.openDirection, visible: this.open, containerId: this.portalId, containerStyle: {
|
|
42
44
|
'z-index': tooltipZIndex,
|
|
43
45
|
'pointer-events': 'none',
|
|
44
|
-
} }, index.h("limel-tooltip-content", { label: this.label, helperLabel: this.helperLabel, maxlength: this.maxlength, role: "tooltip", "aria-hidden": !this.open, id: this.tooltipId }))));
|
|
46
|
+
}, anchor: this.ownerElement }, index.h("limel-tooltip-content", { label: this.label, helperLabel: this.helperLabel, maxlength: this.maxlength, role: "tooltip", "aria-hidden": !this.open, id: this.tooltipId }))));
|
|
45
47
|
}
|
|
46
48
|
setOwnerAriaLabel() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
var _a;
|
|
50
|
+
(_a = this.ownerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-describedby', this.tooltipId);
|
|
49
51
|
}
|
|
50
52
|
addListeners() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
(_a = this.ownerElement) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseover', this.showTooltip);
|
|
55
|
+
(_b = this.ownerElement) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseout', this.hideTooltip);
|
|
56
|
+
(_c = this.ownerElement) === null || _c === void 0 ? void 0 : _c.addEventListener('click', this.hideTooltip);
|
|
55
57
|
}
|
|
56
58
|
removeListeners() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
(_a = this.ownerElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseover', this.showTooltip);
|
|
61
|
+
(_b = this.ownerElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseout', this.hideTooltip);
|
|
62
|
+
(_c = this.ownerElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('click', this.hideTooltip);
|
|
61
63
|
}
|
|
62
64
|
getOwnerElement() {
|
|
63
65
|
let element = this.host;
|
|
@@ -72,7 +74,7 @@ const Tooltip = class {
|
|
|
72
74
|
};
|
|
73
75
|
Tooltip.style = tooltipCss;
|
|
74
76
|
|
|
75
|
-
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)}}";
|
|
77
|
+
const tooltipContentCss = ":host(limel-tooltip-content){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)}}";
|
|
76
78
|
|
|
77
79
|
const TooltipContent = class {
|
|
78
80
|
constructor(hostRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-tooltip.limel-tooltip-content.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,UAAU,GAAG,oCAAoC;;ACGvD,MAAM,kBAAkB,GAAG,EAAE,CAAC;MAkDjB,OAAO;EAwChB;;IA8DQ,gBAAW,GAAG;MAClB,MAAM,YAAY,GAAG,GAAG,CAAC;MACzB,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,UAA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I,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,EAAE;MACpC,gBAAgB;QACZ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;KACpE;IAED,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,IAAI,IAAI,CAAC,SAAS,EAAE;MAChB,KAAK,CAAC,KAAK,GAAG;QACV,6BAA6B,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;OAC5D,CAAC;KACL;IAED,OAAO;MACHA,gCAAM,KAAK,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAM,KAAK,GAC7DA,iBAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAO,EACrCA,iBAAK,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAO,CAC/C;KACV,CAAC;GACL;;;;;;;","names":["createRandomString","h"],"sources":["./src/components/tooltip/tooltip.scss?tag=limel-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx","./src/components/tooltip/tooltip-content.scss?tag=limel-tooltip-content&encapsulation=shadow","./src/components/tooltip/tooltip-content.tsx"],"sourcesContent":["/**\n * @prop --tooltip-z-index: z-index of the tooltip.\n */\n\n.trigger-anchor {\n position: relative;\n}\n","import { Component, h, Prop, Element, State } from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\n\nconst DEFAULT_MAX_LENGTH = 50;\n\n/**\n * A tooltip can be used to display a descriptive text for any element.\n * The displayed content must be a brief and supplemental string of text,\n * identifying the element or describing its function for the user,\n * helping them better understand unfamiliar objects that aren't described\n * directly in the UI.\n *\n * ## Interaction\n * The tooltip appears after a slight delay, when the element is hovered;\n * and disappears as soon as the cursor leaves the element.\n * Therefore, users cannot interact with the tip, but if the trigger element\n * itself is interactive, it will remain interactible even with a tooltip bound\n * to it.\n *\n * :::note\n * In order to display the tooltip, the tooltip element and its trigger element\n * must be within the same document or document fragment.\n * A good practice is to just place them next to each other like below:\n *\n * ```html\n * <limel-button icon=\"search\" id=\"tooltip-example\" />\n * <limel-tooltip label=\"Search\" elementId=\"tooltip-example\" />\n * ```\n * :::\n *\n * ## Usage\n * - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.\n * Use them only when they add significant value.\n * - A good tip is concise, helpful, and informative.\n * Don't explain the obvious or simply repeat what is already on the screen.\n * When used correctly, supplemental info of a tooltip helps to [declutter the UI](/#/DesignGuidelines/decluttering.md/).\n * - If the tip is essential to the primary tasks that the user is performing,\n * such as warnings or important notes, include the information directly in the\n * interface instead.\n * - When a component offers a helper text (e.g. [Input field](/#/component/limel-input-field/)),\n * use that, not a tooltip.\n * - Make sure to use the tooltip on an element that users naturally and\n * effortlessly recognize can be hovered.\n * @exampleComponent limel-example-tooltip\n * @exampleComponent limel-example-tooltip-max-character\n * @exampleComponent limel-example-tooltip-composite\n * @private\n */\n@Component({\n tag: 'limel-tooltip',\n shadow: true,\n styleUrl: 'tooltip.scss',\n})\nexport class Tooltip {\n /**\n * ID of the owner element that the tooltip should describe.\n * Must be a child within the same document fragment as the tooltip element\n * itself.\n */\n @Prop({ reflect: true })\n public elementId!: string;\n\n /**\n * Short descriptive text of the owner element.\n */\n @Prop({ reflect: true })\n public label!: string;\n\n /**\n * Additional helper text for the element.\n * Example usage can be a keyboard shortcut to activate the function of the\n * owner element.\n */\n @Prop({ reflect: true })\n public helperLabel?: string;\n\n /**\n * The maximum amount of characters before rendering 'label' and\n * 'helperLabel' in two rows.\n */\n @Prop({ reflect: true })\n public maxlength?: number = DEFAULT_MAX_LENGTH;\n\n @State()\n private open: boolean;\n\n @Element()\n private host: HTMLLimelTooltipElement;\n\n private portalId: string;\n private tooltipId: string;\n private showTooltipTimeoutHandle: number;\n\n public constructor() {\n this.portalId = createRandomString();\n this.tooltipId = createRandomString();\n }\n\n public connectedCallback() {\n this.setOwnerAriaLabel();\n this.addListeners();\n }\n\n public disconnectedCallback() {\n this.removeListeners();\n }\n\n public render() {\n const tooltipZIndex = getComputedStyle(this.host).getPropertyValue(\n '--tooltip-z-index'\n );\n\n return (\n <div class=\"trigger-anchor\">\n <limel-portal\n openDirection=\"bottom-start\"\n visible={this.open}\n containerId={this.portalId}\n containerStyle={{\n 'z-index': tooltipZIndex,\n 'pointer-events': 'none',\n }}\n >\n <limel-tooltip-content\n label={this.label}\n helperLabel={this.helperLabel}\n maxlength={this.maxlength}\n role=\"tooltip\"\n aria-hidden={!this.open}\n id={this.tooltipId}\n />\n </limel-portal>\n </div>\n );\n }\n\n private setOwnerAriaLabel() {\n const owner = this.getOwnerElement();\n owner?.setAttribute('aria-describedby', this.tooltipId);\n }\n\n private addListeners() {\n const owner = this.getOwnerElement();\n owner?.addEventListener('mouseover', this.showTooltip);\n owner?.addEventListener('mouseout', this.hideTooltip);\n owner?.addEventListener('click', this.hideTooltip);\n }\n\n private removeListeners() {\n const owner = this.getOwnerElement();\n owner?.removeEventListener('mouseover', this.showTooltip);\n owner?.removeEventListener('mouseout', this.hideTooltip);\n owner?.removeEventListener('click', this.hideTooltip);\n }\n\n private showTooltip = () => {\n const tooltipDelay = 500;\n this.showTooltipTimeoutHandle = window.setTimeout(() => {\n this.open = true;\n }, tooltipDelay);\n };\n\n private hideTooltip = () => {\n clearTimeout(this.showTooltipTimeoutHandle);\n this.open = false;\n };\n\n private getOwnerElement(): HTMLElement | undefined {\n let element: Node = this.host;\n\n do {\n element = element.parentNode;\n } while (\n element &&\n element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&\n element.nodeType !== Node.DOCUMENT_NODE\n );\n\n return (element as ShadowRoot)?.getElementById(this.elementId);\n }\n}\n",":host {\n animation: display-tooltip 0.2s ease;\n display: flex;\n\n border-radius: 0.25rem;\n padding: 0.25rem 0.5rem;\n background-color: rgb(var(--contrast-1300));\n box-shadow: var(--shadow-depth-16);\n}\n\ntext {\n font-size: 0.875rem; // 14px\n line-height: 1.25;\n display: flex;\n column-gap: 1rem;\n\n &.has-column-layout {\n display: table-cell;\n width: fit-content;\n max-width: min(var(--tooltip-max-width-of-text), 80vw);\n .label {\n padding-bottom: 0.5rem;\n }\n .helper-label {\n padding-bottom: 0.25rem;\n }\n }\n}\n\n.label {\n color: rgb(var(--contrast-200));\n}\n\n.helper-label {\n color: rgb(var(--contrast-800));\n\n &:empty {\n display: none;\n }\n}\n\n@keyframes display-tooltip {\n 0% {\n opacity: 0;\n transform: translate3d(0, 0, 0) scale(0.94);\n }\n 100% {\n opacity: 1;\n transform: translate3d(0, 0, 0) scale(1);\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * This component is used internally by `limel-tooltip`.\n * @private\n */\n@Component({\n tag: 'limel-tooltip-content',\n shadow: true,\n styleUrl: 'tooltip-content.scss',\n})\nexport class TooltipContent {\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n label!: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n helperLabel?: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n maxlength?: number;\n\n public render() {\n let isLabelsTextLong = false;\n if (this.helperLabel && this.maxlength) {\n isLabelsTextLong =\n this.label.length + this.helperLabel.length > this.maxlength;\n }\n\n const props: any = {};\n if (this.maxlength) {\n props.style = {\n '--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',\n };\n }\n\n return [\n <text class={{ 'has-column-layout': isLabelsTextLong }} {...props}>\n <div class=\"label\">{this.label}</div>\n <div class=\"helper-label\">{this.helperLabel}</div>\n </text>,\n ];\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"limel-tooltip.limel-tooltip-content.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,UAAU,GAAG,6DAA6D;;ACKhF,MAAM,kBAAkB,GAAG,EAAE,CAAC;MAkDjB,OAAO;EA+ChB;;IA6DQ,gBAAW,GAAG;MAClB,MAAM,YAAY,GAAG,GAAG,CAAC;MACzB,IAAI,CAAC,wBAAwB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AAgB;QACZ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;KACpE;IAED,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,IAAI,IAAI,CAAC,SAAS,EAAE;MAChB,KAAK,CAAC,KAAK,GAAG;QACV,6BAA6B,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;OAC5D,CAAC;KACL;IAED,OAAO;MACHA,gCAAM,KAAK,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAM,KAAK,GAC7DA,iBAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAO,EACrCA,iBAAK,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAO,CAC/C;KACV,CAAC;GACL;;;;;;;","names":["createRandomString","h"],"sources":["./src/components/tooltip/tooltip.scss?tag=limel-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx","./src/components/tooltip/tooltip-content.scss?tag=limel-tooltip-content&encapsulation=shadow","./src/components/tooltip/tooltip-content.tsx"],"sourcesContent":["/**\n * @prop --tooltip-z-index: z-index of the tooltip.\n */\n\n:host(limel-tooltip) {\n // Absolutely positioning ensures that this invisible element\n // does not occupy visible space in the UI.\n // Without this, `limel-tooltip` could in many cases\n // mess up the layout, where it is used.\n // For example, inside a `grid` or `flex` section,\n // every instance of the tooltip would take some space,\n // creating gaps and empty holes.\n position: absolute;\n pointer-events: none;\n}\n","import { Component, h, Prop, Element, State } from '@stencil/core';\nimport { JSX } from 'react';\nimport { createRandomString } from '../../util/random-string';\nimport { OpenDirection } from '../menu/menu.types';\n\nconst DEFAULT_MAX_LENGTH = 50;\n\n/**\n * A tooltip can be used to display a descriptive text for any element.\n * The displayed content must be a brief and supplemental string of text,\n * identifying the element or describing its function for the user,\n * helping them better understand unfamiliar objects that aren't described\n * directly in the UI.\n *\n * ## Interaction\n * The tooltip appears after a slight delay, when the element is hovered;\n * and disappears as soon as the cursor leaves the element.\n * Therefore, users cannot interact with the tip, but if the trigger element\n * itself is interactive, it will remain interactible even with a tooltip bound\n * to it.\n *\n * :::note\n * In order to display the tooltip, the tooltip element and its trigger element\n * must be within the same document or document fragment (the same shadowRoot).\n * Often, it's easiest to just place them next to each other like in the example\n * below, but if you need to, you can place them differently.\n *\n * ```html\n * <limel-button icon=\"search\" id=\"tooltip-example\" />\n * <limel-tooltip label=\"Search\" elementId=\"tooltip-example\" />\n * ```\n * :::\n *\n * ## Usage\n * - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.\n * Use them only when they add significant value.\n * - A good tip is concise, helpful, and informative.\n * Don't explain the obvious or simply repeat what is already on the screen.\n * When used correctly, supplemental info of a tooltip helps to [declutter the UI](/#/DesignGuidelines/decluttering.md/).\n * - If the tip is essential to the primary tasks that the user is performing,\n * such as warnings or important notes, include the information directly in the\n * interface instead.\n * - When a component offers a helper text (e.g. [Input field](/#/component/limel-input-field/)),\n * use that, not a tooltip.\n * - Make sure to use the tooltip on an element that users naturally and\n * effortlessly recognize can be hovered.\n * @exampleComponent limel-example-tooltip-basic\n * @exampleComponent limel-example-tooltip-max-character\n * @exampleComponent limel-example-tooltip-composite\n */\n@Component({\n tag: 'limel-tooltip',\n shadow: true,\n styleUrl: 'tooltip.scss',\n})\nexport class Tooltip {\n /**\n * ID of the owner element that the tooltip should describe.\n * Must be a child within the same document fragment as the tooltip element\n * itself.\n */\n @Prop({ reflect: true })\n public elementId!: string;\n\n /**\n * Short descriptive text of the owner element.\n */\n @Prop({ reflect: true })\n public label!: string;\n\n /**\n * Additional helper text for the element.\n * Example usage can be a keyboard shortcut to activate the function of the\n * owner element.\n */\n @Prop({ reflect: true })\n public helperLabel?: string;\n\n /**\n * The maximum amount of characters before rendering 'label' and\n * 'helperLabel' in two rows.\n */\n @Prop({ reflect: true })\n public maxlength?: number = DEFAULT_MAX_LENGTH;\n\n /**\n * Decides the tooltip's location in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'top';\n\n @Element()\n private host: HTMLLimelTooltipElement;\n\n @State()\n private open: boolean;\n\n private portalId: string;\n private tooltipId: string;\n private showTooltipTimeoutHandle: number;\n private ownerElement: HTMLElement;\n\n public constructor() {\n this.portalId = createRandomString();\n this.tooltipId = createRandomString();\n }\n\n public connectedCallback() {\n this.ownerElement = this.getOwnerElement();\n this.setOwnerAriaLabel();\n this.addListeners();\n }\n\n public disconnectedCallback() {\n this.removeListeners();\n }\n\n public render(): JSX.Element {\n const tooltipZIndex = getComputedStyle(this.host).getPropertyValue(\n '--tooltip-z-index'\n );\n\n return (\n <div class=\"trigger-anchor\">\n <limel-portal\n openDirection={this.openDirection}\n visible={this.open}\n containerId={this.portalId}\n containerStyle={{\n 'z-index': tooltipZIndex,\n 'pointer-events': 'none',\n }}\n anchor={this.ownerElement}\n >\n <limel-tooltip-content\n label={this.label}\n helperLabel={this.helperLabel}\n maxlength={this.maxlength}\n role=\"tooltip\"\n aria-hidden={!this.open}\n id={this.tooltipId}\n />\n </limel-portal>\n </div>\n );\n }\n\n private setOwnerAriaLabel() {\n this.ownerElement?.setAttribute('aria-describedby', this.tooltipId);\n }\n\n private addListeners() {\n this.ownerElement?.addEventListener('mouseover', this.showTooltip);\n this.ownerElement?.addEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.addEventListener('click', this.hideTooltip);\n }\n\n private removeListeners() {\n this.ownerElement?.removeEventListener('mouseover', this.showTooltip);\n this.ownerElement?.removeEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.removeEventListener('click', this.hideTooltip);\n }\n\n private showTooltip = () => {\n const tooltipDelay = 500;\n this.showTooltipTimeoutHandle = window.setTimeout(() => {\n this.open = true;\n }, tooltipDelay);\n };\n\n private hideTooltip = () => {\n clearTimeout(this.showTooltipTimeoutHandle);\n this.open = false;\n };\n\n private getOwnerElement(): HTMLElement | undefined {\n let element: Node = this.host;\n\n do {\n element = element.parentNode;\n } while (\n element &&\n element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&\n element.nodeType !== Node.DOCUMENT_NODE\n );\n\n return (element as ShadowRoot)?.getElementById(this.elementId);\n }\n}\n",":host(limel-tooltip-content) {\n animation: display-tooltip 0.2s ease;\n display: flex;\n\n border-radius: 0.25rem;\n padding: 0.25rem 0.5rem;\n background-color: rgb(var(--contrast-1300));\n box-shadow: var(--shadow-depth-16);\n}\n\ntext {\n font-size: 0.875rem; // 14px\n line-height: 1.25;\n display: flex;\n column-gap: 1rem;\n\n &.has-column-layout {\n display: table-cell;\n width: fit-content;\n max-width: min(var(--tooltip-max-width-of-text), 80vw);\n .label {\n padding-bottom: 0.5rem;\n }\n .helper-label {\n padding-bottom: 0.25rem;\n }\n }\n}\n\n.label {\n color: rgb(var(--contrast-200));\n}\n\n.helper-label {\n color: rgb(var(--contrast-800));\n\n &:empty {\n display: none;\n }\n}\n\n@keyframes display-tooltip {\n 0% {\n opacity: 0;\n transform: translate3d(0, 0, 0) scale(0.94);\n }\n 100% {\n opacity: 1;\n transform: translate3d(0, 0, 0) scale(1);\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * This component is used internally by `limel-tooltip`.\n * @private\n */\n@Component({\n tag: 'limel-tooltip-content',\n shadow: true,\n styleUrl: 'tooltip-content.scss',\n})\nexport class TooltipContent {\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n label!: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n helperLabel?: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n maxlength?: number;\n\n public render() {\n let isLabelsTextLong = false;\n if (this.helperLabel && this.maxlength) {\n isLabelsTextLong =\n this.label.length + this.helperLabel.length > this.maxlength;\n }\n\n const props: any = {};\n if (this.maxlength) {\n props.style = {\n '--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',\n };\n }\n\n return [\n <text class={{ 'has-column-layout': isLabelsTextLong }} {...props}>\n <div class=\"label\">{this.label}</div>\n <div class=\"helper-label\">{this.helperLabel}</div>\n </text>,\n ];\n }\n}\n"],"version":3}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["limel-color-picker.cjs",[[1,"limel-color-picker",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"tooltipLabel":[513,"tooltip-label"],"required":[516],"readonly":[516],"isOpen":[32]}]]],["limel-action-bar.cjs",[[1,"limel-action-bar",{"actions":[16],"accessibleLabel":[513,"accessible-label"],"layout":[513],"openDirection":[513,"open-direction"],"overflowCutoff":[32]}]]],["limel-dock.cjs",[[1,"limel-dock",{"dockItems":[16],"dockFooterItems":[16],"accessibleLabel":[513,"accessible-label"],"expanded":[516],"allowResize":[516,"allow-resize"],"mobileBreakPoint":[514,"mobile-break-point"],"useMobileLayout":[32]}]]],["limel-picker.cjs",[[1,"limel-picker",{"disabled":[4],"readonly":[516],"label":[1],"searchLabel":[1,"search-label"],"helperText":[513,"helper-text"],"leadingIcon":[1,"leading-icon"],"emptyResultMessage":[1,"empty-result-message"],"required":[4],"value":[8],"searcher":[8],"multiple":[4],"delimiter":[513],"actions":[16],"actionPosition":[1,"action-position"],"actionScrollBehavior":[1,"action-scroll-behavior"],"badgeIcons":[516,"badge-icons"],"items":[32],"textValue":[32],"loading":[32],"chips":[32]}]]],["limel-split-button.cjs",[[1,"limel-split-button",{"label":[513],"primary":[516],"icon":[513],"disabled":[516],"items":[16]}]]],["limel-date-picker.cjs",[[1,"limel-date-picker",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[16],"type":[520],"format":[513],"language":[520],"formatter":[16],"formattedValue":[32],"internalFormat":[32],"showPortal":[32]}]]],["limel-button-group.cjs",[[1,"limel-button-group",{"value":[16],"disabled":[516],"selectedButtonId":[32]}]]],["limel-select.cjs",[[1,"limel-select",{"disabled":[516],"readonly":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"value":[8],"options":[16],"multiple":[4],"menuOpen":[32]}]]],["limel-file.cjs",[[1,"limel-file",{"value":[8],"label":[513],"required":[516],"disabled":[516],"readonly":[516],"accept":[513],"language":[8],"isDraggingOverDropZone":[32]}]]],["limel-info-tile.cjs",[[1,"limel-info-tile",{"value":[520],"icon":[1],"label":[513],"prefix":[513],"suffix":[513],"disabled":[516],"badge":[520],"loading":[516],"link":[8],"progress":[16]}]]],["limel-snackbar.cjs",[[1,"limel-snackbar",{"message":[1],"timeout":[2],"actionText":[1,"action-text"],"dismissible":[4],"multiline":[4],"language":[8],"show":[64]}]]],["limel-tab-panel.cjs",[[1,"limel-tab-panel",{"tabs":[1040]}]]],["limel-table.cjs",[[1,"limel-table",{"data":[16],"columns":[16],"mode":[1],"layout":[1],"pageSize":[2,"page-size"],"totalRows":[2,"total-rows"],"sorting":[16],"activeRow":[1040],"movableColumns":[4,"movable-columns"],"loading":[4],"page":[2],"emptyMessage":[1,"empty-message"],"aggregates":[16],"selectable":[4],"selection":[16]}]]],["limel-collapsible-section.cjs",[[1,"limel-collapsible-section",{"isOpen":[1540,"is-open"],"header":[513],"actions":[16]}]]],["limel-dialog.cjs",[[1,"limel-dialog",{"heading":[8],"fullscreen":[516],"open":[1540],"closingActions":[520,"closing-actions"]}]]],["limel-progress-flow.cjs",[[1,"limel-progress-flow",{"flowItems":[16],"disabled":[4],"readonly":[4]}]]],["limel-shortcut.cjs",[[1,"limel-shortcut",{"icon":[513],"label":[513],"disabled":[516],"badge":[520],"link":[8]}]]],["limel-banner.cjs",[[1,"limel-banner",{"message":[513],"icon":[513],"isOpen":[32],"open":[64],"close":[64]}]]],["limel-callout.cjs",[[1,"limel-callout",{"heading":[513],"icon":[513],"type":[513],"language":[8]}]]],["limel-slider.cjs",[[1,"limel-slider",{"disabled":[516],"readonly":[516],"factor":[514],"label":[513],"helperText":[513,"helper-text"],"unit":[513],"value":[514],"valuemax":[514],"valuemin":[514],"step":[514],"percentageClass":[32]}]]],["limel-code-editor.cjs",[[1,"limel-code-editor",{"value":[1],"language":[1],"readonly":[4],"lineNumbers":[4,"line-numbers"],"fold":[4],"lint":[4],"colorScheme":[1,"color-scheme"],"random":[32]}]]],["limel-config.cjs",[[1,"limel-config",{"config":[16]}]]],["limel-flex-container.cjs",[[1,"limel-flex-container",{"direction":[520],"justify":[520],"align":[520],"reverse":[516]}]]],["limel-form.cjs",[[1,"limel-form",{"schema":[16],"value":[16],"disabled":[4],"propsFactory":[16],"transformErrors":[16],"errors":[16]}]]],["limel-grid.cjs",[[1,"limel-grid"]]],["limel-
|
|
17
|
+
return index.bootstrapLazy([["limel-color-picker.cjs",[[1,"limel-color-picker",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"tooltipLabel":[513,"tooltip-label"],"required":[516],"readonly":[516],"isOpen":[32]}]]],["limel-action-bar.cjs",[[1,"limel-action-bar",{"actions":[16],"accessibleLabel":[513,"accessible-label"],"layout":[513],"openDirection":[513,"open-direction"],"overflowCutoff":[32]}]]],["limel-dock.cjs",[[1,"limel-dock",{"dockItems":[16],"dockFooterItems":[16],"accessibleLabel":[513,"accessible-label"],"expanded":[516],"allowResize":[516,"allow-resize"],"mobileBreakPoint":[514,"mobile-break-point"],"useMobileLayout":[32]}]]],["limel-picker.cjs",[[1,"limel-picker",{"disabled":[4],"readonly":[516],"label":[1],"searchLabel":[1,"search-label"],"helperText":[513,"helper-text"],"leadingIcon":[1,"leading-icon"],"emptyResultMessage":[1,"empty-result-message"],"required":[4],"value":[8],"searcher":[8],"multiple":[4],"delimiter":[513],"actions":[16],"actionPosition":[1,"action-position"],"actionScrollBehavior":[1,"action-scroll-behavior"],"badgeIcons":[516,"badge-icons"],"items":[32],"textValue":[32],"loading":[32],"chips":[32]}]]],["limel-split-button.cjs",[[1,"limel-split-button",{"label":[513],"primary":[516],"icon":[513],"disabled":[516],"items":[16]}]]],["limel-date-picker.cjs",[[1,"limel-date-picker",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[16],"type":[520],"format":[513],"language":[520],"formatter":[16],"formattedValue":[32],"internalFormat":[32],"showPortal":[32]}]]],["limel-button-group.cjs",[[1,"limel-button-group",{"value":[16],"disabled":[516],"selectedButtonId":[32]}]]],["limel-select.cjs",[[1,"limel-select",{"disabled":[516],"readonly":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"value":[8],"options":[16],"multiple":[4],"menuOpen":[32]}]]],["limel-file.cjs",[[1,"limel-file",{"value":[8],"label":[513],"required":[516],"disabled":[516],"readonly":[516],"accept":[513],"language":[8],"isDraggingOverDropZone":[32]}]]],["limel-info-tile.cjs",[[1,"limel-info-tile",{"value":[520],"icon":[1],"label":[513],"prefix":[513],"suffix":[513],"disabled":[516],"badge":[520],"loading":[516],"link":[8],"progress":[16]}]]],["limel-snackbar.cjs",[[1,"limel-snackbar",{"message":[1],"timeout":[2],"actionText":[1,"action-text"],"dismissible":[4],"multiline":[4],"language":[8],"show":[64]}]]],["limel-tab-panel.cjs",[[1,"limel-tab-panel",{"tabs":[1040]}]]],["limel-table.cjs",[[1,"limel-table",{"data":[16],"columns":[16],"mode":[1],"layout":[1],"pageSize":[2,"page-size"],"totalRows":[2,"total-rows"],"sorting":[16],"activeRow":[1040],"movableColumns":[4,"movable-columns"],"loading":[4],"page":[2],"emptyMessage":[1,"empty-message"],"aggregates":[16],"selectable":[4],"selection":[16]}]]],["limel-collapsible-section.cjs",[[1,"limel-collapsible-section",{"isOpen":[1540,"is-open"],"header":[513],"actions":[16]}]]],["limel-dialog.cjs",[[1,"limel-dialog",{"heading":[8],"fullscreen":[516],"open":[1540],"closingActions":[520,"closing-actions"]}]]],["limel-progress-flow.cjs",[[1,"limel-progress-flow",{"flowItems":[16],"disabled":[4],"readonly":[4]}]]],["limel-shortcut.cjs",[[1,"limel-shortcut",{"icon":[513],"label":[513],"disabled":[516],"badge":[520],"link":[8]}]]],["limel-banner.cjs",[[1,"limel-banner",{"message":[513],"icon":[513],"isOpen":[32],"open":[64],"close":[64]}]]],["limel-callout.cjs",[[1,"limel-callout",{"heading":[513],"icon":[513],"type":[513],"language":[8]}]]],["limel-slider.cjs",[[1,"limel-slider",{"disabled":[516],"readonly":[516],"factor":[514],"label":[513],"helperText":[513,"helper-text"],"unit":[513],"value":[514],"valuemax":[514],"valuemin":[514],"step":[514],"percentageClass":[32]}]]],["limel-switch.cjs",[[1,"limel-switch",{"label":[513],"disabled":[516],"readonly":[516],"value":[516],"helperText":[513,"helper-text"],"fieldId":[32]}]]],["limel-code-editor.cjs",[[1,"limel-code-editor",{"value":[1],"language":[1],"readonly":[4],"lineNumbers":[4,"line-numbers"],"fold":[4],"lint":[4],"colorScheme":[1,"color-scheme"],"random":[32]}]]],["limel-config.cjs",[[1,"limel-config",{"config":[16]}]]],["limel-flex-container.cjs",[[1,"limel-flex-container",{"direction":[520],"justify":[520],"align":[520],"reverse":[516]}]]],["limel-form.cjs",[[1,"limel-form",{"schema":[16],"value":[16],"disabled":[4],"propsFactory":[16],"transformErrors":[16],"errors":[16]}]]],["limel-grid.cjs",[[1,"limel-grid"]]],["limel-icon.cjs",[[1,"limel-icon",{"size":[513],"name":[513],"badge":[516]}]]],["limel-dock-button.cjs",[[0,"limel-dock-button",{"item":[16],"expanded":[516],"useMobileLayout":[516,"use-mobile-layout"],"isOpen":[32]}]]],["limel-color-picker-palette.cjs",[[1,"limel-color-picker-palette",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"required":[516]}]]],["limel-badge.cjs",[[1,"limel-badge",{"label":[520]}]]],["limel-tab-bar.cjs",[[1,"limel-tab-bar",{"tabs":[1040],"canScrollLeft":[32],"canScrollRight":[32]},[[9,"resize","handleWindowResize"]]]]],["limel-checkbox.cjs",[[1,"limel-checkbox",{"disabled":[516],"readonly":[516],"label":[513],"helperText":[513,"helper-text"],"checked":[516],"indeterminate":[516],"required":[516],"modified":[32]}]]],["limel-header.cjs",[[1,"limel-header",{"icon":[1],"heading":[1],"subheading":[1],"supportingText":[1,"supporting-text"]}]]],["limel-progress-flow-item.cjs",[[0,"limel-progress-flow-item",{"item":[16],"disabled":[4],"readonly":[4]}]]],["limel-flatpickr-adapter.cjs",[[1,"limel-flatpickr-adapter",{"value":[16],"type":[8],"format":[1],"isOpen":[4,"is-open"],"inputElement":[16],"language":[8],"formatter":[16]}]]],["limel-action-bar-item_2.cjs",[[0,"limel-action-bar-overflow-menu",{"items":[16],"openDirection":[513,"open-direction"]}],[0,"limel-action-bar-item",{"item":[16],"isVisible":[516,"is-visible"]}]]],["limel-chip-set.cjs",[[1,"limel-chip-set",{"value":[16],"type":[513],"label":[513],"helperText":[513,"helper-text"],"disabled":[516],"readonly":[516],"inputType":[513,"input-type"],"maxItems":[514,"max-items"],"required":[516],"searchLabel":[513,"search-label"],"emptyInputOnBlur":[516,"empty-input-on-blur"],"clearAllButton":[4,"clear-all-button"],"leadingIcon":[513,"leading-icon"],"delimiter":[513],"language":[8],"editMode":[32],"textValue":[32],"blurred":[32],"inputChipIndexSelected":[32],"getEditMode":[64],"setFocus":[64],"emptyInput":[64]}]]],["limel-button.cjs",[[1,"limel-button",{"label":[513],"primary":[516],"outlined":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"justLoaded":[32]}]]],["limel-circular-progress_2.cjs",[[1,"limel-circular-progress",{"value":[2],"maxValue":[2,"max-value"],"prefix":[513],"suffix":[1],"displayPercentageColors":[4,"display-percentage-colors"],"size":[513]}],[1,"limel-linear-progress",{"value":[514],"indeterminate":[516]}]]],["limel-list_2.cjs",[[1,"limel-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[8],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]}],[1,"limel-menu-surface",{"open":[4],"allowClicksElement":[16]}]]],["limel-input-field.cjs",[[1,"limel-input-field",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"prefix":[513],"suffix":[513],"required":[516],"value":[513],"trailingIcon":[513,"trailing-icon"],"leadingIcon":[513,"leading-icon"],"pattern":[513],"type":[513],"formatNumber":[516,"format-number"],"step":[520],"max":[514],"min":[514],"maxlength":[514],"minlength":[514],"completions":[16],"showLink":[516,"show-link"],"isFocused":[32],"isModified":[32],"showCompletions":[32]}]]],["limel-icon-button.cjs",[[1,"limel-icon-button",{"icon":[513],"elevated":[516],"label":[513],"disabled":[516]}]]],["limel-spinner.cjs",[[1,"limel-spinner",{"size":[520],"limeBranded":[4,"lime-branded"]}]]],["limel-portal.cjs",[[1,"limel-portal",{"openDirection":[513,"open-direction"],"position":[513],"containerId":[513,"container-id"],"containerStyle":[16],"parent":[16],"inheritParentWidth":[516,"inherit-parent-width"],"visible":[516],"anchor":[16]}]]],["limel-menu_2.cjs",[[1,"limel-menu",{"items":[16],"disabled":[516],"openDirection":[513,"open-direction"],"open":[1540],"badgeIcons":[516,"badge-icons"],"gridLayout":[516,"grid-layout"]}],[1,"limel-menu-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[8],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]}]]],["limel-popover_2.cjs",[[1,"limel-popover",{"open":[4],"openDirection":[513,"open-direction"]}],[1,"limel-popover-surface",{"contentCollection":[16]}]]],["limel-tooltip_2.cjs",[[1,"limel-tooltip",{"elementId":[513,"element-id"],"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514],"openDirection":[513,"open-direction"],"open":[32]}],[1,"limel-tooltip-content",{"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514]}]]],["limel-helper-line.cjs",[[1,"limel-helper-line",{"helperText":[513,"helper-text"],"length":[514],"maxLength":[514,"max-length"],"invalid":[516],"helperTextId":[513,"helper-text-id"]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-38eb64b5.js');
|
|
4
|
+
|
|
5
|
+
const eventHandlers = new WeakMap();
|
|
6
|
+
class EnterClickable {
|
|
7
|
+
constructor(element) {
|
|
8
|
+
this.element = element;
|
|
9
|
+
this.isActive = false;
|
|
10
|
+
this.hasJustReleasedEnter = true;
|
|
11
|
+
this.handleKeyDown = (event) => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (event.key === 'Enter' && !this.isActive) {
|
|
14
|
+
this.isActive = true;
|
|
15
|
+
if ((_a = this.element) === null || _a === void 0 ? void 0 : _a.shadowRoot) {
|
|
16
|
+
index.forceUpdate(this.element);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.handleKeyUp = (event) => {
|
|
21
|
+
var _a;
|
|
22
|
+
if (event.key === 'Enter' && this.isActive) {
|
|
23
|
+
this.isActive = false;
|
|
24
|
+
this.hasJustReleasedEnter = true;
|
|
25
|
+
if ((_a = this.element) === null || _a === void 0 ? void 0 : _a.shadowRoot) {
|
|
26
|
+
index.forceUpdate(this.element);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
this.handleClick = (event) => {
|
|
31
|
+
if (!this.isActive) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (this.hasJustReleasedEnter) {
|
|
35
|
+
this.hasJustReleasedEnter = false;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
event.stopImmediatePropagation();
|
|
39
|
+
};
|
|
40
|
+
this.callbacks = {
|
|
41
|
+
keydownHandler: this.handleKeyDown.bind(this),
|
|
42
|
+
keyupHandler: this.handleKeyUp.bind(this),
|
|
43
|
+
clickHandler: this.handleClick.bind(this),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
enable() {
|
|
47
|
+
this.element.addEventListener('keydown', this.callbacks.keydownHandler);
|
|
48
|
+
this.element.addEventListener('keyup', this.callbacks.keyupHandler);
|
|
49
|
+
this.element.addEventListener('click', this.callbacks.clickHandler, true);
|
|
50
|
+
}
|
|
51
|
+
disable() {
|
|
52
|
+
this.element.removeEventListener('keydown', this.callbacks.keydownHandler);
|
|
53
|
+
this.element.removeEventListener('keyup', this.callbacks.keyupHandler);
|
|
54
|
+
this.element.removeEventListener('click', this.callbacks.clickHandler, true);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Overrides the default browser behavior for clickable elements
|
|
59
|
+
* When focused and pressing down enter, avoids calling onClick repeatedly
|
|
60
|
+
* @param {HTMLElement} element the clickable element
|
|
61
|
+
*/
|
|
62
|
+
function makeEnterClickable(element) {
|
|
63
|
+
if (!eventHandlers.has(element)) {
|
|
64
|
+
const enterClickable = new EnterClickable(element);
|
|
65
|
+
enterClickable.enable();
|
|
66
|
+
eventHandlers.set(element, enterClickable);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function removeEnterClickable(element) {
|
|
70
|
+
const enterClickable = eventHandlers.get(element);
|
|
71
|
+
if (enterClickable) {
|
|
72
|
+
enterClickable.disable();
|
|
73
|
+
eventHandlers.delete(element);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.makeEnterClickable = makeEnterClickable;
|
|
78
|
+
exports.removeEnterClickable = removeEnterClickable;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=make-enter-clickable-59460fd6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"make-enter-clickable-59460fd6.js","mappings":";;;;AAEA,MAAM,aAAa,GAAyC,IAAI,OAAO,EAAE,CAAC;AAE1E,MAAM,cAAc;EAIhB,YAAoB,OAAoB;IAApB,YAAO,GAAP,OAAO,CAAa;IAHhC,aAAQ,GAAG,KAAK,CAAC;IACjB,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,CAAC;IACxE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACpE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CACzB,OAAO,EACP,IAAI,CAAC,SAAS,CAAC,YAAY,EAC3B,IAAI,CACP,CAAC;GACL;EAEM,OAAO;IACV,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC5B,SAAS,EACT,IAAI,CAAC,SAAS,CAAC,cAAc,CAChC,CAAC;IACF,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC5B,OAAO,EACP,IAAI,CAAC,SAAS,CAAC,YAAY,EAC3B,IAAI,CACP,CAAC;GACL;CACJ;AAED;;;;;SAKgB,kBAAkB,CAAC,OAAoB;EACnD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;IAC7B,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IACnD,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;GAC9C;AACL,CAAC;SAEe,oBAAoB,CAAC,OAAoB;EACrD,MAAM,cAAc,GAAmB,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;EAClE,IAAI,cAAc,EAAE;IAChB,cAAc,CAAC,OAAO,EAAE,CAAC;IACzB,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;GACjC;AACL;;;;;","names":["forceUpdate"],"sources":["./src/util/make-enter-clickable.ts"],"sourcesContent":["import { forceUpdate } from '@stencil/core';\n\nconst eventHandlers: WeakMap<HTMLElement, EnterClickable> = new WeakMap();\n\nclass EnterClickable {\n private isActive = false;\n private hasJustReleasedEnter = true;\n\n constructor(private element: HTMLElement) {}\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' && !this.isActive) {\n this.isActive = true;\n\n if (this.element?.shadowRoot) {\n forceUpdate(this.element);\n }\n }\n };\n\n private handleKeyUp = (event: KeyboardEvent) => {\n if (event.key === 'Enter' && this.isActive) {\n this.isActive = false;\n this.hasJustReleasedEnter = true;\n\n if (this.element?.shadowRoot) {\n forceUpdate(this.element);\n }\n }\n };\n\n private handleClick = (event: MouseEvent) => {\n if (!this.isActive) {\n return;\n }\n\n if (this.hasJustReleasedEnter) {\n this.hasJustReleasedEnter = false;\n\n return;\n }\n\n event.stopImmediatePropagation();\n };\n\n private callbacks: CallBacks = {\n keydownHandler: this.handleKeyDown.bind(this),\n keyupHandler: this.handleKeyUp.bind(this),\n clickHandler: this.handleClick.bind(this),\n };\n\n public enable() {\n this.element.addEventListener('keydown', this.callbacks.keydownHandler);\n this.element.addEventListener('keyup', this.callbacks.keyupHandler);\n this.element.addEventListener(\n 'click',\n this.callbacks.clickHandler,\n true\n );\n }\n\n public disable() {\n this.element.removeEventListener(\n 'keydown',\n this.callbacks.keydownHandler\n );\n this.element.removeEventListener('keyup', this.callbacks.keyupHandler);\n this.element.removeEventListener(\n 'click',\n this.callbacks.clickHandler,\n true\n );\n }\n}\n\n/**\n * Overrides the default browser behavior for clickable elements\n * When focused and pressing down enter, avoids calling onClick repeatedly\n * @param {HTMLElement} element the clickable element\n */\nexport function makeEnterClickable(element: HTMLElement) {\n if (!eventHandlers.has(element)) {\n const enterClickable = new EnterClickable(element);\n enterClickable.enable();\n eventHandlers.set(element, enterClickable);\n }\n}\n\nexport function removeEnterClickable(element: HTMLElement) {\n const enterClickable: EnterClickable = eventHandlers.get(element);\n if (enterClickable) {\n enterClickable.disable();\n eventHandlers.delete(element);\n }\n}\n\ninterface CallBacks {\n keydownHandler: (arg: KeyboardEvent) => void;\n keyupHandler: (arg: KeyboardEvent) => void;\n clickHandler: (arg: MouseEvent) => void;\n}\n"],"version":3}
|
|
@@ -33,6 +33,7 @@ button {
|
|
|
33
33
|
min-width: var(--action-bar-item-height);
|
|
34
34
|
max-width: var(--action-bar-item-max-width, 10rem);
|
|
35
35
|
height: var(--action-bar-item-height);
|
|
36
|
+
color: var(--limel-action-bar-item-text-color);
|
|
36
37
|
border-radius: var(--action-bar-item-height);
|
|
37
38
|
font-size: 0.875rem;
|
|
38
39
|
padding: 0 0.25rem;
|
|
@@ -81,13 +82,6 @@ limel-icon {
|
|
|
81
82
|
color: var(--action-bar-item-icon-color, var(--limel-action-bar-item-text-color));
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
limel-tooltip {
|
|
85
|
-
position: absolute;
|
|
86
|
-
bottom: 0;
|
|
87
|
-
left: 0;
|
|
88
|
-
right: 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
85
|
div[role=separator] {
|
|
92
86
|
width: 1px;
|
|
93
87
|
height: 1.5rem;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, } from '@stencil/core';
|
|
2
2
|
import { createRandomString } from '../../../util/random-string';
|
|
3
|
+
import { makeEnterClickable, removeEnterClickable, } from 'src/util/make-enter-clickable';
|
|
3
4
|
/**
|
|
4
5
|
* @private
|
|
5
6
|
*/
|
|
@@ -13,6 +14,12 @@ export class ActionBarButton {
|
|
|
13
14
|
this.isVisible = true;
|
|
14
15
|
this.tooltipId = createRandomString();
|
|
15
16
|
}
|
|
17
|
+
componentWillLoad() {
|
|
18
|
+
makeEnterClickable(this.host);
|
|
19
|
+
}
|
|
20
|
+
disconnectedCallback() {
|
|
21
|
+
removeEnterClickable(this.host);
|
|
22
|
+
}
|
|
16
23
|
render() {
|
|
17
24
|
if (!this.isItem(this.item) && this.item.separator) {
|
|
18
25
|
return h("div", { role: "separator" });
|
|
@@ -75,7 +82,7 @@ export class ActionBarButton {
|
|
|
75
82
|
"mutable": false,
|
|
76
83
|
"complexType": {
|
|
77
84
|
"original": "ActionBarItem | ListSeparator",
|
|
78
|
-
"resolved": "
|
|
85
|
+
"resolved": "ActionBarItemOnlyIcon | ActionBarItemWithLabel | ListSeparator",
|
|
79
86
|
"references": {
|
|
80
87
|
"ActionBarItem": {
|
|
81
88
|
"location": "import",
|
|
@@ -127,7 +134,7 @@ export class ActionBarButton {
|
|
|
127
134
|
},
|
|
128
135
|
"complexType": {
|
|
129
136
|
"original": "ActionBarItem | ListSeparator",
|
|
130
|
-
"resolved": "
|
|
137
|
+
"resolved": "ActionBarItemOnlyIcon | ActionBarItemWithLabel | ListSeparator",
|
|
131
138
|
"references": {
|
|
132
139
|
"ActionBarItem": {
|
|
133
140
|
"location": "import",
|
|
@@ -141,5 +148,6 @@ export class ActionBarButton {
|
|
|
141
148
|
}
|
|
142
149
|
}];
|
|
143
150
|
}
|
|
151
|
+
static get elementRef() { return "host"; }
|
|
144
152
|
}
|
|
145
153
|
//# sourceMappingURL=action-bar-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-bar-item.js","sourceRoot":"","sources":["../../../../src/components/action-bar/action-bar-item/action-bar-item.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"action-bar-item.js","sourceRoot":"","sources":["../../../../src/components/action-bar/action-bar-item/action-bar-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EACH,kBAAkB,EAClB,oBAAoB,GACvB,MAAM,+BAA+B,CAAC;AAEvC;;GAEG;AAMH,MAAM,OAAO,eAAe;EA4BxB;IA+BQ,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;MACxC,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAA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,IAAI,CAAC,IAAI,CAAC,IAAI,EACpB,KAAK,EAAE;UACH,8BAA8B,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;SAC3D,GACH,CACL,CAAC;KACL;EACL,CAAC;EAEO,WAAW;IACf,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAC/C,OAAO;KACV;IAED,OAAO,YAAM,KAAK,EAAC,MAAM,IAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAQ,CAAC;EACtD,CAAC;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;MACzB,OAAO;KACV;IAED,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MAChB,OAAO,CACH,qBACI,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EACrB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,GACpC,CACL,CAAC;KACL;IAED,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;MACvB,OAAO,CACH,qBACI,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,GAC9B,CACL,CAAC;KACL;EACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n} from '@stencil/core';\nimport { ActionBarItem } from '../action-bar.types';\nimport { createRandomString } from '../../../util/random-string';\nimport { ListSeparator } from 'src/interface';\nimport {\n makeEnterClickable,\n removeEnterClickable,\n} from 'src/util/make-enter-clickable';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-action-bar-item',\n shadow: false,\n styleUrl: 'action-bar-item.scss',\n})\nexport class ActionBarButton {\n /**\n * Item that is placed in the action bar.\n */\n @Prop()\n public item!: ActionBarItem | ListSeparator;\n\n /**\n * Fired when a action bar item has been clicked.\n */\n @Event()\n public select: EventEmitter<ActionBarItem | ListSeparator>;\n\n /**\n * When the item is displayed in the available width,\n * this will be `false`.\n */\n @Prop({ reflect: true })\n public isVisible: boolean = true;\n\n @Element()\n private host: HTMLLimelActionBarItemElement;\n\n /**\n * Used to attach the right tooltip to the right button\n */\n private tooltipId: string;\n\n constructor() {\n this.tooltipId = createRandomString();\n }\n\n public componentWillLoad() {\n makeEnterClickable(this.host);\n }\n\n public disconnectedCallback() {\n removeEnterClickable(this.host);\n }\n\n public render() {\n if (!this.isItem(this.item) && this.item.separator) {\n return <div role=\"separator\" />;\n }\n\n return (\n <button\n id={this.tooltipId}\n type=\"button\"\n onClick={this.handleClick}\n disabled={this.isDisabled()}\n >\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderTooltip()}\n </button>\n );\n }\n\n private handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.select.emit(this.item);\n };\n\n private isItem(item: ActionBarItem | ListSeparator): item is ActionBarItem {\n return !('separator' in item);\n }\n\n private isDisabled() {\n if (this.isItem(this.item) && this.item.disabled) {\n return true;\n }\n\n if (!this.isVisible) {\n return true;\n }\n }\n\n private renderIcon() {\n if (this.isItem(this.item) && !this.item.icon) {\n return;\n }\n\n if ('icon' in this.item) {\n return (\n <limel-icon\n name={this.item.icon}\n style={{\n '--action-bar-item-icon-color': `${this.item.iconColor}`,\n }}\n />\n );\n }\n }\n\n private renderLabel() {\n if (!this.isItem(this.item) || this.item.iconOnly) {\n return;\n }\n\n return <span class=\"text\">{this.item.text}</span>;\n }\n\n private renderTooltip() {\n if (!this.isItem(this.item)) {\n return;\n }\n\n if (this.item.text) {\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.item.text}\n helperLabel={this.item.commandText}\n />\n );\n }\n\n if (this.item.commandText) {\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.item.commandText}\n />\n );\n }\n }\n}\n"]}
|
|
@@ -23,7 +23,6 @@ import { isItem } from './isItem';
|
|
|
23
23
|
* @exampleComponent limel-example-action-bar-floating
|
|
24
24
|
* @exampleComponent limel-example-action-bar-styling
|
|
25
25
|
* @exampleComponent limel-example-action-bar-as-primary-component
|
|
26
|
-
* @private
|
|
27
26
|
*/
|
|
28
27
|
export class ActionBar {
|
|
29
28
|
constructor() {
|
|
@@ -235,7 +234,7 @@ export class ActionBar {
|
|
|
235
234
|
},
|
|
236
235
|
"complexType": {
|
|
237
236
|
"original": "ActionBarItem",
|
|
238
|
-
"resolved": "
|
|
237
|
+
"resolved": "ActionBarItemOnlyIcon | ActionBarItemWithLabel",
|
|
239
238
|
"references": {
|
|
240
239
|
"ActionBarItem": {
|
|
241
240
|
"location": "import",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-bar.js","sourceRoot":"","sources":["../../../src/components/action-bar/action-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,GACV,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH,MAAM,OAAO,SAAS;;IAkDV,gBAAW,GAAG,IAAI,CAAC;IACnB,mBAAc,GAAoC,EAAE,CAAC;IAwCrD,wBAAmB,GAAG,CAAC,IAAmB,EAAE,KAAa,EAAE,EAAE;MACjE,OAAO,CACH,6BACI,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAClC,CACL,CAAC;IACN,CAAC,CAAC;IAEM,uBAAkB,GAAG,CAAC,KAAsC,EAAE,E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AC;IAExB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAEzB,IAAI,CAAC,oBAAoB,GAAG,IAAI,oBAAoB,CAChD,IAAI,CAAC,kBAAkB,EACvB,OAAO,CACV,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,UAAU;OACf,gBAAgB,CAAC,uBAAuB,CAAC;OACzC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;MACvB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;EACX,CAAC;EAEO,OAAO,CAAC,aAA4C;IACxD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACjD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;EAC5C,CAAC;EAEO,gBAAgB;IACpB,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAC5C,CAAC,aAA4C,EAAE,EAAE,CAC7C,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,CACpD,CAAC;IAEF,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAC5B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CACjE,CAAC,IAAI,CACF,CAAC,aAA4C,EAAE,EAAE,CAC7C,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,CACnD,CAAC;IAEF,OAAO,eAAe,IAAI,aAAa,CAAC;EAC5C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Element,\n} from '@stencil/core';\nimport { ActionBarItem } from './action-bar.types';\nimport { MenuItem, OpenDirection } from '../menu/menu.types';\nimport { ListSeparator } from '../list/list-item.types';\nimport { isItem } from './isItem';\n\n/**\n * An action bar is a user interface element commonly found in software applications and websites.\n * It typically appears at the top of the screen or within a specific section\n * and serves as a centralized hub for accessing various actions and commands\n * relevant to the current context or page.\n *\n * The action bar often contains a set of clickable icons or buttons (icons + labels)\n * that represent specific actions, such as saving, deleting, editing, sharing,\n * or bulk operations for selected items.\n *\n * The purpose of an action bar is to provide quick and convenient access to\n * frequently used functionalities, enabling users to perform common tasks efficiently.\n * It enhances usability by organizing important actions in a visually prominent and easily accessible location.\n *\n * The action bar's design and layout can vary based on the platform or application,\n * but its primary goal remains consistent—to\n * empower users to interact with the software and perform desired actions effortlessly.\n * @exampleComponent limel-example-action-bar\n * @exampleComponent limel-example-action-bar-overflow-menu\n * @exampleComponent limel-example-action-bar-colors\n * @exampleComponent limel-example-action-bar-floating\n * @exampleComponent limel-example-action-bar-styling\n * @exampleComponent limel-example-action-bar-as-primary-component\n * @private\n */\n@Component({\n tag: 'limel-action-bar',\n shadow: true,\n styleUrl: 'action-bar.scss',\n})\nexport class ActionBar {\n /**\n * Items that are placed in the action bar.\n * These represent primary actions.\n */\n @Prop()\n public actions: Array<ActionBarItem | ListSeparator> = [];\n\n /**\n * A label used to describe the purpose of the element to users\n * of assistive technologies, like screen readers.\n * Example value: \"toolbar\"\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * - When set to `fullWidth`, the component will take the\n * entire width of its container.\n * - When set to `floating`, the component will get basic stylings\n * to visualize the floating state.\n * :::note\n * You should still properly position the component\n * according to the structure of your user interface.\n * For example, use an `absolute` or `fixed` position.\n * :::\n */\n @Prop({ reflect: true })\n public layout?: 'fullWidth' | 'floating';\n\n /**\n * Defines the location that the content of the overflow menu\n * appears, in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection;\n\n /**\n * Fired when a action bar item has been clicked.\n */\n @Event()\n public itemSelected: EventEmitter<ActionBarItem>;\n\n @Element()\n private host: HTMLElement;\n\n @State()\n private overflowCutoff: number = this.actions.length;\n\n private intersectionObserver: IntersectionObserver;\n private firstRender = true;\n private actionBarItems: HTMLLimelActionBarItemElement[] = [];\n\n public render() {\n let overflowActions: Array<MenuItem | ListSeparator> = [];\n if (this.actions.length) {\n overflowActions = this.actions.slice(this.overflowCutoff);\n }\n\n return (\n <Host\n aria-label={this.accessibleLabel}\n class={{\n 'is-full-width': this.layout === 'fullWidth',\n 'is-floating': this.layout === 'floating',\n }}\n >\n <div class=\"items\">\n {this.actions.map(this.renderActionBarItem)}\n </div>\n {this.renderOverflowMenu(overflowActions)}\n </Host>\n );\n }\n\n public connectedCallback() {}\n\n public componentDidRender() {\n if (this.haveItemsChanged()) {\n this.intersectionObserver?.disconnect();\n this.createIntersectionObserver();\n }\n }\n\n public disconnectedCallback() {\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = undefined;\n this.actionBarItems = [];\n this.connectedCallback = () => this.createIntersectionObserver();\n }\n\n private renderActionBarItem = (item: ActionBarItem, index: number) => {\n return (\n <limel-action-bar-item\n item={item}\n onSelect={this.handleSelect}\n isVisible={this.isVisible(index)}\n />\n );\n };\n\n private renderOverflowMenu = (items: Array<MenuItem | ListSeparator>) => {\n if (!(this.actions.length - this.overflowCutoff)) {\n return;\n }\n\n return (\n <limel-action-bar-overflow-menu\n openDirection={this.openDirection}\n items={items}\n onSelect={this.handleSelect}\n />\n );\n };\n\n private isVisible(index: number) {\n return index < this.overflowCutoff;\n }\n\n private handleSelect = (\n event: CustomEvent<ActionBarItem | ListSeparator>\n ) => {\n event.stopPropagation();\n if (isItem(event.detail)) {\n this.itemSelected.emit(event.detail);\n }\n };\n\n private handleIntersection = (entries: IntersectionObserverEntry[]) => {\n const intersectingItems = entries.filter(\n (entry) => entry.isIntersecting\n );\n\n const notIntersectingItems = entries.filter(\n (entry) => !entry.isIntersecting\n );\n\n if (this.firstRender) {\n this.overflowCutoff = intersectingItems.length;\n } else {\n this.overflowCutoff =\n this.overflowCutoff +\n intersectingItems.length -\n notIntersectingItems.length;\n }\n\n this.firstRender = false;\n };\n\n private createIntersectionObserver() {\n const options = {\n root: this.host.shadowRoot.querySelector('.items'),\n rootMargin: '0px',\n threshold: 1.0,\n };\n\n this.overflowCutoff = this.actions.length;\n this.firstRender = true;\n\n this.actionBarItems = [];\n\n this.intersectionObserver = new IntersectionObserver(\n this.handleIntersection,\n options\n );\n\n this.host.shadowRoot\n .querySelectorAll('limel-action-bar-item')\n .forEach((actionBarItem) => {\n this.observe(actionBarItem);\n });\n }\n\n private observe(actionBarItem: HTMLLimelActionBarItemElement) {\n this.intersectionObserver.observe(actionBarItem);\n this.actionBarItems.push(actionBarItem);\n }\n\n private haveItemsChanged() {\n const someItemRemoved = this.actionBarItems.some(\n (actionBarItem: HTMLLimelActionBarItemElement) =>\n !this.host.shadowRoot.contains(actionBarItem)\n );\n\n const someItemAdded = Array.from(\n this.host.shadowRoot.querySelectorAll('limel-action-bar-item')\n ).some(\n (actionBarItem: HTMLLimelActionBarItemElement) =>\n !this.actionBarItems.includes(actionBarItem)\n );\n\n return someItemRemoved || someItemAdded;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"action-bar.js","sourceRoot":"","sources":["../../../src/components/action-bar/action-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,GACV,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,MAAM,OAAO,SAAS;;IAkDV,gBAAW,GAAG,IAAI,CAAC;IACnB,mBAAc,GAAoC,EAAE,CAAC;IAwCrD,wBAAmB,GAAG,CAAC,IAAmB,EAAE,KAAa,EAAE,EAAE;MACjE,OAAO,CACH,6BACI,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI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;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Element,\n} from '@stencil/core';\nimport { ActionBarItem } from './action-bar.types';\nimport { MenuItem, OpenDirection } from '../menu/menu.types';\nimport { ListSeparator } from '../list/list-item.types';\nimport { isItem } from './isItem';\n\n/**\n * An action bar is a user interface element commonly found in software applications and websites.\n * It typically appears at the top of the screen or within a specific section\n * and serves as a centralized hub for accessing various actions and commands\n * relevant to the current context or page.\n *\n * The action bar often contains a set of clickable icons or buttons (icons + labels)\n * that represent specific actions, such as saving, deleting, editing, sharing,\n * or bulk operations for selected items.\n *\n * The purpose of an action bar is to provide quick and convenient access to\n * frequently used functionalities, enabling users to perform common tasks efficiently.\n * It enhances usability by organizing important actions in a visually prominent and easily accessible location.\n *\n * The action bar's design and layout can vary based on the platform or application,\n * but its primary goal remains consistent—to\n * empower users to interact with the software and perform desired actions effortlessly.\n * @exampleComponent limel-example-action-bar\n * @exampleComponent limel-example-action-bar-overflow-menu\n * @exampleComponent limel-example-action-bar-colors\n * @exampleComponent limel-example-action-bar-floating\n * @exampleComponent limel-example-action-bar-styling\n * @exampleComponent limel-example-action-bar-as-primary-component\n */\n@Component({\n tag: 'limel-action-bar',\n shadow: true,\n styleUrl: 'action-bar.scss',\n})\nexport class ActionBar {\n /**\n * Items that are placed in the action bar.\n * These represent primary actions.\n */\n @Prop()\n public actions: Array<ActionBarItem | ListSeparator> = [];\n\n /**\n * A label used to describe the purpose of the element to users\n * of assistive technologies, like screen readers.\n * Example value: \"toolbar\"\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * - When set to `fullWidth`, the component will take the\n * entire width of its container.\n * - When set to `floating`, the component will get basic stylings\n * to visualize the floating state.\n * :::note\n * You should still properly position the component\n * according to the structure of your user interface.\n * For example, use an `absolute` or `fixed` position.\n * :::\n */\n @Prop({ reflect: true })\n public layout?: 'fullWidth' | 'floating';\n\n /**\n * Defines the location that the content of the overflow menu\n * appears, in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection;\n\n /**\n * Fired when a action bar item has been clicked.\n */\n @Event()\n public itemSelected: EventEmitter<ActionBarItem>;\n\n @Element()\n private host: HTMLElement;\n\n @State()\n private overflowCutoff: number = this.actions.length;\n\n private intersectionObserver: IntersectionObserver;\n private firstRender = true;\n private actionBarItems: HTMLLimelActionBarItemElement[] = [];\n\n public render() {\n let overflowActions: Array<MenuItem | ListSeparator> = [];\n if (this.actions.length) {\n overflowActions = this.actions.slice(this.overflowCutoff);\n }\n\n return (\n <Host\n aria-label={this.accessibleLabel}\n class={{\n 'is-full-width': this.layout === 'fullWidth',\n 'is-floating': this.layout === 'floating',\n }}\n >\n <div class=\"items\">\n {this.actions.map(this.renderActionBarItem)}\n </div>\n {this.renderOverflowMenu(overflowActions)}\n </Host>\n );\n }\n\n public connectedCallback() {}\n\n public componentDidRender() {\n if (this.haveItemsChanged()) {\n this.intersectionObserver?.disconnect();\n this.createIntersectionObserver();\n }\n }\n\n public disconnectedCallback() {\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = undefined;\n this.actionBarItems = [];\n this.connectedCallback = () => this.createIntersectionObserver();\n }\n\n private renderActionBarItem = (item: ActionBarItem, index: number) => {\n return (\n <limel-action-bar-item\n item={item}\n onSelect={this.handleSelect}\n isVisible={this.isVisible(index)}\n />\n );\n };\n\n private renderOverflowMenu = (items: Array<MenuItem | ListSeparator>) => {\n if (!(this.actions.length - this.overflowCutoff)) {\n return;\n }\n\n return (\n <limel-action-bar-overflow-menu\n openDirection={this.openDirection}\n items={items}\n onSelect={this.handleSelect}\n />\n );\n };\n\n private isVisible(index: number) {\n return index < this.overflowCutoff;\n }\n\n private handleSelect = (\n event: CustomEvent<ActionBarItem | ListSeparator>\n ) => {\n event.stopPropagation();\n if (isItem(event.detail)) {\n this.itemSelected.emit(event.detail);\n }\n };\n\n private handleIntersection = (entries: IntersectionObserverEntry[]) => {\n const intersectingItems = entries.filter(\n (entry) => entry.isIntersecting\n );\n\n const notIntersectingItems = entries.filter(\n (entry) => !entry.isIntersecting\n );\n\n if (this.firstRender) {\n this.overflowCutoff = intersectingItems.length;\n } else {\n this.overflowCutoff =\n this.overflowCutoff +\n intersectingItems.length -\n notIntersectingItems.length;\n }\n\n this.firstRender = false;\n };\n\n private createIntersectionObserver() {\n const options = {\n root: this.host.shadowRoot.querySelector('.items'),\n rootMargin: '0px',\n threshold: 1.0,\n };\n\n this.overflowCutoff = this.actions.length;\n this.firstRender = true;\n\n this.actionBarItems = [];\n\n this.intersectionObserver = new IntersectionObserver(\n this.handleIntersection,\n options\n );\n\n this.host.shadowRoot\n .querySelectorAll('limel-action-bar-item')\n .forEach((actionBarItem) => {\n this.observe(actionBarItem);\n });\n }\n\n private observe(actionBarItem: HTMLLimelActionBarItemElement) {\n this.intersectionObserver.observe(actionBarItem);\n this.actionBarItems.push(actionBarItem);\n }\n\n private haveItemsChanged() {\n const someItemRemoved = this.actionBarItems.some(\n (actionBarItem: HTMLLimelActionBarItemElement) =>\n !this.host.shadowRoot.contains(actionBarItem)\n );\n\n const someItemAdded = Array.from(\n this.host.shadowRoot.querySelectorAll('limel-action-bar-item')\n ).some(\n (actionBarItem: HTMLLimelActionBarItemElement) =>\n !this.actionBarItems.includes(actionBarItem)\n );\n\n return someItemRemoved || someItemAdded;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-bar.types.js","sourceRoot":"","sources":["../../../src/components/action-bar/action-bar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MenuItem } from '../menu/menu.types';\n\
|
|
1
|
+
{"version":3,"file":"action-bar.types.js","sourceRoot":"","sources":["../../../src/components/action-bar/action-bar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MenuItem } from '../menu/menu.types';\n\n/**\n * Renders the button in the action bar without their labels.\n * Does not affect the items that are overflown into the overflow menu.\n */\nexport type ActionBarItem = ActionBarItemOnlyIcon | ActionBarItemWithLabel;\n\ninterface ActionBarItemOnlyIcon extends MenuItem {\n iconOnly: true;\n icon: string;\n}\n\ninterface ActionBarItemWithLabel extends MenuItem {\n iconOnly?: false;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
-
import { makeEnterClickable, removeEnterClickable, } from '../../util/
|
|
2
|
+
import { makeEnterClickable, removeEnterClickable, } from '../../util/make-enter-clickable';
|
|
3
3
|
/**
|
|
4
4
|
* @exampleComponent limel-example-button-basic
|
|
5
5
|
* @exampleComponent limel-example-button-primary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACH,kBAAkB,EAClB,oBAAoB,GACvB,MAAM
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACH,kBAAkB,EAClB,oBAAoB,GACvB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;GAYG;AAMH,MAAM,OAAO,MAAM;;;mBAWE,KAAK;oBAMJ,KAAK;;oBAYL,KAAK;mBAON,KAAK;yBAOC,KAAK;sBAGP,KAAK;;EAOnB,iBAAiB;IACpB,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAClC,CAAC;EAEM,oBAAoB;IACvB,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACpC,CAAC;EAEM,MAAM;IACT,OAAO,CACH,cACI,KAAK,EAAE;QACH,YAAY,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AAE,EAAC,IAAI,GAAQ;OAC9C,CAAC;KACL;IAED,OAAO;MACH,YAAM,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,GAAQ;MAC5C,YAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,GAAQ;KAC/C,CAAC;EACN,CAAC;EAEO,UAAU;IACd,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACZ,OAAO;KACV;IAED,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACb,iBAAiB,GAAG,UAAU,CAAC;KAClC;IAED,OAAO,CACH,SAAG,KAAK,EAAE,oBAAoB,iBAAiB,EAAE;MAC7C,kBAAY,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAC/B,CACP,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, h, Prop, State, Watch, Element } from '@stencil/core';\nimport {\n makeEnterClickable,\n removeEnterClickable,\n} from '../../util/make-enter-clickable';\n\n/**\n * @exampleComponent limel-example-button-basic\n * @exampleComponent limel-example-button-primary\n * @exampleComponent limel-example-button-outlined\n * @exampleComponent limel-example-button-disabled\n * @exampleComponent limel-example-button-icon\n * @exampleComponent limel-example-button-loading\n * @exampleComponent limel-example-button-click-success\n * @exampleComponent limel-example-button-click-fail\n * @exampleComponent limel-example-button-reduce-presence\n * @exampleComponent limel-example-button-colors\n * @exampleComponent limel-example-button-composite\n */\n@Component({\n tag: 'limel-button',\n shadow: true,\n styleUrl: 'button.scss',\n})\nexport class Button {\n /**\n * The text to show on the button.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to make the button primary.\n */\n @Prop({ reflect: true })\n public primary = false;\n\n /**\n * Set to `true` to make the button outlined.\n */\n @Prop({ reflect: true })\n public outlined = false;\n\n /**\n * Set icon for the button\n */\n @Prop({ reflect: true })\n public icon: string;\n\n /**\n * Set to `true` to disable the button.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Set to `true` to put the button in the `loading` state.\n * This also disables the button.\n */\n @Prop({ reflect: true })\n public loading = false;\n\n /**\n * Set to `true` to indicate failure instead of success when the button is\n * no longer in the `loading` state.\n */\n @Prop({ reflect: true })\n public loadingFailed = false;\n\n @State()\n private justLoaded = false;\n\n @Element()\n private host: HTMLElement;\n\n private justLoadedTimeout?: number;\n\n public componentWillLoad() {\n makeEnterClickable(this.host);\n }\n\n public disconnectedCallback() {\n removeEnterClickable(this.host);\n }\n\n public render() {\n return (\n <button\n class={{\n 'mdc-button': true,\n loading: this.loading,\n 'just-loaded': this.justLoaded && !this.loadingFailed,\n 'just-failed': this.justLoaded && this.loadingFailed,\n 'mdc-button--outlined': this.outlined,\n }}\n disabled={this.disabled || this.loading}\n >\n {this.renderIcon()}\n <span class=\"label mdc-button__label\">{this.label}</span>\n <limel-spinner limeBranded={false} />\n <svg viewBox=\"0 0 30 30\">{this.renderLoadingIcons()}</svg>\n </button>\n );\n }\n\n @Watch('loading')\n protected loadingWatcher(newValue: boolean, oldValue: boolean) {\n if (oldValue && !newValue) {\n this.justLoaded = true;\n const TIMEOUT = 2000;\n this.justLoadedTimeout = window.setTimeout(() => {\n this.justLoaded = false;\n }, TIMEOUT);\n } else if (newValue) {\n this.justLoaded = false;\n window.clearTimeout(this.justLoadedTimeout);\n }\n }\n\n private renderLoadingIcons() {\n if (this.loadingFailed) {\n return [\n <line x1=\"9\" y1=\"9\" x2=\"21\" y2=\"21\"></line>,\n <line x1=\"21\" y1=\"9\" x2=\"9\" y2=\"21\"></line>,\n ];\n }\n\n return [\n <line x1=\"8\" y1=\"14\" x2=\"15\" y2=\"20\"></line>,\n <line x1=\"23\" y1=\"9\" x2=\"14\" y2=\"20\"></line>,\n ];\n }\n\n private renderIcon(): HTMLElement {\n if (!this.icon) {\n return;\n }\n\n let withoutLabelClass = '';\n if (!this.label) {\n withoutLabelClass = 'no-label';\n }\n\n return (\n <i class={`mdc-button__icon ${withoutLabelClass}`}>\n <limel-icon name={this.icon} />\n </i>\n );\n }\n}\n"]}
|
|
@@ -4,12 +4,29 @@ import { h, } from '@stencil/core';
|
|
|
4
4
|
import { createRandomString } from '../../util/random-string';
|
|
5
5
|
import { CheckboxTemplate } from './checkbox.template';
|
|
6
6
|
/**
|
|
7
|
+
* The Checkbox component is a classic and essential element in UI design that allows
|
|
8
|
+
* users to make multiple selections from a predefined list of options. The Checkbox component is commonly used in forms and settings interfaces to enable users to
|
|
9
|
+
* select one or more items from a list of choices.
|
|
10
|
+
*
|
|
11
|
+
* ## States of a Checkbox
|
|
12
|
+
* When a user clicks or taps on the box, it toggles between two states:
|
|
13
|
+
* Checked and Unchecked.
|
|
14
|
+
*
|
|
15
|
+
* However, a Checkbox can visualize a third state called the "Indeterminate" state.
|
|
16
|
+
* In this state, the checkbox appears as a filled box with a horizontal line or dash inside it.
|
|
17
|
+
*
|
|
18
|
+
* The Indeterminate state is typically used when dealing with checkbox groups
|
|
19
|
+
* that have hierarchical relationships or when the group contains sub-items.
|
|
20
|
+
* This state is used to indicate that that some, but not all, of the items in a group are selected.
|
|
21
|
+
*
|
|
22
|
+
* <limel-example-switch-vs-checkbox />
|
|
7
23
|
* @exampleComponent limel-example-checkbox
|
|
8
24
|
* @exampleComponent limel-example-checkbox-helper-text
|
|
9
25
|
*/
|
|
10
26
|
export class Checkbox {
|
|
11
27
|
constructor() {
|
|
12
28
|
this.id = createRandomString();
|
|
29
|
+
this.helperTextId = createRandomString();
|
|
13
30
|
this.initialize = () => {
|
|
14
31
|
const element = this.limelCheckbox.shadowRoot.querySelector('.mdc-form-field');
|
|
15
32
|
if (!element) {
|
|
@@ -59,7 +76,7 @@ export class Checkbox {
|
|
|
59
76
|
}
|
|
60
77
|
}
|
|
61
78
|
render() {
|
|
62
|
-
return (h(CheckboxTemplate, { disabled: this.disabled || this.readonly, label: this.label, helperText: this.helperText, checked: this.checked || this.indeterminate, indeterminate: this.indeterminate, required: this.required, readonly: this.readonly, invalid: this.required && this.modified && !this.checked, onChange: this.onChange, id: this.id }));
|
|
79
|
+
return (h(CheckboxTemplate, { disabled: this.disabled || this.readonly, label: this.label, helperText: this.helperText, helperTextId: this.helperTextId, checked: this.checked || this.indeterminate, indeterminate: this.indeterminate, required: this.required, readonly: this.readonly, invalid: this.required && this.modified && !this.checked, onChange: this.onChange, id: this.id }));
|
|
63
80
|
}
|
|
64
81
|
static get is() { return "limel-checkbox"; }
|
|
65
82
|
static get encapsulation() { return "shadow"; }
|