@studiocms/ui 0.4.16 → 1.0.0-beta.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.
Files changed (70) hide show
  1. package/dist/components/Accordion/Accordion.astro +1 -0
  2. package/dist/components/Accordion/Item.astro +8 -6
  3. package/dist/components/Accordion/accordion.css +35 -21
  4. package/dist/components/Accordion/accordion.d.ts +46 -1
  5. package/dist/components/Accordion/accordion.js +95 -70
  6. package/dist/components/Badge/Badge.astro +2 -2
  7. package/dist/components/Badge/badge.css +32 -32
  8. package/dist/components/Breadcrumbs/breadcrumbs.css +1 -1
  9. package/dist/components/Button/button.css +93 -93
  10. package/dist/components/Card/card.css +4 -4
  11. package/dist/components/Checkbox/checkbox.css +26 -26
  12. package/dist/components/Divider/Divider.astro +1 -1
  13. package/dist/components/Divider/divider.css +2 -2
  14. package/dist/components/Dropdown/Dropdown.astro +2 -2
  15. package/dist/components/Dropdown/dropdown.css +26 -26
  16. package/dist/components/Footer/footer.css +4 -4
  17. package/dist/components/Icon/Icon.astro +114 -6
  18. package/dist/components/Icon/IconBase.astro +108 -7
  19. package/dist/components/Icon/errors.d.ts +29 -0
  20. package/dist/components/Icon/errors.js +25 -0
  21. package/dist/components/Input/input.css +9 -9
  22. package/dist/components/Modal/Modal.astro +1 -1
  23. package/dist/components/Modal/modal.css +4 -4
  24. package/dist/components/Progress/progress.css +7 -7
  25. package/dist/components/RadioGroup/radiogroup.css +21 -21
  26. package/dist/components/SearchSelect/SearchSelect.astro +29 -27
  27. package/dist/components/SearchSelect/searchselect.css +26 -15
  28. package/dist/components/SearchSelect/searchselect.js +29 -9
  29. package/dist/components/Select/Select.astro +28 -26
  30. package/dist/components/Select/select.css +32 -20
  31. package/dist/components/Select/select.js +1 -1
  32. package/dist/components/Sidebar/Double.astro +4 -4
  33. package/dist/components/Sidebar/Single.astro +2 -2
  34. package/dist/components/Skeleton/Skeleton.astro +61 -0
  35. package/dist/components/Skeleton/skeleton.css +111 -0
  36. package/dist/components/Skeleton/skeleton.d.ts +161 -0
  37. package/dist/components/Skeleton/skeleton.js +71 -0
  38. package/dist/components/Tabs/TabItem.astro +14 -9
  39. package/dist/components/Tabs/Tabs.astro +91 -54
  40. package/dist/components/Tabs/tabs.css +14 -14
  41. package/dist/components/Tabs/tabs.d.ts +17 -1
  42. package/dist/components/Tabs/tabs.js +99 -76
  43. package/dist/components/Textarea/textarea.css +8 -8
  44. package/dist/components/Toast/toaster.css +26 -23
  45. package/dist/components/Toast/toaster.js +4 -0
  46. package/dist/components/Toggle/toggle.css +13 -13
  47. package/dist/components/Tooltip/Tooltip.astro +119 -0
  48. package/dist/components/Tooltip/tooltip.css +187 -0
  49. package/dist/components/Tooltip/tooltip.d.ts +46 -0
  50. package/dist/components/Tooltip/tooltip.js +330 -0
  51. package/dist/components/User/User.astro +1 -1
  52. package/dist/components/User/user.css +3 -3
  53. package/dist/css/colors.css +85 -83
  54. package/dist/css/prose.css +360 -0
  55. package/dist/css/resets.css +3 -3
  56. package/dist/events.d.ts +104 -0
  57. package/dist/index.d.ts +25 -0
  58. package/dist/index.js +120 -313
  59. package/dist/toolbar/index.js +5 -5
  60. package/dist/types/index.d.ts +2 -0
  61. package/dist/utils/iconifyUtils.d.ts +1 -1
  62. package/dist/virtuals.d.js +0 -0
  63. package/dist/virtuals.d.ts +564 -0
  64. package/package.json +5 -1
  65. package/dist/components/Icon/iconType.d.ts +0 -2
  66. package/dist/components/ThemeToggle/ThemeToggle.astro +0 -21
  67. package/dist/components/ThemeToggle/themetoggle.css +0 -17
  68. package/dist/components/ThemeToggle/themetoggle.d.ts +0 -1
  69. package/dist/components/ThemeToggle/themetoggle.js +0 -4
  70. /package/dist/{components/Icon/iconType.js → events.d.js} +0 -0
@@ -0,0 +1,187 @@
1
+ .sui-tooltip-container {
2
+ display: block;
3
+ }
4
+ .sui-tooltip-container.inline {
5
+ display: inline-block;
6
+ }
7
+ .sui-tooltip-popup {
8
+ position: absolute;
9
+ z-index: 1000;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ opacity: 0;
14
+ visibility: hidden;
15
+ border-radius: var(--radius-md);
16
+ padding: 0.5rem 1rem;
17
+ min-width: 250px;
18
+ pointer-events: none;
19
+ }
20
+ .sui-tooltip-popup[data-visible=true] {
21
+ opacity: 1;
22
+ visibility: visible;
23
+ pointer-events: all;
24
+ }
25
+ .sui-tooltip-popup.variant-default,
26
+ .sui-tooltip-popup.variant-outlined {
27
+ border-style: solid;
28
+ border-width: 1px;
29
+ }
30
+ .sui-tooltip-popup.color-default {
31
+ background-color: var(--background-step-3);
32
+ color: var(--text-normal);
33
+ border-color: var(--border);
34
+ }
35
+ .sui-tooltip-popup.color-primary {
36
+ background-color: var(--primary-base);
37
+ color: var(--text-inverted);
38
+ border-color: var(--primary-hover);
39
+ }
40
+ .sui-tooltip-popup.color-success {
41
+ background-color: var(--success-base);
42
+ color: var(--text-dark);
43
+ border-color: var(--success-hover);
44
+ }
45
+ .sui-tooltip-popup.color-warning {
46
+ background-color: var(--warning-base);
47
+ color: var(--text-dark);
48
+ border-color: var(--warning-hover);
49
+ }
50
+ .sui-tooltip-popup.color-danger {
51
+ background-color: var(--danger-base);
52
+ color: var(--text-light);
53
+ border-color: var(--danger-hover);
54
+ }
55
+ .sui-tooltip-popup.color-info {
56
+ background-color: var(--info-base);
57
+ color: var(--text-light);
58
+ border-color: var(--info-hover);
59
+ }
60
+ .sui-tooltip-popup.color-mono {
61
+ background-color: var(--mono-base);
62
+ color: var(--text-inverted);
63
+ border-color: var(--mono-hover);
64
+ }
65
+ .sui-tooltip-popup.color-default.variant-outlined {
66
+ border-color: var(--text-muted);
67
+ background-color: var(--default-base);
68
+ }
69
+ .sui-tooltip-popup.color-primary.variant-outlined {
70
+ border-color: var(--primary-hover);
71
+ background-color: var(--default-base);
72
+ }
73
+ .sui-tooltip-popup.color-success.variant-outlined {
74
+ border-color: var(--success-hover);
75
+ background-color: var(--default-base);
76
+ }
77
+ .sui-tooltip-popup.color-warning.variant-outlined {
78
+ border-color: var(--warning-hover);
79
+ background-color: var(--default-base);
80
+ }
81
+ .sui-tooltip-popup.color-danger.variant-outlined {
82
+ border-color: var(--danger-hover);
83
+ background-color: var(--default-base);
84
+ }
85
+ .sui-tooltip-popup.color-info.variant-outlined {
86
+ border-color: var(--info-hover);
87
+ background-color: var(--default-base);
88
+ }
89
+ .sui-tooltip-popup.color-mono.variant-outlined {
90
+ border-color: var(--mono-hover);
91
+ background-color: var(--default-base);
92
+ }
93
+ .sui-tooltip-popup.animate {
94
+ transition: opacity 0.2s ease-out, visibility 0.2s;
95
+ }
96
+ .sui-tooltip-pointer {
97
+ position: absolute;
98
+ width: 16px;
99
+ height: 16px;
100
+ z-index: 999;
101
+ background-color: var(--background-step-3);
102
+ border: solid 1px var(--border);
103
+ }
104
+ .sui-tooltip-popup.variant-default .sui-tooltip-pointer,
105
+ .sui-tooltip-popup.variant-outlined .sui-tooltip-pointer {
106
+ border-style: solid;
107
+ border-width: 1px;
108
+ }
109
+ .sui-tooltip-popup.color-default .sui-tooltip-pointer {
110
+ background-color: var(--background-step-3);
111
+ border-color: var(--border);
112
+ }
113
+ .sui-tooltip-popup.color-primary .sui-tooltip-pointer {
114
+ background-color: var(--primary-base);
115
+ border-color: var(--primary-hover);
116
+ }
117
+ .sui-tooltip-popup.color-success .sui-tooltip-pointer {
118
+ background-color: var(--success-base);
119
+ border-color: var(--success-hover);
120
+ }
121
+ .sui-tooltip-popup.color-warning .sui-tooltip-pointer {
122
+ background-color: var(--warning-base);
123
+ border-color: var(--warning-hover);
124
+ }
125
+ .sui-tooltip-popup.color-danger .sui-tooltip-pointer {
126
+ background-color: var(--danger-base);
127
+ border-color: var(--danger-hover);
128
+ }
129
+ .sui-tooltip-popup.color-info .sui-tooltip-pointer {
130
+ background-color: var(--info-base);
131
+ border-color: var(--info-hover);
132
+ }
133
+ .sui-tooltip-popup.color-mono .sui-tooltip-pointer {
134
+ background-color: var(--mono-base);
135
+ border-color: var(--mono-hover);
136
+ }
137
+ .sui-tooltip-popup.color-default.variant-outlined .sui-tooltip-pointer {
138
+ border-color: var(--text-muted);
139
+ background-color: var(--default-base);
140
+ }
141
+ .sui-tooltip-popup.color-primary.variant-outlined .sui-tooltip-pointer {
142
+ border-color: var(--primary-hover);
143
+ background-color: var(--default-base);
144
+ }
145
+ .sui-tooltip-popup.color-success.variant-outlined .sui-tooltip-pointer {
146
+ border-color: var(--success-hover);
147
+ }
148
+ .sui-tooltip-popup.color-warning.variant-outlined .sui-tooltip-pointer {
149
+ border-color: var(--warning-hover);
150
+ background-color: var(--default-base);
151
+ }
152
+ .sui-tooltip-popup.color-danger.variant-outlined .sui-tooltip-pointer {
153
+ border-color: var(--danger-hover);
154
+ background-color: var(--default-base);
155
+ }
156
+ .sui-tooltip-popup.color-info.variant-outlined .sui-tooltip-pointer {
157
+ border-color: var(--info-hover);
158
+ background-color: var(--default-base);
159
+ }
160
+ .sui-tooltip-popup.color-mono.variant-outlined .sui-tooltip-pointer {
161
+ border-color: var(--mono-hover);
162
+ background-color: var(--default-base);
163
+ }
164
+ .sui-tooltip-popup.top .sui-tooltip-pointer {
165
+ bottom: -9px;
166
+ transform: rotateZ(45deg);
167
+ border-left: none;
168
+ border-top: none;
169
+ }
170
+ .sui-tooltip-popup.bottom .sui-tooltip-pointer {
171
+ top: -9px;
172
+ transform: rotateZ(45deg);
173
+ border-bottom: none;
174
+ border-right: none;
175
+ }
176
+ .sui-tooltip-popup.left .sui-tooltip-pointer {
177
+ right: -9px;
178
+ transform: rotateZ(45deg);
179
+ border-bottom: none;
180
+ border-left: none;
181
+ }
182
+ .sui-tooltip-popup.right .sui-tooltip-pointer {
183
+ left: -9px;
184
+ transform: rotateZ(45deg);
185
+ border-top: none;
186
+ border-right: none;
187
+ }
@@ -0,0 +1,46 @@
1
+ type Position = 'auto' | 'top' | 'bottom' | 'left' | 'right';
2
+ type Point = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ interface TooltipOptions {
7
+ position: Position;
8
+ defaultOpen?: boolean;
9
+ gap?: number;
10
+ enterDelay?: number;
11
+ exitDelay?: number;
12
+ hoverOnly?: boolean;
13
+ animate?: boolean;
14
+ pointer?: boolean;
15
+ }
16
+ declare class Tooltip {
17
+ #private;
18
+ container: HTMLElement;
19
+ anchor: HTMLElement;
20
+ tooltip: HTMLElement;
21
+ options: TooltipOptions;
22
+ resizeObserver: ResizeObserver | null;
23
+ throttleUpdate: () => void;
24
+ rafId: number | null;
25
+ offset: number;
26
+ isSticky: boolean;
27
+ edgePadding: number;
28
+ constructor(container: HTMLElement | null);
29
+ processOptionsFromAttributes(): TooltipOptions;
30
+ update(): void;
31
+ bindEvents(): void;
32
+ updatePosition(): void;
33
+ updatePointer(position: Position | 'overlap', anchorCenter: Point, tooltipPosition: Point, tooltipWidth: number, tooltipHeight: number): void;
34
+ determinePosition(anchorRect: DOMRect, tooltipWidth: number, tooltipHeight: number): Position | 'overlap';
35
+ isAnchorInViewport(anchorRect: DOMRect): boolean;
36
+ applyViewportConstraints(x: number, y: number, width: number, height: number): Point;
37
+ throttle(fn: (...args: unknown[]) => void, delay: number): () => void;
38
+ show(): void;
39
+ hide(): void;
40
+ getAnchor(): HTMLElement;
41
+ isHoverOnly(): boolean;
42
+ setSticky(sticky: boolean): void;
43
+ isDefaultOpen(): boolean;
44
+ destroy(): void;
45
+ }
46
+ declare function loadTooltips(): void;
@@ -0,0 +1,330 @@
1
+ class Tooltip {
2
+ container;
3
+ anchor;
4
+ tooltip;
5
+ options;
6
+ resizeObserver = null;
7
+ throttleUpdate;
8
+ rafId = null;
9
+ offset;
10
+ isSticky = false;
11
+ edgePadding = 8;
12
+ constructor(container) {
13
+ if (!container) {
14
+ throw new Error("Tooltip: Container element is required.");
15
+ }
16
+ this.container = container;
17
+ this.anchor = container.querySelector("[data-sui-tooltip-anchor]");
18
+ this.tooltip = container.querySelector("[data-sui-tooltip-popup]");
19
+ this.options = this.processOptionsFromAttributes();
20
+ this.offset = this.options.gap ?? 8;
21
+ this.throttleUpdate = this.throttle(() => this.update(), 16);
22
+ this.#init();
23
+ }
24
+ processOptionsFromAttributes() {
25
+ const jsonOptions = this.container.getAttribute("data-sui-tooltip-options");
26
+ let options = {
27
+ position: "auto",
28
+ enterDelay: 0,
29
+ exitDelay: 0,
30
+ hoverOnly: false,
31
+ animate: true,
32
+ pointer: true
33
+ };
34
+ try {
35
+ const parsedOptions = jsonOptions ? JSON.parse(jsonOptions) : {};
36
+ options = { ...options, ...parsedOptions };
37
+ } catch {
38
+ }
39
+ return options;
40
+ }
41
+ #init() {
42
+ this.update();
43
+ this.bindEvents();
44
+ this.container.dataset.initialized = "true";
45
+ }
46
+ update() {
47
+ if (this.rafId) cancelAnimationFrame(this.rafId);
48
+ this.rafId = requestAnimationFrame(() => this.updatePosition());
49
+ }
50
+ bindEvents() {
51
+ window.addEventListener("resize", this.throttleUpdate);
52
+ if (window.ResizeObserver) {
53
+ this.resizeObserver = new ResizeObserver(() => this.update());
54
+ this.resizeObserver.observe(this.tooltip);
55
+ this.resizeObserver.observe(this.anchor);
56
+ }
57
+ }
58
+ updatePosition() {
59
+ const anchorRect = this.anchor.getBoundingClientRect();
60
+ const tooltipWidth = this.tooltip.offsetWidth;
61
+ const tooltipHeight = this.tooltip.offsetHeight;
62
+ const position = this.determinePosition(anchorRect, tooltipWidth, tooltipHeight);
63
+ for (const p of ["top", "bottom", "left", "right", "overlap"]) {
64
+ this.tooltip.classList.toggle(p, p === position);
65
+ }
66
+ let x = null;
67
+ let y = null;
68
+ const anchorCenter = {
69
+ x: anchorRect.left + window.scrollX + anchorRect.width / 2,
70
+ y: anchorRect.top + window.scrollY + anchorRect.height / 2
71
+ };
72
+ switch (position) {
73
+ case "top": {
74
+ x = anchorCenter.x - tooltipWidth / 2;
75
+ y = anchorRect.top + window.scrollY - tooltipHeight - this.offset;
76
+ break;
77
+ }
78
+ case "bottom": {
79
+ x = anchorCenter.x - tooltipWidth / 2;
80
+ y = anchorRect.bottom + window.scrollY + this.offset;
81
+ break;
82
+ }
83
+ case "left": {
84
+ x = anchorRect.left + window.scrollX - tooltipWidth - 12;
85
+ y = anchorCenter.y - tooltipHeight / 2;
86
+ break;
87
+ }
88
+ case "right": {
89
+ x = anchorRect.right + window.scrollX + 12;
90
+ y = anchorCenter.y - tooltipHeight / 2;
91
+ break;
92
+ }
93
+ default: {
94
+ x = anchorCenter.x - tooltipWidth / 2;
95
+ y = anchorRect.top + window.scrollY - tooltipHeight - this.offset;
96
+ break;
97
+ }
98
+ }
99
+ let finalPosition;
100
+ const anchorIsVisible = this.isAnchorInViewport(anchorRect);
101
+ if (anchorIsVisible) {
102
+ finalPosition = this.applyViewportConstraints(x, y, tooltipWidth, tooltipHeight);
103
+ } else {
104
+ finalPosition = { x, y };
105
+ }
106
+ this.tooltip.style.left = `${finalPosition.x}px`;
107
+ this.tooltip.style.top = `${finalPosition.y}px`;
108
+ if (this.options.pointer) {
109
+ this.updatePointer(position, anchorCenter, finalPosition, tooltipWidth, tooltipHeight);
110
+ }
111
+ }
112
+ updatePointer(position, anchorCenter, tooltipPosition, tooltipWidth, tooltipHeight) {
113
+ const arrow = this.tooltip.querySelector(".sui-tooltip-pointer");
114
+ if (!arrow) return;
115
+ arrow.style.left = "";
116
+ arrow.style.top = "";
117
+ const arrowSize = 8;
118
+ if (position === "top" || position === "bottom") {
119
+ const arrowLeft = anchorCenter.x - tooltipPosition.x - arrowSize;
120
+ const min = arrowSize;
121
+ const max = tooltipWidth - arrowSize * 2;
122
+ arrow.style.left = `${Math.max(min, Math.min(arrowLeft, max))}px`;
123
+ } else if (position === "left" || position === "right") {
124
+ const arrowTop = anchorCenter.y - tooltipPosition.y - arrowSize;
125
+ const min = arrowSize;
126
+ const max = tooltipHeight - arrowSize * 2;
127
+ arrow.style.top = `${Math.max(min, Math.min(arrowTop, max))}px`;
128
+ }
129
+ }
130
+ determinePosition(anchorRect, tooltipWidth, tooltipHeight) {
131
+ const position = this.options.position;
132
+ const anchor = anchorRect;
133
+ const space = {
134
+ top: anchor.top - this.offset - this.edgePadding,
135
+ bottom: window.innerHeight - anchor.bottom - this.offset - this.edgePadding,
136
+ left: anchor.left - this.offset - this.edgePadding,
137
+ right: window.innerWidth - anchor.right - this.offset - this.edgePadding
138
+ };
139
+ const canFit = {
140
+ top: space.top >= tooltipHeight,
141
+ bottom: space.bottom >= tooltipHeight,
142
+ left: space.left >= tooltipWidth,
143
+ right: space.right >= tooltipWidth
144
+ };
145
+ const positionHierarchy = {
146
+ top: ["top", "bottom", "right", "left"],
147
+ bottom: ["bottom", "top", "right", "left"],
148
+ left: ["left", "right", "top", "bottom"],
149
+ right: ["right", "left", "top", "bottom"],
150
+ auto: ["top", "bottom", "right", "left"]
151
+ };
152
+ const priority = positionHierarchy[position] || positionHierarchy.auto;
153
+ for (const pos of priority) {
154
+ if (canFit[pos]) {
155
+ return pos;
156
+ }
157
+ }
158
+ return "overlap";
159
+ }
160
+ isAnchorInViewport(anchorRect) {
161
+ return anchorRect.top < window.innerHeight && anchorRect.bottom > 0 && anchorRect.left < window.innerWidth && anchorRect.right > 0;
162
+ }
163
+ applyViewportConstraints(x, y, width, height) {
164
+ const minX = this.edgePadding + window.scrollX;
165
+ const maxX = window.innerWidth - width - this.edgePadding + window.scrollX;
166
+ const finalX = Math.max(minX, Math.min(x, maxX));
167
+ const minY = this.edgePadding + window.scrollY;
168
+ const maxY = window.innerHeight - height - this.edgePadding + window.scrollY;
169
+ const finalY = Math.max(minY, Math.min(y, maxY));
170
+ return {
171
+ x: finalX,
172
+ y: finalY
173
+ };
174
+ }
175
+ throttle(fn, delay) {
176
+ let timeoutId = 0;
177
+ let lastExecTime = 0;
178
+ return (...args) => {
179
+ const currentTime = Date.now();
180
+ const timeSinceLastExec = currentTime - lastExecTime;
181
+ clearTimeout(timeoutId);
182
+ if (timeSinceLastExec >= delay) {
183
+ fn.apply(this, args);
184
+ lastExecTime = currentTime;
185
+ } else {
186
+ timeoutId = window.setTimeout(() => {
187
+ fn.apply(this, args);
188
+ lastExecTime = Date.now();
189
+ }, delay - timeSinceLastExec);
190
+ }
191
+ };
192
+ }
193
+ show() {
194
+ this.tooltip.setAttribute("data-visible", "true");
195
+ this.anchor.setAttribute("aria-describedby", this.tooltip.id);
196
+ this.update();
197
+ }
198
+ hide() {
199
+ this.tooltip.removeAttribute("data-visible");
200
+ this.anchor.removeAttribute("aria-describedby");
201
+ }
202
+ getAnchor() {
203
+ return this.anchor;
204
+ }
205
+ isHoverOnly() {
206
+ return this.options.hoverOnly ?? false;
207
+ }
208
+ setSticky(sticky) {
209
+ this.isSticky = sticky;
210
+ }
211
+ isDefaultOpen() {
212
+ return this.options.defaultOpen ?? false;
213
+ }
214
+ destroy() {
215
+ window.removeEventListener("resize", this.throttleUpdate);
216
+ if (this.resizeObserver) {
217
+ this.resizeObserver.disconnect();
218
+ this.resizeObserver = null;
219
+ }
220
+ if (this.rafId) {
221
+ cancelAnimationFrame(this.rafId);
222
+ this.rafId = null;
223
+ }
224
+ this.anchor.removeAttribute("aria-describedby");
225
+ }
226
+ }
227
+ function loadTooltips() {
228
+ const allTooltipElements = document.querySelectorAll(
229
+ ".sui-tooltip-container[data-sui-tooltip]"
230
+ );
231
+ let activeTooltip = null;
232
+ let enterTimeout;
233
+ let exitTimeout;
234
+ const show = (tooltipInstance, immediate = false) => {
235
+ clearTimeout(exitTimeout);
236
+ const delay = immediate ? 0 : tooltipInstance.options.enterDelay;
237
+ enterTimeout = window.setTimeout(() => {
238
+ if (activeTooltip && activeTooltip !== tooltipInstance) {
239
+ activeTooltip.hide();
240
+ activeTooltip.setSticky(false);
241
+ }
242
+ tooltipInstance.show();
243
+ activeTooltip = tooltipInstance;
244
+ }, delay);
245
+ };
246
+ const hide = (tooltipInstance) => {
247
+ clearTimeout(enterTimeout);
248
+ exitTimeout = window.setTimeout(() => {
249
+ tooltipInstance.hide();
250
+ tooltipInstance.setSticky(false);
251
+ if (activeTooltip === tooltipInstance) {
252
+ activeTooltip = null;
253
+ }
254
+ }, tooltipInstance.options.exitDelay);
255
+ };
256
+ for (const element of allTooltipElements) {
257
+ if (element.dataset.initialized) continue;
258
+ const tooltipInstance = new Tooltip(element);
259
+ const anchor = tooltipInstance.getAnchor();
260
+ const popup = tooltipInstance.tooltip;
261
+ window.sui.tooltips.instances.set(tooltipInstance.container.id, tooltipInstance);
262
+ anchor.addEventListener("mouseenter", () => {
263
+ if (!tooltipInstance.isSticky) {
264
+ show(tooltipInstance);
265
+ }
266
+ });
267
+ anchor.addEventListener("focus", () => {
268
+ if (!tooltipInstance.isSticky) {
269
+ show(tooltipInstance);
270
+ }
271
+ });
272
+ anchor.addEventListener("mouseleave", () => {
273
+ if (!tooltipInstance.isSticky) {
274
+ hide(tooltipInstance);
275
+ }
276
+ });
277
+ anchor.addEventListener("blur", () => {
278
+ if (!tooltipInstance.isSticky) {
279
+ hide(tooltipInstance);
280
+ }
281
+ });
282
+ anchor.addEventListener("click", (e) => {
283
+ e.stopPropagation();
284
+ if (tooltipInstance.isSticky) {
285
+ hide(tooltipInstance);
286
+ } else {
287
+ show(tooltipInstance);
288
+ tooltipInstance.setSticky(true);
289
+ }
290
+ });
291
+ popup.addEventListener("mouseenter", () => clearTimeout(exitTimeout));
292
+ popup.addEventListener("mouseleave", () => {
293
+ if (!tooltipInstance.isSticky) {
294
+ hide(tooltipInstance);
295
+ }
296
+ });
297
+ if (tooltipInstance.isDefaultOpen()) {
298
+ show(tooltipInstance, true);
299
+ tooltipInstance.setSticky(true);
300
+ }
301
+ }
302
+ document.addEventListener("click", (e) => {
303
+ if (activeTooltip?.isSticky && !activeTooltip.getAnchor().contains(e.target) && !activeTooltip.tooltip.contains(e.target)) {
304
+ hide(activeTooltip);
305
+ }
306
+ });
307
+ document.addEventListener("keydown", (e) => {
308
+ if (e.key === "Escape" && activeTooltip) {
309
+ hide(activeTooltip);
310
+ }
311
+ });
312
+ }
313
+ window.sui = window.sui ?? {};
314
+ window.sui.tooltips = {
315
+ instances: /* @__PURE__ */ new Map(),
316
+ get: function(id) {
317
+ return this.instances.get(id);
318
+ },
319
+ show: function(id) {
320
+ const instance = this.get(id);
321
+ if (instance) {
322
+ instance.show();
323
+ instance.setSticky(true);
324
+ }
325
+ },
326
+ hide: function(id) {
327
+ this.get(id)?.hide();
328
+ }
329
+ };
330
+ document.addEventListener("astro:page-load", loadTooltips);
@@ -37,7 +37,7 @@ const { name, description, avatar, class: className, loading = 'lazy' } = Astro.
37
37
  {avatar ? (
38
38
  <Image src={avatar} inferSize loading={loading} alt={name} class="sui-avatar-img" />
39
39
  ) : (
40
- <Icon name='user' width={24} height={24} role='img' aria-label={`Placeholder avatar for ${name}`} />
40
+ <Icon name='heroicons:user' width={24} height={24} role='img' aria-label={`Placeholder avatar for ${name}`} />
41
41
  )}
42
42
  </div>
43
43
  <div class="sui-text-content">
@@ -7,13 +7,13 @@
7
7
  .sui-avatar-container {
8
8
  width: 2.5rem;
9
9
  height: 2.5rem;
10
- background-color: hsl(var(--default-base));
10
+ background-color: var(--default-base);
11
11
  border-radius: var(--radius-full);
12
12
  display: flex;
13
13
  align-items: center;
14
14
  justify-content: center;
15
15
  overflow: hidden;
16
- border: 1px solid hsl(var(--border));
16
+ border: 1px solid var(--border);
17
17
  }
18
18
  .sui-avatar-img {
19
19
  width: 100%;
@@ -31,5 +31,5 @@
31
31
  .sui-description {
32
32
  font-size: .875em;
33
33
  font-weight: 400;
34
- color: hsl(var(--text-muted));
34
+ color: var(--text-muted);
35
35
  }