@antadesign/anta 0.3.2 → 0.3.4
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/anta_helpers.d.ts +97 -0
- package/dist/anta_helpers.js +70 -0
- package/dist/calendar-core.d.ts +126 -0
- package/dist/calendar-core.js +289 -0
- package/dist/components/Button.d.ts +9 -1
- package/dist/components/Button.js +5 -2
- package/dist/components/Calendar.d.ts +85 -0
- package/dist/components/Calendar.js +226 -0
- package/dist/components/Checkbox.d.ts +16 -11
- package/dist/components/Checkbox.js +13 -7
- package/dist/components/Expander.d.ts +7 -1
- package/dist/components/Expander.js +4 -2
- package/dist/components/Input.d.ts +13 -5
- package/dist/components/Input.js +14 -6
- package/dist/components/InputDate.d.ts +89 -0
- package/dist/components/InputDate.js +273 -0
- package/dist/components/InputDate.module.css +1 -0
- package/dist/components/Menu.d.ts +14 -1
- package/dist/components/Menu.js +6 -2
- package/dist/components/MenuItem.d.ts +48 -7
- package/dist/components/MenuItem.js +72 -14
- package/dist/components/MenuSeparator.d.ts +13 -2
- package/dist/components/MenuSeparator.js +12 -2
- package/dist/components/Progress.d.ts +4 -1
- package/dist/components/Progress.js +4 -3
- package/dist/components/RadioGroup.d.ts +12 -10
- package/dist/components/RadioGroup.js +5 -5
- package/dist/components/Select.d.ts +319 -0
- package/dist/components/Select.js +341 -0
- package/dist/components/Select.module.css +1 -0
- package/dist/components/Tab.d.ts +3 -0
- package/dist/components/Tab.js +2 -1
- package/dist/components/TabPanel.d.ts +21 -13
- package/dist/components/TabPanel.js +13 -1
- package/dist/components/Tabs.d.ts +75 -40
- package/dist/components/Tabs.js +20 -88
- package/dist/components/Tag.d.ts +10 -9
- package/dist/components/Tag.js +2 -2
- package/dist/components/Text.d.ts +6 -5
- package/dist/components/Title.d.ts +4 -2
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +5 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-calendar.css +1 -0
- package/dist/elements/a-calendar.d.ts +76 -0
- package/dist/elements/a-calendar.js +190 -0
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.d.ts +1 -2
- package/dist/elements/a-checkbox.js +5 -5
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.d.ts +16 -5
- package/dist/elements/a-expander.js +59 -8
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +6 -1
- package/dist/elements/a-icon.shapes.js +9 -0
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.d.ts +6 -0
- package/dist/elements/a-input.js +28 -8
- package/dist/elements/a-menu-group.css +1 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.d.ts +22 -10
- package/dist/elements/a-menu-item.js +17 -0
- package/dist/elements/a-menu-separator.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +61 -20
- package/dist/elements/a-menu.js +337 -58
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio-group.d.ts +1 -3
- package/dist/elements/a-radio-group.js +13 -13
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-radio.d.ts +3 -11
- package/dist/elements/a-radio.js +3 -34
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tab.d.ts +3 -11
- package/dist/elements/a-tab.js +3 -34
- package/dist/elements/a-tabpanel.css +1 -1
- package/dist/elements/a-tabpanel.d.ts +17 -0
- package/dist/elements/a-tabpanel.js +66 -0
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tabs.d.ts +1 -4
- package/dist/elements/a-tabs.js +14 -14
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.d.ts +14 -13
- package/dist/elements/a-text.js +53 -23
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +1 -11
- package/dist/elements/a-tooltip.js +20 -19
- package/dist/elements/index.d.ts +2 -1
- package/dist/elements/index.js +6 -1
- package/dist/general_types.d.ts +158 -42
- package/dist/index.d.ts +10 -4
- package/dist/index.js +38 -3
- package/dist/jsx-runtime.d.ts +16 -7
- package/dist/jsx-runtime.js +6 -0
- package/dist/reset.css +1 -1
- package/package.json +4 -2
package/dist/elements/a-text.js
CHANGED
|
@@ -20,12 +20,12 @@ const SHADOW_STYLE = `
|
|
|
20
20
|
overflow: hidden;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
:host([truncate][expandable]) slot:not(.expanded) {
|
|
23
|
+
:host([truncate][expandable]) slot.overflowing:not(.expanded) {
|
|
24
24
|
-webkit-mask-image: linear-gradient(to bottom, black calc(100% - 2em), transparent 97%);
|
|
25
25
|
mask-image: linear-gradient(to bottom, black calc(100% - 2em), transparent 97%);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
:host([truncate="1"][expandable]) slot:not(.expanded) {
|
|
28
|
+
:host([truncate="1"][expandable]) slot.overflowing:not(.expanded) {
|
|
29
29
|
-webkit-mask-image: linear-gradient(to right, black calc(100% - 7ch), transparent 97%);
|
|
30
30
|
mask-image: linear-gradient(to right, black calc(100% - 7ch), transparent 97%);
|
|
31
31
|
}
|
|
@@ -73,7 +73,7 @@ const SHADOW_STYLE = `
|
|
|
73
73
|
transition: transform 150ms ease-out;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
:host([truncate][expandable]) .expand-btn {
|
|
76
|
+
:host([truncate][expandable]) slot.overflowing ~ .expand-btn {
|
|
77
77
|
display: block;
|
|
78
78
|
left: 0;
|
|
79
79
|
right: 0;
|
|
@@ -81,15 +81,15 @@ const SHADOW_STYLE = `
|
|
|
81
81
|
height: 1.5em;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
:host([truncate="1"][expandable]) .expand-btn {
|
|
84
|
+
:host([truncate="1"][expandable]) slot.overflowing ~ .expand-btn {
|
|
85
85
|
left: auto;
|
|
86
86
|
top: 0;
|
|
87
87
|
bottom: 0;
|
|
88
88
|
width: 3em;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
:host([truncate][expandable]:hover) .expand-btn,
|
|
92
|
-
:host([truncate][expandable]:focus-within) .expand-btn,
|
|
91
|
+
:host([truncate][expandable]:hover) slot.overflowing ~ .expand-btn,
|
|
92
|
+
:host([truncate][expandable]:focus-within) slot.overflowing ~ .expand-btn,
|
|
93
93
|
.expand-btn.expanded {
|
|
94
94
|
opacity: 1;
|
|
95
95
|
}
|
|
@@ -101,13 +101,15 @@ const SHADOW_STYLE = `
|
|
|
101
101
|
class ATextElement extends HTMLElementBase {
|
|
102
102
|
static observedAttributes = ["expandable", "truncate", "collapsible"];
|
|
103
103
|
slotEl;
|
|
104
|
-
/** The
|
|
105
|
-
* expandable (a plain `<a-text>` never creates a button or a listener).
|
|
106
|
-
* Removed when `expandable` is dropped, and when a one-way expand completes. */
|
|
104
|
+
/** The chevron — built only while expandable, removed on drop or one-way expand. */
|
|
107
105
|
expandBtn;
|
|
108
|
-
/** Expanded state lives
|
|
109
|
-
* it and the app DOM may be reconciled off the UI thread. */
|
|
106
|
+
/** Expanded state lives on the element — a stateless wrapper can't hold it. */
|
|
110
107
|
expanded = false;
|
|
108
|
+
// Re-sync `slot.overflowing`: the resize observer watches the box (width),
|
|
109
|
+
// the mutation observer watches the slotted content — the clamped box never
|
|
110
|
+
// resizes as content grows, so resize alone misses added lines.
|
|
111
|
+
overflowObserver;
|
|
112
|
+
contentObserver;
|
|
111
113
|
constructor() {
|
|
112
114
|
super();
|
|
113
115
|
const shadow = this.attachShadow({ mode: "open" });
|
|
@@ -118,29 +120,37 @@ class ATextElement extends HTMLElementBase {
|
|
|
118
120
|
}
|
|
119
121
|
connectedCallback() {
|
|
120
122
|
this.syncExpandButton();
|
|
123
|
+
if (this.#isExpandable) this.startOverflowObserver();
|
|
124
|
+
}
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
this.overflowObserver?.disconnect();
|
|
127
|
+
this.contentObserver?.disconnect();
|
|
121
128
|
}
|
|
122
129
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
123
130
|
if (oldValue === newValue) return;
|
|
124
131
|
if (name === "truncate" || name === "expandable") this.setExpanded(false);
|
|
125
132
|
this.syncExpandButton();
|
|
133
|
+
if (name === "truncate" || name === "expandable") {
|
|
134
|
+
if (this.#isExpandable) this.startOverflowObserver();
|
|
135
|
+
else this.stopOverflowObserver();
|
|
136
|
+
}
|
|
126
137
|
}
|
|
127
|
-
get isExpandable() {
|
|
138
|
+
get #isExpandable() {
|
|
128
139
|
return this.hasAttribute("truncate") && this.hasAttribute("expandable");
|
|
129
140
|
}
|
|
130
|
-
get isCollapsible() {
|
|
141
|
+
get #isCollapsible() {
|
|
131
142
|
return this.hasAttribute("collapsible");
|
|
132
143
|
}
|
|
133
|
-
/** Create or remove the chevron
|
|
134
|
-
* its label/visibility — the single place the button's lifecycle lives. */
|
|
144
|
+
/** Create or remove the chevron to match `expandable`, then refresh it. */
|
|
135
145
|
syncExpandButton() {
|
|
136
|
-
if (this
|
|
146
|
+
if (this.#isExpandable && !this.expandBtn) {
|
|
137
147
|
const btn = document.createElement("button");
|
|
138
148
|
btn.className = "expand-btn";
|
|
139
149
|
btn.type = "button";
|
|
140
150
|
btn.addEventListener("click", this.handleToggle);
|
|
141
151
|
this.shadowRoot.append(btn);
|
|
142
152
|
this.expandBtn = btn;
|
|
143
|
-
} else if (!this
|
|
153
|
+
} else if (!this.#isExpandable && this.expandBtn) {
|
|
144
154
|
this.expandBtn.remove();
|
|
145
155
|
this.expandBtn = void 0;
|
|
146
156
|
}
|
|
@@ -154,15 +164,35 @@ class ATextElement extends HTMLElementBase {
|
|
|
154
164
|
this.expanded = next;
|
|
155
165
|
this.slotEl.classList.toggle("expanded", next);
|
|
156
166
|
this.refreshButton();
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
167
|
+
if (!next) this.measureOverflow();
|
|
168
|
+
}
|
|
169
|
+
startOverflowObserver() {
|
|
170
|
+
if (!this.#isExpandable) return;
|
|
171
|
+
this.overflowObserver ??= new ResizeObserver(() => this.measureOverflow());
|
|
172
|
+
this.contentObserver ??= new MutationObserver(() => this.measureOverflow());
|
|
173
|
+
this.overflowObserver.observe(this.slotEl);
|
|
174
|
+
this.contentObserver.observe(this, { childList: true, subtree: true, characterData: true });
|
|
175
|
+
this.measureOverflow();
|
|
176
|
+
}
|
|
177
|
+
stopOverflowObserver() {
|
|
178
|
+
this.overflowObserver?.disconnect();
|
|
179
|
+
this.contentObserver?.disconnect();
|
|
180
|
+
this.slotEl.classList.remove("overflowing");
|
|
181
|
+
}
|
|
182
|
+
/** Toggle `slot.overflowing` (gates the fade + chevron) to whether the clamp
|
|
183
|
+
* clips. Frozen on while expanded; height catches wrapped text, width a long word. */
|
|
184
|
+
measureOverflow() {
|
|
185
|
+
if (!this.#isExpandable || this.expanded) return;
|
|
186
|
+
const s = this.slotEl;
|
|
187
|
+
const over = s.scrollHeight > s.clientHeight + 1 || s.scrollWidth > s.clientWidth + 1;
|
|
188
|
+
s.classList.toggle("overflowing", over);
|
|
189
|
+
}
|
|
190
|
+
/** Reflect state onto the button (label + `aria-expanded` + `.expanded`); a
|
|
191
|
+
* one-way expand removes it once open. */
|
|
162
192
|
refreshButton() {
|
|
163
193
|
const btn = this.expandBtn;
|
|
164
194
|
if (!btn) return;
|
|
165
|
-
if (this.expanded && !this
|
|
195
|
+
if (this.expanded && !this.#isCollapsible) {
|
|
166
196
|
btn.remove();
|
|
167
197
|
this.expandBtn = void 0;
|
|
168
198
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-tooltip:not(:defined){display:none}@media(hover:none)and (pointer:coarse){:where(:has(>a-tooltip)){-webkit-touch-callout:none;user-select:none}}a-tooltip{--tooltip-bg: color-mix(in oklch, var(--bg-1) 80%, transparent);--tooltip-shadow: 0 1px 8px color-mix(in oklch, var(--text-1) 15%, transparent), 0 0 1px color-mix(in oklch, var(--text-1) 50%, transparent);--tooltip-radius: 3px;--tooltip-max-width: min( calc(100vw - 20px) , 80ch);--tooltip-border: none;--tooltip-backdrop-filter: blur(8px)}.dark a-tooltip{--tooltip-bg: color-mix(in oklch, var(--bg-1) 70%, transparent);--tooltip-shadow: 0 2px 16px color-mix(in oklch, black 70%, transparent), inset 0 0 0 1px color-mix(in oklch, white 15%, transparent)}}
|
|
1
|
+
@layer anta{a-tooltip:not(:defined){display:none}@media(hover:none)and (pointer:coarse){:where(:has(>a-tooltip)){-webkit-touch-callout:none;user-select:none}}a-tooltip{--tooltip-bg: color-mix(in oklch, var(--bg-1) 80%, transparent);--tooltip-shadow: 0 1px 8px color-mix(in oklch, var(--text-1) 15%, transparent), 0 0 1px color-mix(in oklch, var(--text-1) 50%, transparent);--tooltip-radius: 3px;--tooltip-max-width: min( calc(100vw - 20px) , 80ch);--tooltip-border: none;--tooltip-backdrop-filter: blur(8px)}a-tooltip[round]{--tooltip-radius: attr(round type(<length>), 20px)}.dark a-tooltip{--tooltip-bg: color-mix(in oklch, var(--bg-1) 70%, transparent);--tooltip-shadow: 0 2px 16px color-mix(in oklch, black 70%, transparent), inset 0 0 0 1px color-mix(in oklch, white 15%, transparent)}}
|
|
@@ -28,6 +28,7 @@ import './a-tooltip.css';
|
|
|
28
28
|
* below) instead of selecting text or popping the system menu.
|
|
29
29
|
*/
|
|
30
30
|
export declare class ATooltipElement extends HTMLElementBase {
|
|
31
|
+
#private;
|
|
31
32
|
static observedAttributes: string[];
|
|
32
33
|
/** Shadow-internal popover surface — the only thing we ever mutate. */
|
|
33
34
|
private container;
|
|
@@ -60,17 +61,6 @@ export declare class ATooltipElement extends HTMLElementBase {
|
|
|
60
61
|
* fed the latest cursor event, so it shows at the cursor and so moving back
|
|
61
62
|
* onto an anchor after the tooltip was dismissed re-arms it. */
|
|
62
63
|
private makeDebouncedShow;
|
|
63
|
-
private get isInteractive();
|
|
64
|
-
/** Pinned under the anchor (no cursor-following) — the DEFAULT. Following the
|
|
65
|
-
* cursor is opt-in via the `follow` attribute. `interactive` (you can't move
|
|
66
|
-
* into a bubble that chases the cursor) and a touch long-press (a finger
|
|
67
|
-
* can't track one) force pinned regardless of `follow`. */
|
|
68
|
-
private get isPinned();
|
|
69
|
-
private get prefersTop();
|
|
70
|
-
private get delay();
|
|
71
|
-
/** When set, the tooltip only shows if its resolved target is actually
|
|
72
|
-
* truncated/clipped; a fitting label gets no tooltip. */
|
|
73
|
-
private get truncatedOnly();
|
|
74
64
|
/** The element whose overflow decides whether the tooltip shows: a
|
|
75
65
|
* `truncated-selector` resolved within the anchor wins; else the first of
|
|
76
66
|
* Anta's ellipsizing label parts inside the anchor; else the anchor itself
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLElementBase } from "../anta_helpers";
|
|
1
|
+
import { HTMLElementBase, anchorRect, isMenuOpen, isInsideOpenMenu } from "../anta_helpers";
|
|
2
2
|
import { debounce } from "es-toolkit";
|
|
3
3
|
import "./a-tooltip.css";
|
|
4
4
|
const MARGIN = 4;
|
|
@@ -164,10 +164,10 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
164
164
|
this.bubble.setAttribute("part", "bubble");
|
|
165
165
|
this.container.append(this.bubble);
|
|
166
166
|
this.container.addEventListener("mouseenter", () => {
|
|
167
|
-
if (this
|
|
167
|
+
if (this.#isInteractive) this.cancelHide();
|
|
168
168
|
});
|
|
169
169
|
this.container.addEventListener("mouseleave", () => {
|
|
170
|
-
if (this
|
|
170
|
+
if (this.#isInteractive && this.shown) this.scheduleHide();
|
|
171
171
|
});
|
|
172
172
|
shadow.append(style, this.container);
|
|
173
173
|
}
|
|
@@ -197,23 +197,23 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
197
197
|
* onto an anchor after the tooltip was dismissed re-arms it. */
|
|
198
198
|
makeDebouncedShow() {
|
|
199
199
|
this.debouncedShow?.cancel();
|
|
200
|
-
this.debouncedShow = debounce((e) => this.show(e), this
|
|
200
|
+
this.debouncedShow = debounce((e) => this.show(e), this.#delay);
|
|
201
201
|
}
|
|
202
|
-
get isInteractive() {
|
|
202
|
+
get #isInteractive() {
|
|
203
203
|
return this.hasAttribute("interactive");
|
|
204
204
|
}
|
|
205
205
|
/** Pinned under the anchor (no cursor-following) — the DEFAULT. Following the
|
|
206
206
|
* cursor is opt-in via the `follow` attribute. `interactive` (you can't move
|
|
207
207
|
* into a bubble that chases the cursor) and a touch long-press (a finger
|
|
208
208
|
* can't track one) force pinned regardless of `follow`. */
|
|
209
|
-
get isPinned() {
|
|
210
|
-
if (this
|
|
209
|
+
get #isPinned() {
|
|
210
|
+
if (this.#isInteractive || this.touchOpen) return true;
|
|
211
211
|
return !this.hasAttribute("follow");
|
|
212
212
|
}
|
|
213
|
-
get prefersTop() {
|
|
213
|
+
get #prefersTop() {
|
|
214
214
|
return this.getAttribute("placement") === "top";
|
|
215
215
|
}
|
|
216
|
-
get delay() {
|
|
216
|
+
get #delay() {
|
|
217
217
|
const attr = this.getAttribute("delay");
|
|
218
218
|
if (attr == null) return DEFAULT_DELAY;
|
|
219
219
|
const n = parseInt(attr, 10);
|
|
@@ -222,7 +222,7 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
222
222
|
// --- truncated-only gating (UI-thread layout READS — no mutation) ---
|
|
223
223
|
/** When set, the tooltip only shows if its resolved target is actually
|
|
224
224
|
* truncated/clipped; a fitting label gets no tooltip. */
|
|
225
|
-
get truncatedOnly() {
|
|
225
|
+
get #truncatedOnly() {
|
|
226
226
|
return this.hasAttribute("truncated-only");
|
|
227
227
|
}
|
|
228
228
|
/** The element whose overflow decides whether the tooltip shows: a
|
|
@@ -294,10 +294,10 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
294
294
|
positionToTarget = () => {
|
|
295
295
|
this.schedulePosition(() => {
|
|
296
296
|
if (!this.anchor || !this.shown) return;
|
|
297
|
-
const a = this.anchor
|
|
297
|
+
const a = anchorRect(this.anchor);
|
|
298
298
|
const box = this.container.getBoundingClientRect();
|
|
299
299
|
const { innerWidth: vw, innerHeight: vh } = this.view;
|
|
300
|
-
const top = this.flipVertical(a.top - box.height - MARGIN, a.bottom + MARGIN, box.height, vh, this
|
|
300
|
+
const top = this.flipVertical(a.top - box.height - MARGIN, a.bottom + MARGIN, box.height, vh, this.#prefersTop || this.touchOpen);
|
|
301
301
|
this.place(a.left, top, box.width, vw);
|
|
302
302
|
});
|
|
303
303
|
};
|
|
@@ -306,12 +306,12 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
306
306
|
if (!this.shown && !this.fading) return;
|
|
307
307
|
const box = this.container.getBoundingClientRect();
|
|
308
308
|
const { innerWidth: vw, innerHeight: vh } = this.view;
|
|
309
|
-
const top = this.flipVertical(e.clientY - box.height - MARGIN * 2, e.clientY + CURSOR_SIZE, box.height, vh, this
|
|
309
|
+
const top = this.flipVertical(e.clientY - box.height - MARGIN * 2, e.clientY + CURSOR_SIZE, box.height, vh, this.#prefersTop);
|
|
310
310
|
this.place(e.clientX - PADDING_X, top, box.width, vw);
|
|
311
311
|
});
|
|
312
312
|
};
|
|
313
313
|
position(e) {
|
|
314
|
-
if (!this
|
|
314
|
+
if (!this.#isPinned && e) this.positionToMouse(e);
|
|
315
315
|
else this.positionToTarget();
|
|
316
316
|
}
|
|
317
317
|
/** Opacity for the inner bubble from the cursor's distance to the anchor rect
|
|
@@ -319,7 +319,7 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
319
319
|
* Cursor-follow only — drives the "fade as you move away" behaviour. */
|
|
320
320
|
proximityOpacity(e) {
|
|
321
321
|
if (!this.anchor) return 1;
|
|
322
|
-
const r = this.anchor
|
|
322
|
+
const r = anchorRect(this.anchor);
|
|
323
323
|
const dx = Math.max(r.left - e.clientX, 0, e.clientX - r.right);
|
|
324
324
|
const dy = Math.max(r.top - e.clientY, 0, e.clientY - r.bottom);
|
|
325
325
|
const dist = Math.hypot(dx, dy);
|
|
@@ -330,8 +330,9 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
330
330
|
// --- show / hide ---
|
|
331
331
|
show = (e) => {
|
|
332
332
|
if (!this.anchor) return;
|
|
333
|
+
if (isMenuOpen() && !isInsideOpenMenu(this.anchor)) return;
|
|
333
334
|
if (this.isEmpty()) return;
|
|
334
|
-
if (this
|
|
335
|
+
if (this.#truncatedOnly && !this.isTargetTruncated()) return;
|
|
335
336
|
this.cancelHide();
|
|
336
337
|
if (currentOpen && currentOpen !== this && this.anchor.contains(currentOpen.anchor)) {
|
|
337
338
|
return;
|
|
@@ -408,7 +409,7 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
408
409
|
this.cleanup();
|
|
409
410
|
return;
|
|
410
411
|
}
|
|
411
|
-
if (!(this.shown || this.fading) || this
|
|
412
|
+
if (!(this.shown || this.fading) || this.#isPinned) return;
|
|
412
413
|
this.lastMouse = e;
|
|
413
414
|
const o = this.proximityOpacity(e);
|
|
414
415
|
if (o === 0) {
|
|
@@ -444,7 +445,7 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
444
445
|
* show with the latest cursor event. */
|
|
445
446
|
trigger(e) {
|
|
446
447
|
if (this.isEmpty()) return;
|
|
447
|
-
if (this
|
|
448
|
+
if (this.#truncatedOnly && !this.isTargetTruncated()) return;
|
|
448
449
|
if (isHot()) {
|
|
449
450
|
this.debouncedShow?.cancel();
|
|
450
451
|
this.show(e);
|
|
@@ -466,7 +467,7 @@ class ATooltipElement extends HTMLElementBase {
|
|
|
466
467
|
if (e.pointerType !== "mouse") return;
|
|
467
468
|
this.lastMouse = e;
|
|
468
469
|
if (this.shown) {
|
|
469
|
-
if (!this
|
|
470
|
+
if (!this.#isPinned) this.positionToMouse(e);
|
|
470
471
|
} else {
|
|
471
472
|
this.trigger(e);
|
|
472
473
|
}
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { ACheckboxElement, register_a_checkbox } from './a-checkbox';
|
|
|
21
21
|
export { AExpanderElement, register_a_expander } from './a-expander';
|
|
22
22
|
export { ATooltipElement, register_a_tooltip } from './a-tooltip';
|
|
23
23
|
export { AInputElement, register_a_input } from './a-input';
|
|
24
|
+
export { ACalendarElement, register_a_calendar } from './a-calendar';
|
|
24
25
|
export { ARadioElement, register_a_radio } from './a-radio';
|
|
25
26
|
export { ARadioGroupElement, register_a_radio_group } from './a-radio-group';
|
|
26
27
|
export { AMenuElement, register_a_menu } from './a-menu';
|
|
@@ -29,6 +30,6 @@ export { AMenuSeparatorElement, register_a_menu_separator } from './a-menu-separ
|
|
|
29
30
|
export { AMenuGroupElement, register_a_menu_group } from './a-menu-group';
|
|
30
31
|
export { ATabElement, register_a_tab } from './a-tab';
|
|
31
32
|
export { ATabsElement, register_a_tabs } from './a-tabs';
|
|
33
|
+
export { ATabPanelElement, register_a_tabpanel } from './a-tabpanel';
|
|
32
34
|
import './a-title.css';
|
|
33
35
|
import './a-tag.css';
|
|
34
|
-
import './a-tabpanel.css';
|
package/dist/elements/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { ACheckboxElement, register_a_checkbox } from "./a-checkbox";
|
|
|
6
6
|
import { AExpanderElement, register_a_expander } from "./a-expander";
|
|
7
7
|
import { ATooltipElement, register_a_tooltip } from "./a-tooltip";
|
|
8
8
|
import { AInputElement, register_a_input } from "./a-input";
|
|
9
|
+
import { ACalendarElement, register_a_calendar } from "./a-calendar";
|
|
9
10
|
import { ARadioElement, register_a_radio } from "./a-radio";
|
|
10
11
|
import { ARadioGroupElement, register_a_radio_group } from "./a-radio-group";
|
|
11
12
|
import { AMenuElement, register_a_menu } from "./a-menu";
|
|
@@ -14,11 +15,12 @@ import { AMenuSeparatorElement, register_a_menu_separator } from "./a-menu-separ
|
|
|
14
15
|
import { AMenuGroupElement, register_a_menu_group } from "./a-menu-group";
|
|
15
16
|
import { ATabElement, register_a_tab } from "./a-tab";
|
|
16
17
|
import { ATabsElement, register_a_tabs } from "./a-tabs";
|
|
18
|
+
import { ATabPanelElement, register_a_tabpanel } from "./a-tabpanel";
|
|
17
19
|
import "./a-title.css";
|
|
18
20
|
import "./a-tag.css";
|
|
19
|
-
import "./a-tabpanel.css";
|
|
20
21
|
export {
|
|
21
22
|
AButtonElement,
|
|
23
|
+
ACalendarElement,
|
|
22
24
|
ACheckboxElement,
|
|
23
25
|
AExpanderElement,
|
|
24
26
|
AIconElement,
|
|
@@ -31,10 +33,12 @@ export {
|
|
|
31
33
|
ARadioElement,
|
|
32
34
|
ARadioGroupElement,
|
|
33
35
|
ATabElement,
|
|
36
|
+
ATabPanelElement,
|
|
34
37
|
ATabsElement,
|
|
35
38
|
ATextElement,
|
|
36
39
|
ATooltipElement,
|
|
37
40
|
register_a_button,
|
|
41
|
+
register_a_calendar,
|
|
38
42
|
register_a_checkbox,
|
|
39
43
|
register_a_expander,
|
|
40
44
|
register_a_icon,
|
|
@@ -47,6 +51,7 @@ export {
|
|
|
47
51
|
register_a_radio,
|
|
48
52
|
register_a_radio_group,
|
|
49
53
|
register_a_tab,
|
|
54
|
+
register_a_tabpanel,
|
|
50
55
|
register_a_tabs,
|
|
51
56
|
register_a_text,
|
|
52
57
|
register_a_tooltip
|