@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.
Files changed (101) hide show
  1. package/README.md +38 -10
  2. package/dist/components/Accordion.js +57 -1
  3. package/dist/components/Button.js +144 -1
  4. package/dist/components/Checkbox.js +20 -1
  5. package/dist/components/Divider.js +9 -1
  6. package/dist/components/Hint.js +51 -1
  7. package/dist/components/Input.js +220 -0
  8. package/dist/components/Modal.js +222 -1
  9. package/dist/components/Navigation.js +74 -1
  10. package/dist/components/ScrollArea.js +42 -0
  11. package/dist/components/Search.js +130 -1
  12. package/dist/components/Select.js +46 -1
  13. package/dist/components/Spinner.js +34 -1
  14. package/dist/components/TextAreaInput.js +28 -1
  15. package/dist/components/TextInput.js +52 -1
  16. package/dist/components/Toggle.js +42 -1
  17. package/dist/components/Typography.js +42 -1
  18. package/dist/components/colors.js +1 -0
  19. package/dist/components/index.js +789 -1
  20. package/dist/esm/components/Accordion/component.js +8 -9
  21. package/dist/esm/components/Accordion/constants.js +10 -4
  22. package/dist/esm/components/Accordion/styles.js +63 -17
  23. package/dist/esm/components/Button/component.js +52 -35
  24. package/dist/esm/components/Button/constants.js +21 -20
  25. package/dist/esm/components/Button/styles.js +187 -45
  26. package/dist/esm/components/Checkbox/component.js +3 -14
  27. package/dist/esm/components/Checkbox/constants.js +3 -3
  28. package/dist/esm/components/Checkbox/styles.js +23 -9
  29. package/dist/esm/components/Divider/styles.js +10 -7
  30. package/dist/esm/components/Hint/component.js +16 -16
  31. package/dist/esm/components/Hint/constants.js +3 -3
  32. package/dist/esm/components/Hint/styles.js +58 -13
  33. package/dist/esm/components/Input/component.js +111 -0
  34. package/dist/esm/components/Input/index.js +1 -0
  35. package/dist/esm/components/Input/styles.js +89 -0
  36. package/dist/esm/components/Input/types.js +1 -0
  37. package/dist/esm/components/Modal/component.js +8 -19
  38. package/dist/esm/components/Modal/styles.js +42 -20
  39. package/dist/esm/components/Navigation/component.js +3 -4
  40. package/dist/esm/components/Navigation/styles.js +36 -12
  41. package/dist/esm/components/ScrollArea/component.js +15 -0
  42. package/dist/esm/components/ScrollArea/constants.js +3 -0
  43. package/dist/esm/components/ScrollArea/index.js +1 -0
  44. package/dist/esm/components/ScrollArea/styles.js +69 -0
  45. package/dist/esm/components/ScrollArea/types.js +1 -0
  46. package/dist/esm/components/Search/component.js +16 -17
  47. package/dist/esm/components/Search/styles.js +103 -14
  48. package/dist/esm/components/Select/component.js +5 -16
  49. package/dist/esm/components/Select/styles.js +51 -11
  50. package/dist/esm/components/Spinner/component.js +1 -2
  51. package/dist/esm/components/Spinner/styles.js +39 -29
  52. package/dist/esm/components/TextAreaInput/component.js +4 -15
  53. package/dist/esm/components/TextAreaInput/styles.js +29 -7
  54. package/dist/esm/components/TextInput/component.js +2 -13
  55. package/dist/esm/components/TextInput/styles.js +58 -16
  56. package/dist/esm/components/Toggle/component.js +6 -17
  57. package/dist/esm/components/Toggle/constants.js +3 -3
  58. package/dist/esm/components/Toggle/styles.js +88 -72
  59. package/dist/esm/components/Typography/component.js +3 -14
  60. package/dist/esm/components/Typography/constants.js +1 -1
  61. package/dist/esm/components/Typography/styles.js +50 -17
  62. package/dist/esm/components/index.js +2 -0
  63. package/dist/esm/index.js +2 -1
  64. package/dist/esm/stylesheets/colors.js +57 -0
  65. package/dist/esm/stylesheets/palette.js +55 -0
  66. package/dist/esm/stylesheets/sizing.js +9 -9
  67. package/dist/esm/stylesheets/typography.js +7 -7
  68. package/dist/types/components/Accordion/component.d.ts +1 -1
  69. package/dist/types/components/Accordion/constants.d.ts +7 -1
  70. package/dist/types/components/Accordion/styles.d.ts +2 -1
  71. package/dist/types/components/Accordion/types.d.ts +15 -1
  72. package/dist/types/components/Button/constants.d.ts +3 -2
  73. package/dist/types/components/Button/styles.d.ts +1 -0
  74. package/dist/types/components/Button/type.d.ts +42 -1
  75. package/dist/types/components/Checkbox/types.d.ts +4 -0
  76. package/dist/types/components/Hint/component.d.ts +2 -1
  77. package/dist/types/components/Hint/types.d.ts +9 -0
  78. package/dist/types/components/Input/component.d.ts +12 -0
  79. package/dist/types/components/Input/index.d.ts +1 -0
  80. package/dist/types/components/Input/styles.d.ts +6 -0
  81. package/dist/types/components/Input/types.d.ts +69 -0
  82. package/dist/types/components/Modal/types.d.ts +11 -0
  83. package/dist/types/components/Navigation/types.d.ts +9 -0
  84. package/dist/types/components/ScrollArea/component.d.ts +11 -0
  85. package/dist/types/components/ScrollArea/constants.d.ts +3 -0
  86. package/dist/types/components/ScrollArea/index.d.ts +1 -0
  87. package/dist/types/components/ScrollArea/styles.d.ts +2 -0
  88. package/dist/types/components/ScrollArea/types.d.ts +37 -0
  89. package/dist/types/components/Search/types.d.ts +6 -24
  90. package/dist/types/components/Select/types.d.ts +4 -0
  91. package/dist/types/components/Spinner/types.d.ts +3 -0
  92. package/dist/types/components/TextAreaInput/types.d.ts +7 -0
  93. package/dist/types/components/TextInput/types.d.ts +3 -0
  94. package/dist/types/components/Toggle/types.d.ts +6 -0
  95. package/dist/types/components/Typography/types.d.ts +3 -0
  96. package/dist/types/components/index.d.ts +2 -0
  97. package/dist/types/index.d.ts +2 -1
  98. package/dist/types/stylesheets/colors.d.ts +57 -0
  99. package/dist/types/stylesheets/{pallete.d.ts → palette.d.ts} +13 -9
  100. package/package.json +35 -2
  101. package/dist/esm/stylesheets/pallete.js +0 -46
@@ -1,6 +1,6 @@
1
- export var LAYOUTS = {
1
+ export const LAYOUTS = {
2
2
  RIGHT: 'right',
3
3
  LEFT: 'left',
4
4
  };
5
- export var LAYOUT_VALUES = Object.values(LAYOUTS);
6
- export var DEFAULT_LAYOUT = LAYOUT_VALUES[0];
5
+ export const LAYOUT_VALUES = Object.values(LAYOUTS);
6
+ export const DEFAULT_LAYOUT = LAYOUT_VALUES[0];
@@ -1,13 +1,27 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import styled from 'styled-components';
6
2
  import { Checkbox as MuiCheckbox } from '@mui/material';
7
- import { colorTextDefault, colorBrand1 } from '../../stylesheets/pallete';
3
+ import { colorTextDefault, colorBrand1 } from '../../stylesheets/palette';
8
4
  import { fontSizeDefault } from '../../stylesheets/typography';
9
5
  import { spacingSmall } from '../../stylesheets/sizing';
10
- export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n"])), spacingSmall);
11
- export var Label = styled.label(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n cursor: pointer;\n"], ["\n color: ", ";\n font-size: ", ";\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n cursor: pointer;\n"])), colorTextDefault, fontSizeDefault);
12
- export var StyledCheckbox = styled(MuiCheckbox)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &.MuiCheckbox-root {\n padding: 0;\n }\n\n &.Mui-checked {\n color: ", ";\n }\n"], ["\n &.MuiCheckbox-root {\n padding: 0;\n }\n\n &.Mui-checked {\n color: ", ";\n }\n"])), colorBrand1);
13
- var templateObject_1, templateObject_2, templateObject_3;
6
+ export const Container = styled.div `
7
+ display: inline-flex;
8
+ align-items: center;
9
+ gap: ${spacingSmall};
10
+ `;
11
+ export const Label = styled.label `
12
+ color: ${colorTextDefault};
13
+ font-size: ${fontSizeDefault};
14
+ font-style: normal;
15
+ font-weight: 400;
16
+ line-height: normal;
17
+ cursor: pointer;
18
+ `;
19
+ export const StyledCheckbox = styled(MuiCheckbox) `
20
+ &.MuiCheckbox-root {
21
+ padding: 0;
22
+ }
23
+
24
+ &.Mui-checked {
25
+ color: ${colorBrand1};
26
+ }
27
+ `;
@@ -1,8 +1,11 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import styled from 'styled-components';
6
- import { colorBorderDefault } from '../../stylesheets/pallete';
7
- export var Divider = styled.hr(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n border-top: 0px;\n border-right: 0px;\n border-left: 0px;\n border-image: initial;\n border-bottom: 1px solid ", ";\n margin: 0px;\n"], ["\n width: 100%;\n border-top: 0px;\n border-right: 0px;\n border-left: 0px;\n border-image: initial;\n border-bottom: 1px solid ", ";\n margin: 0px;\n"])), colorBorderDefault);
8
- var templateObject_1;
2
+ import { colorBorderDefault } from '../../stylesheets/palette';
3
+ export const Divider = styled.hr `
4
+ width: 100%;
5
+ border-top: 0px;
6
+ border-right: 0px;
7
+ border-left: 0px;
8
+ border-image: initial;
9
+ border-bottom: 1px solid ${colorBorderDefault};
10
+ margin: 0px;
11
+ `;
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  var __rest = (this && this.__rest) || function (s, e) {
13
2
  var t = {};
14
3
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -20,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
9
  }
21
10
  return t;
22
11
  };
23
- import React from 'react';
12
+ import React, { useState } from 'react';
24
13
  import * as Styled from './styles';
25
14
  import { MdClose, MdInfo } from 'react-icons/md';
26
15
  /**
@@ -29,19 +18,30 @@ import { MdClose, MdInfo } from 'react-icons/md';
29
18
  * This component provides a small contextual hint used to surface tips, short help text or dismissible messages.
30
19
  * It can be displayed with a title, an icon, and a close button.
31
20
  *
21
+ * Visibility is uncontrolled by default (the hint closes itself when its close button is clicked); pass `open` to control it externally instead.
32
22
  */
33
23
  function Hint(_a) {
34
- var title = _a.title, label = _a.label, _b = _a.icon, icon = _b === void 0 ? React.createElement(MdInfo, { fontSize: "1rem" }) : _b, onRequestClose = _a.onRequestClose, children = _a.children, rest = __rest(_a, ["title", "label", "icon", "onRequestClose", "children"]);
35
- var renderedLabel = React.createElement(Styled.Label, null,
24
+ var { title, label, icon = React.createElement(MdInfo, { fontSize: "1rem" }), open, onRequestClose, hideCloseButton = false, children } = _a, rest = __rest(_a, ["title", "label", "icon", "open", "onRequestClose", "hideCloseButton", "children"]);
25
+ const isControlled = open !== undefined;
26
+ const [internalOpen, setInternalOpen] = useState(true);
27
+ const isOpen = isControlled ? open : internalOpen;
28
+ const handleClose = () => {
29
+ if (!isControlled)
30
+ setInternalOpen(false);
31
+ onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose();
32
+ };
33
+ if (!isOpen)
34
+ return null;
35
+ const renderedLabel = React.createElement(Styled.Label, null,
36
36
  label,
37
37
  children);
38
- return (React.createElement(Styled.Container, __assign({ role: "status", "aria-live": "polite", "aria-atomic": "true", "aria-label": title || label }, rest),
38
+ return (React.createElement(Styled.Container, Object.assign({ role: "status", "aria-live": "polite", "aria-atomic": "true", "aria-label": title || label }, rest),
39
39
  React.createElement(Styled.Header, null,
40
40
  React.createElement(Styled.IconTextWrapper, null,
41
41
  React.createElement(Styled.IconWrapper, { "aria-hidden": "true" }, icon),
42
42
  title && React.createElement(Styled.Title, null, title),
43
43
  !title && renderedLabel),
44
- title && (React.createElement(Styled.CloseButton, { type: "button", "aria-label": "Close", onClick: onRequestClose },
44
+ !hideCloseButton && (React.createElement(Styled.CloseButton, { type: "button", "aria-label": "Close", onClick: handleClose },
45
45
  React.createElement(MdClose, { fontSize: "1rem" })))),
46
46
  title && renderedLabel));
47
47
  }
@@ -1,6 +1,6 @@
1
- export var LAYOUTS = {
1
+ export const LAYOUTS = {
2
2
  RIGHT: 'right',
3
3
  LEFT: 'left',
4
4
  };
5
- export var LAYOUT_VALUES = Object.values(LAYOUTS);
6
- export var DEFAULT_LAYOUT = LAYOUT_VALUES[0];
5
+ export const LAYOUT_VALUES = Object.values(LAYOUTS);
6
+ export const DEFAULT_LAYOUT = LAYOUT_VALUES[0];
@@ -1,16 +1,61 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import styled from 'styled-components';
6
- import { colorTextDefault, colorBrand1, colorBackgroundLight, colorIconDefault, colorHoverLight } from '../../stylesheets/pallete';
2
+ import { colorTextDefault, colorBrand1, colorBackgroundLight, colorIconDefault, colorHoverLight } from '../../stylesheets/palette';
7
3
  import { fontSizeDefault } from '../../stylesheets/typography';
8
4
  import { borderRadiusSmall, spacingMedium, spacingSmall, spacingSmallMedium } from '../../stylesheets/sizing';
9
- export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: ", ";\n padding: ", ";\n background-color: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n gap: ", ";\n padding: ", ";\n background-color: ", ";\n"])), spacingSmall, spacingMedium, colorBackgroundLight);
10
- export var IconTextWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n gap: ", ";\n"], ["\n display: flex;\n flex-direction: row;\n gap: ", ";\n"])), spacingSmallMedium);
11
- export var Header = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n"])));
12
- export var IconWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n display: flex;\n align-items: center;\n"], ["\n color: ", ";\n display: flex;\n align-items: center;\n"])), colorBrand1);
13
- export var Title = styled.label(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n font-size: ", "\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n"], ["\n color: ", ";\n font-size: ", "\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n"])), colorTextDefault, fontSizeDefault);
14
- export var CloseButton = styled.button(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n background: transparent;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n aspect-ratio: 1;\n\n &&:hover,\n &&:active {\n background-color: ", ";\n }\n \n &&:focus {\n outline: 2px solid ", ";\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n background: transparent;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n aspect-ratio: 1;\n\n &&:hover,\n &&:active {\n background-color: ", ";\n }\n \n &&:focus {\n outline: 2px solid ", ";\n }\n"])), colorIconDefault, colorHoverLight, colorBrand1);
15
- export var Label = styled.label(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n border-radius: ", ";\n"], ["\n color: ", ";\n font-size: ", ";\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n border-radius: ", ";\n"])), colorTextDefault, fontSizeDefault, borderRadiusSmall);
16
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
5
+ export const Container = styled.div `
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: ${spacingSmall};
9
+ padding: ${spacingMedium};
10
+ background-color: ${colorBackgroundLight};
11
+ `;
12
+ export const IconTextWrapper = styled.div `
13
+ display: flex;
14
+ flex-direction: row;
15
+ gap: ${spacingSmallMedium};
16
+ `;
17
+ export const Header = styled.div `
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: space-between;
21
+ `;
22
+ export const IconWrapper = styled.div `
23
+ color: ${colorBrand1};
24
+ display: flex;
25
+ align-items: center;
26
+ `;
27
+ export const Title = styled.label `
28
+ color: ${colorTextDefault};
29
+ font-size: ${fontSizeDefault}
30
+ font-style: normal;
31
+ font-weight: 600;
32
+ line-height: normal;
33
+ `;
34
+ export const CloseButton = styled.button `
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ color: ${colorIconDefault};
39
+ background: transparent;
40
+ border: none;
41
+ border-radius: 50%;
42
+ cursor: pointer;
43
+ aspect-ratio: 1;
44
+
45
+ &&:hover,
46
+ &&:active {
47
+ background-color: ${colorHoverLight};
48
+ }
49
+
50
+ &&:focus {
51
+ outline: 2px solid ${colorBrand1};
52
+ }
53
+ `;
54
+ export const Label = styled.label `
55
+ color: ${colorTextDefault};
56
+ font-size: ${fontSizeDefault};
57
+ font-style: normal;
58
+ font-weight: 400;
59
+ line-height: normal;
60
+ border-radius: ${borderRadiusSmall};
61
+ `;
@@ -0,0 +1,111 @@
1
+ import React, { useCallback, useEffect, useId, useRef, useState, } from 'react';
2
+ import Button from '../Button/component';
3
+ import { SIZES, LAYOUTS } from '../Button/constants';
4
+ import * as Styled from './styles';
5
+ /**
6
+ * A labeled, auto-growing text field with an inline action button.
7
+ *
8
+ * Modeled after the core chat text input: unifies the recurring "text field +
9
+ * submit button" pattern used across chat, guest messages and breakouts.
10
+ * It supports both uncontrolled (default) and controlled usage, matching BBBSearch.
11
+ *
12
+ */
13
+ function Input({ label, placeholder, value, onChange, onSubmit, buttonIcon, buttonLabel, buttonAriaLabel, buttonVariant = 'primary', dataTest, buttonDataTest, beforeButton, afterButton, submitOnEnter = true, showSentFeedback = false, sentFeedbackContent = 'Message sent', sentFeedbackDuration = 2000, disabled = false, error = false, helperText, minRows = 1, maxRows = 3, maxLength, autoFocus = false, inputRef, id, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, }) {
14
+ const isControlled = value !== undefined;
15
+ const [internalValue, setInternalValue] = useState('');
16
+ const currentValue = isControlled ? (value !== null && value !== void 0 ? value : '') : internalValue;
17
+ const generatedId = useId();
18
+ const fieldId = id !== null && id !== void 0 ? id : generatedId;
19
+ const internalRef = useRef(null);
20
+ const feedbackTimeoutRef = useRef(null);
21
+ const [isFeedbackVisible, setFeedbackVisible] = useState(false);
22
+ const setRefs = useCallback((node) => {
23
+ internalRef.current = node;
24
+ if (typeof inputRef === 'function') {
25
+ inputRef(node);
26
+ }
27
+ else if (inputRef && 'current' in inputRef) {
28
+ inputRef.current = node;
29
+ }
30
+ }, [inputRef]);
31
+ // Auto-grow the textarea between minRows and maxRows as content changes.
32
+ useEffect(() => {
33
+ const el = internalRef.current;
34
+ if (!el)
35
+ return;
36
+ el.style.height = 'auto';
37
+ const computedStyle = window.getComputedStyle(el);
38
+ const lineHeight = parseFloat(computedStyle.lineHeight) || 20;
39
+ const verticalExtra = [
40
+ computedStyle.paddingTop,
41
+ computedStyle.paddingBottom,
42
+ computedStyle.borderTopWidth,
43
+ computedStyle.borderBottomWidth,
44
+ ].reduce((sum, cssValue) => sum + (parseFloat(cssValue) || 0), 0);
45
+ const minHeight = lineHeight * minRows + verticalExtra;
46
+ const maxHeight = lineHeight * maxRows + verticalExtra;
47
+ const nextHeight = Math.min(Math.max(el.scrollHeight, minHeight), maxHeight);
48
+ el.style.height = `${nextHeight}px`;
49
+ el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';
50
+ }, [currentValue, minRows, maxRows]);
51
+ useEffect(() => () => {
52
+ if (feedbackTimeoutRef.current)
53
+ clearTimeout(feedbackTimeoutRef.current);
54
+ }, []);
55
+ useEffect(() => {
56
+ if (autoFocus && internalRef.current) {
57
+ internalRef.current.focus();
58
+ }
59
+ }, [autoFocus]);
60
+ const handleChange = useCallback((e) => {
61
+ const next = e.target.value;
62
+ if (isControlled) {
63
+ onChange === null || onChange === void 0 ? void 0 : onChange(next);
64
+ }
65
+ else {
66
+ setInternalValue(next);
67
+ }
68
+ }, [isControlled, onChange]);
69
+ const submit = useCallback(() => {
70
+ var _a;
71
+ if (disabled)
72
+ return;
73
+ const trimmed = currentValue.trim();
74
+ if (!trimmed)
75
+ return;
76
+ onSubmit(trimmed);
77
+ if (!isControlled) {
78
+ setInternalValue('');
79
+ }
80
+ (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.focus();
81
+ if (showSentFeedback) {
82
+ setFeedbackVisible(true);
83
+ if (feedbackTimeoutRef.current)
84
+ clearTimeout(feedbackTimeoutRef.current);
85
+ feedbackTimeoutRef.current = setTimeout(() => setFeedbackVisible(false), sentFeedbackDuration);
86
+ }
87
+ }, [disabled, currentValue, onSubmit, isControlled, showSentFeedback, sentFeedbackDuration]);
88
+ const handleKeyDown = useCallback((e) => {
89
+ if (e.key === 'Enter' && !e.shiftKey && submitOnEnter) {
90
+ e.preventDefault();
91
+ submit();
92
+ }
93
+ }, [submitOnEnter, submit]);
94
+ const showHelper = Boolean(helperText) || isFeedbackVisible;
95
+ const helperElementId = showHelper ? `${fieldId}-helper` : undefined;
96
+ const describedBy = [ariaDescribedBy, helperElementId].filter(Boolean).join(' ') || undefined;
97
+ // Icon-only submissions (the common case) use Button's `squared` layout — a
98
+ // compact, icon-only button matching the real chat input's send button shape.
99
+ // When a text label is provided instead, fall back to the default layout,
100
+ // which is the one that actually renders a label.
101
+ const button = buttonLabel ? (React.createElement(Button, { onClick: submit, disabled: disabled, size: SIZES.SMALL, variant: buttonVariant, dataTest: buttonDataTest, label: buttonLabel, ariaLabel: buttonAriaLabel, iconStart: buttonIcon })) : (React.createElement(Button, { layout: LAYOUTS.SQUARED, onClick: submit, disabled: disabled, variant: buttonVariant, dataTest: buttonDataTest, icon: buttonIcon, ariaLabel: buttonAriaLabel }));
102
+ return (React.createElement(Styled.Wrapper, null,
103
+ label && React.createElement(Styled.Label, { htmlFor: fieldId }, label),
104
+ React.createElement(Styled.FieldContainer, { "$disabled": disabled, "$error": error },
105
+ React.createElement(Styled.TextArea, { ref: setRefs, id: fieldId, rows: minRows, placeholder: placeholder, value: currentValue, onChange: handleChange, onKeyDown: handleKeyDown, disabled: disabled, maxLength: maxLength, "data-test": dataTest, "aria-label": ariaLabel, "aria-describedby": describedBy }),
106
+ beforeButton,
107
+ button,
108
+ afterButton),
109
+ showHelper && (React.createElement(Styled.HelperText, { id: helperElementId, "$success": isFeedbackVisible, "$error": !isFeedbackVisible && error, role: isFeedbackVisible ? 'status' : undefined, "aria-live": isFeedbackVisible ? 'polite' : undefined }, isFeedbackVisible ? sentFeedbackContent : helperText))));
110
+ }
111
+ export default Input;
@@ -0,0 +1 @@
1
+ export { default as BBBInput } from './component';
@@ -0,0 +1,89 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { colorBorderDefault, colorBorderSelected, colorBorderError, colorBorderFocusRing, colorTextDefault, colorTextLight, colorError, colorSuccess, } from '../../stylesheets/palette';
3
+ import { borderRadiusDefault, spacingSmall, spacingMedium } from '../../stylesheets/sizing';
4
+ import { fontSizeSmall } from '../../stylesheets/typography';
5
+ export const Wrapper = styled.div `
6
+ display: flex;
7
+ flex-direction: column;
8
+ width: 100%;
9
+ gap: ${spacingSmall};
10
+ `;
11
+ export const Label = styled.label `
12
+ color: ${colorTextDefault};
13
+ font-size: ${fontSizeSmall};
14
+ font-style: normal;
15
+ font-weight: 400;
16
+ line-height: normal;
17
+ `;
18
+ export const FieldContainer = styled.div `
19
+ display: flex;
20
+ align-items: center;
21
+ width: 100%;
22
+ padding: ${spacingSmall} ${spacingMedium};
23
+ gap: ${spacingSmall};
24
+ border-radius: ${borderRadiusDefault};
25
+ border: 1px solid ${colorBorderDefault};
26
+ background-color: transparent;
27
+ box-sizing: border-box;
28
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
29
+
30
+ &:focus-within {
31
+ border-color: ${colorBorderSelected};
32
+ box-shadow: 0 0 0 3px ${colorBorderFocusRing};
33
+ }
34
+
35
+ ${({ $error }) => $error &&
36
+ css `
37
+ border-color: ${colorBorderError};
38
+ `}
39
+
40
+ ${({ $disabled }) => $disabled &&
41
+ css `
42
+ opacity: 0.5;
43
+ cursor: not-allowed;
44
+ pointer-events: none;
45
+ `}
46
+ `;
47
+ export const TextArea = styled.textarea `
48
+ flex: 1;
49
+ min-width: 0;
50
+ resize: none;
51
+ border: none;
52
+ outline: none;
53
+ background: transparent;
54
+ color: ${colorTextDefault};
55
+ font-family: inherit;
56
+ font-size: ${fontSizeSmall};
57
+ line-height: 1.5;
58
+ padding: 0;
59
+
60
+ &::placeholder {
61
+ color: ${colorTextLight};
62
+ }
63
+
64
+ &:disabled {
65
+ cursor: not-allowed;
66
+ }
67
+
68
+ [dir='rtl'] & {
69
+ text-align: right;
70
+ }
71
+ `;
72
+ export const HelperText = styled.div `
73
+ color: ${colorTextDefault};
74
+ font-size: ${fontSizeSmall};
75
+ font-style: normal;
76
+ font-weight: 400;
77
+ line-height: normal;
78
+ padding: 0 ${spacingMedium};
79
+
80
+ ${({ $success }) => $success &&
81
+ css `
82
+ color: ${colorSuccess};
83
+ `}
84
+
85
+ ${({ $error }) => $error &&
86
+ css `
87
+ color: ${colorError};
88
+ `}
89
+ `;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  var __rest = (this && this.__rest) || function (s, e) {
13
2
  var t = {};
14
3
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -34,19 +23,19 @@ import { BBButton } from '../Button';
34
23
  * It supports accessibility, dividers, scrollable body, and sticky footer.
35
24
  *
36
25
  */
37
- var Modal = function (_a) {
38
- var _b = _a.isOpen, isOpen = _b === void 0 ? true : _b, onRequestClose = _a.onRequestClose, appElement = _a.appElement, title = _a.title, contentLabel = _a.contentLabel, _c = _a.showDividers, showDividers = _c === void 0 ? false : _c, _d = _a.shouldCloseOnOverlayClick, shouldCloseOnOverlayClick = _d === void 0 ? false : _d, _e = _a.shouldCloseOnEsc, shouldCloseOnEsc = _e === void 0 ? false : _e, _f = _a.allowScroll, allowScroll = _f === void 0 ? true : _f, _g = _a.noFooter, noFooter = _g === void 0 ? false : _g, _h = _a.footerContent, footerContent = _h === void 0 ? null : _h, _j = _a.stickyFooter, stickyFooter = _j === void 0 ? true : _j, testId = _a.testId, closeButtonDataTest = _a.closeButtonDataTest, children = _a.children, rest = __rest(_a, ["isOpen", "onRequestClose", "appElement", "title", "contentLabel", "showDividers", "shouldCloseOnOverlayClick", "shouldCloseOnEsc", "allowScroll", "noFooter", "footerContent", "stickyFooter", "testId", "closeButtonDataTest", "children"]);
39
- var _closeButtonDataTest = closeButtonDataTest;
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"]);
28
+ let _closeButtonDataTest = closeButtonDataTest;
40
29
  if (testId && !closeButtonDataTest) {
41
- _closeButtonDataTest = "".concat(testId, "-close-button");
30
+ _closeButtonDataTest = `${testId}-close-button`;
42
31
  }
43
- var renderFooter = useCallback(function (isSticky) { return (React.createElement(React.Fragment, null,
32
+ const renderFooter = useCallback((isSticky) => (React.createElement(React.Fragment, null,
44
33
  showDividers && React.createElement(BBBDivider, null),
45
- React.createElement(Styled.ModalFooter, { "$stickyFooter": isSticky }, footerContent))); }, [footerContent, showDividers]);
46
- return (React.createElement(ReactModal, __assign({}, rest, { isOpen: isOpen, onRequestClose: onRequestClose, contentLabel: contentLabel, style: Styled.modalStyles, shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, shouldCloseOnEsc: shouldCloseOnEsc, appElement: appElement, testId: testId }),
34
+ React.createElement(Styled.ModalFooter, { "$stickyFooter": isSticky }, footerContent))), [footerContent, showDividers]);
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 }),
47
36
  React.createElement(Styled.ModalHeader, null,
48
37
  React.createElement(BBBTypography, { variant: "header" }, title),
49
- React.createElement(BBButton, __assign({ layout: "circle", icon: React.createElement(MdClose, { size: "1.5rem" }), onClick: onRequestClose, variant: "subtle", ariaLabel: "close" }, (_closeButtonDataTest ? { dataTest: _closeButtonDataTest } : {})))),
38
+ React.createElement(BBButton, Object.assign({ layout: "circle", icon: React.createElement(MdClose, { size: "1.5rem" }), onClick: onRequestClose, variant: "subtle", ariaLabel: "close" }, (_closeButtonDataTest ? { dataTest: _closeButtonDataTest } : {})))),
50
39
  showDividers && React.createElement(BBBDivider, null),
51
40
  React.createElement(Styled.ModalScrollArea, { "$allowScroll": allowScroll },
52
41
  React.createElement(Styled.ModalBodyContent, null, children),
@@ -1,18 +1,14 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import styled from 'styled-components';
6
2
  import { spacingLarge, spacingMedium, spacingSmallMedium, borderRadiusDefault } from '../../stylesheets/sizing';
7
- import { colorWhite } from '../../stylesheets/pallete';
8
- export var modalStyles = {
3
+ import { colorWhite, colorOverlay } from '../../stylesheets/palette';
4
+ export const modalStyles = {
9
5
  overlay: {
10
6
  position: 'fixed',
11
7
  top: 0,
12
8
  left: 0,
13
9
  right: 0,
14
10
  bottom: 0,
15
- backgroundColor: 'rgba(0, 0, 0, 0.75)',
11
+ backgroundColor: colorOverlay,
16
12
  zIndex: 100,
17
13
  display: 'flex',
18
14
  alignItems: 'center',
@@ -37,16 +33,42 @@ export var modalStyles = {
37
33
  flexDirection: 'column',
38
34
  },
39
35
  };
40
- export var ModalHeader = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", " ", " ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n"], ["\n padding: ", " ", " ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])), spacingLarge, spacingLarge, spacingSmallMedium);
41
- export var CloseButton = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n padding: 0;\n line-height: 1;\n"], ["\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n padding: 0;\n line-height: 1;\n"])));
42
- export var ModalScrollArea = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: ", ";\n overflow-x: hidden;\n display: flex;\n flex-direction: column;\n"], ["\n flex-grow: 1;\n overflow-y: ", ";\n overflow-x: hidden;\n display: flex;\n flex-direction: column;\n"])), function (_a) {
43
- var $allowScroll = _a.$allowScroll;
44
- return $allowScroll ? 'auto' : 'hidden';
45
- });
46
- export var ModalBodyContent = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex-grow: 1;\n padding: 0 ", ";\n margin: ", " 0 ", ";\n"], ["\n flex-grow: 1;\n padding: 0 ", ";\n margin: ", " 0 ", ";\n"])), spacingLarge, spacingSmallMedium, spacingSmallMedium);
47
- export var ModalFooter = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: ", " ", " ", ";\n display: flex;\n justify-content: flex-end;\n gap: ", ";\n \n ", "\n"], ["\n padding: ", " ", " ", ";\n display: flex;\n justify-content: flex-end;\n gap: ", ";\n \n ", "\n"])), spacingSmallMedium, spacingLarge, spacingLarge, spacingMedium, function (_a) {
48
- var $stickyFooter = _a.$stickyFooter;
49
- return $stickyFooter &&
50
- "\n position: sticky;\n bottom: 0;\n background-color: ".concat(colorWhite, ";\n ");
51
- });
52
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
36
+ export const ModalHeader = styled.div `
37
+ padding: ${spacingLarge} ${spacingLarge} ${spacingSmallMedium};
38
+ display: flex;
39
+ justify-content: space-between;
40
+ align-items: center;
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
+ export const ModalScrollArea = styled.div `
51
+ flex-grow: 1;
52
+ overflow-y: ${({ $allowScroll }) => $allowScroll ? 'auto' : 'hidden'};
53
+ overflow-x: hidden;
54
+ display: flex;
55
+ flex-direction: column;
56
+ `;
57
+ export const ModalBodyContent = styled.div `
58
+ flex-grow: 1;
59
+ padding: 0 ${spacingLarge};
60
+ margin: ${spacingSmallMedium} 0 ${spacingSmallMedium};
61
+ `;
62
+ export const ModalFooter = styled.div `
63
+ padding: ${spacingSmallMedium} ${spacingLarge} ${spacingLarge};
64
+ display: flex;
65
+ justify-content: flex-end;
66
+ gap: ${spacingMedium};
67
+
68
+ ${({ $stickyFooter }) => $stickyFooter &&
69
+ `
70
+ position: sticky;
71
+ bottom: 0;
72
+ background-color: ${colorWhite};
73
+ `}
74
+ `;
@@ -7,10 +7,9 @@ import { BBBTypography } from '../Typography';
7
7
  * It can be used for navigation actions within an application.
8
8
  *
9
9
  */
10
- function Navigation(_a) {
11
- var label = _a.label, onClick = _a.onClick, onKeyDown = _a.onKeyDown, icon = _a.icon, children = _a.children, ariaLabel = _a.ariaLabel, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, dataTest = _a.dataTest;
12
- var isCustomIcon = !!icon;
13
- var iconToRender = icon || React.createElement(MdExpandCircleDown, { size: "1.5rem" });
10
+ function Navigation({ label, onClick, onKeyDown, icon, children, ariaLabel, ariaLabelledBy, ariaDescribedBy, dataTest, }) {
11
+ const isCustomIcon = !!icon;
12
+ const iconToRender = icon || React.createElement(MdExpandCircleDown, { size: "1.5rem" });
14
13
  return (React.createElement(Styled.NavigationButton, { onClick: onClick, onKeyDown: onKeyDown, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "data-test": dataTest },
15
14
  React.createElement(Styled.IconTextWrapper, null,
16
15
  React.createElement(Styled.IconWrapper, { "$isCustomIcon": isCustomIcon }, iconToRender),
@@ -1,14 +1,38 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import styled, { css } from 'styled-components';
6
2
  import { borderRadiusSmall, spacingMedium } from '../../stylesheets/sizing';
7
- import { colorBrand1 } from '../../stylesheets/pallete';
8
- export var NavigationButton = styled.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: transparent;\n border: none;\n cursor: pointer;\n margin: 1px; /* Adds margin to prevent outline from being cropped */\n border-radius: ", ";\n\n &:focus {\n outline: 1px solid ", ";\n }\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: transparent;\n border: none;\n cursor: pointer;\n margin: 1px; /* Adds margin to prevent outline from being cropped */\n border-radius: ", ";\n\n &:focus {\n outline: 1px solid ", ";\n }\n"])), borderRadiusSmall, colorBrand1);
9
- export var IconTextWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n gap: ", ";\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n gap: ", ";\n"])), spacingMedium);
10
- export var IconWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n\n ", "\n"])), colorBrand1, function (_a) {
11
- var $isCustomIcon = _a.$isCustomIcon;
12
- return !$isCustomIcon && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n transform: rotate(90deg);\n [dir=\"rtl\"] & {\n transform: rotate(-90deg);\n }\n "], ["\n transform: rotate(90deg);\n [dir=\"rtl\"] & {\n transform: rotate(-90deg);\n }\n "])));
13
- });
14
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
3
+ import { colorBrand1 } from '../../stylesheets/palette';
4
+ export const NavigationButton = styled.button `
5
+ display: flex;
6
+ flex-direction: row;
7
+ align-items: center;
8
+ justify-content: space-between;
9
+ background: transparent;
10
+ border: none;
11
+ cursor: pointer;
12
+ margin: 1px; /* Adds margin to prevent outline from being cropped */
13
+ border-radius: ${borderRadiusSmall};
14
+
15
+ &:focus {
16
+ outline: 1px solid ${colorBrand1};
17
+ }
18
+ `;
19
+ export const IconTextWrapper = styled.div `
20
+ display: flex;
21
+ flex-direction: row;
22
+ align-items: center;
23
+ justify-content: center;
24
+ gap: ${spacingMedium};
25
+ `;
26
+ export const IconWrapper = styled.div `
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ color: ${colorBrand1};
31
+
32
+ ${({ $isCustomIcon }) => !$isCustomIcon && css `
33
+ transform: rotate(90deg);
34
+ [dir="rtl"] & {
35
+ transform: rotate(-90deg);
36
+ }
37
+ `}
38
+ `;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import * as Styled from './styles';
3
+ import { DEFAULT_VERTICAL_SCROLL, DEFAULT_HORIZONTAL_SCROLL, DEFAULT_FADE_EDGES } from './constants';
4
+ /**
5
+ * A wrapper that applies standardized scrollbar styling to its content.
6
+ *
7
+ * Use it around any scrollable area (chat, lists, side panels) to get a consistent
8
+ * scrollbar look, with optional axis control, size capping, and edge fading.
9
+ *
10
+ */
11
+ function ScrollArea({ children, verticalScroll = DEFAULT_VERTICAL_SCROLL, horizontalScroll = DEFAULT_HORIZONTAL_SCROLL, maxHeight, maxWidth, fadeEdges = DEFAULT_FADE_EDGES, fadeColor, paddingTop, paddingRight, paddingBottom, paddingLeft, }) {
12
+ const isScrollable = verticalScroll || horizontalScroll;
13
+ return (React.createElement(Styled.ScrollAreaWrapper, { "$verticalScroll": verticalScroll, "$horizontalScroll": horizontalScroll, "$maxHeight": maxHeight, "$maxWidth": maxWidth, "$fadeEdges": fadeEdges, "$fadeColor": fadeColor, "$paddingTop": paddingTop, "$paddingRight": paddingRight, "$paddingBottom": paddingBottom, "$paddingLeft": paddingLeft, tabIndex: isScrollable ? 0 : undefined }, children));
14
+ }
15
+ export default ScrollArea;
@@ -0,0 +1,3 @@
1
+ export const DEFAULT_VERTICAL_SCROLL = true;
2
+ export const DEFAULT_HORIZONTAL_SCROLL = false;
3
+ export const DEFAULT_FADE_EDGES = true;