@bigbluebutton/bbb-ui-components-react 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/dist/components/Accordion.js +53 -1
- package/dist/components/Button.js +144 -1
- package/dist/components/Checkbox.js +20 -1
- package/dist/components/Divider.js +9 -1
- package/dist/components/Hint.js +51 -1
- package/dist/components/Input.js +220 -0
- package/dist/components/Modal.js +222 -1
- package/dist/components/Navigation.js +74 -1
- package/dist/components/Search.js +130 -1
- package/dist/components/Select.js +46 -1
- package/dist/components/Spinner.js +34 -1
- package/dist/components/TextAreaInput.js +23 -1
- package/dist/components/TextInput.js +52 -1
- package/dist/components/Toggle.js +42 -1
- package/dist/components/Typography.js +42 -1
- package/dist/components/index.js +739 -1
- package/dist/esm/components/Accordion/component.js +6 -7
- package/dist/esm/components/Accordion/constants.js +3 -3
- package/dist/esm/components/Accordion/styles.js +58 -17
- package/dist/esm/components/Button/component.js +52 -35
- package/dist/esm/components/Button/constants.js +21 -20
- package/dist/esm/components/Button/styles.js +187 -45
- package/dist/esm/components/Checkbox/component.js +3 -14
- package/dist/esm/components/Checkbox/constants.js +3 -3
- package/dist/esm/components/Checkbox/styles.js +23 -9
- package/dist/esm/components/Divider/styles.js +10 -7
- package/dist/esm/components/Hint/component.js +3 -14
- package/dist/esm/components/Hint/constants.js +3 -3
- package/dist/esm/components/Hint/styles.js +58 -13
- package/dist/esm/components/Input/component.js +111 -0
- package/dist/esm/components/Input/index.js +1 -0
- package/dist/esm/components/Input/styles.js +89 -0
- package/dist/esm/components/Input/types.js +1 -0
- package/dist/esm/components/Modal/component.js +8 -19
- package/dist/esm/components/Modal/styles.js +41 -19
- package/dist/esm/components/Navigation/component.js +3 -4
- package/dist/esm/components/Navigation/styles.js +36 -12
- package/dist/esm/components/Search/component.js +16 -17
- package/dist/esm/components/Search/styles.js +103 -14
- package/dist/esm/components/Select/component.js +5 -16
- package/dist/esm/components/Select/styles.js +51 -11
- package/dist/esm/components/Spinner/component.js +1 -2
- package/dist/esm/components/Spinner/styles.js +39 -29
- package/dist/esm/components/TextAreaInput/component.js +4 -15
- package/dist/esm/components/TextAreaInput/styles.js +24 -7
- package/dist/esm/components/TextInput/component.js +2 -13
- package/dist/esm/components/TextInput/styles.js +58 -16
- package/dist/esm/components/Toggle/component.js +6 -17
- package/dist/esm/components/Toggle/constants.js +3 -3
- package/dist/esm/components/Toggle/styles.js +88 -72
- package/dist/esm/components/Typography/component.js +3 -14
- package/dist/esm/components/Typography/constants.js +1 -1
- package/dist/esm/components/Typography/styles.js +50 -17
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/stylesheets/palette.js +49 -0
- package/dist/esm/stylesheets/sizing.js +9 -9
- package/dist/esm/stylesheets/typography.js +7 -7
- package/dist/types/components/Accordion/types.d.ts +8 -0
- package/dist/types/components/Button/constants.d.ts +3 -2
- package/dist/types/components/Button/styles.d.ts +1 -0
- package/dist/types/components/Button/type.d.ts +42 -1
- package/dist/types/components/Checkbox/types.d.ts +4 -0
- package/dist/types/components/Hint/types.d.ts +5 -0
- package/dist/types/components/Input/component.d.ts +12 -0
- package/dist/types/components/Input/index.d.ts +1 -0
- package/dist/types/components/Input/styles.d.ts +6 -0
- package/dist/types/components/Input/types.d.ts +69 -0
- package/dist/types/components/Modal/types.d.ts +11 -0
- package/dist/types/components/Navigation/types.d.ts +9 -0
- package/dist/types/components/Search/types.d.ts +6 -24
- package/dist/types/components/Select/types.d.ts +4 -0
- package/dist/types/components/Spinner/types.d.ts +3 -0
- package/dist/types/components/TextAreaInput/types.d.ts +7 -0
- package/dist/types/components/TextInput/types.d.ts +3 -0
- package/dist/types/components/Toggle/types.d.ts +6 -0
- package/dist/types/components/Typography/types.d.ts +3 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/stylesheets/{pallete.d.ts → palette.d.ts} +9 -9
- package/package.json +15 -2
- package/dist/esm/stylesheets/pallete.js +0 -46
|
@@ -1,17 +1,106 @@
|
|
|
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
|
-
import { colorBorderDefault, colorBorderSelected, colorTextDefault, colorTextLight, colorIconDefault, colorIconBlue, colorBrand1, } from '../../stylesheets/
|
|
2
|
+
import { colorBorderDefault, colorBorderSelected, colorTextDefault, colorTextLight, colorIconDefault, colorIconBlue, colorBrand1, } from '../../stylesheets/palette';
|
|
7
3
|
import { spacingSmall, spacingMedium, borderRadiusDefault, } from '../../stylesheets/sizing';
|
|
8
4
|
import { fontSizeSmall } from '../../stylesheets/typography';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
export const Container = styled.div `
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 2.5rem;
|
|
11
|
+
padding: ${spacingSmall} ${spacingMedium};
|
|
12
|
+
gap: ${spacingSmall};
|
|
13
|
+
border-radius: ${borderRadiusDefault};
|
|
14
|
+
border: 1px solid ${colorBorderDefault};
|
|
15
|
+
background-color: transparent;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
cursor: text;
|
|
18
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
19
|
+
|
|
20
|
+
&:focus-within {
|
|
21
|
+
border-color: ${colorBorderSelected};
|
|
22
|
+
box-shadow: 0 0 0 3px var(--color-border-focus-ring, rgba(29, 101, 212, 0.15));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${({ $disabled }) => $disabled &&
|
|
26
|
+
css `
|
|
27
|
+
opacity: 0.5;
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
`}
|
|
31
|
+
`;
|
|
32
|
+
export const SearchIconWrapper = styled.span `
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
color: ${colorIconDefault};
|
|
38
|
+
width: 1rem;
|
|
39
|
+
height: 1rem;
|
|
40
|
+
`;
|
|
41
|
+
export const StyledInput = styled.input `
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
border: none;
|
|
45
|
+
outline: none;
|
|
46
|
+
background: transparent;
|
|
47
|
+
color: ${colorTextDefault};
|
|
48
|
+
font-size: ${fontSizeSmall};
|
|
49
|
+
line-height: 1.5;
|
|
50
|
+
padding: 0;
|
|
51
|
+
|
|
52
|
+
&::placeholder {
|
|
53
|
+
color: ${colorTextLight};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:disabled {
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&::-webkit-search-decoration,
|
|
61
|
+
&::-webkit-search-cancel-button,
|
|
62
|
+
&::-webkit-search-results-button,
|
|
63
|
+
&::-webkit-search-results-decoration {
|
|
64
|
+
-webkit-appearance: none;
|
|
65
|
+
appearance: none;
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
[dir='rtl'] & {
|
|
70
|
+
text-align: right;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
export const ActionWrapper = styled.span `
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
width: 1rem;
|
|
79
|
+
height: 1rem;
|
|
80
|
+
color: ${colorBrand1};
|
|
81
|
+
`;
|
|
82
|
+
export const ClearButton = styled.button `
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
background: transparent;
|
|
88
|
+
border: none;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
padding: 0;
|
|
91
|
+
width: 1rem;
|
|
92
|
+
height: 1rem;
|
|
93
|
+
color: ${colorIconDefault};
|
|
94
|
+
line-height: 1;
|
|
95
|
+
transition: color 0.1s ease;
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
color: ${colorIconBlue};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&:focus-visible {
|
|
102
|
+
outline: 2px solid ${colorBorderSelected};
|
|
103
|
+
outline-offset: 2px;
|
|
104
|
+
border-radius: 2px;
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
@@ -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)
|
|
@@ -31,14 +20,14 @@ import * as Styled from './styles';
|
|
|
31
20
|
*
|
|
32
21
|
*/
|
|
33
22
|
function Select(_a) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
var { title = null, icon = null, children, ariaLabel } = _a, props = __rest(_a, ["title", "icon", "children", "ariaLabel"]);
|
|
24
|
+
const id = useId();
|
|
25
|
+
const selectId = `select-${id}`;
|
|
26
|
+
const labelId = title ? `select-label-${id}` : undefined;
|
|
38
27
|
return (React.createElement(Styled.SelectContainer, null,
|
|
39
28
|
title && React.createElement(Styled.Title, { id: labelId, htmlFor: selectId }, title),
|
|
40
29
|
React.createElement(Styled.SelectWrapper, null,
|
|
41
30
|
icon && (React.createElement(Styled.SelectorIcon, null, icon)),
|
|
42
|
-
React.createElement(Styled.Selector,
|
|
31
|
+
React.createElement(Styled.Selector, Object.assign({}, props, { id: selectId, labelId: labelId, "aria-label": ariaLabel, IconComponent: MdExpandMore }), children))));
|
|
43
32
|
}
|
|
44
33
|
export default Select;
|
|
@@ -1,15 +1,55 @@
|
|
|
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 { borderRadiusSmall, spacingMedium, spacingSmall } from '../../stylesheets/sizing';
|
|
7
3
|
import Select from '@mui/material/Select';
|
|
8
|
-
import { colorBorderDefault, colorBrand1, colorDarkGray } from '../../stylesheets/
|
|
4
|
+
import { colorBorderDefault, colorBorderSelected, colorBrand1, colorDarkGray } from '../../stylesheets/palette';
|
|
9
5
|
import { fontSizeSmall } from '../../stylesheets/typography';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
export const SelectContainer = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
gap: ${spacingSmall};
|
|
11
|
+
justify-content: start;
|
|
12
|
+
align-items: center;
|
|
13
|
+
`;
|
|
14
|
+
export const SelectWrapper = styled.div `
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
gap: ${spacingMedium};
|
|
19
|
+
padding: 1px;
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
22
|
+
export const Selector = styled(Select) `
|
|
23
|
+
height: 3.5rem;
|
|
24
|
+
flex: 1;
|
|
25
|
+
border-radius: ${borderRadiusSmall} !important;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
width: 100%;
|
|
28
|
+
|
|
29
|
+
& .MuiOutlinedInput-notchedOutline {
|
|
30
|
+
border-color: ${colorBorderDefault};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:hover .MuiOutlinedInput-notchedOutline {
|
|
34
|
+
border-color: ${colorBorderSelected};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.Mui-focused .MuiOutlinedInput-notchedOutline {
|
|
38
|
+
border-color: ${colorBorderSelected};
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
export const Title = styled.label `
|
|
42
|
+
align-self: flex-start;
|
|
43
|
+
color: ${colorDarkGray};
|
|
44
|
+
font-size: ${fontSizeSmall};
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
line-height: normal;
|
|
48
|
+
`;
|
|
49
|
+
export const SelectorIcon = styled.div `
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
color: ${colorBrand1};
|
|
55
|
+
`;
|
|
@@ -6,8 +6,7 @@ import * as Styled from './styles';
|
|
|
6
6
|
* This component provides a small, configurable loading indicator for background activity or loading states.
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
var _b = _a.size, size = _b === void 0 ? 48 : _b, _c = _a.strokeWidth, strokeWidth = _c === void 0 ? 4 : _c, _d = _a.animate, animate = _d === void 0 ? true : _d;
|
|
9
|
+
const Spinner = ({ size = 48, strokeWidth = 4, animate = true, }) => {
|
|
11
10
|
return (React.createElement(Styled.Wrapper, { "$size": size, role: "progressbar", "aria-label": "Loading", "aria-busy": animate },
|
|
12
11
|
React.createElement(Styled.StyledSvg, { viewBox: "0 0 50 50", "$animate": animate, focusable: "false", "aria-hidden": "true" },
|
|
13
12
|
React.createElement(Styled.Path, { className: "path", cx: "25", cy: "25", r: "20", "$animate": animate, "$strokeWidth": strokeWidth }))));
|
|
@@ -1,30 +1,40 @@
|
|
|
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, { keyframes, css } from 'styled-components';
|
|
6
|
-
import { colorBrand1 } from '../../stylesheets/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
2
|
+
import { colorBrand1 } from '../../stylesheets/palette';
|
|
3
|
+
const rotate = keyframes `
|
|
4
|
+
0% { transform: rotate(0deg); }
|
|
5
|
+
100% { transform: rotate(360deg); }
|
|
6
|
+
`;
|
|
7
|
+
const dash = keyframes `
|
|
8
|
+
0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; }
|
|
9
|
+
50% { stroke-dasharray: 100, 200; stroke-dashoffset: -15; }
|
|
10
|
+
100% { stroke-dasharray: 100, 200; stroke-dashoffset: -125; }
|
|
11
|
+
`;
|
|
12
|
+
export const Wrapper = styled.div `
|
|
13
|
+
width: ${({ $size }) => typeof $size === 'number' ? `${$size}px` : $size};
|
|
14
|
+
height: ${({ $size }) => typeof $size === 'number' ? `${$size}px` : $size};
|
|
15
|
+
display: inline-grid;
|
|
16
|
+
place-items: center;
|
|
17
|
+
`;
|
|
18
|
+
export const StyledSvg = styled.svg `
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
transform-origin: center;
|
|
22
|
+
overflow: visible;
|
|
23
|
+
${({ $animate }) => $animate && css `
|
|
24
|
+
animation: ${rotate} 1.4s linear infinite;
|
|
25
|
+
`}
|
|
26
|
+
`;
|
|
27
|
+
export const Path = styled.circle `
|
|
28
|
+
fill: none;
|
|
29
|
+
stroke: ${colorBrand1};
|
|
30
|
+
stroke-width: ${({ $strokeWidth }) => $strokeWidth}px;
|
|
31
|
+
stroke-linecap: round;
|
|
32
|
+
${({ $animate }) => $animate && css `
|
|
33
|
+
animation: ${dash} 1.4s ease-in-out infinite;
|
|
34
|
+
`}
|
|
35
|
+
|
|
36
|
+
${({ $animate }) => !$animate && css `
|
|
37
|
+
stroke-dasharray: 94.2 31.4;
|
|
38
|
+
stroke-dashoffset: 0;
|
|
39
|
+
`}
|
|
40
|
+
`;
|
|
@@ -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)
|
|
@@ -30,14 +19,14 @@ import * as Styled from './styles';
|
|
|
30
19
|
*
|
|
31
20
|
*/
|
|
32
21
|
function TextAreaInput(_a) {
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
useEffect(
|
|
22
|
+
var { placeholder = '', rows = 1, maxLength = 250, autoFocus = true, inputRef = undefined, onChange, onKeyDown } = _a, props = __rest(_a, ["placeholder", "rows", "maxLength", "autoFocus", "inputRef", "onChange", "onKeyDown"]);
|
|
23
|
+
const internalRef = useRef(null);
|
|
24
|
+
useEffect(() => {
|
|
36
25
|
if (autoFocus && internalRef.current) {
|
|
37
26
|
internalRef.current.focus();
|
|
38
27
|
}
|
|
39
28
|
}, [autoFocus]);
|
|
40
|
-
return (React.createElement(Styled.TextAreaInput,
|
|
29
|
+
return (React.createElement(Styled.TextAreaInput, Object.assign({}, props, { rows: rows, maxLength: maxLength, ref: (ref) => {
|
|
41
30
|
internalRef.current = ref;
|
|
42
31
|
if (typeof inputRef === 'function') {
|
|
43
32
|
inputRef(ref);
|
|
@@ -1,9 +1,26 @@
|
|
|
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, colorBrand1, colorBrand2, colorLightGray, colorWhite } from '../../stylesheets/
|
|
2
|
+
import { colorBorderDefault, colorBrand1, colorBrand2, colorLightGray, colorWhite } from '../../stylesheets/palette';
|
|
7
3
|
import { borderRadiusDefault } from '../../stylesheets/sizing';
|
|
8
|
-
export
|
|
9
|
-
|
|
4
|
+
export const TextAreaInput = styled.textarea `
|
|
5
|
+
flex: 1;
|
|
6
|
+
background: ${colorWhite};
|
|
7
|
+
background-clip: padding-box;
|
|
8
|
+
margin: 0;
|
|
9
|
+
color: ${colorLightGray};
|
|
10
|
+
padding: calc(.3rem* 2.5) calc(.75rem* 1.25);
|
|
11
|
+
resize: none;
|
|
12
|
+
-webkit-transition: none;
|
|
13
|
+
transition: none;
|
|
14
|
+
border-radius: ${borderRadiusDefault};
|
|
15
|
+
font-size: 1rem;
|
|
16
|
+
line-height: 1;
|
|
17
|
+
min-height: 2.5rem;
|
|
18
|
+
max-height: 10rem;
|
|
19
|
+
border: 1px solid ${colorBorderDefault};
|
|
20
|
+
overflow-y: hidden;
|
|
21
|
+
margin: 0.3em;
|
|
22
|
+
&:focus {
|
|
23
|
+
outline: ${colorBrand1} solid 2px;
|
|
24
|
+
box-shadow: 0 0 0 2px ${colorBrand2} inset 0 0 0 1px ${colorBrand1};
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -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)
|
|
@@ -30,10 +19,10 @@ import * as Styled from './styles';
|
|
|
30
19
|
*
|
|
31
20
|
*/
|
|
32
21
|
function TextInput(_a) {
|
|
33
|
-
var
|
|
22
|
+
var { label, helperText, error, placeholder } = _a, props = __rest(_a, ["label", "helperText", "error", "placeholder"]);
|
|
34
23
|
return (React.createElement(Styled.Container, null,
|
|
35
24
|
label && React.createElement(Styled.Label, null, label),
|
|
36
|
-
React.createElement(Styled.StyledTextField,
|
|
25
|
+
React.createElement(Styled.StyledTextField, Object.assign({}, props, { "$error": error, placeholder: placeholder })),
|
|
37
26
|
helperText && React.createElement(Styled.HelperText, { "$error": error }, helperText)));
|
|
38
27
|
}
|
|
39
28
|
export default TextInput;
|
|
@@ -1,20 +1,62 @@
|
|
|
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 { TextField } from '@mui/material';
|
|
7
|
-
import { colorBorderDefault, colorBorderSelected, colorTextDefault, colorTextLight, colorBorderError, colorError, } from '../../stylesheets/
|
|
3
|
+
import { colorBorderDefault, colorBorderSelected, colorTextDefault, colorTextLight, colorBorderError, colorError, } from '../../stylesheets/palette';
|
|
8
4
|
import { fontSizeSmall } from '../../stylesheets/typography';
|
|
9
5
|
import { borderRadiusDefault, spacingMedium, spacingSmall } from '../../stylesheets/sizing';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
export const StyledTextField = styled(TextField) `
|
|
7
|
+
.MuiInputBase-root {
|
|
8
|
+
display: flex;
|
|
9
|
+
padding: ${spacingMedium};
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: ${spacingSmall};
|
|
12
|
+
align-self: stretch;
|
|
13
|
+
border-radius: ${borderRadiusDefault};
|
|
14
|
+
border: 1px solid ${colorBorderDefault};
|
|
15
|
+
color: ${colorTextLight};
|
|
16
|
+
|
|
17
|
+
&.Mui-focused {
|
|
18
|
+
border-color: ${colorBorderSelected};
|
|
19
|
+
color: ${colorTextDefault};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
${({ $error }) => $error &&
|
|
23
|
+
css `
|
|
24
|
+
border-color: ${colorBorderError};
|
|
25
|
+
`}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.MuiInputBase-input {
|
|
29
|
+
padding: 0;
|
|
30
|
+
height: auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.MuiOutlinedInput-notchedOutline {
|
|
34
|
+
border: none;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const Label = styled.div `
|
|
38
|
+
color: ${colorTextDefault};
|
|
39
|
+
font-size: ${fontSizeSmall};
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 400;
|
|
42
|
+
line-height: normal;
|
|
43
|
+
`;
|
|
44
|
+
export const HelperText = styled.div `
|
|
45
|
+
color: ${colorTextDefault};
|
|
46
|
+
font-size: ${fontSizeSmall};
|
|
47
|
+
font-style: normal;
|
|
48
|
+
font-weight: 400;
|
|
49
|
+
line-height: normal;
|
|
50
|
+
padding: 0 ${spacingMedium};
|
|
51
|
+
|
|
52
|
+
${({ $error }) => $error &&
|
|
53
|
+
css `
|
|
54
|
+
color: ${colorError};
|
|
55
|
+
`}
|
|
56
|
+
`;
|
|
57
|
+
export const Container = styled.div `
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
width: 100%;
|
|
61
|
+
gap: ${spacingSmall};
|
|
62
|
+
`;
|
|
@@ -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)
|
|
@@ -31,16 +20,16 @@ import { DEFAULT_TEXT_POSITION } from './constants';
|
|
|
31
20
|
*
|
|
32
21
|
*/
|
|
33
22
|
function Toggle(_a) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
var { label, helperText, textPosition = DEFAULT_TEXT_POSITION, onChange, ariaLabel, ariaLabelledBy, ariaDescribedBy, id: providedId } = _a, rest = __rest(_a, ["label", "helperText", "textPosition", "onChange", "ariaLabel", "ariaLabelledBy", "ariaDescribedBy", "id"]);
|
|
24
|
+
const generatedUniqueId = useId();
|
|
25
|
+
const id = providedId !== null && providedId !== void 0 ? providedId : generatedUniqueId;
|
|
26
|
+
const labelId = label ? `${id}-label` : undefined;
|
|
27
|
+
const helperTextId = helperText ? `${id}-helper` : undefined;
|
|
39
28
|
return (React.createElement(Styled.ToggleWrapper, { "$textPosition": textPosition },
|
|
40
29
|
(label || helperText) && (React.createElement(Styled.TextWrapper, { "$textPosition": textPosition, htmlFor: id, "$hasLabel": !!label, "$hasHelperText": !!helperText },
|
|
41
30
|
label && React.createElement(Styled.Title, { id: labelId }, label),
|
|
42
31
|
helperText && React.createElement(Styled.HelperText, { id: helperTextId }, helperText))),
|
|
43
32
|
React.createElement(Styled.ToggleSwitchWrapper, null,
|
|
44
|
-
React.createElement(Styled.MaterialToggle,
|
|
33
|
+
React.createElement(Styled.MaterialToggle, Object.assign({}, rest, { id: id, onChange: onChange, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : ariaLabelledBy || labelId, "aria-describedby": ariaDescribedBy || helperTextId })))));
|
|
45
34
|
}
|
|
46
35
|
export default Toggle;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const TEXT_POSITIONS = {
|
|
2
2
|
RIGHT: 'right',
|
|
3
3
|
LEFT: 'left',
|
|
4
4
|
TOP: 'top',
|
|
5
5
|
BOTTOM: 'bottom',
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export const TEXT_POSITIONS_VALUES = Object.values(TEXT_POSITIONS);
|
|
8
|
+
export const DEFAULT_TEXT_POSITION = TEXT_POSITIONS_VALUES[0];
|