@bigbluebutton/bbb-ui-components-react 0.5.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/LICENSE +165 -0
- package/README.md +141 -0
- package/dist/components/Accordion.js +1 -0
- package/dist/components/Button.js +1 -0
- package/dist/components/Checkbox.js +1 -0
- package/dist/components/Divider.js +1 -0
- package/dist/components/Hint.js +1 -0
- package/dist/components/Modal.js +1 -0
- package/dist/components/Navigation.js +1 -0
- package/dist/components/Search.js +1 -0
- package/dist/components/Select.js +1 -0
- package/dist/components/Spinner.js +1 -0
- package/dist/components/TextAreaInput.js +1 -0
- package/dist/components/TextInput.js +1 -0
- package/dist/components/Toggle.js +1 -0
- package/dist/components/Typography.js +1 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/components/Accordion/component.js +29 -0
- package/dist/esm/components/Accordion/constants.js +9 -0
- package/dist/esm/components/Accordion/index.js +1 -0
- package/dist/esm/components/Accordion/styles.js +20 -0
- package/dist/esm/components/Accordion/types.js +2 -0
- package/dist/esm/components/Button/component.js +73 -0
- package/dist/esm/components/Button/constants.js +174 -0
- package/dist/esm/components/Button/index.js +1 -0
- package/dist/esm/components/Button/styles.js +60 -0
- package/dist/esm/components/Button/type.js +1 -0
- package/dist/esm/components/Checkbox/component.js +47 -0
- package/dist/esm/components/Checkbox/constants.js +6 -0
- package/dist/esm/components/Checkbox/index.js +1 -0
- package/dist/esm/components/Checkbox/styles.js +13 -0
- package/dist/esm/components/Checkbox/types.js +1 -0
- package/dist/esm/components/Divider/component.js +12 -0
- package/dist/esm/components/Divider/index.js +1 -0
- package/dist/esm/components/Divider/styles.js +8 -0
- package/dist/esm/components/Hint/component.js +48 -0
- package/dist/esm/components/Hint/constants.js +6 -0
- package/dist/esm/components/Hint/index.js +1 -0
- package/dist/esm/components/Hint/styles.js +16 -0
- package/dist/esm/components/Hint/types.js +1 -0
- package/dist/esm/components/Modal/component.js +56 -0
- package/dist/esm/components/Modal/index.js +1 -0
- package/dist/esm/components/Modal/styles.js +52 -0
- package/dist/esm/components/Modal/types.js +1 -0
- package/dist/esm/components/Navigation/component.js +20 -0
- package/dist/esm/components/Navigation/index.js +1 -0
- package/dist/esm/components/Navigation/styles.js +14 -0
- package/dist/esm/components/Navigation/types.js +1 -0
- package/dist/esm/components/Search/component.js +75 -0
- package/dist/esm/components/Search/index.js +1 -0
- package/dist/esm/components/Search/styles.js +17 -0
- package/dist/esm/components/Search/types.js +1 -0
- package/dist/esm/components/Select/component.js +44 -0
- package/dist/esm/components/Select/index.js +1 -0
- package/dist/esm/components/Select/styles.js +15 -0
- package/dist/esm/components/Select/types.js +1 -0
- package/dist/esm/components/Spinner/component.js +15 -0
- package/dist/esm/components/Spinner/index.js +1 -0
- package/dist/esm/components/Spinner/styles.js +30 -0
- package/dist/esm/components/Spinner/types.js +1 -0
- package/dist/esm/components/TextAreaInput/component.js +50 -0
- package/dist/esm/components/TextAreaInput/index.js +1 -0
- package/dist/esm/components/TextAreaInput/styles.js +9 -0
- package/dist/esm/components/TextAreaInput/types.js +2 -0
- package/dist/esm/components/TextInput/component.js +39 -0
- package/dist/esm/components/TextInput/index.js +1 -0
- package/dist/esm/components/TextInput/styles.js +20 -0
- package/dist/esm/components/TextInput/types.js +1 -0
- package/dist/esm/components/Toggle/component.js +46 -0
- package/dist/esm/components/Toggle/constants.js +8 -0
- package/dist/esm/components/Toggle/index.js +1 -0
- package/dist/esm/components/Toggle/styles.js +91 -0
- package/dist/esm/components/Toggle/types.js +2 -0
- package/dist/esm/components/Typography/component.js +36 -0
- package/dist/esm/components/Typography/constants.js +8 -0
- package/dist/esm/components/Typography/index.js +1 -0
- package/dist/esm/components/Typography/styles.js +20 -0
- package/dist/esm/components/Typography/types.js +1 -0
- package/dist/esm/components/index.js +14 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/stylesheets/pallete.js +46 -0
- package/dist/esm/stylesheets/sizing.js +12 -0
- package/dist/esm/stylesheets/typography.js +8 -0
- package/dist/types/components/Accordion/component.d.ts +12 -0
- package/dist/types/components/Accordion/constants.d.ts +9 -0
- package/dist/types/components/Accordion/index.d.ts +1 -0
- package/dist/types/components/Accordion/styles.d.ts +6 -0
- package/dist/types/components/Accordion/types.d.ts +21 -0
- package/dist/types/components/Button/component.d.ts +13 -0
- package/dist/types/components/Button/constants.d.ts +41 -0
- package/dist/types/components/Button/index.d.ts +1 -0
- package/dist/types/components/Button/styles.d.ts +7 -0
- package/dist/types/components/Button/type.d.ts +80 -0
- package/dist/types/components/Checkbox/component.d.ts +12 -0
- package/dist/types/components/Checkbox/constants.d.ts +6 -0
- package/dist/types/components/Checkbox/index.d.ts +1 -0
- package/dist/types/components/Checkbox/styles.d.ts +4 -0
- package/dist/types/components/Checkbox/types.d.ts +10 -0
- package/dist/types/components/Divider/component.d.ts +9 -0
- package/dist/types/components/Divider/index.d.ts +1 -0
- package/dist/types/components/Divider/styles.d.ts +1 -0
- package/dist/types/components/Hint/component.d.ts +11 -0
- package/dist/types/components/Hint/constants.d.ts +6 -0
- package/dist/types/components/Hint/index.d.ts +1 -0
- package/dist/types/components/Hint/styles.d.ts +7 -0
- package/dist/types/components/Hint/types.d.ts +7 -0
- package/dist/types/components/Modal/component.d.ts +11 -0
- package/dist/types/components/Modal/index.d.ts +1 -0
- package/dist/types/components/Modal/styles.d.ts +9 -0
- package/dist/types/components/Modal/types.d.ts +21 -0
- package/dist/types/components/Navigation/component.d.ts +9 -0
- package/dist/types/components/Navigation/index.d.ts +1 -0
- package/dist/types/components/Navigation/styles.d.ts +4 -0
- package/dist/types/components/Navigation/types.d.ts +15 -0
- package/dist/types/components/Search/component.d.ts +8 -0
- package/dist/types/components/Search/index.d.ts +1 -0
- package/dist/types/components/Search/styles.d.ts +9 -0
- package/dist/types/components/Search/types.d.ts +42 -0
- package/dist/types/components/Select/component.d.ts +11 -0
- package/dist/types/components/Select/index.d.ts +1 -0
- package/dist/types/components/Select/styles.d.ts +7 -0
- package/dist/types/components/Select/types.d.ts +8 -0
- package/dist/types/components/Spinner/component.d.ts +10 -0
- package/dist/types/components/Spinner/index.d.ts +1 -0
- package/dist/types/components/Spinner/styles.d.ts +4 -0
- package/dist/types/components/Spinner/types.d.ts +15 -0
- package/dist/types/components/TextAreaInput/component.d.ts +11 -0
- package/dist/types/components/TextAreaInput/index.d.ts +1 -0
- package/dist/types/components/TextAreaInput/styles.d.ts +1 -0
- package/dist/types/components/TextAreaInput/types.d.ts +10 -0
- package/dist/types/components/TextInput/component.d.ts +11 -0
- package/dist/types/components/TextInput/index.d.ts +1 -0
- package/dist/types/components/TextInput/styles.d.ts +8 -0
- package/dist/types/components/TextInput/types.d.ts +9 -0
- package/dist/types/components/Toggle/component.d.ts +11 -0
- package/dist/types/components/Toggle/constants.d.ts +8 -0
- package/dist/types/components/Toggle/index.d.ts +1 -0
- package/dist/types/components/Toggle/styles.d.ts +7 -0
- package/dist/types/components/Toggle/types.d.ts +19 -0
- package/dist/types/components/Typography/component.d.ts +11 -0
- package/dist/types/components/Typography/constants.d.ts +1 -0
- package/dist/types/components/Typography/index.d.ts +1 -0
- package/dist/types/components/Typography/styles.d.ts +2 -0
- package/dist/types/components/Typography/types.d.ts +11 -0
- package/dist/types/components/index.d.ts +14 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stylesheets/pallete.d.ts +30 -0
- package/dist/types/stylesheets/sizing.d.ts +9 -0
- package/dist/types/stylesheets/typography.d.ts +7 -0
- package/package.json +290 -0
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import { CSS_COLOR_PROPERTIES, CSS_COLOR_PROPERTIES_DISABLED, CSS_SIZE_PROPERTIES, DEFAULT_COLOR, DEFAULT_SIZE, DEFAULT_VARIANT, VARIANTS, LAYOUTS, } from './constants';
|
|
7
|
+
import { borderRadiusDefault, spacingSmall, } from '../../stylesheets/sizing';
|
|
8
|
+
import { colorBorderDefault, colorTextDefault } from '../../stylesheets/pallete';
|
|
9
|
+
import { fontSizeSmall } from '../../stylesheets/typography';
|
|
10
|
+
var commonButtonStyles = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: pointer;\n user-select: none;\n font-weight: 600;\n line-height: normal;\n text-align: center;\n white-space: nowrap;\n text-transform: none;\n position: relative;\n transition: opacity 0.2s ease-in-out;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"], ["\n cursor: pointer;\n user-select: none;\n font-weight: 600;\n line-height: normal;\n text-align: center;\n white-space: nowrap;\n text-transform: none;\n position: relative;\n transition: opacity 0.2s ease-in-out;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), function (_a) {
|
|
11
|
+
var _b;
|
|
12
|
+
var $size = _a.$size;
|
|
13
|
+
var safeSize = $size !== null && $size !== void 0 ? $size : DEFAULT_SIZE;
|
|
14
|
+
return "padding: ".concat(((_b = CSS_SIZE_PROPERTIES[safeSize]) !== null && _b !== void 0 ? _b : CSS_SIZE_PROPERTIES[DEFAULT_SIZE]).padding, ";");
|
|
15
|
+
}, function (_a) {
|
|
16
|
+
var $color = _a.$color, $variant = _a.$variant;
|
|
17
|
+
var safeColor = $color || DEFAULT_COLOR;
|
|
18
|
+
var safeVariant = $variant || DEFAULT_VARIANT;
|
|
19
|
+
var _b = CSS_COLOR_PROPERTIES[safeVariant][safeColor], contentColor = _b.color, iconColor = _b.iconColor, background = _b.background, border = _b.border, hoverColor = _b.hoverColor, hoverBackground = _b.hoverBackground, hoverBorder = _b.hoverBorder, outline = _b.outline;
|
|
20
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n & span {\n color: ", ";\n }\n ", ";\n ", "\n ", "\n\n &&:hover:not(:has(> [data-is-aux-icon]:hover)),\n &&:active {\n color: ", ";\n ", "\n ", "\n }\n &&:focus {\n border: 1px solid transparent;\n outline: 2px solid ", ";\n }\n "], ["\n & span {\n color: ", ";\n }\n ", ";\n ", "\n ", "\n\n &&:hover:not(:has(> [data-is-aux-icon]:hover)),\n &&:active {\n color: ", ";\n ", "\n ", "\n }\n &&:focus {\n border: 1px solid transparent;\n outline: 2px solid ", ";\n }\n "])), contentColor, iconColor ? "color: ".concat(iconColor) : "color: ".concat(contentColor), background && "background-color: ".concat(background, ";"), border ? "border: 1px solid ".concat(border, ";") : 'border: 1px solid transparent;', hoverColor, hoverBackground && "background-color: ".concat(hoverBackground, ";"), hoverBorder ? "border: 1px solid ".concat(hoverBorder, ";") : 'border: 1px solid transparent;', outline);
|
|
21
|
+
}, function (_a) {
|
|
22
|
+
var $variant = _a.$variant;
|
|
23
|
+
return $variant === VARIANTS.SUBTLE &&
|
|
24
|
+
"\n text-decoration: underline;\n ";
|
|
25
|
+
}, function (_a) {
|
|
26
|
+
var disabled = _a.disabled;
|
|
27
|
+
if (!disabled)
|
|
28
|
+
return null;
|
|
29
|
+
var color = CSS_COLOR_PROPERTIES_DISABLED.color, background = CSS_COLOR_PROPERTIES_DISABLED.background, border = CSS_COLOR_PROPERTIES_DISABLED.border, outline = CSS_COLOR_PROPERTIES_DISABLED.outline;
|
|
30
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n pointer-events: none;\n cursor: not-allowed;\n & span {\n color: ", ";\n }\n color: ", ";\n ", ";\n border: ", ";\n\n &&:hover,\n &&:active {\n color: ", ";\n ", ";\n border: ", ";\n }\n \n &&:focus {\n outline: 2px solid ", ";\n }\n "], ["\n pointer-events: none;\n cursor: not-allowed;\n & span {\n color: ", ";\n }\n color: ", ";\n ", ";\n border: ", ";\n\n &&:hover,\n &&:active {\n color: ", ";\n ", ";\n border: ", ";\n }\n \n &&:focus {\n outline: 2px solid ", ";\n }\n "])), color, color, background ? "background-color: ".concat(background) : "background-color: none", border ? "1px solid ".concat(border) : 'none', color, background ? "background-color: ".concat(background) : "background-color: none", border ? "1px solid ".concat(border) : 'none', outline);
|
|
31
|
+
});
|
|
32
|
+
var stackedLayoutStyles = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 4.5rem;\n height: 4.5rem;\n border-radius: ", " !important;\n border: 1px solid ", " !important;\n padding: ", " !important;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"], ["\n width: 4.5rem;\n height: 4.5rem;\n border-radius: ", " !important;\n border: 1px solid ", " !important;\n padding: ", " !important;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])), borderRadiusDefault, colorBorderDefault, spacingSmall);
|
|
33
|
+
var circleLayoutStyles = css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-radius: 50%;\n width: 3rem;\n height: 3rem;\n aspect-ratio: 1;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n"], ["\n border-radius: 50%;\n width: 3rem;\n height: 3rem;\n aspect-ratio: 1;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n"])));
|
|
34
|
+
var defaultLayoutStyles = css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n gap: ", ";\n border-radius: ", ";\n"], ["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n gap: ", ";\n border-radius: ", ";\n"])), spacingSmall, borderRadiusDefault);
|
|
35
|
+
export var ButtonWrapper = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
36
|
+
var $layout = _a.$layout;
|
|
37
|
+
return $layout === LAYOUTS.STACKED && "\n width: 5rem;\n display: flex;\n flex-direction: column;\n gap: ".concat(spacingSmall, ";\n align-items: center;\n ");
|
|
38
|
+
});
|
|
39
|
+
export var Button = styled.button(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", "\n\n ", "\n"], ["\n ", "\n\n ", "\n"])), commonButtonStyles, function (_a) {
|
|
40
|
+
var $layout = _a.$layout;
|
|
41
|
+
switch ($layout) {
|
|
42
|
+
case LAYOUTS.STACKED:
|
|
43
|
+
return stackedLayoutStyles;
|
|
44
|
+
case LAYOUTS.CIRCLE:
|
|
45
|
+
return circleLayoutStyles;
|
|
46
|
+
default:
|
|
47
|
+
return defaultLayoutStyles;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export var HelperIconContainer = styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n ", "\n border-radius: 50%;\n padding: 0.2rem;\n position: absolute;\n top: 0.1rem;\n right: 0.1rem;\n & svg {\n font-size: 1.25rem;\n }\n"], ["\n ", "\n border-radius: 50%;\n padding: 0.2rem;\n position: absolute;\n top: 0.1rem;\n right: 0.1rem;\n & svg {\n font-size: 1.25rem;\n }\n"])), function (_a) {
|
|
51
|
+
var $hover = _a.$hover, $variant = _a.$variant, $color = _a.$color;
|
|
52
|
+
if (!$hover)
|
|
53
|
+
return null;
|
|
54
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n &&:hover,\n &&:active {\n ", "\n }\n\n &&:focus {\n outline: 1px solid ", ";\n }\n "], ["\n &&:hover,\n &&:active {\n ", "\n }\n\n &&:focus {\n outline: 1px solid ", ";\n }\n "])), CSS_COLOR_PROPERTIES[$variant][$color].hoverBackground &&
|
|
55
|
+
"background-color: ".concat(CSS_COLOR_PROPERTIES[$variant][$color].hoverBackground, ";"), CSS_COLOR_PROPERTIES[$variant][$color].outline);
|
|
56
|
+
});
|
|
57
|
+
export var HelperIcon = styled.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
|
|
58
|
+
export var IconWrapper = styled.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n\n > i {\n font-size: 2rem;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n\n > i {\n font-size: 2rem;\n }\n"])));
|
|
59
|
+
export var ButtonText = styled.div(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n width: 100%;\n text-align: center;\n line-height: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n"], ["\n color: ", ";\n font-size: ", ";\n width: 100%;\n text-align: center;\n line-height: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n"])), colorTextDefault, fontSizeSmall);
|
|
60
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React, { useId } from 'react';
|
|
24
|
+
import * as Styled from './styles';
|
|
25
|
+
import { DEFAULT_LAYOUT, LAYOUTS } from './constants';
|
|
26
|
+
import { RadioButtonUnchecked, RadioButtonChecked } from '@mui/icons-material';
|
|
27
|
+
/**
|
|
28
|
+
* A customizable Checkbox component.
|
|
29
|
+
*
|
|
30
|
+
* This component provides a wrapper around the Material-UI Checkbox with additional features,
|
|
31
|
+
* such as custom layouts and a round variant. It can be used with a label,
|
|
32
|
+
* and clicking the label will toggle the checkbox state.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
function Checkbox(_a) {
|
|
36
|
+
var label = _a.label, _b = _a.layout, layout = _b === void 0 ? DEFAULT_LAYOUT : _b, _c = _a.round, round = _c === void 0 ? false : _c, ariaLabel = _a.ariaLabel, props = __rest(_a, ["label", "layout", "round", "ariaLabel"]);
|
|
37
|
+
var id = useId();
|
|
38
|
+
var checkbox = (React.createElement(Styled.StyledCheckbox, __assign({}, props, { id: id, "aria-label": ariaLabel, icon: round ? React.createElement(RadioButtonUnchecked, null) : undefined, checkedIcon: round ? React.createElement(RadioButtonChecked, null) : undefined })));
|
|
39
|
+
if (!label) {
|
|
40
|
+
return checkbox;
|
|
41
|
+
}
|
|
42
|
+
return (React.createElement(Styled.Container, null,
|
|
43
|
+
layout === LAYOUTS.LEFT && React.createElement(Styled.Label, { htmlFor: id }, label),
|
|
44
|
+
checkbox,
|
|
45
|
+
layout === LAYOUTS.RIGHT && React.createElement(Styled.Label, { htmlFor: id }, label)));
|
|
46
|
+
}
|
|
47
|
+
export default Checkbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBCheckbox } from './component';
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
import styled from 'styled-components';
|
|
6
|
+
import { Checkbox as MuiCheckbox } from '@mui/material';
|
|
7
|
+
import { colorTextDefault, colorBrand1 } from '../../stylesheets/pallete';
|
|
8
|
+
import { fontSizeDefault } from '../../stylesheets/typography';
|
|
9
|
+
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Styled from './styles';
|
|
3
|
+
/**
|
|
4
|
+
* A customizable divider used to separate content areas.
|
|
5
|
+
*
|
|
6
|
+
* This component provides a styled divider that supports horizontal/vertical orientation and spacing via styles.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
function Divider() {
|
|
10
|
+
return (React.createElement(Styled.Divider, null));
|
|
11
|
+
}
|
|
12
|
+
export default Divider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBDivider } from './component';
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
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;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import * as Styled from './styles';
|
|
25
|
+
import { MdClose, MdInfo } from 'react-icons/md';
|
|
26
|
+
/**
|
|
27
|
+
* A customizable hint component for displaying informational messages.
|
|
28
|
+
*
|
|
29
|
+
* This component provides a small contextual hint used to surface tips, short help text or dismissible messages.
|
|
30
|
+
* It can be displayed with a title, an icon, and a close button.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
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,
|
|
36
|
+
label,
|
|
37
|
+
children);
|
|
38
|
+
return (React.createElement(Styled.Container, __assign({ role: "status", "aria-live": "polite", "aria-atomic": "true", "aria-label": title || label }, rest),
|
|
39
|
+
React.createElement(Styled.Header, null,
|
|
40
|
+
React.createElement(Styled.IconTextWrapper, null,
|
|
41
|
+
React.createElement(Styled.IconWrapper, { "aria-hidden": "true" }, icon),
|
|
42
|
+
title && React.createElement(Styled.Title, null, title),
|
|
43
|
+
!title && renderedLabel),
|
|
44
|
+
title && (React.createElement(Styled.CloseButton, { type: "button", "aria-label": "Close", onClick: onRequestClose },
|
|
45
|
+
React.createElement(MdClose, { fontSize: "1rem" })))),
|
|
46
|
+
title && renderedLabel));
|
|
47
|
+
}
|
|
48
|
+
export default Hint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBHint } from './component';
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import styled from 'styled-components';
|
|
6
|
+
import { colorTextDefault, colorBrand1, colorBackgroundLight, colorIconDefault, colorHoverLight } from '../../stylesheets/pallete';
|
|
7
|
+
import { fontSizeDefault } from '../../stylesheets/typography';
|
|
8
|
+
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React, { useCallback } from 'react';
|
|
24
|
+
import ReactModal from 'react-modal';
|
|
25
|
+
import * as Styled from './styles';
|
|
26
|
+
import { BBBTypography } from '../Typography';
|
|
27
|
+
import { MdClose } from 'react-icons/md';
|
|
28
|
+
import { BBBDivider } from '../Divider';
|
|
29
|
+
import { BBButton } from '../Button';
|
|
30
|
+
/**
|
|
31
|
+
* A versatile BBBModal component
|
|
32
|
+
*
|
|
33
|
+
* This component provides a customizable modal with optional title, body, and footer.
|
|
34
|
+
* It supports accessibility, dividers, scrollable body, and sticky footer.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
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;
|
|
40
|
+
if (testId && !closeButtonDataTest) {
|
|
41
|
+
_closeButtonDataTest = "".concat(testId, "-close-button");
|
|
42
|
+
}
|
|
43
|
+
var renderFooter = useCallback(function (isSticky) { return (React.createElement(React.Fragment, null,
|
|
44
|
+
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 }),
|
|
47
|
+
React.createElement(Styled.ModalHeader, null,
|
|
48
|
+
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 } : {})))),
|
|
50
|
+
showDividers && React.createElement(BBBDivider, null),
|
|
51
|
+
React.createElement(Styled.ModalScrollArea, { "$allowScroll": allowScroll },
|
|
52
|
+
React.createElement(Styled.ModalBodyContent, null, children),
|
|
53
|
+
!noFooter && !stickyFooter && renderFooter(stickyFooter)),
|
|
54
|
+
!noFooter && stickyFooter && renderFooter(stickyFooter)));
|
|
55
|
+
};
|
|
56
|
+
export default Modal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBModal } from './component';
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
import styled from 'styled-components';
|
|
6
|
+
import { spacingLarge, spacingMedium, spacingSmallMedium, borderRadiusDefault } from '../../stylesheets/sizing';
|
|
7
|
+
import { colorWhite } from '../../stylesheets/pallete';
|
|
8
|
+
export var modalStyles = {
|
|
9
|
+
overlay: {
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
top: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
right: 0,
|
|
14
|
+
bottom: 0,
|
|
15
|
+
backgroundColor: 'rgba(0, 0, 0, 0.75)',
|
|
16
|
+
zIndex: 100,
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
},
|
|
21
|
+
content: {
|
|
22
|
+
position: 'relative',
|
|
23
|
+
top: 'auto',
|
|
24
|
+
left: 'auto',
|
|
25
|
+
right: 'auto',
|
|
26
|
+
bottom: 'auto',
|
|
27
|
+
borderRadius: borderRadiusDefault,
|
|
28
|
+
background: colorWhite,
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
WebkitOverflowScrolling: 'touch',
|
|
31
|
+
outline: 'none',
|
|
32
|
+
padding: '0px',
|
|
33
|
+
minWidth: '300px',
|
|
34
|
+
maxWidth: '90vw',
|
|
35
|
+
maxHeight: '90vh',
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Styled from './styles';
|
|
3
|
+
import { MdExpandCircleDown } from 'react-icons/md';
|
|
4
|
+
import { BBBTypography } from '../Typography';
|
|
5
|
+
/**
|
|
6
|
+
* A customizable Navigation component that acts as a button with an icon and a label.
|
|
7
|
+
* It can be used for navigation actions within an application.
|
|
8
|
+
*
|
|
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" });
|
|
14
|
+
return (React.createElement(Styled.NavigationButton, { onClick: onClick, onKeyDown: onKeyDown, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "data-test": dataTest },
|
|
15
|
+
React.createElement(Styled.IconTextWrapper, null,
|
|
16
|
+
React.createElement(Styled.IconWrapper, { "$isCustomIcon": isCustomIcon }, iconToRender),
|
|
17
|
+
React.createElement(BBBTypography, { variant: "default" }, label)),
|
|
18
|
+
children));
|
|
19
|
+
}
|
|
20
|
+
export default Navigation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBNavigation } from './component';
|
|
@@ -0,0 +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
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import BBBSpinner from '../Spinner/component';
|
|
3
|
+
import * as Styled from './styles';
|
|
4
|
+
/**
|
|
5
|
+
* Search input with debounce, clear action, and optional loading state.
|
|
6
|
+
* It supports both uncontrolled usage and controlled mode via `value` + `onChange`.
|
|
7
|
+
*/
|
|
8
|
+
function BBBSearch(_a) {
|
|
9
|
+
var _b;
|
|
10
|
+
var placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, onSearch = _a.onSearch, onClear = _a.onClear, _c = _a.debounce, debounce = _c === void 0 ? 500 : _c, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, inputRef = _a.inputRef, ariaLabel = _a["aria-label"];
|
|
11
|
+
var isControlled = value !== undefined;
|
|
12
|
+
var _g = useState(''), internalValue = _g[0], setInternalValue = _g[1];
|
|
13
|
+
var localInputRef = useRef(null);
|
|
14
|
+
var resolvedRef = (_b = inputRef) !== null && _b !== void 0 ? _b : localInputRef;
|
|
15
|
+
var currentValue = isControlled ? (value !== null && value !== void 0 ? value : '') : internalValue;
|
|
16
|
+
var hasValue = currentValue.length > 0;
|
|
17
|
+
// Debounced onSearch (uncontrolled mode)
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
if (isControlled || !onSearch)
|
|
20
|
+
return;
|
|
21
|
+
var timeoutId = setTimeout(function () {
|
|
22
|
+
onSearch(internalValue);
|
|
23
|
+
}, debounce);
|
|
24
|
+
return function () { return clearTimeout(timeoutId); };
|
|
25
|
+
}, [internalValue, debounce, onSearch, isControlled]);
|
|
26
|
+
// Handle autoFocus on mount
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (autoFocus && resolvedRef.current) {
|
|
29
|
+
resolvedRef.current.focus();
|
|
30
|
+
}
|
|
31
|
+
}, [autoFocus, resolvedRef]);
|
|
32
|
+
var handleChange = useCallback(function (e) {
|
|
33
|
+
var next = e.target.value;
|
|
34
|
+
if (isControlled) {
|
|
35
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
setInternalValue(next);
|
|
39
|
+
}
|
|
40
|
+
}, [isControlled, onChange]);
|
|
41
|
+
var handleClear = useCallback(function () {
|
|
42
|
+
var _a;
|
|
43
|
+
if (onClear) {
|
|
44
|
+
onClear();
|
|
45
|
+
}
|
|
46
|
+
else if (isControlled) {
|
|
47
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Clear is immune to debounce — fire onSearch immediately
|
|
51
|
+
setInternalValue('');
|
|
52
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch('');
|
|
53
|
+
}
|
|
54
|
+
(_a = resolvedRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
55
|
+
}, [onClear, isControlled, onChange, onSearch, resolvedRef]);
|
|
56
|
+
var handleContainerClick = useCallback(function (e) {
|
|
57
|
+
var _a;
|
|
58
|
+
if (e.target === e.currentTarget) {
|
|
59
|
+
(_a = resolvedRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
60
|
+
}
|
|
61
|
+
}, [resolvedRef]);
|
|
62
|
+
return (React.createElement(Styled.Container, { "$disabled": disabled, onClick: handleContainerClick },
|
|
63
|
+
React.createElement(Styled.SearchIconWrapper, { "aria-hidden": "true" },
|
|
64
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", focusable: "false" },
|
|
65
|
+
React.createElement("circle", { cx: "11", cy: "11", r: "8" }),
|
|
66
|
+
React.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }))),
|
|
67
|
+
React.createElement(Styled.StyledInput, { ref: resolvedRef, type: "search", role: "searchbox", placeholder: placeholder, value: currentValue, onChange: handleChange, disabled: disabled, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : placeholder }),
|
|
68
|
+
isLoading && hasValue && (React.createElement(Styled.ActionWrapper, null,
|
|
69
|
+
React.createElement(BBBSpinner, { size: 16, strokeWidth: 3 }))),
|
|
70
|
+
!isLoading && hasValue && (React.createElement(Styled.ClearButton, { type: "button", onClick: handleClear, "aria-label": "Clear search", tabIndex: 0 },
|
|
71
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", focusable: "false", "aria-hidden": "true" },
|
|
72
|
+
React.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
73
|
+
React.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))))));
|
|
74
|
+
}
|
|
75
|
+
export default BBBSearch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBSearch } from './component';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import { colorBorderDefault, colorBorderSelected, colorTextDefault, colorTextLight, colorIconDefault, colorIconBlue, colorBrand1, } from '../../stylesheets/pallete';
|
|
7
|
+
import { spacingSmall, spacingMedium, borderRadiusDefault, } from '../../stylesheets/sizing';
|
|
8
|
+
import { fontSizeSmall } from '../../stylesheets/typography';
|
|
9
|
+
export var Container = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n height: 2.5rem;\n padding: ", " ", ";\n gap: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background-color: transparent;\n box-sizing: border-box;\n cursor: text;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n\n &:focus-within {\n border-color: ", ";\n box-shadow: 0 0 0 3px var(--color-border-focus-ring, rgba(29, 101, 212, 0.15));\n }\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n height: 2.5rem;\n padding: ", " ", ";\n gap: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background-color: transparent;\n box-sizing: border-box;\n cursor: text;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n\n &:focus-within {\n border-color: ", ";\n box-shadow: 0 0 0 3px var(--color-border-focus-ring, rgba(29, 101, 212, 0.15));\n }\n\n ", "\n"])), spacingSmall, spacingMedium, spacingSmall, borderRadiusDefault, colorBorderDefault, colorBorderSelected, function (_a) {
|
|
10
|
+
var $disabled = _a.$disabled;
|
|
11
|
+
return $disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n "], ["\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n "])));
|
|
12
|
+
});
|
|
13
|
+
export var SearchIconWrapper = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: ", ";\n width: 1rem;\n height: 1rem;\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: ", ";\n width: 1rem;\n height: 1rem;\n"])), colorIconDefault);
|
|
14
|
+
export var StyledInput = styled.input(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex: 1;\n min-width: 0;\n border: none;\n outline: none;\n background: transparent;\n color: ", ";\n font-size: ", ";\n line-height: 1.5;\n padding: 0;\n\n &::placeholder {\n color: ", ";\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n display: none;\n }\n\n [dir='rtl'] & {\n text-align: right;\n }\n"], ["\n flex: 1;\n min-width: 0;\n border: none;\n outline: none;\n background: transparent;\n color: ", ";\n font-size: ", ";\n line-height: 1.5;\n padding: 0;\n\n &::placeholder {\n color: ", ";\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n display: none;\n }\n\n [dir='rtl'] & {\n text-align: right;\n }\n"])), colorTextDefault, fontSizeSmall, colorTextLight);
|
|
15
|
+
export var ActionWrapper = styled.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 1rem;\n height: 1rem;\n color: ", ";\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 1rem;\n height: 1rem;\n color: ", ";\n"])), colorBrand1);
|
|
16
|
+
export var ClearButton = styled.button(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n width: 1rem;\n height: 1rem;\n color: ", ";\n line-height: 1;\n transition: color 0.1s ease;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n border-radius: 2px;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n width: 1rem;\n height: 1rem;\n color: ", ";\n line-height: 1;\n transition: color 0.1s ease;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n border-radius: 2px;\n }\n"])), colorIconDefault, colorIconBlue, colorBorderSelected);
|
|
17
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React, { useId } from 'react';
|
|
24
|
+
import { MdExpandMore } from 'react-icons/md';
|
|
25
|
+
import * as Styled from './styles';
|
|
26
|
+
/**
|
|
27
|
+
* A customizable Select component.
|
|
28
|
+
*
|
|
29
|
+
* This component provides a styled wrapper around the Material-UI Select and additional styling,
|
|
30
|
+
* such as a title and an optional icon.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
function Select(_a) {
|
|
34
|
+
var _b = _a.title, title = _b === void 0 ? null : _b, _c = _a.icon, icon = _c === void 0 ? null : _c, children = _a.children, ariaLabel = _a.ariaLabel, props = __rest(_a, ["title", "icon", "children", "ariaLabel"]);
|
|
35
|
+
var id = useId();
|
|
36
|
+
var selectId = "select-".concat(id);
|
|
37
|
+
var labelId = title ? "select-label-".concat(id) : undefined;
|
|
38
|
+
return (React.createElement(Styled.SelectContainer, null,
|
|
39
|
+
title && React.createElement(Styled.Title, { id: labelId, htmlFor: selectId }, title),
|
|
40
|
+
React.createElement(Styled.SelectWrapper, null,
|
|
41
|
+
icon && (React.createElement(Styled.SelectorIcon, null, icon)),
|
|
42
|
+
React.createElement(Styled.Selector, __assign({}, props, { id: selectId, labelId: labelId, "aria-label": ariaLabel, IconComponent: MdExpandMore }), children))));
|
|
43
|
+
}
|
|
44
|
+
export default Select;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BBBSelect } from './component';
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
import styled from 'styled-components';
|
|
6
|
+
import { borderRadiusSmall, spacingMedium, spacingSmall } from '../../stylesheets/sizing';
|
|
7
|
+
import Select from '@mui/material/Select';
|
|
8
|
+
import { colorBorderDefault, colorBrand1, colorDarkGray } from '../../stylesheets/pallete';
|
|
9
|
+
import { fontSizeSmall } from '../../stylesheets/typography';
|
|
10
|
+
export var SelectContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n gap: ", ";\n justify-content: start;\n align-items: center;\n"], ["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n gap: ", ";\n justify-content: start;\n align-items: center;\n"])), spacingSmall);
|
|
11
|
+
export var SelectWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: ", "; \n padding: 1px;\n width: 100%;\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: ", "; \n padding: 1px;\n width: 100%;\n"])), spacingMedium);
|
|
12
|
+
export var Selector = styled(Select)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 3.5rem;\n flex: 1;\n border-radius: ", " !important;\n overflow: hidden;\n width: 100%;\n border: 1px solid ", ";\n"], ["\n height: 3.5rem;\n flex: 1;\n border-radius: ", " !important;\n overflow: hidden;\n width: 100%;\n border: 1px solid ", ";\n"])), borderRadiusSmall, colorBorderDefault);
|
|
13
|
+
export var Title = styled.label(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-self: flex-start;\n color: ", ";\n font-size: ", ";\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n"], ["\n align-self: flex-start;\n color: ", ";\n font-size: ", ";\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n"])), colorDarkGray, fontSizeSmall);
|
|
14
|
+
export var SelectorIcon = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: ", ";\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: ", ";\n"])), colorBrand1);
|
|
15
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|