@tylertech/forge-ai 0.1.0
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/LICENSE +202 -0
- package/README.md +3 -0
- package/custom-elements.json +4963 -0
- package/dist/ai-actions-toolbar/ai-actions-toolbar.d.ts +25 -0
- package/dist/ai-actions-toolbar/ai-actions-toolbar.mjs +74 -0
- package/dist/ai-actions-toolbar/ai-actions-toolbar.scss.mjs +4 -0
- package/dist/ai-actions-toolbar/index.d.ts +1 -0
- package/dist/ai-actions-toolbar/index.mjs +5 -0
- package/dist/ai-artifact/ai-artifact.d.ts +20 -0
- package/dist/ai-artifact/ai-artifact.mjs +39 -0
- package/dist/ai-artifact/ai-artifact.scss.mjs +4 -0
- package/dist/ai-artifact/index.d.ts +1 -0
- package/dist/ai-artifact/index.mjs +5 -0
- package/dist/ai-button/ai-button.d.ts +21 -0
- package/dist/ai-button/ai-button.mjs +67 -0
- package/dist/ai-button/ai-button.scss.mjs +4 -0
- package/dist/ai-button/index.d.ts +1 -0
- package/dist/ai-button/index.mjs +5 -0
- package/dist/ai-chain-of-thought/ai-chain-of-thought.d.ts +17 -0
- package/dist/ai-chain-of-thought/ai-chain-of-thought.mjs +45 -0
- package/dist/ai-chain-of-thought/ai-chain-of-thought.scss.mjs +4 -0
- package/dist/ai-chain-of-thought/index.d.ts +5 -0
- package/dist/ai-chain-of-thought/index.mjs +17 -0
- package/dist/ai-chain-of-thought/thought-base/index.d.ts +1 -0
- package/dist/ai-chain-of-thought/thought-base/index.mjs +5 -0
- package/dist/ai-chain-of-thought/thought-base/thought-base.d.ts +20 -0
- package/dist/ai-chain-of-thought/thought-base/thought-base.mjs +43 -0
- package/dist/ai-chain-of-thought/thought-base/thought-base.scss.mjs +4 -0
- package/dist/ai-chain-of-thought/thought-detail/index.d.ts +1 -0
- package/dist/ai-chain-of-thought/thought-detail/index.mjs +5 -0
- package/dist/ai-chain-of-thought/thought-detail/thought-detail.d.ts +14 -0
- package/dist/ai-chain-of-thought/thought-detail/thought-detail.mjs +34 -0
- package/dist/ai-chain-of-thought/thought-detail/thought-detail.scss.mjs +4 -0
- package/dist/ai-chain-of-thought/thought-image/index.d.ts +1 -0
- package/dist/ai-chain-of-thought/thought-image/index.mjs +5 -0
- package/dist/ai-chain-of-thought/thought-image/thought-image.d.ts +16 -0
- package/dist/ai-chain-of-thought/thought-image/thought-image.mjs +43 -0
- package/dist/ai-chain-of-thought/thought-image/thought-image.scss.mjs +4 -0
- package/dist/ai-chain-of-thought/thought-search-result/index.d.ts +1 -0
- package/dist/ai-chain-of-thought/thought-search-result/index.mjs +5 -0
- package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.d.ts +22 -0
- package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.mjs +62 -0
- package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.scss.mjs +4 -0
- package/dist/ai-chat-header/ai-chat-header.d.ts +54 -0
- package/dist/ai-chat-header/ai-chat-header.mjs +198 -0
- package/dist/ai-chat-header/ai-chat-header.scss.mjs +4 -0
- package/dist/ai-chat-header/index.d.ts +1 -0
- package/dist/ai-chat-header/index.mjs +5 -0
- package/dist/ai-chat-interface/ai-chat-interface.d.ts +38 -0
- package/dist/ai-chat-interface/ai-chat-interface.mjs +117 -0
- package/dist/ai-chat-interface/ai-chat-interface.scss.mjs +4 -0
- package/dist/ai-chat-interface/index.d.ts +1 -0
- package/dist/ai-chat-interface/index.mjs +5 -0
- package/dist/ai-dialog/ai-dialog.d.ts +56 -0
- package/dist/ai-dialog/ai-dialog.mjs +270 -0
- package/dist/ai-dialog/ai-dialog.scss.mjs +4 -0
- package/dist/ai-dialog/index.d.ts +1 -0
- package/dist/ai-dialog/index.mjs +5 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.d.ts +26 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.mjs +80 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.scss.mjs +4 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item.d.ts +133 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item.mjs +335 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item.scss.mjs +4 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.d.ts +18 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.mjs +26 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.scss.mjs +4 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu.d.ts +143 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu.mjs +327 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu.scss.mjs +4 -0
- package/dist/ai-dropdown-menu/index.d.ts +4 -0
- package/dist/ai-dropdown-menu/index.mjs +10 -0
- package/dist/ai-dropdown-menu/navigation-controller.d.ts +79 -0
- package/dist/ai-dropdown-menu/navigation-controller.mjs +205 -0
- package/dist/ai-dropdown-menu/selection-manager.d.ts +145 -0
- package/dist/ai-dropdown-menu/selection-manager.mjs +183 -0
- package/dist/ai-embedded-chat/ai-embedded-chat.d.ts +47 -0
- package/dist/ai-embedded-chat/ai-embedded-chat.mjs +139 -0
- package/dist/ai-embedded-chat/ai-embedded-chat.scss.mjs +4 -0
- package/dist/ai-embedded-chat/index.d.ts +1 -0
- package/dist/ai-embedded-chat/index.mjs +5 -0
- package/dist/ai-empty-state/ai-empty-state.d.ts +19 -0
- package/dist/ai-empty-state/ai-empty-state.mjs +136 -0
- package/dist/ai-empty-state/ai-empty-state.scss.mjs +4 -0
- package/dist/ai-empty-state/index.d.ts +1 -0
- package/dist/ai-empty-state/index.mjs +5 -0
- package/dist/ai-fab/ai-fab.d.ts +23 -0
- package/dist/ai-fab/ai-fab.mjs +75 -0
- package/dist/ai-fab/ai-fab.scss.mjs +4 -0
- package/dist/ai-fab/index.d.ts +1 -0
- package/dist/ai-fab/index.mjs +5 -0
- package/dist/ai-file-picker/ai-file-picker.d.ts +77 -0
- package/dist/ai-file-picker/ai-file-picker.mjs +176 -0
- package/dist/ai-file-picker/ai-file-picker.scss.mjs +4 -0
- package/dist/ai-file-picker/index.d.ts +1 -0
- package/dist/ai-file-picker/index.mjs +4 -0
- package/dist/ai-floating-chat/ai-floating-chat.d.ts +65 -0
- package/dist/ai-floating-chat/ai-floating-chat.mjs +153 -0
- package/dist/ai-floating-chat/ai-floating-chat.scss.mjs +4 -0
- package/dist/ai-floating-chat/index.d.ts +1 -0
- package/dist/ai-floating-chat/index.mjs +5 -0
- package/dist/ai-gradient-container/ai-gradient-container.d.ts +26 -0
- package/dist/ai-gradient-container/ai-gradient-container.mjs +61 -0
- package/dist/ai-gradient-container/ai-gradient-container.scss.mjs +4 -0
- package/dist/ai-gradient-container/index.d.ts +1 -0
- package/dist/ai-gradient-container/index.mjs +5 -0
- package/dist/ai-icon/ai-icon.d.ts +22 -0
- package/dist/ai-icon/ai-icon.mjs +71 -0
- package/dist/ai-icon/ai-icon.scss.mjs +4 -0
- package/dist/ai-icon/index.d.ts +1 -0
- package/dist/ai-icon/index.mjs +5 -0
- package/dist/ai-modal/ai-modal.d.ts +49 -0
- package/dist/ai-modal/ai-modal.mjs +132 -0
- package/dist/ai-modal/ai-modal.scss.mjs +4 -0
- package/dist/ai-modal/index.d.ts +1 -0
- package/dist/ai-modal/index.mjs +4 -0
- package/dist/ai-prompt/ai-prompt.d.ts +42 -0
- package/dist/ai-prompt/ai-prompt.mjs +123 -0
- package/dist/ai-prompt/ai-prompt.scss.mjs +4 -0
- package/dist/ai-prompt/index.d.ts +1 -0
- package/dist/ai-prompt/index.mjs +5 -0
- package/dist/ai-prompt/prompt-button/index.d.ts +1 -0
- package/dist/ai-prompt/prompt-button/index.mjs +5 -0
- package/dist/ai-prompt/prompt-button/prompt-button.d.ts +16 -0
- package/dist/ai-prompt/prompt-button/prompt-button.mjs +40 -0
- package/dist/ai-prompt/prompt-button/prompt-button.scss.mjs +4 -0
- package/dist/ai-reasoning/ai-reasoning.d.ts +17 -0
- package/dist/ai-reasoning/ai-reasoning.mjs +44 -0
- package/dist/ai-reasoning/ai-reasoning.scss.mjs +4 -0
- package/dist/ai-reasoning/index.d.ts +2 -0
- package/dist/ai-reasoning/index.mjs +8 -0
- package/dist/ai-reasoning/reasoning-content/index.d.ts +1 -0
- package/dist/ai-reasoning/reasoning-content/index.mjs +5 -0
- package/dist/ai-reasoning/reasoning-content/reasoning-content.d.ts +22 -0
- package/dist/ai-reasoning/reasoning-content/reasoning-content.mjs +90 -0
- package/dist/ai-reasoning/reasoning-content/reasoning-content.scss.mjs +4 -0
- package/dist/ai-reasoning-header/ai-reasoning-header.d.ts +24 -0
- package/dist/ai-reasoning-header/ai-reasoning-header.mjs +68 -0
- package/dist/ai-reasoning-header/ai-reasoning-header.scss.mjs +4 -0
- package/dist/ai-reasoning-header/index.d.ts +1 -0
- package/dist/ai-reasoning-header/index.mjs +5 -0
- package/dist/ai-response-message/ai-response-message.d.ts +40 -0
- package/dist/ai-response-message/ai-response-message.mjs +137 -0
- package/dist/ai-response-message/ai-response-message.scss.mjs +4 -0
- package/dist/ai-response-message/index.d.ts +1 -0
- package/dist/ai-response-message/index.mjs +5 -0
- package/dist/ai-sidebar/ai-sidebar.d.ts +44 -0
- package/dist/ai-sidebar/ai-sidebar.mjs +105 -0
- package/dist/ai-sidebar/ai-sidebar.scss.mjs +4 -0
- package/dist/ai-sidebar/index.d.ts +1 -0
- package/dist/ai-sidebar/index.mjs +5 -0
- package/dist/ai-sidebar-chat/ai-sidebar-chat.d.ts +64 -0
- package/dist/ai-sidebar-chat/ai-sidebar-chat.mjs +170 -0
- package/dist/ai-sidebar-chat/ai-sidebar-chat.scss.mjs +4 -0
- package/dist/ai-sidebar-chat/index.d.ts +1 -0
- package/dist/ai-sidebar-chat/index.mjs +5 -0
- package/dist/ai-suggestions/ai-suggestions.d.ts +39 -0
- package/dist/ai-suggestions/ai-suggestions.mjs +96 -0
- package/dist/ai-suggestions/ai-suggestions.scss.mjs +4 -0
- package/dist/ai-suggestions/index.d.ts +1 -0
- package/dist/ai-suggestions/index.mjs +5 -0
- package/dist/ai-threads/ai-threads.d.ts +48 -0
- package/dist/ai-threads/ai-threads.mjs +203 -0
- package/dist/ai-threads/ai-threads.scss.mjs +4 -0
- package/dist/ai-threads/index.d.ts +1 -0
- package/dist/ai-threads/index.mjs +5 -0
- package/dist/ai-user-message/ai-user-message.d.ts +15 -0
- package/dist/ai-user-message/ai-user-message.mjs +43 -0
- package/dist/ai-user-message/ai-user-message.scss.mjs +4 -0
- package/dist/ai-user-message/index.d.ts +1 -0
- package/dist/ai-user-message/index.mjs +5 -0
- package/dist/ai-voice-input/ai-voice-input.d.ts +68 -0
- package/dist/ai-voice-input/ai-voice-input.mjs +107 -0
- package/dist/ai-voice-input/ai-voice-input.scss.mjs +4 -0
- package/dist/ai-voice-input/index.d.ts +1 -0
- package/dist/ai-voice-input/index.mjs +5 -0
- package/dist/core/drag-controller.d.ts +66 -0
- package/dist/core/drag-controller.mjs +219 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.mjs +4 -0
- package/dist/core/overlay/index.d.ts +1 -0
- package/dist/core/overlay/index.mjs +4 -0
- package/dist/core/overlay/overlay.d.ts +61 -0
- package/dist/core/overlay/overlay.mjs +142 -0
- package/dist/core/overlay/overlay.scss.mjs +4 -0
- package/dist/core/popover/index.d.ts +1 -0
- package/dist/core/popover/index.mjs +4 -0
- package/dist/core/popover/popover.d.ts +56 -0
- package/dist/core/popover/popover.mjs +71 -0
- package/dist/core/popover/popover.scss.mjs +4 -0
- package/dist/core/tooltip/index.d.ts +1 -0
- package/dist/core/tooltip/index.mjs +4 -0
- package/dist/core/tooltip/tooltip.d.ts +91 -0
- package/dist/core/tooltip/tooltip.mjs +243 -0
- package/dist/core/tooltip/tooltip.scss.mjs +4 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.mjs +98 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.mjs +22 -0
- package/package.json +122 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { flip, shift, autoUpdate, computePosition } from "@floating-ui/dom";
|
|
2
|
+
import { unsafeCSS, LitElement, html } from "lit";
|
|
3
|
+
import { property, customElement } from "lit/decorators.js";
|
|
4
|
+
import styles from "./overlay.scss.mjs";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
let ForgeAiOverlayComponent = class extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.anchor = null;
|
|
19
|
+
this.placement = "bottom-start";
|
|
20
|
+
this.flip = true;
|
|
21
|
+
this.shift = false;
|
|
22
|
+
this.open = false;
|
|
23
|
+
this._overlayElement = null;
|
|
24
|
+
this._cleanupAutoUpdate = null;
|
|
25
|
+
this._onToggle = (event) => {
|
|
26
|
+
this.open = event.newState === "open";
|
|
27
|
+
this.dispatchEvent(
|
|
28
|
+
new CustomEvent("forge-ai-overlay-toggle", {
|
|
29
|
+
detail: {
|
|
30
|
+
open: this.open,
|
|
31
|
+
newState: event.newState,
|
|
32
|
+
oldState: event.oldState
|
|
33
|
+
},
|
|
34
|
+
bubbles: true,
|
|
35
|
+
composed: true
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
super.disconnectedCallback();
|
|
42
|
+
this._cleanup();
|
|
43
|
+
}
|
|
44
|
+
updated(changedProperties) {
|
|
45
|
+
if (changedProperties.has("open")) {
|
|
46
|
+
this._handleOpenChange();
|
|
47
|
+
}
|
|
48
|
+
if (changedProperties.has("anchor") || changedProperties.has("placement") || changedProperties.has("flip") || changedProperties.has("shift")) {
|
|
49
|
+
if (this.open && this._overlayElement && this.anchor) {
|
|
50
|
+
this._updatePosition();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_handleOpenChange() {
|
|
55
|
+
if (this.open) {
|
|
56
|
+
this._showOverlay();
|
|
57
|
+
} else {
|
|
58
|
+
this._hideOverlay();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async _showOverlay() {
|
|
62
|
+
if (!this._overlayElement) {
|
|
63
|
+
await this.updateComplete;
|
|
64
|
+
this._overlayElement = this.shadowRoot?.querySelector(".ai-overlay");
|
|
65
|
+
}
|
|
66
|
+
if (this._overlayElement) {
|
|
67
|
+
this._overlayElement.showPopover();
|
|
68
|
+
if (this.anchor) {
|
|
69
|
+
this._updatePosition();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_hideOverlay() {
|
|
74
|
+
this._overlayElement?.hidePopover();
|
|
75
|
+
this._cleanup();
|
|
76
|
+
}
|
|
77
|
+
_updatePosition() {
|
|
78
|
+
if (!this.anchor || !this._overlayElement) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this._cleanup();
|
|
82
|
+
const middleware = [...this.flip ? [flip()] : [], ...this.shift ? [shift({ padding: 8 })] : []];
|
|
83
|
+
this._cleanupAutoUpdate = autoUpdate(this.anchor, this._overlayElement, () => this._computePosition(middleware));
|
|
84
|
+
}
|
|
85
|
+
async _computePosition(middleware) {
|
|
86
|
+
if (!this.anchor || !this._overlayElement) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const result = await computePosition(this.anchor, this._overlayElement, {
|
|
91
|
+
placement: this.placement,
|
|
92
|
+
middleware
|
|
93
|
+
});
|
|
94
|
+
Object.assign(this._overlayElement.style, {
|
|
95
|
+
left: "0",
|
|
96
|
+
top: "0",
|
|
97
|
+
translate: `${this._roundByDPR(result.x)}px ${this._roundByDPR(result.y)}px`
|
|
98
|
+
});
|
|
99
|
+
this.setAttribute("data-position-placement", result.placement);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error("Failed to compute overlay position:", error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
_roundByDPR(value) {
|
|
105
|
+
const dpr = window.devicePixelRatio || 1;
|
|
106
|
+
return Math.round(value * dpr) / dpr;
|
|
107
|
+
}
|
|
108
|
+
_cleanup() {
|
|
109
|
+
this._cleanupAutoUpdate?.();
|
|
110
|
+
this._cleanupAutoUpdate = null;
|
|
111
|
+
this.removeAttribute("data-position-placement");
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
return html`
|
|
115
|
+
<div class="ai-overlay" popover="manual" @toggle=${this._onToggle}>
|
|
116
|
+
<slot></slot>
|
|
117
|
+
</div>
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
ForgeAiOverlayComponent.styles = unsafeCSS(styles);
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property({ type: Object })
|
|
124
|
+
], ForgeAiOverlayComponent.prototype, "anchor", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
property()
|
|
127
|
+
], ForgeAiOverlayComponent.prototype, "placement", 2);
|
|
128
|
+
__decorateClass([
|
|
129
|
+
property({ type: Boolean })
|
|
130
|
+
], ForgeAiOverlayComponent.prototype, "flip", 2);
|
|
131
|
+
__decorateClass([
|
|
132
|
+
property({ type: Boolean })
|
|
133
|
+
], ForgeAiOverlayComponent.prototype, "shift", 2);
|
|
134
|
+
__decorateClass([
|
|
135
|
+
property({ type: Boolean, reflect: true })
|
|
136
|
+
], ForgeAiOverlayComponent.prototype, "open", 2);
|
|
137
|
+
ForgeAiOverlayComponent = __decorateClass([
|
|
138
|
+
customElement("forge-ai-overlay")
|
|
139
|
+
], ForgeAiOverlayComponent);
|
|
140
|
+
export {
|
|
141
|
+
ForgeAiOverlayComponent
|
|
142
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const styles = ":host {\n display: contents;\n}\n\n.ai-overlay {\n position: relative;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n border: none;\n background: inherit;\n color: inherit;\n border-radius: inherit;\n overflow: visible;\n}\n.ai-overlay[popover] {\n inset: unset;\n}";
|
|
2
|
+
export {
|
|
3
|
+
styles as default
|
|
4
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ForgeAiPopoverComponent, type PopoverPlacement } from './popover.js';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import { OverlayPlacement } from '../overlay/overlay.js';
|
|
3
|
+
declare global {
|
|
4
|
+
interface HTMLElementTagNameMap {
|
|
5
|
+
'forge-ai-popover': ForgeAiPopoverComponent;
|
|
6
|
+
}
|
|
7
|
+
interface HTMLElementEventMap {
|
|
8
|
+
'ai-popover-toggle': CustomEvent<{
|
|
9
|
+
open: boolean;
|
|
10
|
+
newState: string;
|
|
11
|
+
oldState: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export type PopoverPlacement = OverlayPlacement;
|
|
16
|
+
/**
|
|
17
|
+
* @summary A popover component that provides styled overlay functionality.
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* This component wraps the base overlay component with popover-specific styling
|
|
21
|
+
* including animations, shadows, and rounded corners.
|
|
22
|
+
*
|
|
23
|
+
* @since 1.2.0
|
|
24
|
+
*
|
|
25
|
+
* @cssprop --ai-popover-max-width - The maximum width of the popover.
|
|
26
|
+
* @cssprop --ai-popover-max-height - The maximum height of the popover.
|
|
27
|
+
* @cssprop --ai-popover-min-width - The minimum width of the popover.
|
|
28
|
+
* @cssprop --ai-popover-min-height - The minimum height of the popover.
|
|
29
|
+
*
|
|
30
|
+
* @slot - The default slot for popover content.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ForgeAiPopoverComponent extends LitElement {
|
|
33
|
+
static styles: import('lit').CSSResult;
|
|
34
|
+
/**
|
|
35
|
+
* The anchor element to position the popover relative to.
|
|
36
|
+
*/
|
|
37
|
+
anchor: Element | null;
|
|
38
|
+
/**
|
|
39
|
+
* The placement of the popover relative to the anchor.
|
|
40
|
+
*/
|
|
41
|
+
placement: PopoverPlacement;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the popover should flip to the opposite side when there's no space.
|
|
44
|
+
*/
|
|
45
|
+
flip: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the popover should shift to stay in view.
|
|
48
|
+
*/
|
|
49
|
+
shift: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the popover is open.
|
|
52
|
+
*/
|
|
53
|
+
open: boolean;
|
|
54
|
+
private _onOverlayToggle;
|
|
55
|
+
render(): TemplateResult;
|
|
56
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { unsafeCSS, LitElement, html } from "lit";
|
|
2
|
+
import { property, customElement } from "lit/decorators.js";
|
|
3
|
+
import "../overlay/overlay.mjs";
|
|
4
|
+
import styles from "./popover.scss.mjs";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
let ForgeAiPopoverComponent = class extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.anchor = null;
|
|
19
|
+
this.placement = "bottom-start";
|
|
20
|
+
this.flip = true;
|
|
21
|
+
this.shift = false;
|
|
22
|
+
this.open = false;
|
|
23
|
+
this._onOverlayToggle = (event) => {
|
|
24
|
+
this.open = event.detail.open;
|
|
25
|
+
this.dispatchEvent(
|
|
26
|
+
new CustomEvent("ai-popover-toggle", {
|
|
27
|
+
detail: event.detail,
|
|
28
|
+
bubbles: true,
|
|
29
|
+
composed: true
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return html`
|
|
36
|
+
<forge-ai-overlay
|
|
37
|
+
.anchor=${this.anchor}
|
|
38
|
+
.placement=${this.placement}
|
|
39
|
+
.flip=${this.flip}
|
|
40
|
+
.shift=${this.shift}
|
|
41
|
+
.open=${this.open}
|
|
42
|
+
@ai-overlay-toggle=${this._onOverlayToggle}>
|
|
43
|
+
<div class="ai-popover">
|
|
44
|
+
<slot></slot>
|
|
45
|
+
</div>
|
|
46
|
+
</forge-ai-overlay>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
ForgeAiPopoverComponent.styles = unsafeCSS(styles);
|
|
51
|
+
__decorateClass([
|
|
52
|
+
property({ type: Object })
|
|
53
|
+
], ForgeAiPopoverComponent.prototype, "anchor", 2);
|
|
54
|
+
__decorateClass([
|
|
55
|
+
property()
|
|
56
|
+
], ForgeAiPopoverComponent.prototype, "placement", 2);
|
|
57
|
+
__decorateClass([
|
|
58
|
+
property({ type: Boolean })
|
|
59
|
+
], ForgeAiPopoverComponent.prototype, "flip", 2);
|
|
60
|
+
__decorateClass([
|
|
61
|
+
property({ type: Boolean })
|
|
62
|
+
], ForgeAiPopoverComponent.prototype, "shift", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
property({ type: Boolean, reflect: true })
|
|
65
|
+
], ForgeAiPopoverComponent.prototype, "open", 2);
|
|
66
|
+
ForgeAiPopoverComponent = __decorateClass([
|
|
67
|
+
customElement("forge-ai-popover")
|
|
68
|
+
], ForgeAiPopoverComponent);
|
|
69
|
+
export {
|
|
70
|
+
ForgeAiPopoverComponent
|
|
71
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n:host {\n display: contents;\n overflow: visible;\n}\n\n.ai-popover {\n background: var(--forge-theme-surface-bright, #ffffff);\n border-radius: calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1));\n box-shadow: var(--forge-theme-surface-bright-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));\n box-sizing: border-box;\n animation-duration: 150ms;\n animation-timing-function: cubic-bezier(0, 0, 0, 1);\n animation-name: fadein, scalein;\n transform-origin: center center;\n}\n\nforge-ai-overlay[data-position-placement^=top]:not([data-position-placement*="-"]) .ai-popover {\n transform-origin: bottom center;\n}\nforge-ai-overlay[data-position-placement^=top][data-position-placement$=-start] .ai-popover {\n transform-origin: bottom left;\n}\nforge-ai-overlay[data-position-placement^=top][data-position-placement$=-end] .ai-popover {\n transform-origin: bottom right;\n}\n\nforge-ai-overlay[data-position-placement^=right]:not([data-position-placement*="-"]) .ai-popover {\n transform-origin: left center;\n}\nforge-ai-overlay[data-position-placement^=right][data-position-placement$=-start] .ai-popover {\n transform-origin: left top;\n}\nforge-ai-overlay[data-position-placement^=right][data-position-placement$=-end] .ai-popover {\n transform-origin: left bottom;\n}\n\nforge-ai-overlay[data-position-placement^=bottom]:not([data-position-placement*="-"]) .ai-popover {\n transform-origin: top center;\n}\nforge-ai-overlay[data-position-placement^=bottom][data-position-placement$=-start] .ai-popover {\n transform-origin: top left;\n}\nforge-ai-overlay[data-position-placement^=bottom][data-position-placement$=-end] .ai-popover {\n transform-origin: top right;\n}\n\nforge-ai-overlay[data-position-placement^=left]:not([data-position-placement*="-"]) .ai-popover {\n transform-origin: right center;\n}\nforge-ai-overlay[data-position-placement^=left][data-position-placement$=-start] .ai-popover {\n transform-origin: right top;\n}\nforge-ai-overlay[data-position-placement^=left][data-position-placement$=-end] .ai-popover {\n transform-origin: right bottom;\n}\n\n@keyframes fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes scalein {\n from {\n transform: scale(0.8);\n }\n to {\n transform: scale(1);\n }\n}';
|
|
2
|
+
export {
|
|
3
|
+
styles as default
|
|
4
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ForgeAiTooltipComponent, type TooltipPlacement, type TooltipTrigger } from './tooltip.js';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import { OverlayPlacement } from '../overlay/overlay.js';
|
|
3
|
+
declare global {
|
|
4
|
+
interface HTMLElementTagNameMap {
|
|
5
|
+
'forge-ai-tooltip': ForgeAiTooltipComponent;
|
|
6
|
+
}
|
|
7
|
+
interface HTMLElementEventMap {
|
|
8
|
+
'ai-tooltip-toggle': CustomEvent<{
|
|
9
|
+
open: boolean;
|
|
10
|
+
newState: string;
|
|
11
|
+
oldState: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export type TooltipPlacement = OverlayPlacement;
|
|
16
|
+
export type TooltipTrigger = 'hover' | 'focus' | 'click' | 'manual';
|
|
17
|
+
/**
|
|
18
|
+
* @summary A tooltip component with accessibility features and dynamic positioning.
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* This component provides tooltip functionality with proper accessibility support.
|
|
22
|
+
* When closed, the content is visually hidden but available to screen readers.
|
|
23
|
+
* When open, it displays in a positioned overlay above other content.
|
|
24
|
+
*
|
|
25
|
+
* @since 1.2.0
|
|
26
|
+
*
|
|
27
|
+
* @cssprop --ai-tooltip-max-width - The maximum width of the tooltip.
|
|
28
|
+
* @cssprop --ai-tooltip-z-index - The z-index of the tooltip overlay.
|
|
29
|
+
*
|
|
30
|
+
* @slot - The default slot for tooltip content.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ForgeAiTooltipComponent extends LitElement {
|
|
33
|
+
#private;
|
|
34
|
+
static styles: import('lit').CSSResult;
|
|
35
|
+
/**
|
|
36
|
+
* The ID of the anchor element to attach the tooltip to.
|
|
37
|
+
*/
|
|
38
|
+
for: string;
|
|
39
|
+
/**
|
|
40
|
+
* The text content of the tooltip (alternative to slotted content).
|
|
41
|
+
*/
|
|
42
|
+
text: string;
|
|
43
|
+
/**
|
|
44
|
+
* The placement of the tooltip relative to the anchor.
|
|
45
|
+
*/
|
|
46
|
+
placement: TooltipPlacement;
|
|
47
|
+
/**
|
|
48
|
+
* How the tooltip should be triggered.
|
|
49
|
+
*/
|
|
50
|
+
trigger: TooltipTrigger;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the tooltip is open.
|
|
53
|
+
*/
|
|
54
|
+
open: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Delay in milliseconds before showing the tooltip.
|
|
57
|
+
*/
|
|
58
|
+
delay: number;
|
|
59
|
+
/**
|
|
60
|
+
* Delay in milliseconds before hiding the tooltip.
|
|
61
|
+
*/
|
|
62
|
+
hideDelay: number;
|
|
63
|
+
private _anchorElement;
|
|
64
|
+
private _showTimeout;
|
|
65
|
+
private _hideTimeout;
|
|
66
|
+
connectedCallback(): void;
|
|
67
|
+
disconnectedCallback(): void;
|
|
68
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
69
|
+
private _findAnchorElement;
|
|
70
|
+
private _updateHostAttributes;
|
|
71
|
+
private _attachEventListeners;
|
|
72
|
+
private _detachEventListeners;
|
|
73
|
+
private _handleShow;
|
|
74
|
+
private _handleHide;
|
|
75
|
+
private _handleToggle;
|
|
76
|
+
private _clearTimeouts;
|
|
77
|
+
private _onOverlayToggle;
|
|
78
|
+
/**
|
|
79
|
+
* Show the tooltip programmatically.
|
|
80
|
+
*/
|
|
81
|
+
show(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Hide the tooltip programmatically.
|
|
84
|
+
*/
|
|
85
|
+
hide(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Toggle the tooltip programmatically.
|
|
88
|
+
*/
|
|
89
|
+
toggle(): void;
|
|
90
|
+
render(): TemplateResult;
|
|
91
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { unsafeCSS, LitElement, html } from "lit";
|
|
2
|
+
import { property, state, customElement } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import "../overlay/overlay.mjs";
|
|
5
|
+
import styles from "./tooltip.scss.mjs";
|
|
6
|
+
import { when } from "lit/directives/when.js";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __typeError = (msg) => {
|
|
10
|
+
throw TypeError(msg);
|
|
11
|
+
};
|
|
12
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
14
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
+
if (decorator = decorators[i])
|
|
16
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
17
|
+
if (kind && result) __defProp(target, key, result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
21
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
22
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
23
|
+
var _ForgeAiTooltipComponent_instances, tooltipContent_get;
|
|
24
|
+
let ForgeAiTooltipComponent = class extends LitElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
__privateAdd(this, _ForgeAiTooltipComponent_instances);
|
|
28
|
+
this.for = "";
|
|
29
|
+
this.text = "";
|
|
30
|
+
this.placement = "top";
|
|
31
|
+
this.trigger = "hover";
|
|
32
|
+
this.open = false;
|
|
33
|
+
this.delay = 500;
|
|
34
|
+
this.hideDelay = 0;
|
|
35
|
+
this._anchorElement = null;
|
|
36
|
+
this._showTimeout = null;
|
|
37
|
+
this._hideTimeout = null;
|
|
38
|
+
this._handleShow = () => {
|
|
39
|
+
this._clearTimeouts();
|
|
40
|
+
if (this.delay > 0) {
|
|
41
|
+
this._showTimeout = window.setTimeout(() => {
|
|
42
|
+
this.open = true;
|
|
43
|
+
}, this.delay);
|
|
44
|
+
} else {
|
|
45
|
+
this.open = true;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this._handleHide = () => {
|
|
49
|
+
this._clearTimeouts();
|
|
50
|
+
if (this.hideDelay > 0) {
|
|
51
|
+
this._hideTimeout = window.setTimeout(() => {
|
|
52
|
+
this.open = false;
|
|
53
|
+
}, this.hideDelay);
|
|
54
|
+
} else {
|
|
55
|
+
this.open = false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this._handleToggle = () => {
|
|
59
|
+
this.open = !this.open;
|
|
60
|
+
};
|
|
61
|
+
this._onOverlayToggle = (event) => {
|
|
62
|
+
this.open = event.detail.open;
|
|
63
|
+
this.dispatchEvent(
|
|
64
|
+
new CustomEvent("ai-tooltip-toggle", {
|
|
65
|
+
detail: event.detail,
|
|
66
|
+
bubbles: true,
|
|
67
|
+
composed: true
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
super.connectedCallback();
|
|
74
|
+
this._findAnchorElement();
|
|
75
|
+
this._attachEventListeners();
|
|
76
|
+
this._updateHostAttributes();
|
|
77
|
+
if (!this._anchorElement && this.for) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
this._findAnchorElement();
|
|
80
|
+
this._attachEventListeners();
|
|
81
|
+
}, 0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
disconnectedCallback() {
|
|
85
|
+
super.disconnectedCallback();
|
|
86
|
+
this._detachEventListeners();
|
|
87
|
+
this._clearTimeouts();
|
|
88
|
+
}
|
|
89
|
+
updated(changedProperties) {
|
|
90
|
+
if (changedProperties.has("for")) {
|
|
91
|
+
this._detachEventListeners();
|
|
92
|
+
this._findAnchorElement();
|
|
93
|
+
this._attachEventListeners();
|
|
94
|
+
}
|
|
95
|
+
if (changedProperties.has("open")) {
|
|
96
|
+
this._updateHostAttributes();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
_findAnchorElement() {
|
|
100
|
+
if (!this.for) {
|
|
101
|
+
this._anchorElement = null;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this._anchorElement = document.getElementById(this.for);
|
|
105
|
+
if (!this._anchorElement) {
|
|
106
|
+
const root = this.getRootNode();
|
|
107
|
+
if (root !== document && "querySelector" in root) {
|
|
108
|
+
this._anchorElement = root.querySelector(`#${this.for}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!this._anchorElement) {
|
|
112
|
+
console.warn(`Tooltip anchor element with id "${this.for}" not found`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
_updateHostAttributes() {
|
|
116
|
+
this.setAttribute("role", this.open ? "tooltip" : "none");
|
|
117
|
+
this.setAttribute("aria-hidden", String(!this.open));
|
|
118
|
+
if (this.open) {
|
|
119
|
+
this.setAttribute("aria-live", "polite");
|
|
120
|
+
} else {
|
|
121
|
+
this.removeAttribute("aria-live");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
_attachEventListeners() {
|
|
125
|
+
if (!this._anchorElement) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
switch (this.trigger) {
|
|
129
|
+
case "hover":
|
|
130
|
+
this._anchorElement.addEventListener("mouseenter", this._handleShow);
|
|
131
|
+
this._anchorElement.addEventListener("mouseleave", this._handleHide);
|
|
132
|
+
break;
|
|
133
|
+
case "focus":
|
|
134
|
+
this._anchorElement.addEventListener("focusin", this._handleShow);
|
|
135
|
+
this._anchorElement.addEventListener("focusout", this._handleHide);
|
|
136
|
+
break;
|
|
137
|
+
case "click":
|
|
138
|
+
this._anchorElement.addEventListener("click", this._handleToggle);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
_detachEventListeners() {
|
|
143
|
+
if (!this._anchorElement) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this._anchorElement.removeEventListener("mouseenter", this._handleShow);
|
|
147
|
+
this._anchorElement.removeEventListener("mouseleave", this._handleHide);
|
|
148
|
+
this._anchorElement.removeEventListener("focusin", this._handleShow);
|
|
149
|
+
this._anchorElement.removeEventListener("focusout", this._handleHide);
|
|
150
|
+
this._anchorElement.removeEventListener("click", this._handleToggle);
|
|
151
|
+
}
|
|
152
|
+
_clearTimeouts() {
|
|
153
|
+
if (this._showTimeout) {
|
|
154
|
+
clearTimeout(this._showTimeout);
|
|
155
|
+
this._showTimeout = null;
|
|
156
|
+
}
|
|
157
|
+
if (this._hideTimeout) {
|
|
158
|
+
clearTimeout(this._hideTimeout);
|
|
159
|
+
this._hideTimeout = null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Show the tooltip programmatically.
|
|
164
|
+
*/
|
|
165
|
+
show() {
|
|
166
|
+
this.open = true;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Hide the tooltip programmatically.
|
|
170
|
+
*/
|
|
171
|
+
hide() {
|
|
172
|
+
this.open = false;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Toggle the tooltip programmatically.
|
|
176
|
+
*/
|
|
177
|
+
toggle() {
|
|
178
|
+
this.open = !this.open;
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
const contentClasses = {
|
|
182
|
+
"tooltip-content": true,
|
|
183
|
+
"tooltip-content--hidden": !this.open
|
|
184
|
+
};
|
|
185
|
+
return html`
|
|
186
|
+
${when(
|
|
187
|
+
this.open,
|
|
188
|
+
() => html` <!-- Overlay for visual presentation when open -->
|
|
189
|
+
<forge-ai-overlay
|
|
190
|
+
.anchor=${this._anchorElement}
|
|
191
|
+
.placement=${this.placement}
|
|
192
|
+
flip
|
|
193
|
+
.open=${this.open}
|
|
194
|
+
@ai-overlay-toggle=${this._onOverlayToggle}>
|
|
195
|
+
<div class="ai-tooltip" data-placement=${this.placement}>${__privateGet(this, _ForgeAiTooltipComponent_instances, tooltipContent_get)}</div>
|
|
196
|
+
</forge-ai-overlay>`,
|
|
197
|
+
() => html`
|
|
198
|
+
<!-- Content shown when closed for accessibility -->
|
|
199
|
+
<div class=${classMap(contentClasses)}>${__privateGet(this, _ForgeAiTooltipComponent_instances, tooltipContent_get)}</div>
|
|
200
|
+
`
|
|
201
|
+
)}
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
_ForgeAiTooltipComponent_instances = /* @__PURE__ */ new WeakSet();
|
|
206
|
+
tooltipContent_get = function() {
|
|
207
|
+
const hasText = this.text.trim().length > 0;
|
|
208
|
+
if (hasText) {
|
|
209
|
+
return html`${this.text}`;
|
|
210
|
+
}
|
|
211
|
+
return html`<slot></slot>`;
|
|
212
|
+
};
|
|
213
|
+
ForgeAiTooltipComponent.styles = unsafeCSS(styles);
|
|
214
|
+
__decorateClass([
|
|
215
|
+
property()
|
|
216
|
+
], ForgeAiTooltipComponent.prototype, "for", 2);
|
|
217
|
+
__decorateClass([
|
|
218
|
+
property()
|
|
219
|
+
], ForgeAiTooltipComponent.prototype, "text", 2);
|
|
220
|
+
__decorateClass([
|
|
221
|
+
property()
|
|
222
|
+
], ForgeAiTooltipComponent.prototype, "placement", 2);
|
|
223
|
+
__decorateClass([
|
|
224
|
+
property()
|
|
225
|
+
], ForgeAiTooltipComponent.prototype, "trigger", 2);
|
|
226
|
+
__decorateClass([
|
|
227
|
+
property({ type: Boolean, reflect: true })
|
|
228
|
+
], ForgeAiTooltipComponent.prototype, "open", 2);
|
|
229
|
+
__decorateClass([
|
|
230
|
+
property({ type: Number })
|
|
231
|
+
], ForgeAiTooltipComponent.prototype, "delay", 2);
|
|
232
|
+
__decorateClass([
|
|
233
|
+
property({ type: Number, attribute: "hide-delay" })
|
|
234
|
+
], ForgeAiTooltipComponent.prototype, "hideDelay", 2);
|
|
235
|
+
__decorateClass([
|
|
236
|
+
state()
|
|
237
|
+
], ForgeAiTooltipComponent.prototype, "_anchorElement", 2);
|
|
238
|
+
ForgeAiTooltipComponent = __decorateClass([
|
|
239
|
+
customElement("forge-ai-tooltip")
|
|
240
|
+
], ForgeAiTooltipComponent);
|
|
241
|
+
export {
|
|
242
|
+
ForgeAiTooltipComponent
|
|
243
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/* prettier-ignore */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n@keyframes slidein {\n from {\n opacity: 0;\n transform: translateX(var(--_tooltip-slidein-x)) translateY(var(--_tooltip-slidein-y));\n }\n to {\n opacity: 1;\n transform: translateX(0) translateY(0);\n }\n}\n:host {\n display: inline-block;\n position: relative;\n}\n\n.ai-tooltip {\n --_tooltip-slidein-x: 0;\n --_tooltip-slidein-y: 0;\n --_tooltip-background: var(--forge-tooltip-background, var(--forge-theme-surface-inverse, #333333));\n --_tooltip-color: var(--forge-tooltip-color, var(--forge-theme-on-surface-inverse, #ffffff));\n --_tooltip-shape: var(--forge-tooltip-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));\n --_tooltip-padding: var(--forge-tooltip-padding, var(--forge-spacing-xsmall, 8px));\n --_tooltip-padding-block: var(--forge-tooltip-padding-block, var(--_tooltip-padding));\n --_tooltip-padding-inline: var(--forge-tooltip-padding-inline, var(--_tooltip-padding));\n --_tooltip-width: var(--forge-tooltip-width, max-content);\n --_tooltip-max-width: var(--forge-tooltip-max-width, 320px);\n --_tooltip-elevation: var(--forge-tooltip-elevation, var(--forge-theme-surface-bright-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)));\n --_tooltip-content-align: var(--forge-tooltip-content-align, center);\n --_tooltip-border-width: var(--forge-tooltip-border-width, 0);\n --_tooltip-border-style: var(--forge-tooltip-border-style, solid);\n --_tooltip-border-color: var(--forge-tooltip-border-color, var(--forge-theme-outline, #e0e0e0));\n --_tooltip-animation-timing: var(--forge-tooltip-animation-timing, var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1)));\n --_tooltip-animation-duration: var(--forge-tooltip-animation-duration, var(--forge-animation-duration-short3, 150ms));\n --_tooltip-animation-offset: var(--forge-tooltip-animation-offset, 24px);\n --_tooltip-arrow-size: var(--forge-tooltip-arrow-size, 8px);\n --_tooltip-arrow-height: var(--forge-tooltip-arrow-height, var(--_tooltip-arrow-size));\n --_tooltip-arrow-width: var(--forge-tooltip-arrow-width, var(--_tooltip-arrow-size));\n --_tooltip-arrow-shape: var(--forge-tooltip-arrow-shape, calc(var(--forge-shape-small, 2px) * var(--forge-shape-factor, 1)));\n --_tooltip-arrow-rotation: var(--forge-tooltip-arrow-rotation, 0deg);\n --_tooltip-arrow-top-rotation: var(--forge-tooltip-arrow-top-rotation, 315deg);\n --_tooltip-arrow-right-rotation: var(--forge-tooltip-arrow-right-rotation, 45deg);\n --_tooltip-arrow-bottom-rotation: var(--forge-tooltip-arrow-bottom-rotation, 135deg);\n --_tooltip-arrow-left-rotation: var(--forge-tooltip-arrow-left-rotation, 225deg);\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-body1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-body1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-font-size-scale, 0.875)));\n font-weight: var(--forge-typography-body1-font-weight, 400);\n line-height: var(--forge-typography-body1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-line-height-scale, 1.125)));\n letter-spacing: var(--forge-typography-body1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-body1-text-transform, inherit);\n text-decoration: var(--forge-typography-body1-text-decoration, inherit);\n position: relative;\n background: var(--_tooltip-background);\n color: var(--_tooltip-color);\n border-radius: var(--_tooltip-shape);\n border-width: var(--_tooltip-border-width);\n border-style: var(--_tooltip-border-style);\n border-color: var(--_tooltip-border-color);\n padding-block: var(--_tooltip-padding-block);\n padding-inline: var(--_tooltip-padding-inline);\n box-shadow: var(--_tooltip-elevation);\n width: var(--_tooltip-width);\n max-width: var(--_tooltip-max-width);\n text-align: var(--_tooltip-content-align);\n line-height: normal;\n white-space: normal;\n animation-duration: var(--_tooltip-animation-duration);\n animation-timing-function: var(--_tooltip-animation-timing);\n animation-name: slidein;\n animation-fill-mode: forwards;\n}\n\n.tooltip-content--hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n\n@keyframes tooltip-fadein {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}';
|
|
2
|
+
export {
|
|
3
|
+
styles as default
|
|
4
|
+
};
|