@allxsmith/bestax-bulma 5.59.0 → 5.60.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/index.esm.js CHANGED
@@ -34,6 +34,7 @@ export { TreeView, TreeViewItem } from './esm/components/TreeView.js';
34
34
  export { ScrollArea } from './esm/components/ScrollArea.js';
35
35
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from './esm/components/Command.js';
36
36
  export { DataTable } from './esm/components/DataTable.js';
37
+ export { Affix } from './esm/components/Affix.js';
37
38
  export { Block } from './esm/elements/Block.js';
38
39
  export { Box } from './esm/elements/Box.js';
39
40
  export { Button } from './esm/elements/Button.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ import type { BadgePosition } from './Badge.js';
4
+ /** A corner of the viewport: the same four values as `BadgePosition`. */
5
+ export type AffixPosition = BadgePosition;
6
+ /**
7
+ * Props for the Affix component. The helper props, the other attributes and
8
+ * the `ref` land on its `<div>`.
9
+ *
10
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `<div>`, wherever it renders.
11
+ */
12
+ export interface AffixProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
13
+ /** Additional CSS classes to apply. */
14
+ className?: string;
15
+ /** What stays in the corner. */
16
+ children?: React.ReactNode;
17
+ /**
18
+ * The corner of the viewport it's fixed to. Physical, as Badge's and
19
+ * Toast's are: `'bottom-right'` stays on the right in right-to-left text.
20
+ * Its distance from the edges is `--bulma-affix-offset-vertical` and
21
+ * `--bulma-affix-offset-horizontal` plus the device's safe-area inset; a
22
+ * margin from the spacing helpers (`mb`, `mr`, …) adds to it. A margin on
23
+ * one side also takes that much of the width its content can have, which
24
+ * the offset variables don't, so move it far with those.
25
+ * @defaultValue 'bottom-right'
26
+ */
27
+ position?: AffixPosition;
28
+ /**
29
+ * Renders it into another container, for a page where an ancestor's
30
+ * `transform`, `filter` or `contain` would capture `position: fixed`.
31
+ * `true` portals to the `portalContainer` a `ConfigProvider` sets,
32
+ * `document.body` by default; a string is used as a
33
+ * `document.querySelector` selector; an element is used directly. Renders
34
+ * in place on the server and while hydrating, moving into the portal once
35
+ * the client takes over, so hydration matches. Portaled, it's appended to
36
+ * that container when it mounts, so it comes after what's already there in
37
+ * the reading and Tab order.
38
+ * @defaultValue false
39
+ */
40
+ portal?: boolean | string | HTMLElement;
41
+ }
42
+ /**
43
+ * The `Affix` component keeps its content fixed to a corner of the viewport while the page scrolls under it.
44
+ *
45
+ * It's a `<div>` with no role, so what's inside keeps its own. It sits
46
+ * `--bulma-affix-offset-vertical` and `--bulma-affix-offset-horizontal`
47
+ * from its corner's edges, plus the device's safe-area inset, and stacks at
48
+ * `--bulma-affix-z-index`, over the page's content and under its navbar,
49
+ * static or fixed, its menus, popovers, the Sidebar, the modals, Tooltip and
50
+ * Toast. It's as wide as its
51
+ * content and never wider than the viewport less its offsets. It doesn't
52
+ * scroll, so nothing inside it is clipped, and content that can be taller
53
+ * than the screen scrolls itself. Its place in the reading and Tab order is
54
+ * its place in the DOM, whatever corner it shows in.
55
+ *
56
+ * @function
57
+ * @param {AffixProps} props - Props for the Affix component.
58
+ * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `<div>`.
59
+ * @returns The `<div>`, in place or in its portal.
60
+ *
61
+ * @example
62
+ * <Affix position="bottom-left">
63
+ * <Button color="primary">Feedback</Button>
64
+ * </Affix>
65
+ */
66
+ export declare const Affix: React.ForwardRefExoticComponent<AffixProps & React.RefAttributes<HTMLDivElement>>;
67
+ export default Affix;
@@ -30,6 +30,48 @@ export declare function resolvePortalContainer(container?: string | HTMLElement)
30
30
  * returns the DOM node to portal into.
31
31
  */
32
32
  export declare function usePortalContainer(): (container?: string | HTMLElement) => HTMLElement;
33
+ /**
34
+ * What a component that takes Modal's `portal` prop does with it now. See
35
+ * `usePortalProp`.
36
+ */
37
+ export interface PortalPropState {
38
+ /**
39
+ * Whether the content renders in its portal: `portal` is set and
40
+ * hydration is over. Before that it renders in place.
41
+ */
42
+ isPortaled: boolean;
43
+ /**
44
+ * The target to pass `Portal` as its `container`: the selector or element
45
+ * `portal` names, or `undefined` for `true`, which leaves the choice to the
46
+ * `portalContainer` a `ConfigProvider` sets and then `document.body`.
47
+ */
48
+ container?: string | HTMLElement;
49
+ /**
50
+ * The `portalContainer` a `ConfigProvider` sets, while it's what places the
51
+ * content (portaled, with `portal` set to `true`), else `undefined`. A
52
+ * change to it moves the content, so effects that hold its nodes depend
53
+ * on it.
54
+ */
55
+ defaultTarget?: string | HTMLElement;
56
+ }
57
+ /**
58
+ * Reads Modal's `portal` prop (`boolean | string | HTMLElement`) for a
59
+ * component that takes it: whether the content is in its portal yet, and
60
+ * where it goes.
61
+ *
62
+ * A portal has no server-rendered counterpart, so such a component renders in
63
+ * place on the server and while hydrating, and moves into its portal once the
64
+ * client takes over. Render the content in `Portal` with
65
+ * `disabled={!isPortaled}` and this `container`. Moving remounts the content,
66
+ * so an effect that holds one of its nodes depends on `isPortaled`, `portal`
67
+ * and `defaultTarget`.
68
+ *
69
+ * @function usePortalProp
70
+ * @param portal - The component's `portal` prop.
71
+ * @returns Whether it's portaled now, its `container`, and the provider's
72
+ * target while that places it.
73
+ */
74
+ export declare function usePortalProp(portal?: boolean | string | HTMLElement): PortalPropState;
33
75
  /**
34
76
  * Props for the Portal component.
35
77
  */
@@ -33,6 +33,7 @@ export * from './components/TreeView.js';
33
33
  export * from './components/ScrollArea.js';
34
34
  export * from './components/Command.js';
35
35
  export * from './components/DataTable.js';
36
+ export * from './components/Affix.js';
36
37
  export * from './elements/Block.js';
37
38
  export * from './elements/Box.js';
38
39
  export * from './elements/Button.js';
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ import type { BadgePosition } from './Badge.js';
4
+ /** A corner of the viewport: the same four values as `BadgePosition`. */
5
+ export type AffixPosition = BadgePosition;
6
+ /**
7
+ * Props for the Affix component. The helper props, the other attributes and
8
+ * the `ref` land on its `<div>`.
9
+ *
10
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `<div>`, wherever it renders.
11
+ */
12
+ export interface AffixProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
13
+ /** Additional CSS classes to apply. */
14
+ className?: string;
15
+ /** What stays in the corner. */
16
+ children?: React.ReactNode;
17
+ /**
18
+ * The corner of the viewport it's fixed to. Physical, as Badge's and
19
+ * Toast's are: `'bottom-right'` stays on the right in right-to-left text.
20
+ * Its distance from the edges is `--bulma-affix-offset-vertical` and
21
+ * `--bulma-affix-offset-horizontal` plus the device's safe-area inset; a
22
+ * margin from the spacing helpers (`mb`, `mr`, …) adds to it. A margin on
23
+ * one side also takes that much of the width its content can have, which
24
+ * the offset variables don't, so move it far with those.
25
+ * @defaultValue 'bottom-right'
26
+ */
27
+ position?: AffixPosition;
28
+ /**
29
+ * Renders it into another container, for a page where an ancestor's
30
+ * `transform`, `filter` or `contain` would capture `position: fixed`.
31
+ * `true` portals to the `portalContainer` a `ConfigProvider` sets,
32
+ * `document.body` by default; a string is used as a
33
+ * `document.querySelector` selector; an element is used directly. Renders
34
+ * in place on the server and while hydrating, moving into the portal once
35
+ * the client takes over, so hydration matches. Portaled, it's appended to
36
+ * that container when it mounts, so it comes after what's already there in
37
+ * the reading and Tab order.
38
+ * @defaultValue false
39
+ */
40
+ portal?: boolean | string | HTMLElement;
41
+ }
42
+ /**
43
+ * The `Affix` component keeps its content fixed to a corner of the viewport while the page scrolls under it.
44
+ *
45
+ * It's a `<div>` with no role, so what's inside keeps its own. It sits
46
+ * `--bulma-affix-offset-vertical` and `--bulma-affix-offset-horizontal`
47
+ * from its corner's edges, plus the device's safe-area inset, and stacks at
48
+ * `--bulma-affix-z-index`, over the page's content and under its navbar,
49
+ * static or fixed, its menus, popovers, the Sidebar, the modals, Tooltip and
50
+ * Toast. It's as wide as its
51
+ * content and never wider than the viewport less its offsets. It doesn't
52
+ * scroll, so nothing inside it is clipped, and content that can be taller
53
+ * than the screen scrolls itself. Its place in the reading and Tab order is
54
+ * its place in the DOM, whatever corner it shows in.
55
+ *
56
+ * @function
57
+ * @param {AffixProps} props - Props for the Affix component.
58
+ * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `<div>`.
59
+ * @returns The `<div>`, in place or in its portal.
60
+ *
61
+ * @example
62
+ * <Affix position="bottom-left">
63
+ * <Button color="primary">Feedback</Button>
64
+ * </Affix>
65
+ */
66
+ export declare const Affix: React.ForwardRefExoticComponent<AffixProps & React.RefAttributes<HTMLDivElement>>;
67
+ export default Affix;
@@ -30,6 +30,48 @@ export declare function resolvePortalContainer(container?: string | HTMLElement)
30
30
  * returns the DOM node to portal into.
31
31
  */
32
32
  export declare function usePortalContainer(): (container?: string | HTMLElement) => HTMLElement;
33
+ /**
34
+ * What a component that takes Modal's `portal` prop does with it now. See
35
+ * `usePortalProp`.
36
+ */
37
+ export interface PortalPropState {
38
+ /**
39
+ * Whether the content renders in its portal: `portal` is set and
40
+ * hydration is over. Before that it renders in place.
41
+ */
42
+ isPortaled: boolean;
43
+ /**
44
+ * The target to pass `Portal` as its `container`: the selector or element
45
+ * `portal` names, or `undefined` for `true`, which leaves the choice to the
46
+ * `portalContainer` a `ConfigProvider` sets and then `document.body`.
47
+ */
48
+ container?: string | HTMLElement;
49
+ /**
50
+ * The `portalContainer` a `ConfigProvider` sets, while it's what places the
51
+ * content (portaled, with `portal` set to `true`), else `undefined`. A
52
+ * change to it moves the content, so effects that hold its nodes depend
53
+ * on it.
54
+ */
55
+ defaultTarget?: string | HTMLElement;
56
+ }
57
+ /**
58
+ * Reads Modal's `portal` prop (`boolean | string | HTMLElement`) for a
59
+ * component that takes it: whether the content is in its portal yet, and
60
+ * where it goes.
61
+ *
62
+ * A portal has no server-rendered counterpart, so such a component renders in
63
+ * place on the server and while hydrating, and moves into its portal once the
64
+ * client takes over. Render the content in `Portal` with
65
+ * `disabled={!isPortaled}` and this `container`. Moving remounts the content,
66
+ * so an effect that holds one of its nodes depends on `isPortaled`, `portal`
67
+ * and `defaultTarget`.
68
+ *
69
+ * @function usePortalProp
70
+ * @param portal - The component's `portal` prop.
71
+ * @returns Whether it's portaled now, its `container`, and the provider's
72
+ * target while that places it.
73
+ */
74
+ export declare function usePortalProp(portal?: boolean | string | HTMLElement): PortalPropState;
33
75
  /**
34
76
  * Props for the Portal component.
35
77
  */
@@ -33,6 +33,7 @@ export * from './components/TreeView.js';
33
33
  export * from './components/ScrollArea.js';
34
34
  export * from './components/Command.js';
35
35
  export * from './components/DataTable.js';
36
+ export * from './components/Affix.js';
36
37
  export * from './elements/Block.js';
37
38
  export * from './elements/Box.js';
38
39
  export * from './elements/Button.js';