@allxsmith/bestax-bulma 5.27.7 → 5.28.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/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/HoverCard.js +127 -0
- package/dist/esm/components/HoverCard.js.map +1 -0
- package/dist/esm/form/DateInput.js.map +1 -1
- package/dist/esm/form/DateInputBase.js +2 -3
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInput.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +2 -3
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Field.js +36 -5
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/File.js.map +1 -1
- package/dist/esm/form/FormContext.js +53 -9
- package/dist/esm/form/FormContext.js.map +1 -1
- package/dist/esm/form/Input.js.map +1 -1
- package/dist/esm/form/InputBase.js +6 -5
- package/dist/esm/form/InputBase.js.map +1 -1
- package/dist/esm/form/Numberinput.js.map +1 -1
- package/dist/esm/form/Select.js.map +1 -1
- package/dist/esm/form/SelectBase.js +7 -5
- package/dist/esm/form/SelectBase.js.map +1 -1
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/Taginput.js.map +1 -1
- package/dist/esm/form/TextArea.js.map +1 -1
- package/dist/esm/form/TextAreaBase.js +6 -5
- package/dist/esm/form/TextAreaBase.js.map +1 -1
- package/dist/esm/form/TimeInput.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +2 -3
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/useAutoLabelId.js +8 -3
- package/dist/esm/form/useAutoLabelId.js.map +1 -1
- package/dist/esm/helpers/Theme.js +87 -17
- package/dist/esm/helpers/Theme.js.map +1 -1
- package/dist/esm/helpers/devWarnings.js +8 -3
- package/dist/esm/helpers/devWarnings.js.map +1 -1
- package/dist/esm/helpers/useFlexboxClasses.js +1 -1
- package/dist/esm/helpers/useFocusTrap.js +2 -1
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/esm/helpers/useHoverOpen.js +390 -0
- package/dist/esm/helpers/useHoverOpen.js.map +1 -0
- package/dist/esm/helpers/useOtherClasses.js +1 -1
- package/dist/esm/helpers/useSpacingClasses.js +1 -1
- package/dist/esm/helpers/useTypographyClasses.js +1 -1
- package/dist/esm/helpers/useVisibilityClasses.js +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +700 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/HoverCard.d.ts +136 -0
- package/dist/types/form/DateInput.d.ts +1 -1
- package/dist/types/form/DateTimeInput.d.ts +1 -1
- package/dist/types/form/Field.d.ts +2 -2
- package/dist/types/form/File.d.ts +1 -1
- package/dist/types/form/FormContext.d.ts +47 -8
- package/dist/types/form/Input.d.ts +1 -1
- package/dist/types/form/Numberinput.d.ts +1 -1
- package/dist/types/form/Select.d.ts +1 -1
- package/dist/types/form/Slider.d.ts +1 -1
- package/dist/types/form/Taginput.d.ts +1 -1
- package/dist/types/form/TextArea.d.ts +1 -1
- package/dist/types/form/TimeInput.d.ts +1 -1
- package/dist/types/form/useAutoLabelId.d.ts +4 -2
- package/dist/types/helpers/Theme.d.ts +15 -1
- package/dist/types/helpers/devWarnings.d.ts +8 -0
- package/dist/types/helpers/useFocusTrap.d.ts +9 -0
- package/dist/types/helpers/useHoverOpen.d.ts +98 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-cjs/components/HoverCard.d.ts +136 -0
- package/dist/types-cjs/form/DateInput.d.ts +1 -1
- package/dist/types-cjs/form/DateTimeInput.d.ts +1 -1
- package/dist/types-cjs/form/Field.d.ts +2 -2
- package/dist/types-cjs/form/File.d.ts +1 -1
- package/dist/types-cjs/form/FormContext.d.ts +47 -8
- package/dist/types-cjs/form/Input.d.ts +1 -1
- package/dist/types-cjs/form/Numberinput.d.ts +1 -1
- package/dist/types-cjs/form/Select.d.ts +1 -1
- package/dist/types-cjs/form/Slider.d.ts +1 -1
- package/dist/types-cjs/form/Taginput.d.ts +1 -1
- package/dist/types-cjs/form/TextArea.d.ts +1 -1
- package/dist/types-cjs/form/TimeInput.d.ts +1 -1
- package/dist/types-cjs/form/useAutoLabelId.d.ts +4 -2
- package/dist/types-cjs/helpers/Theme.d.ts +15 -1
- package/dist/types-cjs/helpers/devWarnings.d.ts +8 -0
- package/dist/types-cjs/helpers/useFocusTrap.d.ts +9 -0
- package/dist/types-cjs/helpers/useHoverOpen.d.ts +98 -0
- package/dist/types-cjs/index.d.ts +1 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +18 -18
- package/src/scss/components/_hovercard.scss +118 -0
- package/src/scss/components/_index.scss +1 -0
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the browser puts `el` in the tab order, before anything that hides
|
|
4
|
+
* or disables it. The `tabIndex` property can't answer this on its own: it
|
|
5
|
+
* can read `-1` for an editable region or an `<embed>` that Tab still visits,
|
|
6
|
+
* and `0` for a `<video>` without controls that it doesn't. So a valid
|
|
7
|
+
* `tabindex` attribute decides, and otherwise the element's kind does.
|
|
8
|
+
* Internal like `firstTabStop`: `src/index.ts` names what it takes from here.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isTabbableKind(el: Element): boolean;
|
|
2
11
|
/**
|
|
3
12
|
* The first tab stop inside `container`, found the way the trap finds it, or
|
|
4
13
|
* `null` when there is none. For a component that moves focus into a panel
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { FocusEvent, PointerEvent, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Options for `useHoverOpen`.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseHoverOpenOptions {
|
|
6
|
+
/** Whether the floating element is open now, controlled or not. */
|
|
7
|
+
open: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Asks for the floating element to open or close: when a delay runs out,
|
|
10
|
+
* and at once on Escape. It isn't asked for the state it is already in,
|
|
11
|
+
* except that an Escape between asking to open and the open showing takes
|
|
12
|
+
* the ask back by asking to close.
|
|
13
|
+
*/
|
|
14
|
+
onOpenChange: (open: boolean) => void;
|
|
15
|
+
/** How long hover or keyboard focus waits before asking to open, in milliseconds. */
|
|
16
|
+
openDelay: number;
|
|
17
|
+
/**
|
|
18
|
+
* How long it waits once the pointer and focus have both left before
|
|
19
|
+
* asking to close, in milliseconds. Coming back in that time keeps it open,
|
|
20
|
+
* which is how the pointer crosses a gap to the floating element.
|
|
21
|
+
*/
|
|
22
|
+
closeDelay: number;
|
|
23
|
+
/**
|
|
24
|
+
* The element that opens it, which has to take focus itself. The Escape
|
|
25
|
+
* listener goes on its document, an iframe's when it renders into one, and
|
|
26
|
+
* focus left in the floating element comes back here when the floating
|
|
27
|
+
* element closes.
|
|
28
|
+
*/
|
|
29
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
30
|
+
/** The floating element, while it is open. */
|
|
31
|
+
floatingRef: RefObject<HTMLElement | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a tap on the trigger opens it at once, with the next tap closing
|
|
34
|
+
* it. Without it, a touch pointer never opens it. While a tap holds it
|
|
35
|
+
* open, no hover timer closes it, and a press outside the trigger and the
|
|
36
|
+
* floating element does, as Escape does. The trigger's own tap action
|
|
37
|
+
* still runs.
|
|
38
|
+
* @defaultValue false
|
|
39
|
+
*/
|
|
40
|
+
openOnTap?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Pointer and focus handlers for the element that holds the trigger. The
|
|
44
|
+
* floating element has to be inside it in React's tree, in place or through
|
|
45
|
+
* a portal, since React's events reach it from there either way, and it
|
|
46
|
+
* should hold nothing else: focus inside it that isn't on the trigger counts
|
|
47
|
+
* as focus in the floating element.
|
|
48
|
+
*/
|
|
49
|
+
export interface HoverOpenHandlers {
|
|
50
|
+
onPointerEnter: (event: PointerEvent<HTMLElement>) => void;
|
|
51
|
+
onPointerLeave: (event: PointerEvent<HTMLElement>) => void;
|
|
52
|
+
onFocus: (event: FocusEvent<HTMLElement>) => void;
|
|
53
|
+
onBlur: (event: FocusEvent<HTMLElement>) => void;
|
|
54
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
55
|
+
onPointerUp: (event: PointerEvent<HTMLElement>) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Decides when a floating element that opens on hover or keyboard focus asks
|
|
59
|
+
* to open and to close. It renders nothing, and leaves roles, ARIA and
|
|
60
|
+
* placement to the component that calls it.
|
|
61
|
+
*
|
|
62
|
+
* - The pointer entering, or keyboard focus arriving on the trigger, asks to
|
|
63
|
+
* open after `openDelay`. A touch pointer doesn't count. Neither does focus
|
|
64
|
+
* that a press brings to the trigger: it counts when the browser shows it
|
|
65
|
+
* as `:focus-visible`.
|
|
66
|
+
* - Focus in the floating element holds it open however it got there,
|
|
67
|
+
* including focus in content it portals elsewhere, such as a nested card.
|
|
68
|
+
* Whether a click focuses what it lands on is up to the browser: Safari
|
|
69
|
+
* and Firefox on macOS don't focus a button on click, so there a clicked
|
|
70
|
+
* button doesn't hold it once the pointer leaves.
|
|
71
|
+
* - Once the pointer and focus have both left, it asks to close after
|
|
72
|
+
* `closeDelay`, and either coming back before then keeps it open. Nothing
|
|
73
|
+
* else closes it on a timer.
|
|
74
|
+
* - Escape closes it at once, wherever focus is, and stops there when focus
|
|
75
|
+
* is in it, on its trigger or nowhere, so a `Popover` or `Modal` around it
|
|
76
|
+
* keeps its own. With focus somewhere else, the key goes on after closing
|
|
77
|
+
* it. Inside another one, the inner one closes first. Escape before it
|
|
78
|
+
* opens takes the opening back and goes on its way. One key listener per
|
|
79
|
+
* document serves every hook on it, there only while one of them is open
|
|
80
|
+
* or on its way to open.
|
|
81
|
+
* - With `openOnTap`, a tap on the trigger opens it at once and the next tap
|
|
82
|
+
* on the trigger closes it. While a tap holds it open, a press outside the
|
|
83
|
+
* trigger and the floating element closes it, from a listener on the
|
|
84
|
+
* document that is there only then. Taps never count as hover, and mouse
|
|
85
|
+
* and pen work the same with it or without.
|
|
86
|
+
* - Once it closes, for any reason, whatever was holding it open has to
|
|
87
|
+
* leave and come back to open it again.
|
|
88
|
+
* - When the floating element closes with focus inside it, focus goes back
|
|
89
|
+
* to the trigger, unless the same update put it somewhere else. Handing it
|
|
90
|
+
* back doesn't count as focus arriving.
|
|
91
|
+
*
|
|
92
|
+
* Nothing it scheduled runs after the component unmounts.
|
|
93
|
+
*
|
|
94
|
+
* @function useHoverOpen
|
|
95
|
+
* @param options - The open state, how to ask for another, the delays, and the two elements.
|
|
96
|
+
* @returns Handlers for the element that holds the trigger.
|
|
97
|
+
*/
|
|
98
|
+
export declare function useHoverOpen(options: UseHoverOpenOptions): HoverOpenHandlers;
|
|
@@ -18,6 +18,7 @@ export * from './components/Collapse.js';
|
|
|
18
18
|
export * from './components/Collapses.js';
|
|
19
19
|
export * from './components/Tooltip.js';
|
|
20
20
|
export * from './components/Popover.js';
|
|
21
|
+
export * from './components/HoverCard.js';
|
|
21
22
|
export * from './components/Steps.js';
|
|
22
23
|
export * from './components/Sidebar.js';
|
|
23
24
|
export * from './components/Toast.js';
|