@bigbluebutton/bbb-ui-components-react 0.9.0 → 0.10.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 +1 -0
- package/dist/components/Search.js +3 -2
- package/dist/components/Spinner.js +1 -0
- package/dist/components/Toast.js +292 -0
- package/dist/components/Toggle.js +18 -11
- package/dist/components/index.js +366 -216
- package/dist/esm/components/Spinner/styles.js +1 -0
- package/dist/esm/components/Toast/component.js +144 -0
- package/dist/esm/components/Toast/constants.js +36 -0
- package/dist/esm/components/Toast/index.js +1 -0
- package/dist/esm/components/Toast/styles.js +180 -0
- package/dist/esm/components/Toast/types.js +1 -0
- package/dist/esm/components/Toggle/component.js +5 -4
- package/dist/esm/components/Toggle/styles.js +13 -2
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/stylesheets/palette.js +4 -0
- package/dist/types/components/Accordion/constants.d.ts +1 -1
- package/dist/types/components/Button/constants.d.ts +4 -4
- package/dist/types/components/Slider/styles.d.ts +1 -1
- package/dist/types/components/TextInput/styles.d.ts +1 -1
- package/dist/types/components/Toast/component.d.ts +14 -0
- package/dist/types/components/Toast/constants.d.ts +42 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/types/components/Toast/styles.d.ts +14 -0
- package/dist/types/components/Toast/types.d.ts +68 -0
- package/dist/types/components/Toggle/component.d.ts +1 -1
- package/dist/types/components/Toggle/constants.d.ts +2 -2
- package/dist/types/components/Toggle/types.d.ts +3 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/stylesheets/palette.d.ts +2 -0
- package/package.json +11 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TOAST_VARIANT_VALUES } from './constants';
|
|
3
|
+
export type ToastVariant = (typeof TOAST_VARIANT_VALUES)[number];
|
|
4
|
+
export interface StyledToastProps {
|
|
5
|
+
$disablePointer: boolean;
|
|
6
|
+
$maxHeight: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StyledProgressBarProps {
|
|
9
|
+
$variant: ToastVariant;
|
|
10
|
+
$duration: number;
|
|
11
|
+
$paused: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface StyledIconBadgeProps {
|
|
14
|
+
$variant: ToastVariant;
|
|
15
|
+
$small: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface StyledCardActionProps {
|
|
18
|
+
$visuallyHidden: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface StyledTextProps {
|
|
21
|
+
$small: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
24
|
+
/** Title of the notification, rendered on its own line; usually plain text, but takes a node for inline i18n markup. */
|
|
25
|
+
message?: React.ReactNode;
|
|
26
|
+
/** Visual variant driving the default icon and the icon badge color. @default 'default' */
|
|
27
|
+
variant?: ToastVariant;
|
|
28
|
+
/** Custom icon replacing the one matched to `variant`, or `false` to hide the icon badge entirely. */
|
|
29
|
+
icon?: React.ReactNode | false;
|
|
30
|
+
/** Description or secondary content (text, links, action buttons) rendered below the title, sharing its left edge. */
|
|
31
|
+
content?: React.ReactNode;
|
|
32
|
+
/** Shows the divider between the title and `content`; only rendered when both are present. @default true */
|
|
33
|
+
showSeparator?: boolean;
|
|
34
|
+
/** Compact variant for space-constrained placements. @default false */
|
|
35
|
+
small?: boolean;
|
|
36
|
+
/** Keeps the default cursor instead of showing a pointer one, so the toast doesn't read as clickable; defaults to `false` when `onClick` is set and `true` otherwise. */
|
|
37
|
+
disablePointer?: boolean;
|
|
38
|
+
/** Click handler for the whole toast (e.g. open a related chat or panel); exposed to assistive technology as a button wrapping `message`. */
|
|
39
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
40
|
+
/** Accessible name for the `onClick` action, overriding the `message` text; needed when `onClick` is set without a `message`, else the `content` text is used. */
|
|
41
|
+
clickAriaLabel?: string;
|
|
42
|
+
/** Label for an optional action button rendered below the content. */
|
|
43
|
+
actionLabel?: string;
|
|
44
|
+
/** Handler for the action button; only used when `actionLabel` is set. */
|
|
45
|
+
onActionClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
46
|
+
/** Auto-dismiss delay in milliseconds, paused while the toast is hovered or focused, or `false` to persist until dismissed manually. @default 5000 */
|
|
47
|
+
autoClose?: number | false;
|
|
48
|
+
/** Pauses the `autoClose` countdown from outside, on top of the card's own pause on hover and focus (e.g. while a toast engine's stack is hovered). @default false */
|
|
49
|
+
paused?: boolean;
|
|
50
|
+
/** Hides the bar at the bottom of the card that counts down `autoClose`; never shown when `autoClose` is `false`. @default false */
|
|
51
|
+
hideProgressBar?: boolean;
|
|
52
|
+
/** Hides the close (X) button, for toasts that shouldn't be manually dismissed. @default false */
|
|
53
|
+
hideCloseButton?: boolean;
|
|
54
|
+
/** Accessible name for the close button; pass a translated string in localized apps. @default 'Close' */
|
|
55
|
+
closeButtonAriaLabel?: string;
|
|
56
|
+
/** Callback fired when the toast is dismissed, by the close button or by `autoClose`. */
|
|
57
|
+
onRequestClose?: () => void;
|
|
58
|
+
/** Caps the card's height, scrolling its body past that point; any CSS length. @default '70vh' */
|
|
59
|
+
maxHeight?: string;
|
|
60
|
+
/** Value for the `data-test` attribute on the container; also the base for the derived test ids below. */
|
|
61
|
+
dataTest?: string;
|
|
62
|
+
/** Test identifier applied to the message. Defaults to `${dataTest}-message` when `dataTest` is set. */
|
|
63
|
+
messageDataTest?: string;
|
|
64
|
+
/** Test identifier applied to the close button. Defaults to `${dataTest}-close-button` when `dataTest` is set. */
|
|
65
|
+
closeButtonDataTest?: string;
|
|
66
|
+
/** Test identifier applied to the action button. Defaults to `${dataTest}-action-button` when `dataTest` is set. */
|
|
67
|
+
actionButtonDataTest?: string;
|
|
68
|
+
}
|
|
@@ -7,5 +7,5 @@ import { ToggleProps } from './types';
|
|
|
7
7
|
* It supports labels (label and helperText) and various textPosition configurations.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
declare function Toggle({ label, helperText, textPosition, onChange, ariaLabel, ariaLabelledBy, ariaDescribedBy, id: providedId, slotProps, ...rest }: ToggleProps): JSX.Element;
|
|
10
|
+
declare function Toggle({ label, helperText, textPosition, fullWidth, onChange, ariaLabel, ariaLabelledBy, ariaDescribedBy, id: providedId, slotProps, ...rest }: ToggleProps): JSX.Element;
|
|
11
11
|
export default Toggle;
|
|
@@ -4,5 +4,5 @@ export declare const TEXT_POSITIONS: {
|
|
|
4
4
|
readonly TOP: "top";
|
|
5
5
|
readonly BOTTOM: "bottom";
|
|
6
6
|
};
|
|
7
|
-
export declare const TEXT_POSITIONS_VALUES: ("
|
|
8
|
-
export declare const DEFAULT_TEXT_POSITION: "
|
|
7
|
+
export declare const TEXT_POSITIONS_VALUES: ("top" | "bottom" | "left" | "right")[];
|
|
8
|
+
export declare const DEFAULT_TEXT_POSITION: "top" | "bottom" | "left" | "right";
|
|
@@ -4,6 +4,7 @@ export type LayoutType = typeof TEXT_POSITIONS_VALUES[number];
|
|
|
4
4
|
export type LabelPlacement = 'top' | 'bottom' | 'start' | 'end';
|
|
5
5
|
export interface StyledToggleWrapperProps {
|
|
6
6
|
$textPosition: LayoutType;
|
|
7
|
+
$fullWidth: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface StyledTextWrapperProps extends StyledToggleWrapperProps {
|
|
9
10
|
$hasLabel: boolean;
|
|
@@ -16,6 +17,8 @@ export interface ToggleProps extends Omit<SwitchProps, 'inputProps'> {
|
|
|
16
17
|
helperText?: string;
|
|
17
18
|
/** Position of the label/helper text relative to the toggle. @default 'right' */
|
|
18
19
|
textPosition?: LayoutType;
|
|
20
|
+
/** Stretches the row to its container, putting the text and the switch at opposite ends; only used with `textPosition` 'left' or 'right'. @default false */
|
|
21
|
+
fullWidth?: boolean;
|
|
19
22
|
/** Accessible name for the toggle. */
|
|
20
23
|
ariaLabel?: string;
|
|
21
24
|
/** ID of the element that labels the toggle; ignored when `ariaLabel` is set, and falls back to the rendered label's id when omitted. */
|
|
@@ -14,5 +14,6 @@ export { BBBSlider } from './Slider';
|
|
|
14
14
|
export { BBBSpinner } from './Spinner';
|
|
15
15
|
export { BBBTextAreaInput } from './TextAreaInput';
|
|
16
16
|
export { BBBTextInput } from './TextInput';
|
|
17
|
+
export { BBBToast } from './Toast';
|
|
17
18
|
export { BBBToggle } from './Toggle';
|
|
18
19
|
export { BBBTypography } from './Typography';
|
|
@@ -12,6 +12,8 @@ export declare const colorBrandLight = "var(--color-blue-aux, var(--color-brand-
|
|
|
12
12
|
export declare const colorBrandAux = "var(--color-brand-aux, var(--color-hover-light, var(--color-brand-light, #E5EFFB)))";
|
|
13
13
|
export declare const colorSuccess = "var(--color-success, #2DD36F)";
|
|
14
14
|
export declare const colorWarning = "var(--color-warning, #F59240)";
|
|
15
|
+
export declare const colorSuccessDark = "var(--color-success-dark, #209B51)";
|
|
16
|
+
export declare const colorWarningDark = "var(--color-warning-dark, #D8680B)";
|
|
15
17
|
export declare const colorError = "var(--color-danger, var(--color-error, #DF2721))";
|
|
16
18
|
export declare const colorErrorDark = "var(--color-danger-dark, var(--color-error-dark, #AE1010))";
|
|
17
19
|
export declare const colorBackgroundWhite = "var(--color-background-white, var(--color-white, var(--color-neutral-white, #FFFFFF)))";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbluebutton/bbb-ui-components-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/bigbluebutton/bbb-ui-components-react.git"
|
|
@@ -127,6 +127,13 @@
|
|
|
127
127
|
"require": "./dist/components/TextInput.js",
|
|
128
128
|
"default": "./dist/components/TextInput.js"
|
|
129
129
|
},
|
|
130
|
+
"./Toast": {
|
|
131
|
+
"types": "./dist/types/components/Toast/index.d.ts",
|
|
132
|
+
"node": "./dist/components/Toast.js",
|
|
133
|
+
"import": "./dist/esm/components/Toast/index.js",
|
|
134
|
+
"require": "./dist/components/Toast.js",
|
|
135
|
+
"default": "./dist/components/Toast.js"
|
|
136
|
+
},
|
|
130
137
|
"./Toggle": {
|
|
131
138
|
"types": "./dist/types/components/Toggle/index.d.ts",
|
|
132
139
|
"node": "./dist/components/Toggle.js",
|
|
@@ -240,6 +247,9 @@
|
|
|
240
247
|
"TextInput": [
|
|
241
248
|
"dist/types/components/TextInput/index.d.ts"
|
|
242
249
|
],
|
|
250
|
+
"Toast": [
|
|
251
|
+
"dist/types/components/Toast/index.d.ts"
|
|
252
|
+
],
|
|
243
253
|
"Toggle": [
|
|
244
254
|
"dist/types/components/Toggle/index.d.ts"
|
|
245
255
|
],
|