@allxsmith/bestax-bulma 5.27.8 → 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/DateTimeInput.js.map +1 -1
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/File.js.map +1 -1
- package/dist/esm/form/Input.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/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/TimeInput.js.map +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/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +498 -0
- 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 +1 -1
- package/dist/types/form/File.d.ts +1 -1
- 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/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 +1 -1
- package/dist/types-cjs/form/File.d.ts +1 -1
- 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/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 +2 -2
- package/src/scss/components/_hovercard.scss +118 -0
- package/src/scss/components/_index.scss +1 -0
|
@@ -18,7 +18,7 @@ import { SelectBaseProps } from './SelectBase.js';
|
|
|
18
18
|
* `label`, `horizontal` and class name on that `Field`.
|
|
19
19
|
*/
|
|
20
20
|
export interface SelectProps extends SelectBaseProps {
|
|
21
|
-
/** Field label. Automatically associated with the select via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
|
|
21
|
+
/** Field label. Automatically associated with the select via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */
|
|
22
22
|
label?: React.ReactNode;
|
|
23
23
|
/** Size for the label. */
|
|
24
24
|
labelSize?: FieldProps['labelSize'];
|
|
@@ -22,7 +22,7 @@ export interface SliderMark {
|
|
|
22
22
|
* Shared base props for single and range Slider modes.
|
|
23
23
|
*/
|
|
24
24
|
interface SliderBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'color' | 'size' | 'onChange' | 'value' | 'defaultValue'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'>, FormFieldProps {
|
|
25
|
-
/** Field label. Automatically associated with the slider input via `htmlFor` — uses your `id` when provided, otherwise a generated one. In range mode the `htmlFor` targets the low (minimum) thumb, and the label also starts each thumb's name through `aria-labelledby`, as in "Price Minimum value" and "Price Maximum value", unless an `aria-label` or `aria-labelledby` on the Slider takes its place there. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`), naming a range Slider's thumbs the same way. A `Field` label you wire by hand to the low thumb with `labelProps.htmlFor` names the thumbs too when you also give it an `id` there, since the `Field` generates none for it. */
|
|
25
|
+
/** Field label. Automatically associated with the slider input via `htmlFor` — uses your `id` when provided, otherwise a generated one. In range mode the `htmlFor` targets the low (minimum) thumb, and the label also starts each thumb's name through `aria-labelledby`, as in "Price Minimum value" and "Price Maximum value", unless an `aria-label` or `aria-labelledby` on the Slider takes its place there. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here, naming a range Slider's thumbs the same way. A `Field` label you wire by hand to the low thumb with `labelProps.htmlFor` names the thumbs too when you also give it an `id` there, since the `Field` generates none for it. */
|
|
26
26
|
label?: React.ReactNode;
|
|
27
27
|
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). In range mode an `id` here is the one the thumbs' `aria-labelledby` points at, in place of a generated one. */
|
|
28
28
|
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
@@ -26,7 +26,7 @@ type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
|
|
|
26
26
|
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the input element.
|
|
27
27
|
*/
|
|
28
28
|
export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>, Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
29
|
-
/** Field label. Automatically associated with the text input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired when the tag limit is reached (the input is not rendered). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`); it then replaces the `aria-label="Add tag"` fallback too. */
|
|
29
|
+
/** Field label. Automatically associated with the text input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired when the tag limit is reached (the input is not rendered). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here; it then replaces the `aria-label="Add tag"` fallback too. */
|
|
30
30
|
label?: React.ReactNode;
|
|
31
31
|
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
32
32
|
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
@@ -18,7 +18,7 @@ import { TextAreaBaseProps } from './TextAreaBase.js';
|
|
|
18
18
|
* `label`, `horizontal` and class name on that `Field`.
|
|
19
19
|
*/
|
|
20
20
|
export interface TextAreaProps extends TextAreaBaseProps {
|
|
21
|
-
/** Field label. Automatically associated with the textarea via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
|
|
21
|
+
/** Field label. Automatically associated with the textarea via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */
|
|
22
22
|
label?: React.ReactNode;
|
|
23
23
|
/** Size for the label. */
|
|
24
24
|
labelSize?: FieldProps['labelSize'];
|
|
@@ -22,7 +22,7 @@ import { TimeInputBaseProps } from './TimeInputBase.js';
|
|
|
22
22
|
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.
|
|
23
23
|
*/
|
|
24
24
|
export interface TimeInputProps extends TimeInputBaseProps {
|
|
25
|
-
/** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
|
|
25
|
+
/** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */
|
|
26
26
|
label?: React.ReactNode;
|
|
27
27
|
/** Size for the label. */
|
|
28
28
|
labelSize?: FieldProps['labelSize'];
|
|
@@ -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';
|