@bigbluebutton/bbb-ui-components-react 0.5.0 → 0.7.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 +38 -10
- package/dist/components/Accordion.js +57 -1
- package/dist/components/Button.js +144 -1
- package/dist/components/Checkbox.js +20 -1
- package/dist/components/Divider.js +9 -1
- package/dist/components/Hint.js +51 -1
- package/dist/components/Input.js +220 -0
- package/dist/components/Modal.js +222 -1
- package/dist/components/Navigation.js +74 -1
- package/dist/components/ScrollArea.js +42 -0
- package/dist/components/Search.js +130 -1
- package/dist/components/Select.js +46 -1
- package/dist/components/Spinner.js +34 -1
- package/dist/components/TextAreaInput.js +28 -1
- package/dist/components/TextInput.js +52 -1
- package/dist/components/Toggle.js +42 -1
- package/dist/components/Typography.js +42 -1
- package/dist/components/colors.js +1 -0
- package/dist/components/index.js +789 -1
- package/dist/esm/components/Accordion/component.js +8 -9
- package/dist/esm/components/Accordion/constants.js +10 -4
- package/dist/esm/components/Accordion/styles.js +63 -17
- package/dist/esm/components/Button/component.js +52 -35
- package/dist/esm/components/Button/constants.js +21 -20
- package/dist/esm/components/Button/styles.js +187 -45
- package/dist/esm/components/Checkbox/component.js +3 -14
- package/dist/esm/components/Checkbox/constants.js +3 -3
- package/dist/esm/components/Checkbox/styles.js +23 -9
- package/dist/esm/components/Divider/styles.js +10 -7
- package/dist/esm/components/Hint/component.js +16 -16
- package/dist/esm/components/Hint/constants.js +3 -3
- package/dist/esm/components/Hint/styles.js +58 -13
- package/dist/esm/components/Input/component.js +111 -0
- package/dist/esm/components/Input/index.js +1 -0
- package/dist/esm/components/Input/styles.js +89 -0
- package/dist/esm/components/Input/types.js +1 -0
- package/dist/esm/components/Modal/component.js +8 -19
- package/dist/esm/components/Modal/styles.js +42 -20
- package/dist/esm/components/Navigation/component.js +3 -4
- package/dist/esm/components/Navigation/styles.js +36 -12
- package/dist/esm/components/ScrollArea/component.js +15 -0
- package/dist/esm/components/ScrollArea/constants.js +3 -0
- package/dist/esm/components/ScrollArea/index.js +1 -0
- package/dist/esm/components/ScrollArea/styles.js +69 -0
- package/dist/esm/components/ScrollArea/types.js +1 -0
- package/dist/esm/components/Search/component.js +16 -17
- package/dist/esm/components/Search/styles.js +103 -14
- package/dist/esm/components/Select/component.js +5 -16
- package/dist/esm/components/Select/styles.js +51 -11
- package/dist/esm/components/Spinner/component.js +1 -2
- package/dist/esm/components/Spinner/styles.js +39 -29
- package/dist/esm/components/TextAreaInput/component.js +4 -15
- package/dist/esm/components/TextAreaInput/styles.js +29 -7
- package/dist/esm/components/TextInput/component.js +2 -13
- package/dist/esm/components/TextInput/styles.js +58 -16
- package/dist/esm/components/Toggle/component.js +6 -17
- package/dist/esm/components/Toggle/constants.js +3 -3
- package/dist/esm/components/Toggle/styles.js +88 -72
- package/dist/esm/components/Typography/component.js +3 -14
- package/dist/esm/components/Typography/constants.js +1 -1
- package/dist/esm/components/Typography/styles.js +50 -17
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/stylesheets/colors.js +57 -0
- package/dist/esm/stylesheets/palette.js +55 -0
- package/dist/esm/stylesheets/sizing.js +9 -9
- package/dist/esm/stylesheets/typography.js +7 -7
- package/dist/types/components/Accordion/component.d.ts +1 -1
- package/dist/types/components/Accordion/constants.d.ts +7 -1
- package/dist/types/components/Accordion/styles.d.ts +2 -1
- package/dist/types/components/Accordion/types.d.ts +15 -1
- package/dist/types/components/Button/constants.d.ts +3 -2
- package/dist/types/components/Button/styles.d.ts +1 -0
- package/dist/types/components/Button/type.d.ts +42 -1
- package/dist/types/components/Checkbox/types.d.ts +4 -0
- package/dist/types/components/Hint/component.d.ts +2 -1
- package/dist/types/components/Hint/types.d.ts +9 -0
- package/dist/types/components/Input/component.d.ts +12 -0
- package/dist/types/components/Input/index.d.ts +1 -0
- package/dist/types/components/Input/styles.d.ts +6 -0
- package/dist/types/components/Input/types.d.ts +69 -0
- package/dist/types/components/Modal/types.d.ts +11 -0
- package/dist/types/components/Navigation/types.d.ts +9 -0
- package/dist/types/components/ScrollArea/component.d.ts +11 -0
- package/dist/types/components/ScrollArea/constants.d.ts +3 -0
- package/dist/types/components/ScrollArea/index.d.ts +1 -0
- package/dist/types/components/ScrollArea/styles.d.ts +2 -0
- package/dist/types/components/ScrollArea/types.d.ts +37 -0
- package/dist/types/components/Search/types.d.ts +6 -24
- package/dist/types/components/Select/types.d.ts +4 -0
- package/dist/types/components/Spinner/types.d.ts +3 -0
- package/dist/types/components/TextAreaInput/types.d.ts +7 -0
- package/dist/types/components/TextInput/types.d.ts +3 -0
- package/dist/types/components/Toggle/types.d.ts +6 -0
- package/dist/types/components/Typography/types.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/stylesheets/colors.d.ts +57 -0
- package/dist/types/stylesheets/{pallete.d.ts → palette.d.ts} +13 -9
- package/package.json +35 -2
- package/dist/esm/stylesheets/pallete.js +0 -46
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TOOLTIP_PLACEMENT_VALUES } from './constants';
|
|
1
|
+
import { TOOLTIP_PLACEMENT_VALUES, BUTTON_HEADER_POSITION_VALUES } from './constants';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
export interface StyledExpandIcon {
|
|
4
4
|
$expanded: boolean;
|
|
@@ -7,15 +7,29 @@ export interface StyledAccordionContent {
|
|
|
7
7
|
$expanded: boolean;
|
|
8
8
|
$scrollHeight: number;
|
|
9
9
|
}
|
|
10
|
+
export interface StyledButtonHeaderWrapper {
|
|
11
|
+
$position: ButtonHeaderPositionType;
|
|
12
|
+
}
|
|
10
13
|
type TooltipPlacementType = typeof TOOLTIP_PLACEMENT_VALUES[number];
|
|
14
|
+
type ButtonHeaderPositionType = typeof BUTTON_HEADER_POSITION_VALUES[number];
|
|
11
15
|
export interface AccordionProps {
|
|
16
|
+
/** The text to be displayed in the accordion header. */
|
|
12
17
|
title: string;
|
|
18
|
+
/** Optional label for a tooltip that appears when hovering the header; no tooltip is shown when omitted. */
|
|
13
19
|
tooltipLabel?: string;
|
|
20
|
+
/** Placement of the tooltip when `tooltipLabel` is provided. @default 'top' */
|
|
14
21
|
tooltipPlacement?: TooltipPlacementType;
|
|
22
|
+
/** Accessible name for the expand button. */
|
|
15
23
|
ariaLabel?: string;
|
|
24
|
+
/** ID of the element that labels the expand button. */
|
|
16
25
|
ariaLabelledBy?: string;
|
|
26
|
+
/** ID of the element that describes the expand button. */
|
|
17
27
|
ariaDescribedBy?: string;
|
|
28
|
+
/** Optional React node rendered inside the button header, alongside the title. @default null */
|
|
18
29
|
buttonHeader?: React.ReactNode;
|
|
30
|
+
/** Position of `buttonHeader` within the header row. @default 'left' */
|
|
31
|
+
buttonHeaderPosition?: ButtonHeaderPositionType;
|
|
32
|
+
/** Content shown when the accordion is expanded. */
|
|
19
33
|
children?: React.ReactNode;
|
|
20
34
|
}
|
|
21
35
|
export {};
|
|
@@ -24,9 +24,10 @@ declare const LAYOUTS: {
|
|
|
24
24
|
readonly DEFAULT: "default";
|
|
25
25
|
readonly STACKED: "stacked";
|
|
26
26
|
readonly CIRCLE: "circle";
|
|
27
|
+
readonly SQUARED: "squared";
|
|
27
28
|
};
|
|
28
|
-
declare const LAYOUT_VALUES: ("
|
|
29
|
-
declare const DEFAULT_LAYOUT: "
|
|
29
|
+
declare const LAYOUT_VALUES: ("default" | "stacked" | "circle" | "squared")[];
|
|
30
|
+
declare const DEFAULT_LAYOUT: "default" | "stacked" | "circle" | "squared";
|
|
30
31
|
declare const TOOLTIP_PLACEMENTS: {
|
|
31
32
|
readonly TOP: "top";
|
|
32
33
|
readonly BOTTOM: "bottom";
|
|
@@ -4,4 +4,5 @@ export declare const Button: import("styled-components/dist/types").IStyledCompo
|
|
|
4
4
|
export declare const HelperIconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledHelperIconContainer>> & string;
|
|
5
5
|
export declare const HelperIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
6
|
export declare const IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const FeedbackContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
7
8
|
export declare const ButtonText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -44,37 +44,78 @@ export interface StyledButtonProps {
|
|
|
44
44
|
disabled: boolean;
|
|
45
45
|
}
|
|
46
46
|
type BaseButtonProps = {
|
|
47
|
+
/** HTML `id` for the root element; auto-generated via `useId` when omitted, and used to derive the label's id and default `data-test` value. @default '' */
|
|
47
48
|
id?: string;
|
|
49
|
+
/** Value for the `data-test` attribute, used for test selectors; falls back to an auto-generated id based on `id`/`label` when omitted. */
|
|
48
50
|
dataTest?: string;
|
|
51
|
+
/** Text label for the button; rendered in layouts that display a label (e.g. `default`, `stacked`). */
|
|
49
52
|
label?: string;
|
|
53
|
+
/** Text shown in a tooltip; the tooltip only renders when this is provided. */
|
|
50
54
|
tooltipLabel?: string;
|
|
55
|
+
/** Placement of the tooltip relative to the button; only used when `tooltipLabel` is set. @default 'top' */
|
|
51
56
|
tooltipPlacement?: TooltipPlacementType;
|
|
57
|
+
/** Click handler for the button's primary action (required); for the `stacked` layout this is distinct from `helperOnClick`. */
|
|
52
58
|
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
59
|
+
/** Keydown handler for the button element, for custom keyboard interactions. */
|
|
53
60
|
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
61
|
+
/** Id of the element that labels the button (`aria-labelledby`); when omitted, falls back to the id of the button's own rendered label element, if any. */
|
|
54
62
|
ariaLabelledBy?: string;
|
|
63
|
+
/** Id of the element that describes the button, wired to `aria-describedby`, when provided. */
|
|
55
64
|
ariaDescribedBy?: string;
|
|
65
|
+
/** Accessible name for the button (`aria-label`); falls back to `label` when not provided. */
|
|
56
66
|
ariaLabel?: string;
|
|
67
|
+
/** Color theme for the button (affects background/border/text depending on `variant`). @default 'default' */
|
|
57
68
|
color?: ColorType;
|
|
69
|
+
/** Visual variant controlling emphasis and background/border styling. @default 'primary' */
|
|
58
70
|
variant?: VariantType;
|
|
71
|
+
/** Button size; affects padding and, for the `circle` layout, the overall diameter. @default 'md' */
|
|
59
72
|
size?: SizeType;
|
|
73
|
+
/** Disables interaction and applies disabled styling. @default false */
|
|
60
74
|
disabled?: boolean;
|
|
75
|
+
/** Additional content rendered inside the button, after the label (only used in the `default` layout). */
|
|
61
76
|
children?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* When `true`, temporarily shows `feedbackContent` in place of the button's own
|
|
79
|
+
* label/icon for `feedbackDuration` after `onClick` fires.
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
showFeedback?: boolean;
|
|
83
|
+
/** Content rendered while the click feedback is visible (e.g. a checkmark icon and "Copied"). @default <MdCheckCircle /> */
|
|
84
|
+
feedbackContent?: React.ReactNode;
|
|
85
|
+
/** How long, in milliseconds, the click feedback stays visible. @default 2000 */
|
|
86
|
+
feedbackDuration?: number;
|
|
62
87
|
};
|
|
63
88
|
type DefaultLayoutProps = BaseButtonProps & {
|
|
89
|
+
/** Layout mode for this variant — always `'default'`, the standard inline label/icon button; also the overall default. @default 'default' */
|
|
64
90
|
layout?: typeof LAYOUTS.DEFAULT;
|
|
91
|
+
/** Icon rendered before the label (left side); effective when a label is present. */
|
|
65
92
|
iconStart?: React.ReactNode;
|
|
93
|
+
/** Icon rendered after the label (right side); effective when a label is present. */
|
|
66
94
|
iconEnd?: React.ReactNode;
|
|
67
95
|
};
|
|
68
96
|
type StackedLayoutProps = BaseButtonProps & {
|
|
97
|
+
/** Layout mode for this variant — must be `'stacked'`, rendering a main icon with a label underneath plus an optional helper icon. */
|
|
69
98
|
layout: typeof LAYOUTS.STACKED;
|
|
99
|
+
/** Main icon for the button, shown above the label. */
|
|
70
100
|
icon?: React.ReactNode;
|
|
101
|
+
/** Auxiliary icon for a secondary action, shown next to the main icon; clickable via `helperOnClick`. @default MdSettings icon */
|
|
71
102
|
helperIcon?: React.ReactNode;
|
|
103
|
+
/** Hides the helper icon entirely when true. @default false */
|
|
72
104
|
hideHelperIcon?: boolean;
|
|
105
|
+
/** Click handler for the helper icon, triggering a secondary action separate from `onClick`. @default null */
|
|
73
106
|
helperOnClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
74
107
|
};
|
|
75
108
|
type CircleLayoutProps = BaseButtonProps & {
|
|
109
|
+
/** Layout mode for this variant — must be `'circle'`, rendering an icon-only circular button. */
|
|
76
110
|
layout: typeof LAYOUTS.CIRCLE;
|
|
111
|
+
/** Icon rendered inside the circular button (no label is shown in this layout). */
|
|
77
112
|
icon?: React.ReactNode;
|
|
78
113
|
};
|
|
79
|
-
|
|
114
|
+
type SquaredLayoutProps = BaseButtonProps & {
|
|
115
|
+
/** Layout mode for this variant — must be `'squared'`, rendering an icon-only square button. */
|
|
116
|
+
layout: typeof LAYOUTS.SQUARED;
|
|
117
|
+
/** Icon rendered inside the square button (no label is shown in this layout). */
|
|
118
|
+
icon?: React.ReactNode;
|
|
119
|
+
};
|
|
120
|
+
export type ButtonProps = DefaultLayoutProps | StackedLayoutProps | CircleLayoutProps | SquaredLayoutProps;
|
|
80
121
|
export {};
|
|
@@ -2,9 +2,13 @@ import { CheckboxProps as MuiCheckboxProps } from '@mui/material';
|
|
|
2
2
|
import { LAYOUTS } from './constants';
|
|
3
3
|
type Layout = typeof LAYOUTS[keyof typeof LAYOUTS];
|
|
4
4
|
export interface CheckboxProps extends MuiCheckboxProps {
|
|
5
|
+
/** Text label displayed next to the checkbox. */
|
|
5
6
|
label?: string;
|
|
7
|
+
/** Position of the label relative to the checkbox. @default 'right' */
|
|
6
8
|
layout?: Layout;
|
|
9
|
+
/** When true, renders the checkbox as a round radio-style control. @default false */
|
|
7
10
|
round?: boolean;
|
|
11
|
+
/** Accessible name for the checkbox. */
|
|
8
12
|
ariaLabel?: string;
|
|
9
13
|
}
|
|
10
14
|
export {};
|
|
@@ -6,6 +6,7 @@ import { HintProps } from './types';
|
|
|
6
6
|
* This component provides a small contextual hint used to surface tips, short help text or dismissible messages.
|
|
7
7
|
* It can be displayed with a title, an icon, and a close button.
|
|
8
8
|
*
|
|
9
|
+
* Visibility is uncontrolled by default (the hint closes itself when its close button is clicked); pass `open` to control it externally instead.
|
|
9
10
|
*/
|
|
10
|
-
declare function Hint({ title, label, icon, onRequestClose, children, ...rest }: HintProps): JSX.Element;
|
|
11
|
+
declare function Hint({ title, label, icon, open, onRequestClose, hideCloseButton, children, ...rest }: HintProps): JSX.Element | null;
|
|
11
12
|
export default Hint;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export interface HintProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
/** Main text content of the hint. */
|
|
2
3
|
label: string;
|
|
4
|
+
/** Optional title shown in the header; when set, `label` renders as a separate line below instead of inline. */
|
|
3
5
|
title?: string;
|
|
6
|
+
/** Optional icon node displayed next to the title or label. @default <MdInfo /> */
|
|
4
7
|
icon?: React.ReactNode;
|
|
8
|
+
/** Whether the hint is visible. Omit to let the hint manage its own visibility, closing itself when the close button is clicked; pass a boolean to control visibility externally. */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/** Callback fired when the close button is clicked, in both controlled and uncontrolled mode. */
|
|
5
11
|
onRequestClose?: () => void;
|
|
12
|
+
/** Hides the close (X) button, for hints that shouldn't be manually dismissed. @default false */
|
|
13
|
+
hideCloseButton?: boolean;
|
|
14
|
+
/** Optional additional content rendered under the label. */
|
|
6
15
|
children?: React.ReactNode;
|
|
7
16
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { BBBInputProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A labeled, auto-growing text field with an inline action button.
|
|
5
|
+
*
|
|
6
|
+
* Modeled after the core chat text input: unifies the recurring "text field +
|
|
7
|
+
* submit button" pattern used across chat, guest messages and breakouts.
|
|
8
|
+
* It supports both uncontrolled (default) and controlled usage, matching BBBSearch.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
declare function Input({ label, placeholder, value, onChange, onSubmit, buttonIcon, buttonLabel, buttonAriaLabel, buttonVariant, dataTest, buttonDataTest, beforeButton, afterButton, submitOnEnter, showSentFeedback, sentFeedbackContent, sentFeedbackDuration, disabled, error, helperText, minRows, maxRows, maxLength, autoFocus, inputRef, id, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, }: BBBInputProps): JSX.Element;
|
|
12
|
+
export default Input;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBInput } from './component';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StyledContainerProps, StyledHelperTextProps } from './types';
|
|
2
|
+
export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
|
|
4
|
+
export declare const FieldContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledContainerProps>> & string;
|
|
5
|
+
export declare const TextArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, never>> & string;
|
|
6
|
+
export declare const HelperText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledHelperTextProps>> & string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VARIANT_VALUES } from '../Button/constants';
|
|
3
|
+
export type BBBInputButtonVariant = typeof VARIANT_VALUES[number];
|
|
4
|
+
export interface BBBInputProps {
|
|
5
|
+
/** Label displayed above the field. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Placeholder text displayed inside the field when it's empty. */
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
/** Controlled value. When provided together with `onChange`, the component is fully controlled. */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** Called on every keystroke. Required when using controlled mode (`value` prop). */
|
|
12
|
+
onChange?: (value: string) => void;
|
|
13
|
+
/** Called with the trimmed, non-empty value when the field is submitted. */
|
|
14
|
+
onSubmit: (value: string) => void;
|
|
15
|
+
/** Icon rendered inside the action button. */
|
|
16
|
+
buttonIcon?: React.ReactNode;
|
|
17
|
+
/** Text label rendered by the action button, instead of (or alongside) `buttonIcon`. */
|
|
18
|
+
buttonLabel?: string;
|
|
19
|
+
/** Accessible name for the action button. Falls back to `buttonLabel` when set. Required for the button to be accessible when only `buttonIcon` is provided. */
|
|
20
|
+
buttonAriaLabel?: string;
|
|
21
|
+
/** Visual variant of the action button (same variants as the shared `Button`). @default 'primary' */
|
|
22
|
+
buttonVariant?: BBBInputButtonVariant;
|
|
23
|
+
/** `data-test` attribute on the underlying `<textarea>` element. */
|
|
24
|
+
dataTest?: string;
|
|
25
|
+
/** `data-test` attribute on the action button. */
|
|
26
|
+
buttonDataTest?: string;
|
|
27
|
+
/** Extra content (icon, button, or any other element) rendered to the left of the action button. */
|
|
28
|
+
beforeButton?: React.ReactNode;
|
|
29
|
+
/** Extra content (icon, button, or any other element) rendered to the right of the action button. */
|
|
30
|
+
afterButton?: React.ReactNode;
|
|
31
|
+
/** When `true`, pressing Enter submits the field (Shift+Enter still inserts a newline). When `false`, Enter always inserts a newline and only the button submits. @default true */
|
|
32
|
+
submitOnEnter?: boolean;
|
|
33
|
+
/** When `true`, shows `sentFeedbackContent` in place of `helperText` for `sentFeedbackDuration` after a successful submit. @default false */
|
|
34
|
+
showSentFeedback?: boolean;
|
|
35
|
+
/** Content rendered while the sent feedback is visible. @default 'Message sent' */
|
|
36
|
+
sentFeedbackContent?: React.ReactNode;
|
|
37
|
+
/** How long, in milliseconds, the sent feedback stays visible. @default 2000 */
|
|
38
|
+
sentFeedbackDuration?: number;
|
|
39
|
+
/** Disables the field and the action button. */
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** Puts the field in an error state. */
|
|
42
|
+
error?: boolean;
|
|
43
|
+
/** Helper text displayed below the field. */
|
|
44
|
+
helperText?: string;
|
|
45
|
+
/** Minimum number of visible rows. @default 1 */
|
|
46
|
+
minRows?: number;
|
|
47
|
+
/** Maximum number of rows before the field scrolls internally. @default 3 */
|
|
48
|
+
maxRows?: number;
|
|
49
|
+
/** Maximum character length, enforced natively by the underlying `<textarea>`. */
|
|
50
|
+
maxLength?: number;
|
|
51
|
+
/** Focuses the field when the component mounts. */
|
|
52
|
+
autoFocus?: boolean;
|
|
53
|
+
/** Ref forwarded to the underlying `<textarea>` element. */
|
|
54
|
+
inputRef?: React.Ref<HTMLTextAreaElement>;
|
|
55
|
+
/** HTML `id` for the underlying `<textarea>`. Auto-generated when omitted. */
|
|
56
|
+
id?: string;
|
|
57
|
+
/** Accessible name set as `aria-label` on the underlying `<textarea>`. */
|
|
58
|
+
'aria-label'?: string;
|
|
59
|
+
/** Additional `aria-describedby` id(s), merged with the helper text's id when it's visible. */
|
|
60
|
+
'aria-describedby'?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface StyledContainerProps {
|
|
63
|
+
$disabled?: boolean;
|
|
64
|
+
$error?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface StyledHelperTextProps {
|
|
67
|
+
$error?: boolean;
|
|
68
|
+
$success?: boolean;
|
|
69
|
+
}
|
|
@@ -7,15 +7,26 @@ export interface StyledModalFooterProps {
|
|
|
7
7
|
$stickyFooter: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface ModalProps extends Omit<ReactModal.Props, 'style'> {
|
|
10
|
+
/** Controls whether the modal is open. @default true */
|
|
10
11
|
isOpen: boolean;
|
|
12
|
+
/** Callback invoked when a request to close the modal occurs (e.g., overlay click, ESC key, or close button). */
|
|
11
13
|
onRequestClose: NonNullable<ReactModal.Props['onRequestClose']>;
|
|
14
|
+
/** Modal title shown in the header. */
|
|
12
15
|
title?: string;
|
|
16
|
+
/** Show dividers between header/body/footer. @default false */
|
|
13
17
|
showDividers?: boolean;
|
|
18
|
+
/** Enable scrolling inside the modal body. @default true */
|
|
14
19
|
allowScroll?: boolean;
|
|
20
|
+
/** Hide the footer section. @default false */
|
|
15
21
|
noFooter?: boolean;
|
|
22
|
+
/** When true, the footer is sticky to the bottom instead of scrolling with the body. @default true */
|
|
16
23
|
stickyFooter?: boolean;
|
|
24
|
+
/** Custom React node to render inside the footer. @default null */
|
|
17
25
|
footerContent?: React.ReactNode;
|
|
26
|
+
/** Test identifier applied to the modal element (native ReactModal prop). Also used to derive `closeButtonDataTest` when that prop is omitted. */
|
|
18
27
|
testId?: string;
|
|
28
|
+
/** Test identifier applied to the close button. Defaults to `${testId}-close-button` when `testId` is set. */
|
|
19
29
|
closeButtonDataTest?: string;
|
|
30
|
+
/** Modal body content. */
|
|
20
31
|
children: React.ReactNode;
|
|
21
32
|
}
|
|
@@ -3,13 +3,22 @@ export interface StyledIconWrapper {
|
|
|
3
3
|
$isCustomIcon: boolean;
|
|
4
4
|
}
|
|
5
5
|
export interface NavigationProps {
|
|
6
|
+
/** Text label displayed inside the navigation button. */
|
|
6
7
|
label: string;
|
|
8
|
+
/** Click handler fired when the navigation button is activated. */
|
|
7
9
|
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
/** Keyboard keydown handler for the navigation button. */
|
|
8
11
|
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
12
|
+
/** Optional custom icon node. If omitted, a default icon is displayed. */
|
|
9
13
|
icon?: React.ReactNode;
|
|
14
|
+
/** Optional children (e.g., sub-menus) rendered within the button. */
|
|
10
15
|
children?: React.ReactNode;
|
|
16
|
+
/** Accessible name for the navigation button. */
|
|
11
17
|
ariaLabel?: string;
|
|
18
|
+
/** ID of the element that labels the navigation button. */
|
|
12
19
|
ariaLabelledBy?: string;
|
|
20
|
+
/** ID of the element that describes the navigation button. */
|
|
13
21
|
ariaDescribedBy?: string;
|
|
22
|
+
/** Test id used for automated tests. */
|
|
14
23
|
dataTest?: string;
|
|
15
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { ScrollAreaProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A wrapper that applies standardized scrollbar styling to its content.
|
|
5
|
+
*
|
|
6
|
+
* Use it around any scrollable area (chat, lists, side panels) to get a consistent
|
|
7
|
+
* scrollbar look, with optional axis control, size capping, and edge fading.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare function ScrollArea({ children, verticalScroll, horizontalScroll, maxHeight, maxWidth, fadeEdges, fadeColor, paddingTop, paddingRight, paddingBottom, paddingLeft, }: ScrollAreaProps): JSX.Element;
|
|
11
|
+
export default ScrollArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBScrollArea } from './component';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { StyledScrollAreaWrapperProps } from './types';
|
|
2
|
+
export declare const ScrollAreaWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledScrollAreaWrapperProps>> & string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface StyledScrollAreaWrapperProps {
|
|
3
|
+
$verticalScroll: boolean;
|
|
4
|
+
$horizontalScroll: boolean;
|
|
5
|
+
$maxHeight?: string;
|
|
6
|
+
$maxWidth?: string;
|
|
7
|
+
$fadeEdges: boolean;
|
|
8
|
+
$fadeColor?: string;
|
|
9
|
+
$paddingTop?: string;
|
|
10
|
+
$paddingRight?: string;
|
|
11
|
+
$paddingBottom?: string;
|
|
12
|
+
$paddingLeft?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ScrollAreaProps {
|
|
15
|
+
/** Scrollable content. */
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/** Enables vertical scrolling. @default true */
|
|
18
|
+
verticalScroll?: boolean;
|
|
19
|
+
/** Enables horizontal scrolling. @default false */
|
|
20
|
+
horizontalScroll?: boolean;
|
|
21
|
+
/** Caps the content height; scrolling kicks in past this value (e.g. '400px', '50vh'). */
|
|
22
|
+
maxHeight?: string;
|
|
23
|
+
/** Caps the content width; scrolling kicks in past this value (e.g. '600px', '100%'). */
|
|
24
|
+
maxWidth?: string;
|
|
25
|
+
/** Fades the scrollable edges with a color mask + shadow, matching the chat's scroll style. @default true */
|
|
26
|
+
fadeEdges?: boolean;
|
|
27
|
+
/** Background color the fade blends into. Required in practice when `fadeEdges` is `true` — if omitted, the fade is silently skipped. */
|
|
28
|
+
fadeColor?: string;
|
|
29
|
+
/** Space reserved above the content, before the scrollable area's top edge (e.g. '1rem'). Keeps the first item clear of the top fade instead of butting against it. */
|
|
30
|
+
paddingTop?: string;
|
|
31
|
+
/** Space reserved to the right of the content, before the scrollable area's right edge (e.g. '1rem'). Keeps the last item clear of the right fade instead of butting against it. */
|
|
32
|
+
paddingRight?: string;
|
|
33
|
+
/** Space reserved below the content, before the scrollable area's bottom edge (e.g. '1rem'). Keeps the last item clear of the bottom fade instead of butting against it. */
|
|
34
|
+
paddingBottom?: string;
|
|
35
|
+
/** Space reserved to the left of the content, before the scrollable area's left edge (e.g. '1rem'). Keeps the first item clear of the left fade instead of butting against it. */
|
|
36
|
+
paddingLeft?: string;
|
|
37
|
+
}
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
export interface BBBSearchProps {
|
|
2
2
|
/** Placeholder text displayed inside the input field. */
|
|
3
3
|
placeholder?: string;
|
|
4
|
-
/**
|
|
5
|
-
* Controlled value for the search input.
|
|
6
|
-
* When provided together with `onChange`, the component operates in controlled mode.
|
|
7
|
-
*/
|
|
4
|
+
/** Controlled value for the search input. When provided together with `onChange`, the component operates in controlled mode. */
|
|
8
5
|
value?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Called on every keystroke with the current input value.
|
|
11
|
-
* Required when using controlled mode (`value` prop).
|
|
12
|
-
*/
|
|
6
|
+
/** Called on every keystroke with the current input value. Required when using controlled mode (`value` prop). */
|
|
13
7
|
onChange?: (value: string) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Debounced callback fired after the user stops typing.
|
|
16
|
-
* Receives the current search term as argument.
|
|
17
|
-
*/
|
|
8
|
+
/** Debounced callback fired after the user stops typing. Receives the current search term as argument. */
|
|
18
9
|
onSearch?: (term: string) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Called when the clear button is clicked.
|
|
21
|
-
* If not provided, the component clears the internal state and calls `onSearch('')`.
|
|
22
|
-
*/
|
|
10
|
+
/** Called when the clear button is clicked. If not provided, the component clears the internal state and calls `onSearch('')`. */
|
|
23
11
|
onClear?: () => void;
|
|
24
|
-
/**
|
|
25
|
-
* Debounce delay in milliseconds applied to `onSearch`.
|
|
26
|
-
* @default 500
|
|
27
|
-
*/
|
|
12
|
+
/** Debounce delay in milliseconds applied to `onSearch`. @default 500 */
|
|
28
13
|
debounce?: number;
|
|
29
|
-
/**
|
|
30
|
-
* When `true` and the input has a value, a loading spinner replaces the clear button.
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
14
|
+
/** When `true` and the input has a value, a loading spinner replaces the clear button. @default false */
|
|
33
15
|
isLoading?: boolean;
|
|
34
16
|
/** Disables the search input. */
|
|
35
17
|
disabled?: boolean;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SelectProps as MuiSelectProps } from '@mui/material/Select';
|
|
3
3
|
export type SelectProps = MuiSelectProps & {
|
|
4
|
+
/** Label text displayed above the select input. @default null */
|
|
4
5
|
title?: string;
|
|
6
|
+
/** Optional icon rendered inside the select wrapper. @default null */
|
|
5
7
|
icon?: React.ReactNode;
|
|
8
|
+
/** Accessible name for the select when a visible title is not present. */
|
|
6
9
|
ariaLabel?: string;
|
|
10
|
+
/** Option elements rendered inside the select. */
|
|
7
11
|
children: React.ReactNode;
|
|
8
12
|
};
|
|
@@ -9,7 +9,10 @@ export interface StyledPathProps {
|
|
|
9
9
|
$strokeWidth: number;
|
|
10
10
|
}
|
|
11
11
|
export interface SpinnerProps {
|
|
12
|
+
/** Width/height of the spinner (number in px or CSS string, e.g. '2rem'). @default 48 */
|
|
12
13
|
size?: number | string;
|
|
14
|
+
/** Thickness of the spinner stroke. @default 4 */
|
|
13
15
|
strokeWidth?: number;
|
|
16
|
+
/** When false, disables the rotation animation. @default true */
|
|
14
17
|
animate?: boolean;
|
|
15
18
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface TextAreaInputProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
|
+
/** Initial number of visible text lines. @default 1 */
|
|
3
4
|
rows?: number;
|
|
5
|
+
/** Maximum number of characters allowed. @default 250 */
|
|
4
6
|
maxLength?: number;
|
|
7
|
+
/** Placeholder text shown when the textarea is empty. @default '' */
|
|
5
8
|
placeholder?: string;
|
|
9
|
+
/** When true, the textarea is focused automatically on mount. @default true */
|
|
6
10
|
autoFocus?: boolean;
|
|
11
|
+
/** Ref to the underlying textarea element; accepts either a mutable ref object or a callback ref. */
|
|
7
12
|
inputRef?: React.MutableRefObject<HTMLTextAreaElement | null> | ((ref: HTMLTextAreaElement) => void);
|
|
13
|
+
/** Change event handler for the textarea. */
|
|
8
14
|
onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
|
|
15
|
+
/** Keyboard event handler for the textarea. */
|
|
9
16
|
onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
|
10
17
|
}
|
|
@@ -3,7 +3,10 @@ export interface StyledTextProps {
|
|
|
3
3
|
$error?: boolean;
|
|
4
4
|
}
|
|
5
5
|
export interface TextInputProps extends Omit<TextFieldProps, 'label'> {
|
|
6
|
+
/** Label displayed above the input. */
|
|
6
7
|
label?: string;
|
|
8
|
+
/** Helper text shown below the input. */
|
|
7
9
|
helperText?: string;
|
|
10
|
+
/** When true, renders the input in an error state. */
|
|
8
11
|
error?: boolean;
|
|
9
12
|
}
|
|
@@ -10,10 +10,16 @@ export interface StyledTextWrapperProps extends StyledToggleWrapperProps {
|
|
|
10
10
|
$hasHelperText: boolean;
|
|
11
11
|
}
|
|
12
12
|
export interface ToggleProps extends SwitchProps {
|
|
13
|
+
/** Main label text displayed next to the toggle. */
|
|
13
14
|
label?: string;
|
|
15
|
+
/** Helper text displayed below the label. */
|
|
14
16
|
helperText?: string;
|
|
17
|
+
/** Position of the label/helper text relative to the toggle. @default 'right' */
|
|
15
18
|
textPosition?: LayoutType;
|
|
19
|
+
/** Accessible name for the toggle. */
|
|
16
20
|
ariaLabel?: string;
|
|
21
|
+
/** ID of the element that labels the toggle; ignored when `ariaLabel` is set, and falls back to the rendered label's id when omitted. */
|
|
17
22
|
ariaLabelledBy?: string;
|
|
23
|
+
/** ID of the element that describes the toggle; falls back to the rendered helper text's id when omitted. */
|
|
18
24
|
ariaDescribedBy?: string;
|
|
19
25
|
}
|
|
@@ -5,7 +5,10 @@ export interface StyledTypography {
|
|
|
5
5
|
$variant: TypographyVariants;
|
|
6
6
|
}
|
|
7
7
|
export interface TypographyProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
|
+
/** Text content to render. */
|
|
8
9
|
children: React.ReactNode;
|
|
10
|
+
/** Typography variant (e.g., header, default) controlling the applied text style. @default 'default' */
|
|
9
11
|
variant?: TypographyVariants;
|
|
12
|
+
/** HTML element to render as (e.g., h1, p, span), overriding the variant's default element. */
|
|
10
13
|
as?: React.ElementType;
|
|
11
14
|
}
|
|
@@ -3,8 +3,10 @@ export { BBButton } from './Button';
|
|
|
3
3
|
export { BBBCheckbox } from './Checkbox';
|
|
4
4
|
export { BBBDivider } from './Divider';
|
|
5
5
|
export { BBBHint } from './Hint';
|
|
6
|
+
export { BBBInput } from './Input';
|
|
6
7
|
export { BBBModal } from './Modal';
|
|
7
8
|
export { BBBNavigation } from './Navigation';
|
|
9
|
+
export { BBBScrollArea } from './ScrollArea';
|
|
8
10
|
export { BBBSearch } from './Search';
|
|
9
11
|
export { BBBSelect } from './Select';
|
|
10
12
|
export { BBBSpinner } from './Spinner';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
readonly neutral: {
|
|
3
|
+
readonly neutral2: "var(--color-neutral-2, #717C91)";
|
|
4
|
+
readonly neutral3: "var(--color-neutral-3, #B0BDC9)";
|
|
5
|
+
readonly neutral4: "var(--color-neutral-4, #DCE4EC)";
|
|
6
|
+
readonly white: "var(--color-neutral-white, #FFFFFF)";
|
|
7
|
+
readonly lightGray: "var(--color-light-gray, #F4F6FA)";
|
|
8
|
+
readonly gray: "var(--color-gray, #4E5A66)";
|
|
9
|
+
readonly darkGray: "var(--color-dark-gray, #393C48)";
|
|
10
|
+
};
|
|
11
|
+
readonly brand: {
|
|
12
|
+
readonly brand1: "var(--color-primary, var(--color-brand-1, #0F70D7))";
|
|
13
|
+
readonly brand2: "var(--color-brand-2, var(--color-brand-1, #0F70D7))";
|
|
14
|
+
readonly brand3: "var(--color-brand-3, var(--color-brand-1, #0F70D7))";
|
|
15
|
+
readonly light: "var(--color-blue-aux, var(--color-brand-light, #E5EFFB))";
|
|
16
|
+
readonly aux: "var(--color-brand-aux, var(--color-brand-light, #E5EFFB))";
|
|
17
|
+
};
|
|
18
|
+
readonly semantic: {
|
|
19
|
+
readonly success: "var(--color-success, #2DD36F)";
|
|
20
|
+
readonly warning: "var(--color-warning, #F59240)";
|
|
21
|
+
readonly error: "var(--color-danger, var(--color-error, #DF2721))";
|
|
22
|
+
readonly errorDark: "var(--color-danger-dark, var(--color-error-dark, #AE1010))";
|
|
23
|
+
};
|
|
24
|
+
readonly background: {
|
|
25
|
+
readonly white: "var(--color-background-white, var(--color-neutral-white, #FFFFFF))";
|
|
26
|
+
readonly light: "var(--color-background-light, var(--color-light-gray, #F4F6FA))";
|
|
27
|
+
readonly blue: "var(--color-background-blue, var(--color-brand-light, #E5EFFB))";
|
|
28
|
+
};
|
|
29
|
+
readonly border: {
|
|
30
|
+
readonly default: "var(--default-border, var(--color-border-default, var(--color-neutral-3, #B0BDC9)))";
|
|
31
|
+
readonly selected: "var(--color-border-selected, var(--color-brand-1, #0F70D7))";
|
|
32
|
+
readonly error: "var(--color-border-error, var(--color-error, #DF2721))";
|
|
33
|
+
readonly focusRing: "var(--color-border-focus-ring, rgba(29, 101, 212, 0.15))";
|
|
34
|
+
};
|
|
35
|
+
readonly text: {
|
|
36
|
+
readonly default: "var(--color-text-default, var(--color-dark-gray, #393C48))";
|
|
37
|
+
readonly light: "var(--color-text-light, var(--color-neutral-2, #717C91))";
|
|
38
|
+
};
|
|
39
|
+
readonly icon: {
|
|
40
|
+
readonly default: "var(--color-icon-default, var(--color-neutral-2, #717C91))";
|
|
41
|
+
readonly blue: "var(--color-icon-blue, var(--color-brand-1, #0F70D7))";
|
|
42
|
+
readonly white: "var(--color-icon-white, var(--color-neutral-white, #FFFFFF))";
|
|
43
|
+
readonly defaultDark: "var(--color-icon-default-dark, rgba(255, 255, 255, 0.35))";
|
|
44
|
+
};
|
|
45
|
+
readonly hover: {
|
|
46
|
+
readonly dark: "var(--color-hover-dark, #0C57A7)";
|
|
47
|
+
readonly light: "var(--color-hover-light, #D4E5FA)";
|
|
48
|
+
readonly neutral: "var(--color-hover-neutral, var(--color-neutral-4, #DCE4EC))";
|
|
49
|
+
};
|
|
50
|
+
readonly overlay: {
|
|
51
|
+
readonly default: "var(--color-overlay, rgba(0, 0, 0, 0.75))";
|
|
52
|
+
};
|
|
53
|
+
readonly shadow: {
|
|
54
|
+
readonly default: "var(--color-shadow-default, rgb(0 35 11 / 20%))";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type Colors = typeof colors;
|