@enonic/ui 1.0.0-beta.4 → 1.0.0-beta.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
2
|
export type InputAddonProps = ComponentPropsWithoutRef<'div'>;
|
|
3
3
|
export type InputProps = {
|
|
4
4
|
label?: string;
|
|
@@ -19,12 +19,18 @@ export type InputProps = {
|
|
|
19
19
|
* `useBlinkAttention` for the trigger logic.
|
|
20
20
|
*/
|
|
21
21
|
highlight?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Ref to the field's container element — the one that wears the blink ring. Pass the same ref
|
|
24
|
+
* to `useBlinkAttention` so the hook can restart the CSS animation directly via the DOM. When
|
|
25
|
+
* provided, `highlight` becomes optional; the hook drives the class on its own.
|
|
26
|
+
*/
|
|
27
|
+
highlightRef?: Ref<HTMLDivElement>;
|
|
22
28
|
className?: string;
|
|
23
29
|
} & ComponentPropsWithoutRef<'input'>;
|
|
24
30
|
export declare const Input: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<InputProps> & {
|
|
25
|
-
ref?:
|
|
31
|
+
ref?: Ref<HTMLInputElement> | undefined;
|
|
26
32
|
}> & {
|
|
27
33
|
Addon: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<InputAddonProps> & {
|
|
28
|
-
ref?:
|
|
34
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
29
35
|
}>;
|
|
30
36
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
2
|
export type TextAreaProps = {
|
|
3
3
|
label?: string;
|
|
4
4
|
description?: ReactNode;
|
|
@@ -17,6 +17,12 @@ export type TextAreaProps = {
|
|
|
17
17
|
* `useBlinkAttention` for the trigger logic.
|
|
18
18
|
*/
|
|
19
19
|
highlight?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Ref to the field's container element — the one that wears the blink ring. Pass the same ref
|
|
22
|
+
* to `useBlinkAttention` so the hook can restart the CSS animation directly via the DOM. When
|
|
23
|
+
* provided, `highlight` becomes optional; the hook drives the class on its own.
|
|
24
|
+
*/
|
|
25
|
+
highlightRef?: Ref<HTMLDivElement>;
|
|
20
26
|
resizable?: boolean;
|
|
21
27
|
/**
|
|
22
28
|
* Enables automatic content-based sizing.
|
|
@@ -28,5 +34,5 @@ export type TextAreaProps = {
|
|
|
28
34
|
className?: string;
|
|
29
35
|
} & ComponentPropsWithoutRef<'textarea'>;
|
|
30
36
|
export declare const TextArea: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<TextAreaProps> & {
|
|
31
|
-
ref?:
|
|
37
|
+
ref?: Ref<HTMLTextAreaElement> | undefined;
|
|
32
38
|
}>;
|
|
@@ -5,8 +5,14 @@ export type UseBlinkAttentionConfig = {
|
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* Draws attention to an element by scrolling it into view and pulsing a one-shot ring around it.
|
|
8
|
-
*
|
|
8
|
+
* The hook owns the `input-blink-attention` class on the ref'd element — the ref must point to
|
|
9
|
+
* the element that wears the ring (typically a field's container, e.g. `Input.highlightRef` /
|
|
10
|
+
* `TextArea.highlightRef`). A boolean is also returned for callers that need to react to the
|
|
11
|
+
* blink in their own UI.
|
|
9
12
|
*
|
|
10
|
-
* The trigger is edge-driven: every time `trigger` flips to truthy, the animation restarts
|
|
13
|
+
* The trigger is edge-driven: every time `trigger` flips to truthy, the animation restarts —
|
|
14
|
+
* even when the previous blink is still in progress. Restarts go through a class-remove → reflow
|
|
15
|
+
* → class-add cycle rather than React state alone, because React can coalesce a false→true
|
|
16
|
+
* toggle into a single commit and the browser would then see one uninterrupted animation.
|
|
11
17
|
*/
|
|
12
18
|
export declare const useBlinkAttention: <T extends HTMLElement>(ref: RefObject<T | null>, trigger: unknown, { scrollIntoView }?: UseBlinkAttentionConfig) => boolean;
|