@bigbluebutton/bbb-ui-components-react 0.7.0 → 0.8.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.
Files changed (51) hide show
  1. package/README.md +4 -1
  2. package/dist/components/Avatar.js +30 -0
  3. package/dist/components/Button.js +16 -19
  4. package/dist/components/Checkbox.js +4 -4
  5. package/dist/components/Input.js +21 -24
  6. package/dist/components/Modal.js +24 -34
  7. package/dist/components/Slider.js +35 -0
  8. package/dist/components/colors.js +1 -1
  9. package/dist/components/index.js +280 -227
  10. package/dist/esm/components/Avatar/component.js +38 -0
  11. package/dist/esm/components/Avatar/constants.js +13 -0
  12. package/dist/esm/components/Avatar/index.js +1 -0
  13. package/dist/esm/components/Avatar/styles.js +42 -0
  14. package/dist/esm/components/Avatar/types.js +1 -0
  15. package/dist/esm/components/Button/constants.js +4 -2
  16. package/dist/esm/components/Button/styles.js +15 -12
  17. package/dist/esm/components/Checkbox/component.js +7 -5
  18. package/dist/esm/components/Modal/component.js +2 -2
  19. package/dist/esm/components/Modal/styles.js +0 -8
  20. package/dist/esm/components/Slider/component.js +63 -0
  21. package/dist/esm/components/Slider/constants.js +9 -0
  22. package/dist/esm/components/Slider/index.js +1 -0
  23. package/dist/esm/components/Slider/styles.js +138 -0
  24. package/dist/esm/components/Slider/types.js +1 -0
  25. package/dist/esm/components/index.js +2 -0
  26. package/dist/esm/stylesheets/colors.js +4 -1
  27. package/dist/esm/stylesheets/palette.js +2 -0
  28. package/dist/esm/stylesheets/sizing.js +1 -0
  29. package/dist/types/components/Accordion/constants.d.ts +1 -1
  30. package/dist/types/components/Avatar/component.d.ts +12 -0
  31. package/dist/types/components/Avatar/constants.d.ts +8 -0
  32. package/dist/types/components/Avatar/index.d.ts +1 -0
  33. package/dist/types/components/Avatar/styles.d.ts +3 -0
  34. package/dist/types/components/Avatar/types.d.ts +26 -0
  35. package/dist/types/components/Button/constants.d.ts +3 -3
  36. package/dist/types/components/Button/type.d.ts +2 -1
  37. package/dist/types/components/Checkbox/component.d.ts +1 -1
  38. package/dist/types/components/Checkbox/types.d.ts +2 -0
  39. package/dist/types/components/Modal/styles.d.ts +0 -1
  40. package/dist/types/components/Modal/types.d.ts +2 -0
  41. package/dist/types/components/Slider/component.d.ts +11 -0
  42. package/dist/types/components/Slider/constants.d.ts +9 -0
  43. package/dist/types/components/Slider/index.d.ts +1 -0
  44. package/dist/types/components/Slider/styles.d.ts +8 -0
  45. package/dist/types/components/Slider/types.d.ts +46 -0
  46. package/dist/types/components/Toggle/constants.d.ts +2 -2
  47. package/dist/types/components/index.d.ts +2 -0
  48. package/dist/types/stylesheets/colors.d.ts +3 -0
  49. package/dist/types/stylesheets/palette.d.ts +1 -0
  50. package/dist/types/stylesheets/sizing.d.ts +1 -0
  51. package/package.json +21 -1
@@ -0,0 +1,38 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import Tippy from '@tippyjs/react';
3
+ import 'tippy.js/dist/tippy.css';
4
+ import * as Styled from './styles';
5
+ import { DEFAULT_AVATAR_SIZE, AVATAR_FALLBACK_COLORS } from './constants';
6
+ import { colorUserYou } from '../../stylesheets/palette';
7
+ function getInitials(name) {
8
+ const words = name.trim().split(/\s+/).filter(Boolean);
9
+ if (words.length === 0)
10
+ return '';
11
+ if (words.length === 1)
12
+ return words[0].slice(0, 2).toUpperCase();
13
+ return `${words[0][0]}${words[words.length - 1][0]}`.toUpperCase();
14
+ }
15
+ function getFallbackColor(name) {
16
+ const hash = name.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
17
+ return AVATAR_FALLBACK_COLORS[hash % AVATAR_FALLBACK_COLORS.length];
18
+ }
19
+ /**
20
+ * A user avatar component.
21
+ *
22
+ * Renders the user's avatar image when available, falling back to their initials on a
23
+ * deterministically-colored background when no image is provided or it fails to load.
24
+ *
25
+ */
26
+ function Avatar({ name, avatarUrl, color, size = DEFAULT_AVATAR_SIZE, isModerator = false, isYou = false, isTalking = false, disableTooltip = false, }) {
27
+ const [hasImageError, setHasImageError] = useState(false);
28
+ const resolvedColor = color || (isYou ? colorUserYou : getFallbackColor(name));
29
+ useEffect(() => {
30
+ setHasImageError(false);
31
+ }, [avatarUrl]);
32
+ const avatarElement = avatarUrl && !hasImageError ? (React.createElement(Styled.AvatarImage, { src: avatarUrl, alt: name, "$size": size, "$color": resolvedColor, "$isModerator": isModerator, "$isTalking": isTalking, onError: () => setHasImageError(true) })) : (React.createElement(Styled.AvatarInitials, { "$size": size, "$color": resolvedColor, "$isModerator": isModerator, "$isTalking": isTalking }, getInitials(name)));
33
+ if (disableTooltip) {
34
+ return avatarElement;
35
+ }
36
+ return (React.createElement(Tippy, { content: name, placement: "top" }, avatarElement));
37
+ }
38
+ export default Avatar;
@@ -0,0 +1,13 @@
1
+ export const AVATAR_SIZES = {
2
+ SMALL: 'small',
3
+ MEDIUM: 'medium',
4
+ LARGE: 'large',
5
+ };
6
+ export const AVATAR_SIZE_VALUES = Object.values(AVATAR_SIZES);
7
+ export const DEFAULT_AVATAR_SIZE = AVATAR_SIZES.MEDIUM;
8
+ // Mirrors the palette akka-bbb-apps' ColorPicker assigns to users server-side (round-robin per
9
+ // meeting), so a name-hash fallback here lands on the same colors real BBB users get.
10
+ export const AVATAR_FALLBACK_COLORS = [
11
+ '#7b1fa2', '#6a1b9a', '#4a148c', '#5e35b1', '#512da8', '#4527a0', '#311b92',
12
+ '#3949ab', '#303f9f', '#283593', '#1a237e', '#1976d2', '#1565c0', '#0d47a1', '#0277bd', '#01579b',
13
+ ];
@@ -0,0 +1 @@
1
+ export { default as BBBAvatar } from './component';
@@ -0,0 +1,42 @@
1
+ import styled, { css, keyframes } from 'styled-components';
2
+ import { colorWhite } from '../../stylesheets/palette';
3
+ import { AVATAR_SIZES } from './constants';
4
+ const DIMENSIONS = {
5
+ [AVATAR_SIZES.SMALL]: { dimension: '1.625rem', fontSize: '0.625rem', fontWeight: '600' },
6
+ [AVATAR_SIZES.MEDIUM]: { dimension: '3rem', fontSize: '1.125rem', fontWeight: '500' },
7
+ [AVATAR_SIZES.LARGE]: { dimension: '6rem', fontSize: '2.75rem', fontWeight: '400' },
8
+ };
9
+ // Mirrors BBB's talking indicator (a ring, in the user's own color, that spreads and fades out).
10
+ const talkingPulse = (color) => keyframes `
11
+ 0% { box-shadow: 0 0 0 0 ${color}; }
12
+ 100% { box-shadow: 0 0 0 4px transparent; }
13
+ `;
14
+ const talkingStyles = css `
15
+ ${({ $isTalking, $color }) => $isTalking && css `
16
+ animation: ${talkingPulse($color)} 1s infinite ease-in;
17
+ `}
18
+ `;
19
+ export const AvatarInitials = styled.div `
20
+ width: ${({ $size }) => DIMENSIONS[$size].dimension};
21
+ height: ${({ $size }) => DIMENSIONS[$size].dimension};
22
+ border-radius: ${({ $isModerator }) => ($isModerator ? '20%' : '50%')};
23
+ flex-shrink: 0;
24
+ background: ${({ $color }) => $color};
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ font-size: ${({ $size }) => DIMENSIONS[$size].fontSize};
29
+ font-weight: ${({ $size }) => DIMENSIONS[$size].fontWeight};
30
+ color: ${colorWhite};
31
+ text-transform: uppercase;
32
+ ${talkingStyles}
33
+ `;
34
+ export const AvatarImage = styled.img `
35
+ width: ${({ $size }) => DIMENSIONS[$size].dimension};
36
+ height: ${({ $size }) => DIMENSIONS[$size].dimension};
37
+ border-radius: ${({ $isModerator }) => ($isModerator ? '20%' : '50%')};
38
+ flex-shrink: 0;
39
+ object-fit: cover;
40
+ border: 2px solid ${({ $color }) => $color};
41
+ ${talkingStyles}
42
+ `;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { colorBrand1, colorHoverDark, colorWhite, colorError, colorBorderError, colorErrorDark, colorBackgroundWhite, colorBackgroundBlue, colorHoverLight, colorLightGray, colorNeutral3, colorBackgroundLight, colorBorderSelected, colorTextLight, colorIconDefault, colorGray, colorBrandAux, } from '../../stylesheets/palette';
2
- import { spacingMedium, spacingSmall, spacingSmallMedium } from '../../stylesheets/sizing';
2
+ import { spacingSmall, spacingSmallMedium, spacingMedium, spacingXLarge, spacingXXLarge, } from '../../stylesheets/sizing';
3
3
  const VARIANTS = {
4
4
  PRIMARY: 'primary',
5
5
  SECONDARY: 'secondary',
@@ -167,9 +167,11 @@ const CSS_COLOR_PROPERTIES_DISABLED = {
167
167
  const CSS_SIZE_PROPERTIES = {
168
168
  sm: {
169
169
  padding: `${spacingSmall} ${spacingSmallMedium}`,
170
+ iconBoxSize: spacingXLarge,
170
171
  },
171
172
  md: {
172
- padding: spacingMedium
173
+ padding: spacingMedium,
174
+ iconBoxSize: spacingXXLarge,
173
175
  },
174
176
  };
175
177
  export { VARIANTS, VARIANT_VALUES, DEFAULT_VARIANT, COLORS, COLOR_VALUES, DEFAULT_COLOR, SIZES, SIZE_VALUES, DEFAULT_SIZE, LAYOUTS, LAYOUT_VALUES, DEFAULT_LAYOUT, TOOLTIP_PLACEMENTS, TOOLTIP_PLACEMENT_VALUES, DEFAULT_TOOLTIP_PLACEMENT, CSS_COLOR_PROPERTIES, CSS_COLOR_PROPERTIES_DISABLED, CSS_SIZE_PROPERTIES, };
@@ -89,26 +89,29 @@ const stackedLayoutStyles = css `
89
89
  justify-content: center;
90
90
  align-items: center;
91
91
  `;
92
- const circleLayoutStyles = css `
93
- border-radius: 50%;
94
- width: 3rem;
95
- height: 3rem;
92
+ // Shared by `circle` and `squared`: both are icon-only, fixed-box layouts that
93
+ // must render at the same width/height for a given `size` — they differ only
94
+ // in border-radius (round vs. slightly rounded square).
95
+ const iconOnlyBoxStyles = css `
96
+ ${({ $size }) => {
97
+ var _a;
98
+ const safeSize = $size !== null && $size !== void 0 ? $size : DEFAULT_SIZE;
99
+ const { iconBoxSize } = (_a = CSS_SIZE_PROPERTIES[safeSize]) !== null && _a !== void 0 ? _a : CSS_SIZE_PROPERTIES[DEFAULT_SIZE];
100
+ return `width: ${iconBoxSize}; height: ${iconBoxSize};`;
101
+ }}
96
102
  aspect-ratio: 1;
97
103
  padding: 0;
98
104
  display: flex;
99
105
  justify-content: center;
100
106
  align-items: center;
101
107
  `;
102
- // Icon-only, sized by its own (equal, non-text) padding rather than a fixed
103
- // box — stays compact next to a single line of text instead of forcing a
104
- // fixed height like circle/stacked do.
108
+ const circleLayoutStyles = css `
109
+ ${iconOnlyBoxStyles}
110
+ border-radius: 50%;
111
+ `;
105
112
  const squaredLayoutStyles = css `
113
+ ${iconOnlyBoxStyles}
106
114
  border-radius: ${borderRadiusSmall};
107
- aspect-ratio: 1;
108
- padding: ${spacingSmall};
109
- display: flex;
110
- justify-content: center;
111
- align-items: center;
112
115
  `;
113
116
  const defaultLayoutStyles = css `
114
117
  display: inline-flex;
@@ -22,15 +22,17 @@ import { RadioButtonUnchecked, RadioButtonChecked } from '@mui/icons-material';
22
22
  *
23
23
  */
24
24
  function Checkbox(_a) {
25
- var { label, layout = DEFAULT_LAYOUT, round = false, ariaLabel } = _a, props = __rest(_a, ["label", "layout", "round", "ariaLabel"]);
26
- const id = useId();
27
- const checkbox = (React.createElement(Styled.StyledCheckbox, Object.assign({}, props, { id: id, "aria-label": ariaLabel, icon: round ? React.createElement(RadioButtonUnchecked, null) : undefined, checkedIcon: round ? React.createElement(RadioButtonChecked, null) : undefined })));
25
+ var { label, layout = DEFAULT_LAYOUT, round = false, ariaLabel, id, dataTest, inputProps } = _a, props = __rest(_a, ["label", "layout", "round", "ariaLabel", "id", "dataTest", "inputProps"]);
26
+ const generatedId = useId();
27
+ const checkboxId = id !== null && id !== void 0 ? id : generatedId;
28
+ const mergedInputProps = Object.assign({ 'data-test': dataTest }, inputProps);
29
+ const checkbox = (React.createElement(Styled.StyledCheckbox, Object.assign({}, props, { id: checkboxId, "aria-label": ariaLabel, icon: round ? React.createElement(RadioButtonUnchecked, null) : undefined, checkedIcon: round ? React.createElement(RadioButtonChecked, null) : undefined, inputProps: mergedInputProps })));
28
30
  if (!label) {
29
31
  return checkbox;
30
32
  }
31
33
  return (React.createElement(Styled.Container, null,
32
- layout === LAYOUTS.LEFT && React.createElement(Styled.Label, { htmlFor: id }, label),
34
+ layout === LAYOUTS.LEFT && React.createElement(Styled.Label, { htmlFor: checkboxId }, label),
33
35
  checkbox,
34
- layout === LAYOUTS.RIGHT && React.createElement(Styled.Label, { htmlFor: id }, label)));
36
+ layout === LAYOUTS.RIGHT && React.createElement(Styled.Label, { htmlFor: checkboxId }, label)));
35
37
  }
36
38
  export default Checkbox;
@@ -24,7 +24,7 @@ import { BBButton } from '../Button';
24
24
  *
25
25
  */
26
26
  const Modal = (_a) => {
27
- var { isOpen = true, onRequestClose, appElement, title, contentLabel, showDividers = false, shouldCloseOnOverlayClick = false, shouldCloseOnEsc = false, allowScroll = true, noFooter = false, footerContent = null, stickyFooter = true, testId, closeButtonDataTest, children } = _a, rest = __rest(_a, ["isOpen", "onRequestClose", "appElement", "title", "contentLabel", "showDividers", "shouldCloseOnOverlayClick", "shouldCloseOnEsc", "allowScroll", "noFooter", "footerContent", "stickyFooter", "testId", "closeButtonDataTest", "children"]);
27
+ var { isOpen = true, onRequestClose, appElement, title, contentLabel, showDividers = false, shouldCloseOnOverlayClick = false, shouldCloseOnEsc = false, allowScroll = true, noFooter = false, hideCloseButton = false, footerContent = null, stickyFooter = true, testId, closeButtonDataTest, children } = _a, rest = __rest(_a, ["isOpen", "onRequestClose", "appElement", "title", "contentLabel", "showDividers", "shouldCloseOnOverlayClick", "shouldCloseOnEsc", "allowScroll", "noFooter", "hideCloseButton", "footerContent", "stickyFooter", "testId", "closeButtonDataTest", "children"]);
28
28
  let _closeButtonDataTest = closeButtonDataTest;
29
29
  if (testId && !closeButtonDataTest) {
30
30
  _closeButtonDataTest = `${testId}-close-button`;
@@ -35,7 +35,7 @@ const Modal = (_a) => {
35
35
  return (React.createElement(ReactModal, Object.assign({}, rest, { isOpen: isOpen, onRequestClose: onRequestClose, contentLabel: contentLabel, style: Styled.modalStyles, shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, shouldCloseOnEsc: shouldCloseOnEsc, appElement: appElement, testId: testId }),
36
36
  React.createElement(Styled.ModalHeader, null,
37
37
  React.createElement(BBBTypography, { variant: "header" }, title),
38
- React.createElement(BBButton, Object.assign({ layout: "circle", icon: React.createElement(MdClose, { size: "1.5rem" }), onClick: onRequestClose, variant: "subtle", ariaLabel: "close" }, (_closeButtonDataTest ? { dataTest: _closeButtonDataTest } : {})))),
38
+ !hideCloseButton && (React.createElement(BBButton, Object.assign({ layout: "circle", icon: React.createElement(MdClose, { size: "1.5rem" }), onClick: onRequestClose, variant: "subtle", ariaLabel: "close" }, (_closeButtonDataTest ? { dataTest: _closeButtonDataTest } : {}))))),
39
39
  showDividers && React.createElement(BBBDivider, null),
40
40
  React.createElement(Styled.ModalScrollArea, { "$allowScroll": allowScroll },
41
41
  React.createElement(Styled.ModalBodyContent, null, children),
@@ -39,14 +39,6 @@ export const ModalHeader = styled.div `
39
39
  justify-content: space-between;
40
40
  align-items: center;
41
41
  `;
42
- export const CloseButton = styled.button `
43
- background: none;
44
- border: none;
45
- font-size: 1.5rem;
46
- cursor: pointer;
47
- padding: 0;
48
- line-height: 1;
49
- `;
50
42
  export const ModalScrollArea = styled.div `
51
43
  flex-grow: 1;
52
44
  overflow-y: ${({ $allowScroll }) => $allowScroll ? 'auto' : 'hidden'};
@@ -0,0 +1,63 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
13
+ import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles';
14
+ import * as Styled from './styles';
15
+ import { DEFAULT_ANIMATE, DEFAULT_SHOW_MARK_TICKS, DEFAULT_VALUE_LABEL_DISPLAY } from './constants';
16
+ /**
17
+ * A horizontal, single-thumb slider for picking a value inside a range.
18
+ *
19
+ * It supports labels (label and helperText), decorative end icons, marks and a value tooltip,
20
+ * and keeps its accessible name and description on the underlying range input.
21
+ *
22
+ */
23
+ function Slider(_a) {
24
+ var { label, helperText, iconStart, iconEnd, showMarkTicks = DEFAULT_SHOW_MARK_TICKS, animate = DEFAULT_ANIMATE, valueLabelDisplay = DEFAULT_VALUE_LABEL_DISPLAY, onChange, onChangeCommitted, id: providedId, dataTest, ariaLabel, ariaLabelledBy, ariaDescribedBy, slotProps } = _a, rest = __rest(_a, ["label", "helperText", "iconStart", "iconEnd", "showMarkTicks", "animate", "valueLabelDisplay", "onChange", "onChangeCommitted", "id", "dataTest", "ariaLabel", "ariaLabelledBy", "ariaDescribedBy", "slotProps"]);
25
+ const generatedUniqueId = useId();
26
+ const id = providedId !== null && providedId !== void 0 ? providedId : generatedUniqueId;
27
+ const labelId = label ? `${id}-label` : undefined;
28
+ const helperTextId = helperText ? `${id}-helper` : undefined;
29
+ const wrapperRef = useRef(null);
30
+ const [isRtl, setIsRtl] = useState(false);
31
+ useEffect(() => {
32
+ const wrapper = wrapperRef.current;
33
+ if (!wrapper)
34
+ return undefined;
35
+ const readDirection = () => {
36
+ setIsRtl(window.getComputedStyle(wrapper).direction === 'rtl');
37
+ };
38
+ readDirection();
39
+ const observer = new MutationObserver(readDirection);
40
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['dir'] });
41
+ return () => observer.disconnect();
42
+ }, []);
43
+ const outerTheme = useTheme();
44
+ const theme = useMemo(() => (isRtl && outerTheme.direction !== 'rtl'
45
+ ? createTheme(outerTheme, { direction: 'rtl' })
46
+ : outerTheme), [outerTheme, isRtl]);
47
+ const handleChange = useCallback((event, value) => {
48
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, Array.isArray(value) ? value[0] : value);
49
+ }, [onChange]);
50
+ const handleChangeCommitted = useCallback((event, value) => {
51
+ onChangeCommitted === null || onChangeCommitted === void 0 ? void 0 : onChangeCommitted(event, Array.isArray(value) ? value[0] : value);
52
+ }, [onChangeCommitted]);
53
+ return (React.createElement(Styled.SliderWrapper, { ref: wrapperRef, "$valueLabelSpace": valueLabelDisplay !== 'off' },
54
+ (label || helperText) && (React.createElement(Styled.TextWrapper, { htmlFor: id },
55
+ label && React.createElement(Styled.Title, { id: labelId }, label),
56
+ helperText && React.createElement(Styled.HelperText, { id: helperTextId }, helperText))),
57
+ React.createElement(Styled.SliderRow, { "$showMarkTicks": showMarkTicks, "$animate": animate, "$isRtl": isRtl },
58
+ iconStart && React.createElement(Styled.IconWrapper, { "aria-hidden": true }, iconStart),
59
+ React.createElement(ThemeProvider, { theme: theme },
60
+ React.createElement(Styled.MaterialSlider, Object.assign({}, rest, { valueLabelDisplay: valueLabelDisplay, onChange: handleChange, onChangeCommitted: handleChangeCommitted, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : ariaLabelledBy || labelId, "data-test": dataTest, slotProps: Object.assign(Object.assign({}, slotProps), { input: Object.assign(Object.assign({ id, 'aria-describedby': ariaDescribedBy || helperTextId }, (dataTest ? { 'data-test': `${dataTest}-input` } : {})), (typeof (slotProps === null || slotProps === void 0 ? void 0 : slotProps.input) === 'object' ? slotProps.input : {})) }) }))),
61
+ iconEnd && React.createElement(Styled.IconWrapper, { "aria-hidden": true }, iconEnd))));
62
+ }
63
+ export default Slider;
@@ -0,0 +1,9 @@
1
+ export const VALUE_LABEL_DISPLAYS = {
2
+ AUTO: 'auto',
3
+ ON: 'on',
4
+ OFF: 'off',
5
+ };
6
+ export const VALUE_LABEL_DISPLAY_VALUES = Object.values(VALUE_LABEL_DISPLAYS);
7
+ export const DEFAULT_VALUE_LABEL_DISPLAY = VALUE_LABEL_DISPLAYS.AUTO;
8
+ export const DEFAULT_SHOW_MARK_TICKS = true;
9
+ export const DEFAULT_ANIMATE = true;
@@ -0,0 +1 @@
1
+ export { default as BBBSlider } from './component';
@@ -0,0 +1,138 @@
1
+ import { Slider } from '@mui/material';
2
+ import { styled as materialStyled } from '@mui/material/styles';
3
+ import styled from 'styled-components';
4
+ import { colorBrand1, colorNeutral3, colorWhite, colorShadowDefault, colorTextDefault, colorTextLight, colorIconDefault, colorBorderFocusRing, } from '../../stylesheets/palette';
5
+ import { fontSizeXSmall, fontSizeDefault, fontSizeBig, fontWeightDefault, fontWeightLight, } from '../../stylesheets/typography';
6
+ import { spacingXSmall, spacingSmall, spacingXLarge, borderRadiusSmall, } from '../../stylesheets/sizing';
7
+ const THUMB_SIZE = '1rem';
8
+ const TRACK_HEIGHT = '0.3125rem';
9
+ const MARK_SIZE = '0.25rem';
10
+ const ICON_SIZE = '1.5rem';
11
+ export const SliderWrapper = styled.div `
12
+ display: flex;
13
+ flex-direction: column;
14
+ width: 100%;
15
+
16
+ ${({ $valueLabelSpace }) => $valueLabelSpace && `
17
+ gap: ${spacingXLarge};
18
+ `}
19
+ `;
20
+ export const TextWrapper = styled.label `
21
+ display: flex;
22
+ flex-direction: column;
23
+ cursor: pointer;
24
+ `;
25
+ export const Title = styled.span `
26
+ color: ${colorTextDefault};
27
+ font-size: ${fontSizeBig};
28
+ font-weight: ${fontWeightLight};
29
+ `;
30
+ export const HelperText = styled.span `
31
+ color: ${colorTextLight};
32
+ font-size: ${fontSizeDefault};
33
+ font-weight: ${fontWeightLight};
34
+ `;
35
+ export const SliderRow = styled.div `
36
+ display: flex;
37
+ align-items: center;
38
+ gap: ${spacingSmall};
39
+ width: 100%;
40
+
41
+ ${({ $showMarkTicks }) => !$showMarkTicks && `
42
+ & .MuiSlider-mark {
43
+ display: none;
44
+ }
45
+ `}
46
+
47
+ ${({ $animate }) => !$animate && `
48
+ & .MuiSlider-thumb,
49
+ & .MuiSlider-track,
50
+ & .MuiSlider-valueLabel {
51
+ transition: none;
52
+ }
53
+
54
+ & .MuiSlider-thumb:hover:not(.Mui-focusVisible),
55
+ & .MuiSlider-thumb.Mui-active:not(.Mui-focusVisible) {
56
+ box-shadow: 0 2px 4px 0 ${colorShadowDefault};
57
+ }
58
+ `}
59
+
60
+ ${({ $isRtl }) => $isRtl && `
61
+ /* MUI only mirrors right:-anchored positioning under RTL, not the LTR transforms paired
62
+ with it (that half normally comes from stylis-plugin-rtl, which this library can't add) */
63
+ && .MuiSlider-thumb {
64
+ transform: translate(50%, -50%);
65
+ }
66
+
67
+ && .MuiSlider-mark {
68
+ transform: translate(1px, -50%);
69
+ }
70
+
71
+ && .MuiSlider-markLabel {
72
+ transform: translateX(50%);
73
+ }
74
+ `}
75
+ `;
76
+ export const IconWrapper = styled.span `
77
+ display: flex;
78
+ align-items: center;
79
+ color: ${colorIconDefault};
80
+ font-size: ${ICON_SIZE};
81
+ `;
82
+ export const MaterialSlider = materialStyled(Slider)({
83
+ color: colorBrand1,
84
+ height: TRACK_HEIGHT,
85
+ '& .MuiSlider-rail': {
86
+ backgroundColor: 'currentColor',
87
+ opacity: 0.38,
88
+ },
89
+ '& .MuiSlider-track': {
90
+ border: '1px solid currentColor',
91
+ backgroundColor: colorBrand1,
92
+ },
93
+ '& .MuiSlider-thumb': {
94
+ height: THUMB_SIZE,
95
+ width: THUMB_SIZE,
96
+ backgroundColor: 'currentColor',
97
+ boxShadow: `0 2px 4px 0 ${colorShadowDefault}`,
98
+ '&:hover, &.Mui-focusVisible': {
99
+ boxShadow: `0 0 0 0.5rem ${colorBorderFocusRing}`,
100
+ },
101
+ '&.Mui-active': {
102
+ boxShadow: `0 0 0 0.875rem ${colorBorderFocusRing}`,
103
+ },
104
+ },
105
+ '& .MuiSlider-mark': {
106
+ width: MARK_SIZE,
107
+ height: MARK_SIZE,
108
+ borderRadius: '50%',
109
+ backgroundColor: colorNeutral3,
110
+ '&.MuiSlider-markActive': {
111
+ backgroundColor: colorWhite,
112
+ },
113
+ },
114
+ '& .MuiSlider-markLabel': {
115
+ color: colorTextLight,
116
+ fontSize: fontSizeXSmall,
117
+ // RTL: resolve each label's own direction so a leading minus sign doesn't get reordered
118
+ unicodeBidi: 'plaintext',
119
+ },
120
+ '& .MuiSlider-valueLabel': {
121
+ backgroundColor: colorTextDefault,
122
+ color: colorWhite,
123
+ fontSize: fontSizeXSmall,
124
+ fontWeight: fontWeightDefault,
125
+ borderRadius: borderRadiusSmall,
126
+ padding: `${spacingXSmall} ${spacingSmall}`,
127
+ '& .MuiSlider-valueLabelLabel': {
128
+ // RTL: resolve each label's own direction so a leading minus sign doesn't get reordered
129
+ unicodeBidi: 'plaintext',
130
+ },
131
+ },
132
+ '&.Mui-disabled': {
133
+ color: colorNeutral3,
134
+ '& .MuiSlider-track': {
135
+ backgroundColor: colorNeutral3,
136
+ },
137
+ },
138
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export { BBBAccordion } from './Accordion';
2
+ export { BBBAvatar } from './Avatar';
2
3
  export { BBButton } from './Button';
3
4
  export { BBBCheckbox } from './Checkbox';
4
5
  export { BBBDivider } from './Divider';
@@ -9,6 +10,7 @@ export { BBBNavigation } from './Navigation';
9
10
  export { BBBScrollArea } from './ScrollArea';
10
11
  export { BBBSearch } from './Search';
11
12
  export { BBBSelect } from './Select';
13
+ export { BBBSlider } from './Slider';
12
14
  export { BBBSpinner } from './Spinner';
13
15
  export { BBBTextAreaInput } from './TextAreaInput';
14
16
  export { BBBTextInput } from './TextInput';
@@ -1,4 +1,4 @@
1
- import { colorNeutral2, colorNeutral3, colorNeutral4, colorWhite, colorLightGray, colorGray, colorDarkGray, colorBrand1, colorBrand2, colorBrand3, colorBrandLight, colorBrandAux, colorSuccess, colorWarning, colorError, colorErrorDark, colorBackgroundWhite, colorBackgroundLight, colorBackgroundBlue, colorBorderDefault, colorBorderSelected, colorBorderError, colorBorderFocusRing, colorTextDefault, colorTextLight, colorIconDefault, colorIconBlue, colorIconWhite, colorIconDefaultDark, colorHoverDark, colorHoverLight, colorHoverNeutral, colorOverlay, colorShadowDefault, } from './palette';
1
+ import { colorNeutral2, colorNeutral3, colorNeutral4, colorWhite, colorLightGray, colorGray, colorDarkGray, colorBrand1, colorBrand2, colorBrand3, colorBrandLight, colorBrandAux, colorSuccess, colorWarning, colorError, colorErrorDark, colorBackgroundWhite, colorBackgroundLight, colorBackgroundBlue, colorBorderDefault, colorBorderSelected, colorBorderError, colorBorderFocusRing, colorTextDefault, colorTextLight, colorIconDefault, colorIconBlue, colorIconWhite, colorIconDefaultDark, colorHoverDark, colorHoverLight, colorHoverNeutral, colorOverlay, colorShadowDefault, colorUserYou, } from './palette';
2
2
  export const colors = {
3
3
  neutral: {
4
4
  neutral2: colorNeutral2,
@@ -54,4 +54,7 @@ export const colors = {
54
54
  shadow: {
55
55
  default: colorShadowDefault,
56
56
  },
57
+ user: {
58
+ you: colorUserYou,
59
+ },
57
60
  };
@@ -53,3 +53,5 @@ export const colorHoverNeutral = `var(--color-hover-neutral, ${colorNeutral4})`;
53
53
  export const colorOverlay = 'var(--color-overlay, rgba(0, 0, 0, 0.75))';
54
54
  //Shadow colors
55
55
  export const colorShadowDefault = 'var(--color-shadow-default, rgb(0 35 11 / 20%))';
56
+ // User colors
57
+ export const colorUserYou = 'var(--color-user-you, #19237C)';
@@ -7,6 +7,7 @@ export const spacingMedium = '1rem'; // 16px
7
7
  export const spacingMediumLarge = '1.25rem'; // 20px
8
8
  export const spacingLarge = '1.5rem'; // 24px
9
9
  export const spacingXLarge = '2rem'; // 32px
10
+ export const spacingXXLarge = '3rem'; // 48px
10
11
  // Border sizes
11
12
  export const borderRadiusDefault = '1rem'; //16px
12
13
  export const borderRadiusSmall = '0.5rem'; //8px
@@ -4,7 +4,7 @@ declare const TOOLTIP_PLACEMENTS: {
4
4
  readonly LEFT: "left";
5
5
  readonly RIGHT: "right";
6
6
  };
7
- declare const TOOLTIP_PLACEMENT_VALUES: ("top" | "bottom" | "left" | "right")[];
7
+ declare const TOOLTIP_PLACEMENT_VALUES: ("left" | "right" | "bottom" | "top")[];
8
8
  declare const DEFAULT_TOOLTIP_PLACEMENT: "top";
9
9
  declare const BUTTON_HEADER_POSITIONS: {
10
10
  readonly LEFT: "left";
@@ -0,0 +1,12 @@
1
+ import { JSX } from 'react';
2
+ import 'tippy.js/dist/tippy.css';
3
+ import { AvatarProps } from './types';
4
+ /**
5
+ * A user avatar component.
6
+ *
7
+ * Renders the user's avatar image when available, falling back to their initials on a
8
+ * deterministically-colored background when no image is provided or it fails to load.
9
+ *
10
+ */
11
+ declare function Avatar({ name, avatarUrl, color, size, isModerator, isYou, isTalking, disableTooltip, }: AvatarProps): JSX.Element;
12
+ export default Avatar;
@@ -0,0 +1,8 @@
1
+ export declare const AVATAR_SIZES: {
2
+ readonly SMALL: "small";
3
+ readonly MEDIUM: "medium";
4
+ readonly LARGE: "large";
5
+ };
6
+ export declare const AVATAR_SIZE_VALUES: ("small" | "medium" | "large")[];
7
+ export declare const DEFAULT_AVATAR_SIZE: "medium";
8
+ export declare const AVATAR_FALLBACK_COLORS: string[];
@@ -0,0 +1 @@
1
+ export { default as BBBAvatar } from './component';
@@ -0,0 +1,3 @@
1
+ import { StyledAvatarProps } from './types';
2
+ export declare const AvatarInitials: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledAvatarProps>> & string;
3
+ export declare const AvatarImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, StyledAvatarProps>> & string;
@@ -0,0 +1,26 @@
1
+ import { AVATAR_SIZE_VALUES } from './constants';
2
+ export type AvatarSize = typeof AVATAR_SIZE_VALUES[number];
3
+ export interface StyledAvatarProps {
4
+ $size: AvatarSize;
5
+ $color: string;
6
+ $isModerator: boolean;
7
+ $isTalking: boolean;
8
+ }
9
+ export interface AvatarProps {
10
+ /** Full name of the user; used to render initials, to derive a deterministic fallback color, and as the tooltip content. */
11
+ name: string;
12
+ /** URL of the user's avatar image. Falls back to initials when omitted or if the image fails to load. */
13
+ avatarUrl?: string;
14
+ /** Background color behind the initials (and border color on the image). @default a color deterministically derived from `name`, or BBB's "you" color when `isYou` is set */
15
+ color?: string;
16
+ /** Size variant of the avatar. @default 'medium' */
17
+ size?: AvatarSize;
18
+ /** Renders a rounded-square shape instead of a circle, matching BBB's moderator avatar treatment. @default false */
19
+ isModerator?: boolean;
20
+ /** Marks this avatar as belonging to the current user, applying BBB's "you" color in place of the fallback/computed color. Ignored when `color` is set. @default false */
21
+ isYou?: boolean;
22
+ /** Shows a pulsing ring around the avatar, in its own color, matching BBB's talking indicator. @default false */
23
+ isTalking?: boolean;
24
+ /** Disables the tooltip that shows the full `name` on hover. @default false */
25
+ disableTooltip?: boolean;
26
+ }
@@ -26,15 +26,15 @@ declare const LAYOUTS: {
26
26
  readonly CIRCLE: "circle";
27
27
  readonly SQUARED: "squared";
28
28
  };
29
- declare const LAYOUT_VALUES: ("default" | "stacked" | "circle" | "squared")[];
30
- declare const DEFAULT_LAYOUT: "default" | "stacked" | "circle" | "squared";
29
+ declare const LAYOUT_VALUES: ("default" | "circle" | "stacked" | "squared")[];
30
+ declare const DEFAULT_LAYOUT: "default" | "circle" | "stacked" | "squared";
31
31
  declare const TOOLTIP_PLACEMENTS: {
32
32
  readonly TOP: "top";
33
33
  readonly BOTTOM: "bottom";
34
34
  readonly LEFT: "left";
35
35
  readonly RIGHT: "right";
36
36
  };
37
- declare const TOOLTIP_PLACEMENT_VALUES: ("top" | "bottom" | "left" | "right")[];
37
+ declare const TOOLTIP_PLACEMENT_VALUES: ("left" | "right" | "bottom" | "top")[];
38
38
  declare const DEFAULT_TOOLTIP_PLACEMENT: "top";
39
39
  declare const CSS_COLOR_PROPERTIES: CSSColorPropertiesType;
40
40
  declare const CSS_COLOR_PROPERTIES_DISABLED: EssentialColorProperties;
@@ -19,6 +19,7 @@ export type CSSColorPropertiesType = {
19
19
  };
20
20
  export type SizeProperties = {
21
21
  padding: string;
22
+ iconBoxSize: string;
22
23
  };
23
24
  export type CSSSizePropertiesType = {
24
25
  [key: string]: SizeProperties;
@@ -68,7 +69,7 @@ type BaseButtonProps = {
68
69
  color?: ColorType;
69
70
  /** Visual variant controlling emphasis and background/border styling. @default 'primary' */
70
71
  variant?: VariantType;
71
- /** Button size; affects padding and, for the `circle` layout, the overall diameter. @default 'md' */
72
+ /** Button size; affects padding and, for the `circle`/`squared` layouts, the overall box size (both render at the same size). @default 'md' */
72
73
  size?: SizeType;
73
74
  /** Disables interaction and applies disabled styling. @default false */
74
75
  disabled?: boolean;
@@ -8,5 +8,5 @@ import { CheckboxProps } from './types';
8
8
  * and clicking the label will toggle the checkbox state.
9
9
  *
10
10
  */
11
- declare function Checkbox({ label, layout, round, ariaLabel, ...props }: CheckboxProps): JSX.Element;
11
+ declare function Checkbox({ label, layout, round, ariaLabel, id, dataTest, inputProps, ...props }: CheckboxProps): JSX.Element;
12
12
  export default Checkbox;
@@ -10,5 +10,7 @@ export interface CheckboxProps extends MuiCheckboxProps {
10
10
  round?: boolean;
11
11
  /** Accessible name for the checkbox. */
12
12
  ariaLabel?: string;
13
+ /** `data-test` attribute on the underlying `<input>` element. */
14
+ dataTest?: string;
13
15
  }
14
16
  export {};
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  import { StyledModalBodyProps, StyledModalFooterProps } from './types';
4
4
  export declare const modalStyles: Styles;
5
5
  export declare const ModalHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
- export declare const CloseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
7
6
  export declare const ModalScrollArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledModalBodyProps>> & string;
8
7
  export declare const ModalBodyContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
9
8
  export declare const ModalFooter: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledModalFooterProps>> & string;