@allxsmith/bestax-bulma 5.49.0 → 5.50.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/README.md +2 -3
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/elements/RingProgress.js +117 -0
- package/dist/esm/elements/RingProgress.js.map +1 -0
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +108 -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/elements/RingProgress.d.ts +91 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-cjs/elements/RingProgress.d.ts +91 -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/elements/_index.scss +1 -0
- package/src/scss/elements/_ringprogress.scss +160 -0
package/dist/index.esm.js
CHANGED
|
@@ -56,6 +56,7 @@ export { OrderedList } from './esm/elements/OrderedList.js';
|
|
|
56
56
|
export { Paragraph } from './esm/elements/Paragraph.js';
|
|
57
57
|
export { Pre } from './esm/elements/Pre.js';
|
|
58
58
|
export { Progress } from './esm/elements/Progress.js';
|
|
59
|
+
export { RingProgress } from './esm/elements/RingProgress.js';
|
|
59
60
|
export { Skeleton } from './esm/elements/Skeleton.js';
|
|
60
61
|
export { Span } from './esm/elements/Span.js';
|
|
61
62
|
export { Strong } from './esm/elements/Strong.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,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
|
|
3
|
+
declare const validRingProgressColors: readonly ["primary", "link", "info", "success", "warning", "danger", "black", "dark", "light", "white"];
|
|
4
|
+
/** The Bulma colors an arc takes, the ones `Progress` takes. */
|
|
5
|
+
export type RingProgressColor = (typeof validRingProgressColors)[number];
|
|
6
|
+
declare const validRingProgressSizes: readonly ["small", "medium", "large"];
|
|
7
|
+
/** One colored part of a ring drawn in sections. */
|
|
8
|
+
export interface RingProgressSection {
|
|
9
|
+
/** Its size, in the same units as the ring's `max`. */
|
|
10
|
+
value: number;
|
|
11
|
+
/** Its color. Without one, it takes the ring's. */
|
|
12
|
+
color?: RingProgressColor;
|
|
13
|
+
/** What it is, such as "Photos", read in the ring's name with its share. */
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Props for the RingProgress component. The helper props, the other
|
|
18
|
+
* attributes and the `ref` land on its root `<div>`.
|
|
19
|
+
*
|
|
20
|
+
* @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root `<div>`.
|
|
21
|
+
* @extraProp {string} [aria-labelledby] - The id of a visible heading that names the ring, in place of `label`. With `sections`, use `label`, since a name from here replaces the one that lists the values.
|
|
22
|
+
* @extraProp {string} [aria-valuetext] - What a screen reader says for the value, such as "7 of 10 tasks". Without it, the value is read as a percentage.
|
|
23
|
+
*/
|
|
24
|
+
export interface RingProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
25
|
+
/** Additional CSS classes to apply. */
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* How far along it is, from 0 to `max`. Values outside that range are
|
|
29
|
+
* drawn, and read, at the nearest end. Ignored with `sections`.
|
|
30
|
+
*/
|
|
31
|
+
value?: number;
|
|
32
|
+
/** The value that fills the ring. */
|
|
33
|
+
max?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Several values around one ring, in order clockwise from the top, each
|
|
36
|
+
* with its own color and label. The ring is then an image whose name
|
|
37
|
+
* writes them out, such as "Storage: Documents 40%, Photos 15%", since a
|
|
38
|
+
* screen reader can't take several values from one element. A total over
|
|
39
|
+
* `max` fills the ring and stops.
|
|
40
|
+
*/
|
|
41
|
+
sections?: RingProgressSection[];
|
|
42
|
+
/**
|
|
43
|
+
* What it shows, such as "Upload" or "Storage". It names the ring, so it's
|
|
44
|
+
* read with the value. A development build warns when the ring has no
|
|
45
|
+
* name.
|
|
46
|
+
*/
|
|
47
|
+
label?: string;
|
|
48
|
+
/**
|
|
49
|
+
* A level within a range, such as storage used or a score, rather than a
|
|
50
|
+
* task moving toward done: `role="meter"` in place of `role="progressbar"`.
|
|
51
|
+
* Ignored with `sections`.
|
|
52
|
+
*/
|
|
53
|
+
isMeter?: boolean;
|
|
54
|
+
/** The arc's color, and the color of sections without one. */
|
|
55
|
+
color?: RingProgressColor;
|
|
56
|
+
/** The ring's size. */
|
|
57
|
+
size?: (typeof validRingProgressSizes)[number];
|
|
58
|
+
/** Rounds the ends of the arc. */
|
|
59
|
+
isRounded?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* What sits in the middle of the ring, such as the value as text. It's
|
|
62
|
+
* hidden from assistive tech, which reads the value from the ring itself,
|
|
63
|
+
* so the value isn't heard twice. Say anything more, such as "7 of 10
|
|
64
|
+
* tasks", in `aria-valuetext`.
|
|
65
|
+
*/
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
/** Text color helper. */
|
|
68
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
69
|
+
/** Background color helper. */
|
|
70
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The `RingProgress` component draws a value as a ring that fills as it grows, with anything you pass shown in the middle.
|
|
74
|
+
*
|
|
75
|
+
* It's a `progressbar` for a task moving toward done, or a `meter` with
|
|
76
|
+
* `isMeter` for a level within a range, named by `label`. With `sections`
|
|
77
|
+
* it draws several values around one ring and is an image whose name lists
|
|
78
|
+
* them. It has no state for work with no value: that's `Loader`.
|
|
79
|
+
*
|
|
80
|
+
* @function
|
|
81
|
+
* @param {RingProgressProps} props - Props for the RingProgress component.
|
|
82
|
+
* @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root `<div>`.
|
|
83
|
+
* @returns {JSX.Element} The rendered ring.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* <RingProgress value={72} label="Upload" color="success">
|
|
87
|
+
* 72%
|
|
88
|
+
* </RingProgress>
|
|
89
|
+
*/
|
|
90
|
+
export declare const RingProgress: React.ForwardRefExoticComponent<RingProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
export default RingProgress;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export * from './elements/OrderedList.js';
|
|
|
55
55
|
export * from './elements/Paragraph.js';
|
|
56
56
|
export * from './elements/Pre.js';
|
|
57
57
|
export * from './elements/Progress.js';
|
|
58
|
+
export * from './elements/RingProgress.js';
|
|
58
59
|
export * from './elements/Skeleton.js';
|
|
59
60
|
export * from './elements/Span.js';
|
|
60
61
|
export * from './elements/Strong.js';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
|
|
3
|
+
declare const validRingProgressColors: readonly ["primary", "link", "info", "success", "warning", "danger", "black", "dark", "light", "white"];
|
|
4
|
+
/** The Bulma colors an arc takes, the ones `Progress` takes. */
|
|
5
|
+
export type RingProgressColor = (typeof validRingProgressColors)[number];
|
|
6
|
+
declare const validRingProgressSizes: readonly ["small", "medium", "large"];
|
|
7
|
+
/** One colored part of a ring drawn in sections. */
|
|
8
|
+
export interface RingProgressSection {
|
|
9
|
+
/** Its size, in the same units as the ring's `max`. */
|
|
10
|
+
value: number;
|
|
11
|
+
/** Its color. Without one, it takes the ring's. */
|
|
12
|
+
color?: RingProgressColor;
|
|
13
|
+
/** What it is, such as "Photos", read in the ring's name with its share. */
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Props for the RingProgress component. The helper props, the other
|
|
18
|
+
* attributes and the `ref` land on its root `<div>`.
|
|
19
|
+
*
|
|
20
|
+
* @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root `<div>`.
|
|
21
|
+
* @extraProp {string} [aria-labelledby] - The id of a visible heading that names the ring, in place of `label`. With `sections`, use `label`, since a name from here replaces the one that lists the values.
|
|
22
|
+
* @extraProp {string} [aria-valuetext] - What a screen reader says for the value, such as "7 of 10 tasks". Without it, the value is read as a percentage.
|
|
23
|
+
*/
|
|
24
|
+
export interface RingProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
25
|
+
/** Additional CSS classes to apply. */
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* How far along it is, from 0 to `max`. Values outside that range are
|
|
29
|
+
* drawn, and read, at the nearest end. Ignored with `sections`.
|
|
30
|
+
*/
|
|
31
|
+
value?: number;
|
|
32
|
+
/** The value that fills the ring. */
|
|
33
|
+
max?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Several values around one ring, in order clockwise from the top, each
|
|
36
|
+
* with its own color and label. The ring is then an image whose name
|
|
37
|
+
* writes them out, such as "Storage: Documents 40%, Photos 15%", since a
|
|
38
|
+
* screen reader can't take several values from one element. A total over
|
|
39
|
+
* `max` fills the ring and stops.
|
|
40
|
+
*/
|
|
41
|
+
sections?: RingProgressSection[];
|
|
42
|
+
/**
|
|
43
|
+
* What it shows, such as "Upload" or "Storage". It names the ring, so it's
|
|
44
|
+
* read with the value. A development build warns when the ring has no
|
|
45
|
+
* name.
|
|
46
|
+
*/
|
|
47
|
+
label?: string;
|
|
48
|
+
/**
|
|
49
|
+
* A level within a range, such as storage used or a score, rather than a
|
|
50
|
+
* task moving toward done: `role="meter"` in place of `role="progressbar"`.
|
|
51
|
+
* Ignored with `sections`.
|
|
52
|
+
*/
|
|
53
|
+
isMeter?: boolean;
|
|
54
|
+
/** The arc's color, and the color of sections without one. */
|
|
55
|
+
color?: RingProgressColor;
|
|
56
|
+
/** The ring's size. */
|
|
57
|
+
size?: (typeof validRingProgressSizes)[number];
|
|
58
|
+
/** Rounds the ends of the arc. */
|
|
59
|
+
isRounded?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* What sits in the middle of the ring, such as the value as text. It's
|
|
62
|
+
* hidden from assistive tech, which reads the value from the ring itself,
|
|
63
|
+
* so the value isn't heard twice. Say anything more, such as "7 of 10
|
|
64
|
+
* tasks", in `aria-valuetext`.
|
|
65
|
+
*/
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
/** Text color helper. */
|
|
68
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
69
|
+
/** Background color helper. */
|
|
70
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The `RingProgress` component draws a value as a ring that fills as it grows, with anything you pass shown in the middle.
|
|
74
|
+
*
|
|
75
|
+
* It's a `progressbar` for a task moving toward done, or a `meter` with
|
|
76
|
+
* `isMeter` for a level within a range, named by `label`. With `sections`
|
|
77
|
+
* it draws several values around one ring and is an image whose name lists
|
|
78
|
+
* them. It has no state for work with no value: that's `Loader`.
|
|
79
|
+
*
|
|
80
|
+
* @function
|
|
81
|
+
* @param {RingProgressProps} props - Props for the RingProgress component.
|
|
82
|
+
* @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root `<div>`.
|
|
83
|
+
* @returns {JSX.Element} The rendered ring.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* <RingProgress value={72} label="Upload" color="success">
|
|
87
|
+
* 72%
|
|
88
|
+
* </RingProgress>
|
|
89
|
+
*/
|
|
90
|
+
export declare const RingProgress: React.ForwardRefExoticComponent<RingProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
export default RingProgress;
|
|
@@ -55,6 +55,7 @@ export * from './elements/OrderedList.js';
|
|
|
55
55
|
export * from './elements/Paragraph.js';
|
|
56
56
|
export * from './elements/Pre.js';
|
|
57
57
|
export * from './elements/Progress.js';
|
|
58
|
+
export * from './elements/RingProgress.js';
|
|
58
59
|
export * from './elements/Skeleton.js';
|
|
59
60
|
export * from './elements/Span.js';
|
|
60
61
|
export * from './elements/Strong.js';
|