@astryxdesign/core 0.7.2-canary.58d3353 → 0.7.2-canary.59c4ef7
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/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +10 -2
- package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
- package/dist/Markdown/plugins/frontmatter.js +7 -3
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +6 -2
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +7 -1
- package/dist/Text/useTruncation.d.ts +7 -5
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +16 -5
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +17 -1
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +17 -1
- package/dist/utils/sharedMutationObserver.d.ts +21 -0
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -0
- package/dist/utils/sharedMutationObserver.js +69 -0
- package/locales/en.json +64 -0
- package/locales/pseudo.json +48 -0
- package/package.json +3 -3
- package/src/HoverCard/HoverCard.test.tsx +58 -0
- package/src/HoverCard/useHoverCard.tsx +10 -2
- package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
- package/src/Markdown/plugins/frontmatter.ts +7 -3
- package/src/Selector/hooks.ts +6 -2
- package/src/Selector/useCombobox.doc.mjs +237 -0
- package/src/Switch/Switch.test.tsx +21 -0
- package/src/Switch/Switch.tsx +5 -0
- package/src/Text/useTruncation.test.tsx +69 -0
- package/src/Text/useTruncation.ts +16 -5
- package/src/i18n/generated-locales/en.generated.ts +16 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +16 -0
- package/src/utils/sharedMutationObserver.test.ts +53 -0
- package/src/utils/sharedMutationObserver.ts +78 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/useHoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AA6BlC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;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G;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAyBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CAyc5E"}
|
|
@@ -145,6 +145,14 @@ export function useHoverCard(options = {}) {
|
|
|
145
145
|
isHoveringContentRef.current = false;
|
|
146
146
|
hideLayer();
|
|
147
147
|
}, [clearTimeouts, hideLayer]);
|
|
148
|
+
|
|
149
|
+
// The imperative hide. A card closed while the pointer rests on it unmounts
|
|
150
|
+
// without a mouseleave, so the content-hover latch is cleared here; left set,
|
|
151
|
+
// it would keep the trigger's next hover-open from closing on leave.
|
|
152
|
+
const hide = useCallback(() => {
|
|
153
|
+
isHoveringContentRef.current = false;
|
|
154
|
+
hideLayer();
|
|
155
|
+
}, [hideLayer]);
|
|
148
156
|
const {
|
|
149
157
|
isTouchPointerRef,
|
|
150
158
|
isTouchInteraction,
|
|
@@ -291,7 +299,7 @@ export function useHoverCard(options = {}) {
|
|
|
291
299
|
// clear it.
|
|
292
300
|
const card = typeof document === 'undefined' ? null : document.getElementById(layerId);
|
|
293
301
|
const hadFocus = card?.contains(document.activeElement) ?? false;
|
|
294
|
-
|
|
302
|
+
hide();
|
|
295
303
|
if (hadFocus) {
|
|
296
304
|
isEscapeDismissingRef.current = true;
|
|
297
305
|
triggerRef.current?.focus();
|
|
@@ -448,6 +456,6 @@ export function useHoverCard(options = {}) {
|
|
|
448
456
|
isOpen: isLayerOpen,
|
|
449
457
|
renderHoverCard,
|
|
450
458
|
show: showLayer,
|
|
451
|
-
hide
|
|
459
|
+
hide
|
|
452
460
|
};
|
|
453
461
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/Markdown/plugins/frontmatter.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AAC5C,OAA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
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const entries = new Map();
|
|
39
39
|
for (const line of body.slice(0, close.index).split(/\r?\n/)) {
|
|
40
40
|
if (line.trim() === '') {
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
43
|
const separator = line.indexOf(':');
|
|
44
44
|
const key = line.slice(0, separator).trim();
|
|
45
|
-
if (separator <= 0 || key === '' ||
|
|
45
|
+
if (separator <= 0 || key === '' || entries.has(key)) {
|
|
46
46
|
return {
|
|
47
47
|
status: 'none'
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
entries.set(key, line.slice(separator + 1).trim());
|
|
51
51
|
}
|
|
52
|
+
// A plain object, so a parser that returns the record unchanged passes the
|
|
53
|
+
// JSON-like metadata check. `fromEntries` defines every key as an own data
|
|
54
|
+
// property, so a field named `__proto__` stays a field.
|
|
55
|
+
const fields = Object.fromEntries(entries);
|
|
52
56
|
let end = openingLength + close.index + close[0].length;
|
|
53
57
|
if (source.startsWith('\r\n', end)) {
|
|
54
58
|
end += 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/Selector/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/Selector/hooks.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAyBhD,UAAU,4BAA4B;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED,UAAU,2BAA2B;IACnC,MAA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UAAkB,EAClB,MAAM,EACN,SAAiB,EACjB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,GACV,EAAE,kBAAkB,GAAG,iBAAiB,CAqOxC"}
|
package/dist/Selector/hooks.js
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* @file hooks.ts
|
|
7
7
|
* @input Uses untransformed DOM layout geometry from the Selector's outer
|
|
8
8
|
* anchor, listbox, and selected option
|
|
9
|
-
* @output Hooks for Selector
|
|
10
|
-
*
|
|
9
|
+
* @output Hooks for Selector: useSelectedItemOffset, and useCombobox (public,
|
|
10
|
+
* exported from the Selector entry point; also used by CommandPalette)
|
|
11
|
+
* @position Selector hooks; used by Selector.tsx and CommandPalette
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When useCombobox's options or return change, update:
|
|
14
|
+
* - /packages/core/src/Selector/useCombobox.doc.mjs
|
|
11
15
|
*/
|
|
12
16
|
import { useCallback, useState } from 'react';
|
|
13
17
|
import { useHighlightedOptionScroll } from "../hooks/useHighlightedOptionScroll.js";
|
package/dist/Switch/Switch.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export interface SwitchProps extends Omit<BaseProps, 'onChange'> {
|
|
|
159
159
|
* />
|
|
160
160
|
* ```
|
|
161
161
|
*/
|
|
162
|
-
export declare function Switch({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, htmlName, disabledMessage, isOptional, isRequired, onFocus, onBlur, labelIcon, labelTooltip, labelPosition, labelSpacing, status, size, width, xstyle, className, style, ref, 'aria-describedby': ariaDescribedByProp, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
162
|
+
export declare function Switch({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, htmlName, disabledMessage, isOptional, isRequired, onFocus, onBlur, labelIcon, labelTooltip, labelPosition, labelSpacing, status, size, width, xstyle, className, style, ref, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
163
163
|
export declare namespace Switch {
|
|
164
164
|
var displayName: string;
|
|
165
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAcf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAkV9C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,CACb,OAAO,EAAE,OAAO,EAChB,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAC7B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;;OAGG;IACH,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K,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,IAAI,EACR,EAAE,WAAW,+BAiOb;yBA9Pe,MAAM"}
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -292,6 +292,7 @@ export function Switch({
|
|
|
292
292
|
style,
|
|
293
293
|
ref,
|
|
294
294
|
'aria-describedby': ariaDescribedByProp,
|
|
295
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
295
296
|
...rest
|
|
296
297
|
}) {
|
|
297
298
|
const t = useTranslator();
|
|
@@ -388,7 +389,12 @@ export function Switch({
|
|
|
388
389
|
}
|
|
389
390
|
},
|
|
390
391
|
onFocus: onFocus,
|
|
391
|
-
onBlur: onBlur
|
|
392
|
+
onBlur: onBlur
|
|
393
|
+
// A caller's `aria-labelledby` names the control (a visible title
|
|
394
|
+
// elsewhere in the row, for example), so it reaches the input rather
|
|
395
|
+
// than the field wrapper via `...rest`.
|
|
396
|
+
,
|
|
397
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
392
398
|
"aria-describedby": ariaDescribedBy,
|
|
393
399
|
"aria-invalid": status?.type === 'error' ? true : undefined,
|
|
394
400
|
"aria-busy": isBusy || undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file useTruncation.ts
|
|
3
|
-
* @input Uses React hooks, sharedResizeObserver
|
|
3
|
+
* @input Uses React hooks, sharedResizeObserver, sharedMutationObserver
|
|
4
4
|
* @output Exports useTruncation hook for detecting text overflow
|
|
5
5
|
* @position Hook; consumed by Text.tsx, Heading.tsx
|
|
6
6
|
*
|
|
@@ -32,10 +32,12 @@ export interface UseTruncationReturn {
|
|
|
32
32
|
/**
|
|
33
33
|
* Hook for detecting text overflow/truncation.
|
|
34
34
|
*
|
|
35
|
-
* Uses a shared ResizeObserver singleton (via observeResize)
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* Uses a shared ResizeObserver singleton (via observeResize) for size
|
|
36
|
+
* changes and a shared MutationObserver singleton (via observeContent) for
|
|
37
|
+
* content changes, so even hundreds of table cells create one observer of
|
|
38
|
+
* each kind. Observing content matters because an element whose text changes
|
|
39
|
+
* without resizing (a fixed-width status line) must still be re-measured for
|
|
40
|
+
* the tooltip text and the truncated state to follow the current content.
|
|
39
41
|
*
|
|
40
42
|
* - Single-line: compares scrollWidth > offsetWidth
|
|
41
43
|
* - Multi-line: uses Range.getBoundingClientRect() to measure actual content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTruncation.d.ts","sourceRoot":"","sources":["../../src/Text/useTruncation.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAgC,KAAK,WAAW,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useTruncation.d.ts","sourceRoot":"","sources":["../../src/Text/useTruncation.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAgC,KAAK,WAAW,EAAC,MAAM,OAAO,CAAC;AAItE,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,oBAAoB,GAC5B,mBAAmB,CAmFrB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTruncation.ts
|
|
7
|
-
* @input Uses React hooks, sharedResizeObserver
|
|
7
|
+
* @input Uses React hooks, sharedResizeObserver, sharedMutationObserver
|
|
8
8
|
* @output Exports useTruncation hook for detecting text overflow
|
|
9
9
|
* @position Hook; consumed by Text.tsx, Heading.tsx
|
|
10
10
|
*
|
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { useCallback, useRef, useState } from 'react';
|
|
15
15
|
import { observeResize } from "../utils/sharedResizeObserver.js";
|
|
16
|
+
import { observeContent } from "../utils/sharedMutationObserver.js";
|
|
16
17
|
/**
|
|
17
18
|
* Hook for detecting text overflow/truncation.
|
|
18
19
|
*
|
|
19
|
-
* Uses a shared ResizeObserver singleton (via observeResize)
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Uses a shared ResizeObserver singleton (via observeResize) for size
|
|
21
|
+
* changes and a shared MutationObserver singleton (via observeContent) for
|
|
22
|
+
* content changes, so even hundreds of table cells create one observer of
|
|
23
|
+
* each kind. Observing content matters because an element whose text changes
|
|
24
|
+
* without resizing (a fixed-width status line) must still be re-measured for
|
|
25
|
+
* the tooltip text and the truncated state to follow the current content.
|
|
23
26
|
*
|
|
24
27
|
* - Single-line: compares scrollWidth > offsetWidth
|
|
25
28
|
* - Multi-line: uses Range.getBoundingClientRect() to measure actual content
|
|
@@ -44,6 +47,7 @@ export function useTruncation(options) {
|
|
|
44
47
|
const [fullText, setFullText] = useState('');
|
|
45
48
|
const elementRef = useRef(null);
|
|
46
49
|
const unobserveRef = useRef(null);
|
|
50
|
+
const unobserveContentRef = useRef(null);
|
|
47
51
|
const checkTruncation = useCallback(element => {
|
|
48
52
|
if (maxLines === 0) {
|
|
49
53
|
setIsTruncated(false);
|
|
@@ -80,6 +84,8 @@ export function useTruncation(options) {
|
|
|
80
84
|
// by element leaves any other observer of the same node untouched.
|
|
81
85
|
unobserveRef.current?.();
|
|
82
86
|
unobserveRef.current = null;
|
|
87
|
+
unobserveContentRef.current?.();
|
|
88
|
+
unobserveContentRef.current = null;
|
|
83
89
|
elementRef.current = element;
|
|
84
90
|
if (element && maxLines > 0) {
|
|
85
91
|
// Observe via shared singleton (if available).
|
|
@@ -92,6 +98,11 @@ export function useTruncation(options) {
|
|
|
92
98
|
} else {
|
|
93
99
|
checkTruncation(element);
|
|
94
100
|
}
|
|
101
|
+
// New text in a box that keeps its size fires no resize, so the
|
|
102
|
+
// captured text and truncated state would otherwise stay stale.
|
|
103
|
+
unobserveContentRef.current = observeContent(element, () => {
|
|
104
|
+
checkTruncation(element);
|
|
105
|
+
});
|
|
95
106
|
} else {
|
|
96
107
|
setIsTruncated(false);
|
|
97
108
|
setFullText('');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/en.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"en.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/en.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0epD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -436,6 +436,22 @@ const runtimeCatalog = {
|
|
|
436
436
|
'@astryx.transferList.announceSearchResults': '{count, number} {count, plural, one {item} other {items}} found.',
|
|
437
437
|
'@astryx.transferListSelector.apply': 'Apply',
|
|
438
438
|
'@astryx.transferListSelector.cancel': 'Cancel',
|
|
439
|
-
'@astryx.transferListSelector.triggerLabel': '{count, number} selected'
|
|
439
|
+
'@astryx.transferListSelector.triggerLabel': '{count, number} selected',
|
|
440
|
+
'@astryx.emojiPicker.label': 'Emoji',
|
|
441
|
+
'@astryx.emojiPicker.searchLabel': 'Search emoji',
|
|
442
|
+
'@astryx.emojiPicker.frequentlyUsed': 'Frequently used',
|
|
443
|
+
'@astryx.emojiPicker.searchResults': 'Search results',
|
|
444
|
+
'@astryx.emojiPicker.noResults': 'No emoji match “{query}”',
|
|
445
|
+
'@astryx.emojiPicker.loading': 'Loading emoji',
|
|
446
|
+
'@astryx.emojiPicker.loadFailed': "More emoji couldn't be loaded.",
|
|
447
|
+
'@astryx.emojiPicker.groupSmileysEmotion': 'Smileys & emotion',
|
|
448
|
+
'@astryx.emojiPicker.groupPeopleBody': 'People & body',
|
|
449
|
+
'@astryx.emojiPicker.groupAnimalsNature': 'Animals & nature',
|
|
450
|
+
'@astryx.emojiPicker.groupFoodDrink': 'Food & drink',
|
|
451
|
+
'@astryx.emojiPicker.groupTravelPlaces': 'Travel & places',
|
|
452
|
+
'@astryx.emojiPicker.groupActivities': 'Activities',
|
|
453
|
+
'@astryx.emojiPicker.groupObjects': 'Objects',
|
|
454
|
+
'@astryx.emojiPicker.groupSymbols': 'Symbols',
|
|
455
|
+
'@astryx.emojiPicker.groupFlags': 'Flags'
|
|
440
456
|
};
|
|
441
457
|
export default runtimeCatalog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pseudo.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/pseudo.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"pseudo.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/pseudo.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmfpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -436,6 +436,22 @@ const runtimeCatalog = {
|
|
|
436
436
|
'@astryx.transferList.announceSearchResults': '⟦{count, number} {count, plural, one {item} other {items}} ƒóúñð.⟧',
|
|
437
437
|
'@astryx.transferListSelector.apply': '⟦Àþþłý⟧',
|
|
438
438
|
'@astryx.transferListSelector.cancel': '⟦Çàñçéł⟧',
|
|
439
|
-
'@astryx.transferListSelector.triggerLabel': '⟦{count, number} šéłéçţéð⟧'
|
|
439
|
+
'@astryx.transferListSelector.triggerLabel': '⟦{count, number} šéłéçţéð⟧',
|
|
440
|
+
'@astryx.emojiPicker.label': '⟦Éɱóĵí⟧',
|
|
441
|
+
'@astryx.emojiPicker.searchLabel': '⟦Šéàřçĥ éɱóĵí⟧',
|
|
442
|
+
'@astryx.emojiPicker.frequentlyUsed': '⟦Ƒřéɋúéñţłý úšéð⟧',
|
|
443
|
+
'@astryx.emojiPicker.searchResults': '⟦Šéàřçĥ řéšúłţš⟧',
|
|
444
|
+
'@astryx.emojiPicker.noResults': '⟦Ñó éɱóĵí ɱàţçĥ “{query}”⟧',
|
|
445
|
+
'@astryx.emojiPicker.loading': '⟦Łóàðíñĝ éɱóĵí⟧',
|
|
446
|
+
'@astryx.emojiPicker.loadFailed': "⟦Ṁóřé éɱóĵí çóúłðñ'ţ ƀé łóàðéð.⟧",
|
|
447
|
+
'@astryx.emojiPicker.groupSmileysEmotion': '⟦Šɱíłéýš & éɱóţíóñ⟧',
|
|
448
|
+
'@astryx.emojiPicker.groupPeopleBody': '⟦Þéóþłé & ƀóðý⟧',
|
|
449
|
+
'@astryx.emojiPicker.groupAnimalsNature': '⟦Àñíɱàłš & ñàţúřé⟧',
|
|
450
|
+
'@astryx.emojiPicker.groupFoodDrink': '⟦Ƒóóð & ðříñķ⟧',
|
|
451
|
+
'@astryx.emojiPicker.groupTravelPlaces': '⟦Ţřàṽéł & þłàçéš⟧',
|
|
452
|
+
'@astryx.emojiPicker.groupActivities': '⟦Àçţíṽíţíéš⟧',
|
|
453
|
+
'@astryx.emojiPicker.groupObjects': '⟦Óƀĵéçţš⟧',
|
|
454
|
+
'@astryx.emojiPicker.groupSymbols': '⟦Šýɱƀółš⟧',
|
|
455
|
+
'@astryx.emojiPicker.groupFlags': '⟦Ƒłàĝš⟧'
|
|
440
456
|
};
|
|
441
457
|
export default runtimeCatalog;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file sharedMutationObserver.ts
|
|
3
|
+
* @input MutationObserver API
|
|
4
|
+
* @output Exports observeContent for shared content-change observation
|
|
5
|
+
* @position Internal utility; consumed by useTruncation. The content-change
|
|
6
|
+
* counterpart of sharedResizeObserver: one observer for every element, so a
|
|
7
|
+
* repeated cell or row path does not create one observer per instance.
|
|
8
|
+
*/
|
|
9
|
+
type ContentCallback = () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Call `callback` when the element's text or children change (including
|
|
12
|
+
* descendants). Returns an unsubscribe that removes only this registration.
|
|
13
|
+
*
|
|
14
|
+
* MutationObserver has no per-target unobserve, so a released element stays
|
|
15
|
+
* registered with the shared observer until no element remains; its records
|
|
16
|
+
* match no callback and are ignored. The observer disconnects and is released
|
|
17
|
+
* when the last registration goes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function observeContent(element: Element, callback: ContentCallback): () => void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=sharedMutationObserver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedMutationObserver.d.ts","sourceRoot":"","sources":["../../src/utils/sharedMutationObserver.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,KAAK,eAAe,GAAG,MAAM,IAAI,CAAC;AAuBlC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,GACxB,MAAM,IAAI,CA6BZ"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file sharedMutationObserver.ts
|
|
7
|
+
* @input MutationObserver API
|
|
8
|
+
* @output Exports observeContent for shared content-change observation
|
|
9
|
+
* @position Internal utility; consumed by useTruncation. The content-change
|
|
10
|
+
* counterpart of sharedResizeObserver: one observer for every element, so a
|
|
11
|
+
* repeated cell or row path does not create one observer per instance.
|
|
12
|
+
*/
|
|
13
|
+
const OPTIONS = {
|
|
14
|
+
characterData: true,
|
|
15
|
+
childList: true,
|
|
16
|
+
subtree: true
|
|
17
|
+
};
|
|
18
|
+
let observer = null;
|
|
19
|
+
const callbacks = new Map();
|
|
20
|
+
function dispatch(records) {
|
|
21
|
+
// One call per callback per batch, however many records it received. A
|
|
22
|
+
// record's target can be any descendant, so walk up to the observed roots.
|
|
23
|
+
const pending = new Set();
|
|
24
|
+
for (const record of records) {
|
|
25
|
+
for (let node = record.target; node; node = node.parentNode) {
|
|
26
|
+
callbacks.get(node)?.forEach(callback => pending.add(callback));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
pending.forEach(callback => callback());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Call `callback` when the element's text or children change (including
|
|
34
|
+
* descendants). Returns an unsubscribe that removes only this registration.
|
|
35
|
+
*
|
|
36
|
+
* MutationObserver has no per-target unobserve, so a released element stays
|
|
37
|
+
* registered with the shared observer until no element remains; its records
|
|
38
|
+
* match no callback and are ignored. The observer disconnects and is released
|
|
39
|
+
* when the last registration goes.
|
|
40
|
+
*/
|
|
41
|
+
export function observeContent(element, callback) {
|
|
42
|
+
if (typeof MutationObserver === 'undefined') {
|
|
43
|
+
return () => {};
|
|
44
|
+
}
|
|
45
|
+
observer ??= new MutationObserver(dispatch);
|
|
46
|
+
const existing = callbacks.get(element);
|
|
47
|
+
if (existing) {
|
|
48
|
+
existing.add(callback);
|
|
49
|
+
} else {
|
|
50
|
+
callbacks.set(element, new Set([callback]));
|
|
51
|
+
observer.observe(element, OPTIONS);
|
|
52
|
+
}
|
|
53
|
+
let isSubscribed = true;
|
|
54
|
+
return () => {
|
|
55
|
+
if (!isSubscribed) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
isSubscribed = false;
|
|
59
|
+
const targetCallbacks = callbacks.get(element);
|
|
60
|
+
targetCallbacks?.delete(callback);
|
|
61
|
+
if (targetCallbacks?.size === 0) {
|
|
62
|
+
callbacks.delete(element);
|
|
63
|
+
}
|
|
64
|
+
if (callbacks.size === 0 && observer) {
|
|
65
|
+
observer.disconnect();
|
|
66
|
+
observer = null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
package/locales/en.json
CHANGED
|
@@ -1718,5 +1718,69 @@
|
|
|
1718
1718
|
"@astryx.transferListSelector.triggerLabel": {
|
|
1719
1719
|
"defaultMessage": "{count, number} selected",
|
|
1720
1720
|
"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."
|
|
1721
|
+
},
|
|
1722
|
+
"@astryx.emojiPicker.label": {
|
|
1723
|
+
"defaultMessage": "Emoji",
|
|
1724
|
+
"description": "Default accessible name of the scrolling list of emoji in a lab EmojiPicker, and the footer text when no emoji is hovered or focused."
|
|
1725
|
+
},
|
|
1726
|
+
"@astryx.emojiPicker.searchLabel": {
|
|
1727
|
+
"defaultMessage": "Search emoji",
|
|
1728
|
+
"description": "Default placeholder and hidden label of the search field of a lab EmojiPicker."
|
|
1729
|
+
},
|
|
1730
|
+
"@astryx.emojiPicker.frequentlyUsed": {
|
|
1731
|
+
"defaultMessage": "Frequently used",
|
|
1732
|
+
"description": "Heading of the first group in a lab EmojiPicker, the host's frequent or recent emoji."
|
|
1733
|
+
},
|
|
1734
|
+
"@astryx.emojiPicker.searchResults": {
|
|
1735
|
+
"defaultMessage": "Search results",
|
|
1736
|
+
"description": "Heading of the single group a lab EmojiPicker shows while its search field has text."
|
|
1737
|
+
},
|
|
1738
|
+
"@astryx.emojiPicker.noResults": {
|
|
1739
|
+
"defaultMessage": "No emoji match “{query}”",
|
|
1740
|
+
"description": "Shown in a lab EmojiPicker when no emoji name or keyword matches the search. `query` is the search text."
|
|
1741
|
+
},
|
|
1742
|
+
"@astryx.emojiPicker.loading": {
|
|
1743
|
+
"defaultMessage": "Loading emoji",
|
|
1744
|
+
"description": "Accessible name of the spinner a lab EmojiPicker shows while its bundled emoji set loads."
|
|
1745
|
+
},
|
|
1746
|
+
"@astryx.emojiPicker.loadFailed": {
|
|
1747
|
+
"defaultMessage": "More emoji couldn't be loaded.",
|
|
1748
|
+
"description": "Shown in a lab EmojiPicker when its bundled emoji set failed to load; the frequent emoji still show."
|
|
1749
|
+
},
|
|
1750
|
+
"@astryx.emojiPicker.groupSmileysEmotion": {
|
|
1751
|
+
"defaultMessage": "Smileys & emotion",
|
|
1752
|
+
"description": "Heading of the Unicode CLDR emoji group of faces and emotions in a lab EmojiPicker."
|
|
1753
|
+
},
|
|
1754
|
+
"@astryx.emojiPicker.groupPeopleBody": {
|
|
1755
|
+
"defaultMessage": "People & body",
|
|
1756
|
+
"description": "Heading of the Unicode CLDR emoji group of people, gestures, and body parts in a lab EmojiPicker."
|
|
1757
|
+
},
|
|
1758
|
+
"@astryx.emojiPicker.groupAnimalsNature": {
|
|
1759
|
+
"defaultMessage": "Animals & nature",
|
|
1760
|
+
"description": "Heading of the Unicode CLDR emoji group of animals and plants in a lab EmojiPicker."
|
|
1761
|
+
},
|
|
1762
|
+
"@astryx.emojiPicker.groupFoodDrink": {
|
|
1763
|
+
"defaultMessage": "Food & drink",
|
|
1764
|
+
"description": "Heading of the Unicode CLDR emoji group of food and drink in a lab EmojiPicker."
|
|
1765
|
+
},
|
|
1766
|
+
"@astryx.emojiPicker.groupTravelPlaces": {
|
|
1767
|
+
"defaultMessage": "Travel & places",
|
|
1768
|
+
"description": "Heading of the Unicode CLDR emoji group of places, vehicles, and weather in a lab EmojiPicker."
|
|
1769
|
+
},
|
|
1770
|
+
"@astryx.emojiPicker.groupActivities": {
|
|
1771
|
+
"defaultMessage": "Activities",
|
|
1772
|
+
"description": "Heading of the Unicode CLDR emoji group of sports, games, and events in a lab EmojiPicker."
|
|
1773
|
+
},
|
|
1774
|
+
"@astryx.emojiPicker.groupObjects": {
|
|
1775
|
+
"defaultMessage": "Objects",
|
|
1776
|
+
"description": "Heading of the Unicode CLDR emoji group of everyday objects in a lab EmojiPicker."
|
|
1777
|
+
},
|
|
1778
|
+
"@astryx.emojiPicker.groupSymbols": {
|
|
1779
|
+
"defaultMessage": "Symbols",
|
|
1780
|
+
"description": "Heading of the Unicode CLDR emoji group of signs and symbols in a lab EmojiPicker."
|
|
1781
|
+
},
|
|
1782
|
+
"@astryx.emojiPicker.groupFlags": {
|
|
1783
|
+
"defaultMessage": "Flags",
|
|
1784
|
+
"description": "Heading of the Unicode CLDR emoji group of flags in a lab EmojiPicker."
|
|
1721
1785
|
}
|
|
1722
1786
|
}
|
package/locales/pseudo.json
CHANGED
|
@@ -1288,5 +1288,53 @@
|
|
|
1288
1288
|
},
|
|
1289
1289
|
"@astryx.transferListSelector.triggerLabel": {
|
|
1290
1290
|
"defaultMessage": "⟦{count, number} šéłéçţéð⟧"
|
|
1291
|
+
},
|
|
1292
|
+
"@astryx.emojiPicker.label": {
|
|
1293
|
+
"defaultMessage": "⟦Éɱóĵí⟧"
|
|
1294
|
+
},
|
|
1295
|
+
"@astryx.emojiPicker.searchLabel": {
|
|
1296
|
+
"defaultMessage": "⟦Šéàřçĥ éɱóĵí⟧"
|
|
1297
|
+
},
|
|
1298
|
+
"@astryx.emojiPicker.frequentlyUsed": {
|
|
1299
|
+
"defaultMessage": "⟦Ƒřéɋúéñţłý úšéð⟧"
|
|
1300
|
+
},
|
|
1301
|
+
"@astryx.emojiPicker.searchResults": {
|
|
1302
|
+
"defaultMessage": "⟦Šéàřçĥ řéšúłţš⟧"
|
|
1303
|
+
},
|
|
1304
|
+
"@astryx.emojiPicker.noResults": {
|
|
1305
|
+
"defaultMessage": "⟦Ñó éɱóĵí ɱàţçĥ “{query}”⟧"
|
|
1306
|
+
},
|
|
1307
|
+
"@astryx.emojiPicker.loading": {
|
|
1308
|
+
"defaultMessage": "⟦Łóàðíñĝ éɱóĵí⟧"
|
|
1309
|
+
},
|
|
1310
|
+
"@astryx.emojiPicker.loadFailed": {
|
|
1311
|
+
"defaultMessage": "⟦Ṁóřé éɱóĵí çóúłðñ'ţ ƀé łóàðéð.⟧"
|
|
1312
|
+
},
|
|
1313
|
+
"@astryx.emojiPicker.groupSmileysEmotion": {
|
|
1314
|
+
"defaultMessage": "⟦Šɱíłéýš & éɱóţíóñ⟧"
|
|
1315
|
+
},
|
|
1316
|
+
"@astryx.emojiPicker.groupPeopleBody": {
|
|
1317
|
+
"defaultMessage": "⟦Þéóþłé & ƀóðý⟧"
|
|
1318
|
+
},
|
|
1319
|
+
"@astryx.emojiPicker.groupAnimalsNature": {
|
|
1320
|
+
"defaultMessage": "⟦Àñíɱàłš & ñàţúřé⟧"
|
|
1321
|
+
},
|
|
1322
|
+
"@astryx.emojiPicker.groupFoodDrink": {
|
|
1323
|
+
"defaultMessage": "⟦Ƒóóð & ðříñķ⟧"
|
|
1324
|
+
},
|
|
1325
|
+
"@astryx.emojiPicker.groupTravelPlaces": {
|
|
1326
|
+
"defaultMessage": "⟦Ţřàṽéł & þłàçéš⟧"
|
|
1327
|
+
},
|
|
1328
|
+
"@astryx.emojiPicker.groupActivities": {
|
|
1329
|
+
"defaultMessage": "⟦Àçţíṽíţíéš⟧"
|
|
1330
|
+
},
|
|
1331
|
+
"@astryx.emojiPicker.groupObjects": {
|
|
1332
|
+
"defaultMessage": "⟦Óƀĵéçţš⟧"
|
|
1333
|
+
},
|
|
1334
|
+
"@astryx.emojiPicker.groupSymbols": {
|
|
1335
|
+
"defaultMessage": "⟦Šýɱƀółš⟧"
|
|
1336
|
+
},
|
|
1337
|
+
"@astryx.emojiPicker.groupFlags": {
|
|
1338
|
+
"defaultMessage": "⟦Ƒłàĝš⟧"
|
|
1291
1339
|
}
|
|
1292
1340
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.2-canary.
|
|
3
|
+
"version": "0.7.2-canary.59c4ef7",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -787,8 +787,8 @@
|
|
|
787
787
|
"react-dom": ">=19.0.0"
|
|
788
788
|
},
|
|
789
789
|
"devDependencies": {
|
|
790
|
-
"@astryxdesign/a11y-spec": "0.7.2-canary.
|
|
791
|
-
"@astryxdesign/cli": "0.7.2-canary.
|
|
790
|
+
"@astryxdesign/a11y-spec": "0.7.2-canary.59c4ef7",
|
|
791
|
+
"@astryxdesign/cli": "0.7.2-canary.59c4ef7",
|
|
792
792
|
"@babel/cli": "^7.29.7",
|
|
793
793
|
"@babel/core": "^7.29.7",
|
|
794
794
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -109,6 +109,64 @@ describe('useHoverCard identity', () => {
|
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
// A card closed while the pointer rests on it unmounts without a mouseleave,
|
|
113
|
+
// so the hook must not keep believing the pointer is over the card: if it
|
|
114
|
+
// does, the next open of the same trigger never closes on leave.
|
|
115
|
+
describe('useHoverCard closing while the pointer is on the card', () => {
|
|
116
|
+
function Harness() {
|
|
117
|
+
const card = useHoverCard({delay: 0, hideDelay: 0});
|
|
118
|
+
return (
|
|
119
|
+
<div>
|
|
120
|
+
<span ref={card.ref}>Trigger</span>
|
|
121
|
+
<output data-testid="state">{card.isOpen ? 'open' : 'closed'}</output>
|
|
122
|
+
{card.renderHoverCard(
|
|
123
|
+
<button type="button" onClick={card.hide}>
|
|
124
|
+
Pick
|
|
125
|
+
</button>,
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function openThenRestOnCard() {
|
|
132
|
+
const state = screen.getByTestId('state');
|
|
133
|
+
fireEvent.mouseEnter(screen.getByText('Trigger'));
|
|
134
|
+
await waitFor(() => expect(state).toHaveTextContent('open'));
|
|
135
|
+
const pick = screen.getByRole('button', {name: 'Pick', hidden: true});
|
|
136
|
+
fireEvent.mouseLeave(screen.getByText('Trigger'));
|
|
137
|
+
fireEvent.mouseEnter(pick.parentElement!);
|
|
138
|
+
return {state, pick};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function expectNextOpenClosesOnLeave(state: HTMLElement) {
|
|
142
|
+
const trigger = screen.getByText('Trigger');
|
|
143
|
+
fireEvent.mouseEnter(trigger);
|
|
144
|
+
await waitFor(() => expect(state).toHaveTextContent('open'));
|
|
145
|
+
fireEvent.mouseLeave(trigger);
|
|
146
|
+
await waitFor(() => expect(state).toHaveTextContent('closed'));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
it('closes the next open on leave after hide() from inside the card', async () => {
|
|
150
|
+
render(<Harness />);
|
|
151
|
+
const {state, pick} = await openThenRestOnCard();
|
|
152
|
+
|
|
153
|
+
fireEvent.click(pick);
|
|
154
|
+
await waitFor(() => expect(state).toHaveTextContent('closed'));
|
|
155
|
+
|
|
156
|
+
await expectNextOpenClosesOnLeave(state);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('closes the next open on leave after Escape dismisses the card', async () => {
|
|
160
|
+
render(<Harness />);
|
|
161
|
+
const {state} = await openThenRestOnCard();
|
|
162
|
+
|
|
163
|
+
fireEvent.keyDown(document.body, {key: 'Escape'});
|
|
164
|
+
await waitFor(() => expect(state).toHaveTextContent('closed'));
|
|
165
|
+
|
|
166
|
+
await expectNextOpenClosesOnLeave(state);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
112
170
|
describe('HoverCard', () => {
|
|
113
171
|
it('renders trigger element', () => {
|
|
114
172
|
render(
|
|
@@ -345,6 +345,14 @@ export function useHoverCard(options: HoverCardOptions = {}): HoverCardReturn {
|
|
|
345
345
|
hideLayer();
|
|
346
346
|
}, [clearTimeouts, hideLayer]);
|
|
347
347
|
|
|
348
|
+
// The imperative hide. A card closed while the pointer rests on it unmounts
|
|
349
|
+
// without a mouseleave, so the content-hover latch is cleared here; left set,
|
|
350
|
+
// it would keep the trigger's next hover-open from closing on leave.
|
|
351
|
+
const hide = useCallback(() => {
|
|
352
|
+
isHoveringContentRef.current = false;
|
|
353
|
+
hideLayer();
|
|
354
|
+
}, [hideLayer]);
|
|
355
|
+
|
|
348
356
|
const {
|
|
349
357
|
isTouchPointerRef,
|
|
350
358
|
isTouchInteraction,
|
|
@@ -508,7 +516,7 @@ export function useHoverCard(options: HoverCardOptions = {}): HoverCardReturn {
|
|
|
508
516
|
? null
|
|
509
517
|
: document.getElementById(layerId);
|
|
510
518
|
const hadFocus = card?.contains(document.activeElement) ?? false;
|
|
511
|
-
|
|
519
|
+
hide();
|
|
512
520
|
if (hadFocus) {
|
|
513
521
|
isEscapeDismissingRef.current = true;
|
|
514
522
|
triggerRef.current?.focus();
|
|
@@ -720,6 +728,6 @@ export function useHoverCard(options: HoverCardOptions = {}): HoverCardReturn {
|
|
|
720
728
|
isOpen: isLayerOpen,
|
|
721
729
|
renderHoverCard,
|
|
722
730
|
show: showLayer,
|
|
723
|
-
hide
|
|
731
|
+
hide,
|
|
724
732
|
};
|
|
725
733
|
}
|