@allxsmith/bestax-bulma 5.47.0 → 5.48.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/ScrollArea.js +225 -0
- package/dist/esm/components/ScrollArea.js.map +1 -0
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +215 -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/ScrollArea.d.ts +105 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-cjs/components/ScrollArea.d.ts +105 -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 +1 -1
- package/src/scss/components/_index.scss +1 -0
- package/src/scss/components/_scrollarea.scss +248 -0
package/dist/index.esm.js
CHANGED
|
@@ -31,6 +31,7 @@ export { Dialog, DialogContainer, dialog } from './esm/components/Dialog.js';
|
|
|
31
31
|
export { Carousel, CarouselItem } from './esm/components/Carousel.js';
|
|
32
32
|
export { Reveal } from './esm/components/Reveal.js';
|
|
33
33
|
export { TreeView, TreeViewItem } from './esm/components/TreeView.js';
|
|
34
|
+
export { ScrollArea } from './esm/components/ScrollArea.js';
|
|
34
35
|
export { Block } from './esm/elements/Block.js';
|
|
35
36
|
export { Box } from './esm/elements/Box.js';
|
|
36
37
|
export { Button } from './esm/elements/Button.js';
|
package/dist/index.esm.js.map
CHANGED
|
@@ -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,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
|
|
3
|
+
/** Which way the content scrolls. */
|
|
4
|
+
export type ScrollAreaOrientation = 'vertical' | 'horizontal' | 'both';
|
|
5
|
+
/** When the scrollbars show. */
|
|
6
|
+
export type ScrollAreaScrollbars = 'auto' | 'hover' | 'always';
|
|
7
|
+
/** An edge of the content: the block's top and bottom, the line's start and end. */
|
|
8
|
+
export type ScrollAreaEdge = 'top' | 'bottom' | 'start' | 'end';
|
|
9
|
+
/**
|
|
10
|
+
* Props for the ScrollArea component.
|
|
11
|
+
*
|
|
12
|
+
* @helperProps The helper props go on the outer `<div>`, the `.scroll-area`
|
|
13
|
+
* frame, with `className` and `style`. The `ref`, the name, `onScroll` and
|
|
14
|
+
* the other attributes go on the `<div>` inside it, the viewport that
|
|
15
|
+
* scrolls.
|
|
16
|
+
*
|
|
17
|
+
* @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the viewport, the element that scrolls, for `scrollTo` and the like.
|
|
18
|
+
* @extraProp {string} [aria-label] - Names the region, such as "Release notes". It needs a name, so pass this or `aria-labelledby`, and a development build warns when it has neither. The name is rendered with the region's role, while the content overflows, since ARIA doesn't allow naming a plain `div`.
|
|
19
|
+
* @extraProp {string} [aria-labelledby] - The id of a visible heading that names the region, in place of `aria-label`.
|
|
20
|
+
* @extraProp {React.UIEventHandler<HTMLDivElement>} [onScroll] - Called as the viewport scrolls.
|
|
21
|
+
*/
|
|
22
|
+
export interface ScrollAreaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role' | 'tabIndex'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
23
|
+
/** Additional CSS classes for the outer frame. */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Inline styles for the outer frame. */
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
/** What scrolls. */
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The area's height. A number is pixels, and a string is any CSS length
|
|
31
|
+
* (`"20rem"`, `"50vh"`, `"100%"`).
|
|
32
|
+
*/
|
|
33
|
+
height?: number | string;
|
|
34
|
+
/**
|
|
35
|
+
* The height it grows to with its content, then scrolls past. A number is
|
|
36
|
+
* pixels. Use it in place of `height` for an area that's only as tall as
|
|
37
|
+
* it needs to be.
|
|
38
|
+
*/
|
|
39
|
+
maxHeight?: number | string;
|
|
40
|
+
/**
|
|
41
|
+
* Which way it scrolls. `vertical` and `horizontal` clip the other axis,
|
|
42
|
+
* and `both` scrolls whichever overflows.
|
|
43
|
+
*/
|
|
44
|
+
orientation?: ScrollAreaOrientation;
|
|
45
|
+
/**
|
|
46
|
+
* When the scrollbars show. `auto`: whenever the content overflows, the
|
|
47
|
+
* way the system shows them. `hover`: colorless until the pointer is over
|
|
48
|
+
* the area or focus is in it, which hides that the area scrolls until
|
|
49
|
+
* then, so keep it for places where the layout makes that plain.
|
|
50
|
+
* `always`: on every axis it scrolls, even when the content fits. Where the
|
|
51
|
+
* system draws its bars over the content (macOS by default, phones and
|
|
52
|
+
* tablets), they still show only while you scroll, and in forced colors
|
|
53
|
+
* they always show.
|
|
54
|
+
*/
|
|
55
|
+
showScrollbars?: ScrollAreaScrollbars;
|
|
56
|
+
/**
|
|
57
|
+
* Keeps room for the vertical scrollbar whether or not it shows, so the
|
|
58
|
+
* content doesn't shift when it starts to overflow. It does nothing where
|
|
59
|
+
* the system draws its bars over the content.
|
|
60
|
+
*/
|
|
61
|
+
hasStableGutter?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Fades the content out toward each edge that has more past it, without
|
|
64
|
+
* fading the scrollbar. It's off in forced colors and when the user asks
|
|
65
|
+
* for more contrast.
|
|
66
|
+
*/
|
|
67
|
+
hasFade?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Called with the edge when scrolling reaches it, once each time it
|
|
70
|
+
* arrives, such as to load older messages at the top. It isn't called for
|
|
71
|
+
* the edge the area starts at, or when the content changes size.
|
|
72
|
+
*/
|
|
73
|
+
onEdgeReach?: (edge: ScrollAreaEdge) => void;
|
|
74
|
+
/** Text color helper. */
|
|
75
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
76
|
+
/** Background color helper. */
|
|
77
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The `ScrollArea` component renders a box whose content scrolls inside it, on the browser's own scrollbars in Bulma's colors.
|
|
81
|
+
*
|
|
82
|
+
* The bars are the system's, made thin and colored from Bulma's tokens, so
|
|
83
|
+
* they follow dark mode and keep the system's own settings. While the
|
|
84
|
+
* content overflows, the viewport is a region you can tab to and scroll by
|
|
85
|
+
* keyboard, Safari included, named by `aria-label` or `aria-labelledby`.
|
|
86
|
+
* While it fits, it's a plain box. Setting the bars' colors turns off any
|
|
87
|
+
* `::-webkit-scrollbar` styles inside it.
|
|
88
|
+
*
|
|
89
|
+
* @function
|
|
90
|
+
* @param {ScrollAreaProps} props - Props for the ScrollArea component.
|
|
91
|
+
* @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the viewport.
|
|
92
|
+
* @returns {JSX.Element} The rendered scroll area.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* <ScrollArea height={240} aria-label="Release notes">
|
|
96
|
+
* <Content>…</Content>
|
|
97
|
+
* </ScrollArea>
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* <ScrollArea maxHeight="20rem" aria-label="Messages" hasFade>
|
|
101
|
+
* …
|
|
102
|
+
* </ScrollArea>
|
|
103
|
+
*/
|
|
104
|
+
export declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
105
|
+
export default ScrollArea;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from './components/Dialog.js';
|
|
|
30
30
|
export * from './components/Carousel.js';
|
|
31
31
|
export * from './components/Reveal.js';
|
|
32
32
|
export * from './components/TreeView.js';
|
|
33
|
+
export * from './components/ScrollArea.js';
|
|
33
34
|
export * from './elements/Block.js';
|
|
34
35
|
export * from './elements/Box.js';
|
|
35
36
|
export * from './elements/Button.js';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
|
|
3
|
+
/** Which way the content scrolls. */
|
|
4
|
+
export type ScrollAreaOrientation = 'vertical' | 'horizontal' | 'both';
|
|
5
|
+
/** When the scrollbars show. */
|
|
6
|
+
export type ScrollAreaScrollbars = 'auto' | 'hover' | 'always';
|
|
7
|
+
/** An edge of the content: the block's top and bottom, the line's start and end. */
|
|
8
|
+
export type ScrollAreaEdge = 'top' | 'bottom' | 'start' | 'end';
|
|
9
|
+
/**
|
|
10
|
+
* Props for the ScrollArea component.
|
|
11
|
+
*
|
|
12
|
+
* @helperProps The helper props go on the outer `<div>`, the `.scroll-area`
|
|
13
|
+
* frame, with `className` and `style`. The `ref`, the name, `onScroll` and
|
|
14
|
+
* the other attributes go on the `<div>` inside it, the viewport that
|
|
15
|
+
* scrolls.
|
|
16
|
+
*
|
|
17
|
+
* @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the viewport, the element that scrolls, for `scrollTo` and the like.
|
|
18
|
+
* @extraProp {string} [aria-label] - Names the region, such as "Release notes". It needs a name, so pass this or `aria-labelledby`, and a development build warns when it has neither. The name is rendered with the region's role, while the content overflows, since ARIA doesn't allow naming a plain `div`.
|
|
19
|
+
* @extraProp {string} [aria-labelledby] - The id of a visible heading that names the region, in place of `aria-label`.
|
|
20
|
+
* @extraProp {React.UIEventHandler<HTMLDivElement>} [onScroll] - Called as the viewport scrolls.
|
|
21
|
+
*/
|
|
22
|
+
export interface ScrollAreaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role' | 'tabIndex'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
23
|
+
/** Additional CSS classes for the outer frame. */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Inline styles for the outer frame. */
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
/** What scrolls. */
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The area's height. A number is pixels, and a string is any CSS length
|
|
31
|
+
* (`"20rem"`, `"50vh"`, `"100%"`).
|
|
32
|
+
*/
|
|
33
|
+
height?: number | string;
|
|
34
|
+
/**
|
|
35
|
+
* The height it grows to with its content, then scrolls past. A number is
|
|
36
|
+
* pixels. Use it in place of `height` for an area that's only as tall as
|
|
37
|
+
* it needs to be.
|
|
38
|
+
*/
|
|
39
|
+
maxHeight?: number | string;
|
|
40
|
+
/**
|
|
41
|
+
* Which way it scrolls. `vertical` and `horizontal` clip the other axis,
|
|
42
|
+
* and `both` scrolls whichever overflows.
|
|
43
|
+
*/
|
|
44
|
+
orientation?: ScrollAreaOrientation;
|
|
45
|
+
/**
|
|
46
|
+
* When the scrollbars show. `auto`: whenever the content overflows, the
|
|
47
|
+
* way the system shows them. `hover`: colorless until the pointer is over
|
|
48
|
+
* the area or focus is in it, which hides that the area scrolls until
|
|
49
|
+
* then, so keep it for places where the layout makes that plain.
|
|
50
|
+
* `always`: on every axis it scrolls, even when the content fits. Where the
|
|
51
|
+
* system draws its bars over the content (macOS by default, phones and
|
|
52
|
+
* tablets), they still show only while you scroll, and in forced colors
|
|
53
|
+
* they always show.
|
|
54
|
+
*/
|
|
55
|
+
showScrollbars?: ScrollAreaScrollbars;
|
|
56
|
+
/**
|
|
57
|
+
* Keeps room for the vertical scrollbar whether or not it shows, so the
|
|
58
|
+
* content doesn't shift when it starts to overflow. It does nothing where
|
|
59
|
+
* the system draws its bars over the content.
|
|
60
|
+
*/
|
|
61
|
+
hasStableGutter?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Fades the content out toward each edge that has more past it, without
|
|
64
|
+
* fading the scrollbar. It's off in forced colors and when the user asks
|
|
65
|
+
* for more contrast.
|
|
66
|
+
*/
|
|
67
|
+
hasFade?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Called with the edge when scrolling reaches it, once each time it
|
|
70
|
+
* arrives, such as to load older messages at the top. It isn't called for
|
|
71
|
+
* the edge the area starts at, or when the content changes size.
|
|
72
|
+
*/
|
|
73
|
+
onEdgeReach?: (edge: ScrollAreaEdge) => void;
|
|
74
|
+
/** Text color helper. */
|
|
75
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
76
|
+
/** Background color helper. */
|
|
77
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The `ScrollArea` component renders a box whose content scrolls inside it, on the browser's own scrollbars in Bulma's colors.
|
|
81
|
+
*
|
|
82
|
+
* The bars are the system's, made thin and colored from Bulma's tokens, so
|
|
83
|
+
* they follow dark mode and keep the system's own settings. While the
|
|
84
|
+
* content overflows, the viewport is a region you can tab to and scroll by
|
|
85
|
+
* keyboard, Safari included, named by `aria-label` or `aria-labelledby`.
|
|
86
|
+
* While it fits, it's a plain box. Setting the bars' colors turns off any
|
|
87
|
+
* `::-webkit-scrollbar` styles inside it.
|
|
88
|
+
*
|
|
89
|
+
* @function
|
|
90
|
+
* @param {ScrollAreaProps} props - Props for the ScrollArea component.
|
|
91
|
+
* @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the viewport.
|
|
92
|
+
* @returns {JSX.Element} The rendered scroll area.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* <ScrollArea height={240} aria-label="Release notes">
|
|
96
|
+
* <Content>…</Content>
|
|
97
|
+
* </ScrollArea>
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* <ScrollArea maxHeight="20rem" aria-label="Messages" hasFade>
|
|
101
|
+
* …
|
|
102
|
+
* </ScrollArea>
|
|
103
|
+
*/
|
|
104
|
+
export declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
105
|
+
export default ScrollArea;
|
|
@@ -30,6 +30,7 @@ export * from './components/Dialog.js';
|
|
|
30
30
|
export * from './components/Carousel.js';
|
|
31
31
|
export * from './components/Reveal.js';
|
|
32
32
|
export * from './components/TreeView.js';
|
|
33
|
+
export * from './components/ScrollArea.js';
|
|
33
34
|
export * from './elements/Block.js';
|
|
34
35
|
export * from './elements/Box.js';
|
|
35
36
|
export * from './elements/Button.js';
|