@balena/ui-shared-components 6.1.2 → 6.1.3
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/dist/components/AnimatedText/index.d.ts +0 -1
- package/dist/components/AnimatedText/index.js +5 -5
- package/dist/components/ButtonWithTracking/index.js +1 -1
- package/dist/components/CollapsedList/index.d.ts +0 -1
- package/dist/components/CollapsedList/index.js +5 -5
- package/dist/components/CollectionSummary/index.js +1 -1
- package/dist/components/CookiesBanner/index.js +1 -1
- package/dist/components/Copy/index.js +7 -7
- package/dist/components/DialogWithCloseButton/index.d.ts +0 -1
- package/dist/components/DialogWithCloseButton/index.js +3 -3
- package/dist/components/DownloadImageDialog/ApplicationInstructions.d.ts +0 -1
- package/dist/components/DownloadImageDialog/ApplicationInstructions.js +6 -6
- package/dist/components/DownloadImageDialog/ImageForm.d.ts +0 -1
- package/dist/components/DownloadImageDialog/ImageForm.js +21 -21
- package/dist/components/DownloadImageDialog/OsTypeSelector.js +5 -5
- package/dist/components/DownloadImageDialog/VariantSelector.d.ts +0 -1
- package/dist/components/DownloadImageDialog/VariantSelector.js +7 -7
- package/dist/components/DownloadImageDialog/index.d.ts +0 -1
- package/dist/components/DownloadImageDialog/index.js +7 -7
- package/dist/components/DropDownButton/index.d.ts +0 -1
- package/dist/components/DropDownButton/index.js +4 -4
- package/dist/components/Form/FieldTemplates/ObjectFieldTemplate.d.ts +2 -2
- package/dist/components/Form/FieldTemplates/ObjectFieldTemplate.js +1 -1
- package/dist/components/Form/Widgets/FileWidget.js +9 -9
- package/dist/components/Form/Widgets/PasswordWidget.js +5 -7
- package/dist/components/Form/Widgets/SelectWidget.js +3 -5
- package/dist/components/Form/index.d.ts +0 -1
- package/dist/components/Form/index.js +2 -2
- package/dist/components/IconButtonWithTracking/index.js +1 -1
- package/dist/components/LimitedRowImages/index.d.ts +0 -1
- package/dist/components/LimitedRowImages/index.js +2 -2
- package/dist/components/MUILinkWithTracking/index.d.ts +0 -1
- package/dist/components/MUILinkWithTracking/index.js +1 -1
- package/dist/components/Map/index.d.ts +0 -1
- package/dist/components/Map/index.js +3 -3
- package/dist/components/Markdown/index.d.ts +0 -1
- package/dist/components/OrderedListItem/index.d.ts +0 -1
- package/dist/components/OrderedListItem/index.js +2 -2
- package/dist/components/RouterLinkWithTracking/index.d.ts +0 -1
- package/dist/components/RouterLinkWithTracking/index.js +1 -1
- package/dist/components/SnackbarProvider/index.js +1 -1
- package/dist/components/Spinner/index.js +7 -7
- package/dist/components/SurroundingOverlay/index.js +2 -2
- package/dist/components/Tabs/index.d.ts +0 -1
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Tooltip/index.d.ts +0 -1
- package/dist/components/Truncate/index.js +2 -2
- package/dist/components/VirtualizedAutocomplete/index.d.ts +3 -1
- package/dist/components/VirtualizedAutocomplete/index.js +4 -4
- package/dist/contexts/AnalyticsContext.d.ts +0 -1
- package/dist/contexts/AnalyticsContext.js +1 -1
- package/dist/docs/utils.d.ts +3 -3
- package/dist/docs/utils.js +3 -3
- package/dist/theme.js +6 -6
- package/package.json +3 -3
|
@@ -31,16 +31,16 @@ export const AnimatedText = ({ words, animationType, animationTimeout = 4000, })
|
|
|
31
31
|
};
|
|
32
32
|
}, [animationTimeout, wordIndex, words.length]);
|
|
33
33
|
if (animationType === 'grow') {
|
|
34
|
-
return (_jsx(Grow,
|
|
34
|
+
return (_jsx(Grow, { in: showSlide, timeout: { enter: 800, exit: 1200 }, children: _jsx(Typography, { variant: "inherit", component: "div", color: "hubYellow.main", children: words[wordIndex] }) }));
|
|
35
35
|
}
|
|
36
36
|
if (animationType === 'zoom') {
|
|
37
|
-
return (_jsx(Zoom,
|
|
37
|
+
return (_jsx(Zoom, { in: showSlide, timeout: { enter: 800, exit: 1200 }, children: _jsx(Typography, { variant: "inherit", component: "div", color: "hubYellow.main", children: words[wordIndex] }) }));
|
|
38
38
|
}
|
|
39
39
|
if (animationType === 'slide') {
|
|
40
|
-
return (_jsx(Slide,
|
|
40
|
+
return (_jsx(Slide, { direction: "down", in: showSlide, timeout: { enter: 800, exit: 1200 }, children: _jsx(Typography, { variant: "inherit", component: "div", color: "hubYellow.main", children: words[wordIndex] }) }));
|
|
41
41
|
}
|
|
42
42
|
if (animationType === 'fade') {
|
|
43
|
-
return (_jsx(Fade,
|
|
43
|
+
return (_jsx(Fade, { in: showSlide, timeout: { enter: 800, exit: 1200 }, children: _jsx(Typography, { variant: "inherit", component: "div", color: "hubYellow.main", children: words[wordIndex] }) }));
|
|
44
44
|
}
|
|
45
|
-
return (_jsx(Collapse,
|
|
45
|
+
return (_jsx(Collapse, { orientation: "horizontal", in: showSlide, timeout: { enter: 800, exit: 1200 }, children: _jsx(Typography, { variant: "inherit", component: "div", color: "hubYellow.main", sx: { overflow: 'hidden', whiteSpace: 'nowrap' }, children: words[wordIndex] }) }));
|
|
46
46
|
};
|
|
@@ -18,5 +18,5 @@ export const ButtonWithTracking = (_a) => {
|
|
|
18
18
|
const tooltipProps = tooltip && typeof tooltip === 'object' && 'title' in tooltip
|
|
19
19
|
? tooltip
|
|
20
20
|
: { title: tooltip };
|
|
21
|
-
return (_jsx(Tooltip, Object.assign({}, tooltipProps, { children: _jsx(Button, Object.assign({}, rest, { onClick: handleClick, disableElevation: true
|
|
21
|
+
return (_jsx(Tooltip, Object.assign({}, tooltipProps, { children: _jsx(Button, Object.assign({}, rest, { onClick: handleClick, disableElevation: true, children: children })) })));
|
|
22
22
|
};
|
|
@@ -8,16 +8,16 @@ import ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp';
|
|
|
8
8
|
*/
|
|
9
9
|
export const CollapsedList = ({ list, collapseItems = 3, }) => {
|
|
10
10
|
const [showMore, setShowMore] = useState(false);
|
|
11
|
-
const listItems = useMemo(() => (_jsx(Box,
|
|
11
|
+
const listItems = useMemo(() => (_jsx(Box, { display: "flex", flexDirection: "column", children: list === null || list === void 0 ? void 0 : list.map((item, index) => {
|
|
12
12
|
var _a;
|
|
13
|
-
return (_jsxs(Typography,
|
|
13
|
+
return (_jsxs(Typography, { variant: "body2", display: "flex", alignItems: "center", my: 1, children: [item.logo && (_jsx(Avatar, { variant: "square", component: "span", alt: item.name, src: (_a = item.logo) !== null && _a !== void 0 ? _a : '', sx: {
|
|
14
14
|
width: '24px',
|
|
15
15
|
height: '24px',
|
|
16
16
|
marginRight: 2,
|
|
17
|
-
} })), item.name] }
|
|
18
|
-
}) }))
|
|
17
|
+
} })), item.name] }, index));
|
|
18
|
+
}) })), [list]);
|
|
19
19
|
if (!list) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
return (_jsxs(Box,
|
|
22
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "column", justifyContent: "center", children: [_jsx(Collapse, { in: showMore, collapsedSize: collapseItems * 33, children: listItems }), list.length > collapseItems && (_jsxs(Button, { onClick: () => setShowMore(!showMore), children: [showMore ? 'Less' : 'More', showMore ? _jsx(ArrowDropUpIcon, {}) : _jsx(ArrowDropDownIcon, {})] }))] }));
|
|
23
23
|
};
|
|
@@ -19,5 +19,5 @@ export const CollectionSummary = ({ expanded, items, itemsType, maxVisibleItemCo
|
|
|
19
19
|
if (!items.length) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
return (_jsx(Box, { children: items.length === 1 ? (_jsx(Typography,
|
|
22
|
+
return (_jsx(Box, { children: items.length === 1 ? (_jsx(Typography, { color: "text.secondary", children: stringifyItems })) : (_jsxs(Stack, { alignItems: "start", children: [_jsx(Button, { onClick: () => setIsExpanded(!isExpanded), variant: "text", sx: { color: color.text.subtle.value, minWidth: 'unset' }, endIcon: isExpanded ? (_jsx(FontAwesomeIcon, { icon: faCaretUp })) : (_jsx(FontAwesomeIcon, { icon: faCaretDown })), size: "small", children: `${items.length} ${itemsType}` }), _jsx(Fade, { in: isExpanded, appear: !isExpanded, unmountOnExit: true, children: _jsx(Typography, { variant: "bodySm", color: "text.secondary", children: stringifyItems }) })] })) }));
|
|
23
23
|
};
|
|
@@ -60,5 +60,5 @@ export const CookiesBanner = ({ show, cookies, productName, removeCookies, onIni
|
|
|
60
60
|
if ((removeCookies === null || removeCookies === void 0 ? void 0 : removeCookies.length) && document.cookie) {
|
|
61
61
|
deleteMatchingCookies(removeCookies);
|
|
62
62
|
}
|
|
63
|
-
return (_jsx(Drawer,
|
|
63
|
+
return (_jsx(Drawer, { anchor: "bottom", open: show, disableEscapeKeyDown: true, children: _jsxs(Box, { display: "flex", flexDirection: "column", p: 4, children: [showCustomizeView ? (_jsx(Box, { display: "flex", flexDirection: "column", children: Object.entries(internalCookies).map(([key, cookie]) => (_jsxs(Box, { display: "flex", alignItems: "center", mb: 3, children: [_jsxs(Box, { display: "flex", flexDirection: "column", width: "90%", children: [_jsx(Typography, { variant: "h5", children: cookie.title }), _jsx(Typography, { variant: "body1", children: cookie.description })] }), _jsx(Box, { display: "flex", children: _jsx(Switch, { checked: cookie.value, onChange: () => handleOnChange(key), disabled: cookie.required }) })] }, key))) })) : (_jsx(Box, { display: "flex", justifyContent: "center", children: _jsxs(Typography, { variant: "body1", children: ["We use cookies to enhance your browsing experience and analyze our traffic. By clicking \"Accept All\" you consent to our use of cookies. Read more about our", ' ', _jsx(Link, { href: "https://www.balena.io/privacy-policy", target: "_blank", children: "privacy policy" }), "."] }) })), _jsxs(Box, { display: "flex", mt: 4, ml: "auto", justifyContent: "space-around", width: "400px", children: [_jsx(Button, { variant: "outlined", onClick: handleReject, children: "Reject all" }), _jsx(Button, { variant: "outlined", onClick: () => setShowCustomizeView(!showCustomizeView), children: showCustomizeView ? 'Back' : 'Customize' }), _jsx(Button, { variant: "contained", onClick: handleSaveOrAcceptAll, children: showCustomizeView ? 'Save selection' : 'Accept all' })] })] }) }));
|
|
64
64
|
};
|
|
@@ -45,18 +45,18 @@ export const Copy = (_a) => {
|
|
|
45
45
|
if (!copy) {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
|
-
const copyComponent = (_jsx(Tooltip,
|
|
48
|
+
const copyComponent = (_jsx(Tooltip, { title: "Copied!", disableFocusListener: true, disableHoverListener: true, disableTouchListener: true, open: open, PopperProps: {
|
|
49
49
|
disablePortal: true,
|
|
50
|
-
}, placement: "top"
|
|
50
|
+
}, placement: "top", children: _jsx(FontAwesomeIcon, { icon: faCopy, onClick: copyClick, className: "copy", size: "sm", style: Object.assign(Object.assign({ color: color.icon.value, cursor: 'pointer' }, ('variant' in props &&
|
|
51
51
|
props.variant === 'absolute' && {
|
|
52
52
|
position: 'absolute',
|
|
53
|
-
})), { padding: theme.spacing(1) }) }) }))
|
|
53
|
+
})), { padding: theme.spacing(1) }) }) }));
|
|
54
54
|
if (!('children' in props)) {
|
|
55
55
|
return copyComponent;
|
|
56
56
|
}
|
|
57
57
|
const { children, variant = 'adjacent' } = props;
|
|
58
58
|
if (variant === 'adjacent') {
|
|
59
|
-
return (_jsxs(Box,
|
|
59
|
+
return (_jsxs(Box, { sx: {
|
|
60
60
|
display: 'flex',
|
|
61
61
|
alignItems: 'center',
|
|
62
62
|
'.copy': {
|
|
@@ -72,9 +72,9 @@ export const Copy = (_a) => {
|
|
|
72
72
|
},
|
|
73
73
|
width: 'fit-content',
|
|
74
74
|
maxWidth: '100%',
|
|
75
|
-
}
|
|
75
|
+
}, children: [children, copyComponent] }));
|
|
76
76
|
}
|
|
77
|
-
return (_jsxs(Box,
|
|
77
|
+
return (_jsxs(Box, { sx: {
|
|
78
78
|
display: 'inline-flex',
|
|
79
79
|
alignItems: 'center',
|
|
80
80
|
justifyContent: 'center',
|
|
@@ -94,5 +94,5 @@ export const Copy = (_a) => {
|
|
|
94
94
|
'.copy': { visibility: 'visible', opacity: 1 },
|
|
95
95
|
cursor: 'pointer',
|
|
96
96
|
},
|
|
97
|
-
}, onClick: copyClick
|
|
97
|
+
}, onClick: copyClick, children: [_jsx(Box, { className: "copy-children-container", children: children }), copyComponent] }));
|
|
98
98
|
};
|
|
@@ -5,13 +5,13 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
5
5
|
import { faClose } from '@fortawesome/free-solid-svg-icons/faClose';
|
|
6
6
|
export const DialogWithCloseButton = (_a) => {
|
|
7
7
|
var { children, onClose, title } = _a, other = __rest(_a, ["children", "onClose", "title"]);
|
|
8
|
-
return (_jsxs(Dialog, Object.assign({ onClose: onClose }, other, { children: [title != null && (_jsxs(DialogTitle,
|
|
8
|
+
return (_jsxs(Dialog, Object.assign({ onClose: onClose }, other, { children: [title != null && (_jsxs(DialogTitle, { sx: {
|
|
9
9
|
display: 'flex',
|
|
10
10
|
alignItems: 'start',
|
|
11
11
|
}, onClick: (e) => {
|
|
12
12
|
e.preventDefault();
|
|
13
13
|
e.stopPropagation();
|
|
14
|
-
}
|
|
14
|
+
}, children: [title, onClose ? (_jsx(IconButton, { edge: "end", "aria-label": "close", onClick: (e) => {
|
|
15
15
|
onClose(e, 'backdropClick');
|
|
16
|
-
}, sx: { ml: 'auto' }
|
|
16
|
+
}, sx: { ml: 'auto' }, children: _jsx(FontAwesomeIcon, { icon: faClose }) })) : null] })), children] })));
|
|
17
17
|
};
|
|
@@ -52,7 +52,7 @@ export const ApplicationInstructions = memo(({ deviceType, templateData, }) => {
|
|
|
52
52
|
}
|
|
53
53
|
}, [currentOs, setCurrentOs, instructions, hasOsSpecificInstructions]);
|
|
54
54
|
if (!deviceType || !instructions) {
|
|
55
|
-
return (_jsx(Typography,
|
|
55
|
+
return (_jsx(Typography, { variant: "body1", children: "Instructions for this device type are not currently available. Please try again later." }));
|
|
56
56
|
}
|
|
57
57
|
const interpolatedInstructions = (_a = (hasOsSpecificInstructions
|
|
58
58
|
? instructions[normalizedOs]
|
|
@@ -65,9 +65,9 @@ export const ApplicationInstructions = memo(({ deviceType, templateData, }) => {
|
|
|
65
65
|
...interpolatedInstructions,
|
|
66
66
|
'Your device should appear in your application dashboard within a few minutes. Have fun!',
|
|
67
67
|
];
|
|
68
|
-
return (_jsxs(Box,
|
|
68
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "flex-start", children: [_jsx(Typography, { variant: "h5", children: "Instructions" }), hasOsSpecificInstructions && (_jsx(Box, { mb: 3, children: _jsx(Box, { sx: { borderBottom: 1, borderColor: 'divider' }, children: _jsx(Tabs, { value: Object.keys(instructions).find((key) => key === currentOs), onChange: (_event, value) => setCurrentOs(value !== null && value !== void 0 ? value : 'Unknown'), "aria-label": "os tabs", children: Object.keys(instructions).map((os) => {
|
|
69
69
|
return _jsx(Tab, { label: os, value: os }, os);
|
|
70
|
-
}) })
|
|
70
|
+
}) }) }) })), _jsx(InstructionsList, { instructions: finalInstructions }), _jsx(Box, { mt: 2, children: _jsxs(Typography, { children: ["For more details please refer to our", ' ', _jsx(MUILinkWithTracking, { href: `https://www.balena.io/docs/learn/getting-started/${deviceType.slug}/nodejs/`, children: "Getting Started Guide" }), "."] }) })] }));
|
|
71
71
|
});
|
|
72
72
|
const InstructionsItem = ({ node, index }) => {
|
|
73
73
|
const hasChildren = has(node, 'children');
|
|
@@ -78,7 +78,7 @@ const InstructionsItem = ({ node, index }) => {
|
|
|
78
78
|
if (node === null || node === void 0 ? void 0 : node.text) {
|
|
79
79
|
text = node.text;
|
|
80
80
|
}
|
|
81
|
-
return (_jsxs(OrderedListItem,
|
|
81
|
+
return (_jsxs(OrderedListItem, { index: index + 1, sx: { maxWidth: '100%' }, children: [_jsx(Markdown, { children: text, components: {
|
|
82
82
|
code: (codeProps) => {
|
|
83
83
|
return (_jsx("code", Object.assign({ style: {
|
|
84
84
|
maxWidth: '100%',
|
|
@@ -91,10 +91,10 @@ const InstructionsItem = ({ node, index }) => {
|
|
|
91
91
|
br: () => {
|
|
92
92
|
return _jsx("p", {});
|
|
93
93
|
},
|
|
94
|
-
p: ({ children }) => (_jsx("p",
|
|
94
|
+
p: ({ children }) => (_jsx("p", { style: { marginTop: 0, marginBottom: 0 }, children: children })),
|
|
95
95
|
} }), hasChildren && (_jsx(List, { children: node.children.map((item, i) => {
|
|
96
96
|
return _jsx(InstructionsItem, { node: item, index: i }, i);
|
|
97
|
-
}) }))] }))
|
|
97
|
+
}) }))] }));
|
|
98
98
|
};
|
|
99
99
|
const InstructionsList = ({ instructions }) => {
|
|
100
100
|
return (_jsx(List, { children: instructions.map((item, i) => {
|
|
@@ -93,20 +93,20 @@ export const ImageForm = memo(({ compatibleDeviceTypes, osVersions, isInitialDef
|
|
|
93
93
|
setVariant(variant === 'dev' ? 'prod' : 'dev');
|
|
94
94
|
}
|
|
95
95
|
}, [version, variant, onChange, versionSelectionOpts]);
|
|
96
|
-
return (_jsxs(Box,
|
|
96
|
+
return (_jsxs(Box, { action: downloadUrl, method: "post", component: "form", noValidate: true, autoComplete: "off", p: 2, ref: formElement, children: [_jsx("input", { type: "hidden", name: "_token", value: authToken }), _jsx("input", { type: "hidden", name: "appId", value: applicationId }), _jsx("input", { type: "hidden", name: "fileType", value: ".zip" }), _jsxs(Box, { py: 3, display: "flex", flexWrap: "wrap", gap: 2, children: [compatibleDeviceTypes && compatibleDeviceTypes.length > 1 && (_jsxs(Box, { display: "flex", flexDirection: "column", flex: "1", maxWidth: "100%", children: [_jsxs(InputLabel, { htmlFor: "device-type-select", sx: { display: 'flex', alignItems: 'center', mb: 2 }, children: ["Select device type", ' ', _jsx(Tooltip, { title: "Applications can support any devices that share the same architecture as their default device type.", children: _jsx(HelpIcon, { color: "info", sx: { fontSize: '1rem', marginLeft: 1 } }) })] }), _jsx(Select, { fullWidth: true, id: "device-type-select", value: model.deviceType.slug, inputProps: {
|
|
97
97
|
name: 'deviceType',
|
|
98
98
|
}, renderValue: (dt) => (_jsx(DeviceTypeItem, { deviceType: compatibleDeviceTypes.find((c) => c.slug === dt) })), onChange: (event) => {
|
|
99
99
|
return handleSelectedDeviceTypeChange(compatibleDeviceTypes.find((c) => c.slug === (event === null || event === void 0 ? void 0 : event.target.value)));
|
|
100
|
-
}
|
|
100
|
+
}, children: compatibleDeviceTypes === null || compatibleDeviceTypes === void 0 ? void 0 : compatibleDeviceTypes.map((dt) => {
|
|
101
101
|
var _a;
|
|
102
|
-
return (_jsxs(MenuItem,
|
|
103
|
-
}) })
|
|
102
|
+
return (_jsxs(MenuItem, { value: dt.slug, sx: { maxWidth: '100%' }, children: [_jsx(Avatar, { variant: "square", src: (_a = dt.logo) !== null && _a !== void 0 ? _a : FALLBACK_LOGO_UNKNOWN_DEVICE, sx: { mr: 3, width: '20px', height: '20px' } }), _jsx(Typography, { noWrap: true, children: dt.name })] }, dt.slug));
|
|
103
|
+
}) })] })), (!isInitialDefault || osType) &&
|
|
104
104
|
hasEsrVersions &&
|
|
105
105
|
model.deviceType && (_jsx(OsTypeSelector, { supportedOsTypes: osTypes, hasEsrVersions: hasEsrVersions !== null && hasEsrVersions !== void 0 ? hasEsrVersions : false, selectedOsTypeSlug: osType, onSelectedOsTypeChange: (ot) => {
|
|
106
106
|
onSelectedOsTypeChange(ot);
|
|
107
107
|
setVersion(undefined);
|
|
108
108
|
onChange('version', undefined);
|
|
109
|
-
} }))] })
|
|
109
|
+
} }))] }), !isInitialDefault && model.version && (_jsxs(Box, { display: "flex", flexWrap: "wrap", maxWidth: "100%", children: [_jsxs(Box, { display: "flex", flexDirection: "column", maxWidth: "100%", flex: 1, children: [_jsx(InputLabel, { sx: { mb: 2 }, htmlFor: "e2e-download-image-versions-list", children: "Select version" }), _jsx(Select, { fullWidth: true, id: "e2e-download-image-versions-list", value: model.version, inputProps: {
|
|
110
110
|
name: 'version',
|
|
111
111
|
}, onChange: (event) => {
|
|
112
112
|
const version = versionSelectionOpts.find((v) => v.value === event.target.value);
|
|
@@ -114,46 +114,46 @@ export const ImageForm = memo(({ compatibleDeviceTypes, osVersions, isInitialDef
|
|
|
114
114
|
onChange('version', version === null || version === void 0 ? void 0 : version.value);
|
|
115
115
|
}, placeholder: "Choose a version...", renderValue: () => {
|
|
116
116
|
return _jsx(VersionSelectItem, { option: version });
|
|
117
|
-
}
|
|
118
|
-
return (_jsx(MenuItem,
|
|
119
|
-
}) })
|
|
117
|
+
}, children: versionSelectionOpts === null || versionSelectionOpts === void 0 ? void 0 : versionSelectionOpts.map((option, index) => {
|
|
118
|
+
return (_jsx(MenuItem, { value: option.value, children: _jsx(VersionSelectItem, { option: option }) }, index));
|
|
119
|
+
}) })] }), showAllVersionsToggle && (_jsxs(Box, { mx: 2, display: "flex", alignItems: "center", alignSelf: "flex-end",
|
|
120
120
|
// TODO: find a better way to center the checkbox with the input only (without label)
|
|
121
|
-
height: 54
|
|
121
|
+
height: 54, children: [_jsx(Checkbox, { id: "e2e-show-all-versions-check", checked: showAllVersions, onChange: handleShowAllVersions }), _jsx(Typography, { children: "Show outdated versions" })] }))] })), (!isInitialDefault || !variant) && (_jsx(Box, { sx: { mt: 3 }, children: _jsx(VariantSelector, { version: version, variant: variant, onVariantChange: (variant) => {
|
|
122
122
|
setVariant(variant ? 'dev' : 'prod');
|
|
123
|
-
} }) }))
|
|
123
|
+
} }) })), _jsx(Divider, { variant: "fullWidth", sx: { my: 3, borderStyle: 'dashed' } }), _jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { id: "network-radio-buttons-group-label", children: "Network" }), _jsxs(RadioGroup, { "aria-labelledby": "network-radio-buttons-group-label", value: model.network, name: "network", onChange: (event) => onChange('network', event.target.value), children: [_jsx(FormControlLabel, { value: "ethernet", control: _jsx(Radio, {}), label: "Ethernet only" }), _jsx(FormControlLabel, { value: "wifi", control: _jsx(Radio, {}), label: "Wifi + Ethernet" })] })] }), model.network === 'wifi' && (_jsxs(_Fragment, { children: [_jsx(InputLabel, { htmlFor: "device-wifi-ssid", sx: { mb: 2 }, children: "WiFi SSID" }), _jsx(TextField, { value: model.wifiSsid, id: "device-wifi-ssid", inputProps: {
|
|
124
124
|
name: 'wifiSsid',
|
|
125
125
|
autocomplete: 'wifiSsid-auto-complete',
|
|
126
|
-
}, onChange: (event) => onChange('wifiSsid', event.target.value) }), _jsx(InputLabel,
|
|
126
|
+
}, onChange: (event) => onChange('wifiSsid', event.target.value) }), _jsx(InputLabel, { htmlFor: "device-wifi-password", sx: { my: 2 }, children: "Wifi Passphrase" }), _jsx(TextField, { type: showPassword ? 'text' : 'password', id: "device-wifi-password", value: model.wifiKey, inputProps: {
|
|
127
127
|
name: 'wifiKey',
|
|
128
128
|
},
|
|
129
129
|
// InputProps and inputProps are different https://mui.com/material-ui/api/text-field/#TextField-prop-InputProps
|
|
130
130
|
InputProps: {
|
|
131
|
-
endAdornment: (_jsx(InputAdornment,
|
|
131
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { onClick: () => setShowPassword((show) => !show), onMouseDown: (event) => {
|
|
132
132
|
event.preventDefault();
|
|
133
|
-
}, edge: "end"
|
|
134
|
-
}, onChange: (event) => onChange('wifiKey', event.target.value) })] }))] })
|
|
133
|
+
}, edge: "end", children: showPassword ? _jsx(VisibilityOff, {}) : _jsx(Visibility, {}) }) })),
|
|
134
|
+
}, onChange: (event) => onChange('wifiKey', event.target.value) })] }))] }), _jsx(Divider, { variant: "fullWidth", sx: { my: 3, borderStyle: 'dashed' } }), _jsxs(Button, { onClick: () => setShowAdvancedSettings(!showAdvancedSettings), variant: "outlined", sx: { mb: 2 }, children: [showAdvancedSettings ? _jsx(RemoveIcon, {}) : _jsx(AddIcon, {}), " Advanced settings"] }), _jsx(Collapse, { in: showAdvancedSettings, collapsedSize: 0, children: _jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsxs(FormControl, { children: [_jsxs(FormLabel, { htmlFor: "poll-interval-label", sx: { display: 'flex' }, children: ["Check for updates every X minutes", ' ', _jsx(MUILinkWithTracking, { href: POLL_INTERVAL_DOCS, sx: {
|
|
135
135
|
display: 'flex',
|
|
136
136
|
alignItems: 'center',
|
|
137
137
|
height: '1.5rem',
|
|
138
|
-
}
|
|
138
|
+
}, children: _jsx(ArticleIcon, { sx: { ml: 1, fontSize: '1.15rem' } }) })] }), _jsx(TextField, { id: "poll-interval-label", "aria-labelledby": "poll-interval-label", value: model.appUpdatePollInterval, inputProps: {
|
|
139
139
|
name: 'appUpdatePollInterval',
|
|
140
140
|
autocomplete: 'appUpdatePollInterval-auto-complete',
|
|
141
|
-
}, onChange: (event) => onChange('appUpdatePollInterval', event.target.value) })] }), _jsx(InputLabel,
|
|
141
|
+
}, onChange: (event) => onChange('appUpdatePollInterval', event.target.value) })] }), _jsx(InputLabel, { htmlFor: "provision-key-name", sx: { my: 2 }, children: "Provisioning Key name" }), _jsx(TextField, { name: "provisioningKeyName", id: "provision-key-name", value: (_a = model.provisioningKeyName) !== null && _a !== void 0 ? _a : '', inputProps: {
|
|
142
142
|
name: 'provisioningKeyName',
|
|
143
143
|
autocomplete: 'provisioningKeyName-auto-complete',
|
|
144
|
-
}, onChange: (event) => onChange('provisioningKeyName', event.target.value) }), _jsx(InputLabel,
|
|
144
|
+
}, onChange: (event) => onChange('provisioningKeyName', event.target.value) }), _jsx(InputLabel, { htmlFor: "provision-key-expiring", sx: { my: 2 }, children: "Provisioning Key expiring on" }), _jsx(TextField, { type: "date", id: "provision-key-expiring", value: (_b = model.provisioningKeyExpiryDate) !== null && _b !== void 0 ? _b : '', inputProps: {
|
|
145
145
|
name: 'provisioningKeyExpiryDate',
|
|
146
146
|
autocomplete: 'provisioningKeyExpiryDate-auto-complete',
|
|
147
|
-
}, onChange: (event) => onChange('provisioningKeyExpiryDate', event.target.value) })] })
|
|
147
|
+
}, onChange: (event) => onChange('provisioningKeyExpiryDate', event.target.value) })] }) })] }));
|
|
148
148
|
});
|
|
149
149
|
const DeviceTypeItem = ({ deviceType, }) => {
|
|
150
150
|
var _a;
|
|
151
|
-
return (_jsxs(Box,
|
|
151
|
+
return (_jsxs(Box, { display: "flex", children: [_jsx(Avatar, { variant: "square", src: (_a = deviceType.logo) !== null && _a !== void 0 ? _a : FALLBACK_LOGO_UNKNOWN_DEVICE, sx: { mr: 3, width: '20px', height: '20px' } }), _jsx(Typography, { noWrap: true, children: deviceType.name })] }));
|
|
152
152
|
};
|
|
153
153
|
export const VersionSelectItem = ({ option }) => {
|
|
154
154
|
var _a;
|
|
155
|
-
return (_jsx(Tooltip,
|
|
155
|
+
return (_jsx(Tooltip, { title: (_a = option.knownIssueList) !== null && _a !== void 0 ? _a : undefined, children: _jsxs(Box, { display: "flex", alignItems: "center", gap: 2, flexWrap: "nowrap", maxWidth: "100%", children: [_jsx(Box, { children: option.title }), !!option.line && (_jsx(Chip, { label: option.line, color: lineMap[option.line] })), !!option.isRecommended && (_jsx(Chip, { label: "recommended", sx: {
|
|
156
156
|
height: 20,
|
|
157
157
|
backgroundColor: '#CAFECD',
|
|
158
|
-
} })), !!option.knownIssueList && (_jsxs(Box,
|
|
158
|
+
} })), !!option.knownIssueList && (_jsxs(Box, { alignItems: "center", flex: 1, display: "contents", children: [_jsx(WarningAmberIcon, { color: "warning" }), _jsx(Typography, { noWrap: true, children: option.knownIssueList })] }))] }) }));
|
|
159
159
|
};
|
|
@@ -7,11 +7,11 @@ import { OsTypesEnum } from './models';
|
|
|
7
7
|
import { Chip } from '../Chip';
|
|
8
8
|
const OsTypeOption = ({ osType }) => {
|
|
9
9
|
if (!osType) {
|
|
10
|
-
return _jsx(Typography,
|
|
10
|
+
return _jsx(Typography, { variant: "body1", children: "Select OS type..." });
|
|
11
11
|
}
|
|
12
|
-
return (_jsx(Tooltip,
|
|
12
|
+
return (_jsx(Tooltip, { title: !osType.supportedForDeviceType
|
|
13
13
|
? 'No ESR versions are available for this device type yet. Check the documentation for device types that already have ESR versions.'
|
|
14
|
-
: undefined
|
|
14
|
+
: undefined, children: _jsxs(Box, { display: "flex", width: "100%", justifyContent: "space-between", alignItems: "center", children: [_jsx(Typography, { variant: "body1", children: getOsTypeName(osType.slug) }), _jsxs(Box, { children: [!osType.supportedForDeviceType && (_jsx(Chip, { label: "no versions yet", color: "blue" })), !osType.supportedForApp && (_jsx(Chip, { label: "production and enterprise plan only", color: "orange" }))] })] }) }));
|
|
15
15
|
};
|
|
16
16
|
export const OsTypeSelector = ({ supportedOsTypes, hasEsrVersions, selectedOsTypeSlug, onSelectedOsTypeChange, }) => {
|
|
17
17
|
var _a;
|
|
@@ -30,8 +30,8 @@ export const OsTypeSelector = ({ supportedOsTypes, hasEsrVersions, selectedOsTyp
|
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
32
|
const selectedOsType = selectOsTypes.find((osType) => osType.slug === selectedOsTypeSlug && osType.supportedForDeviceType);
|
|
33
|
-
return (_jsxs(Box,
|
|
33
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "column", flex: 1, children: [_jsxs(InputLabel, { htmlFor: "newAppApplicationType", sx: { display: 'flex', alignItems: 'center', mb: 2 }, children: ["Select OS type", ' ', _jsx(MUILinkWithTracking, { sx: { height: 14 }, href: "https://www.balena.io/docs/reference/OS/extended-support-release", children: _jsx(ArticleIcon, { sx: { width: 14, height: 14, marginLeft: 1 } }) })] }), _jsx(Select, { id: "newAppApplicationType", fullWidth: true, disabled: supportedOsTypes.length === 0, value: (_a = selectedOsType === null || selectedOsType === void 0 ? void 0 : selectedOsType.slug) !== null && _a !== void 0 ? _a : OsTypesEnum.DEFAULT, renderValue: (selected) => (_jsx(Box, { display: "flex", width: "100%", children: _jsx(OsTypeOption, { osType: selectOsTypes.find((osType) => selected === osType.slug) }) })), onChange: (event) => {
|
|
34
34
|
const osType = selectOsTypes.find((os) => os.slug === event.target.value);
|
|
35
35
|
return !osType.disabled && onSelectedOsTypeChange(osType.slug);
|
|
36
|
-
}
|
|
36
|
+
}, children: selectOsTypes.map((option) => (_jsx(MenuItem, { value: option.slug, children: _jsx(OsTypeOption, { osType: option }) }, option.slug))) })] }));
|
|
37
37
|
};
|
|
@@ -5,8 +5,8 @@ import { getOsVariantDisplayText } from './utils';
|
|
|
5
5
|
import { Lightbulb } from '@mui/icons-material';
|
|
6
6
|
const variantInfo = {
|
|
7
7
|
dev: {
|
|
8
|
-
title: (_jsxs(Box,
|
|
9
|
-
description: (_jsxs(_Fragment, { children: ["Development images should be used when you are developing an application and want to use the fast", ' ', _jsx(MUILinkWithTracking,
|
|
8
|
+
title: (_jsxs(Box, { display: "flex", gap: 1, flexDirection: "row", alignItems: "center", children: [_jsx(Typography, { children: getOsVariantDisplayText('dev') }), _jsxs(Typography, { variant: "bodySm", color: "customBlue.main", alignItems: "center", display: "flex", children: [_jsx(Lightbulb, { sx: { width: 14, height: 14 } }), "Recommended for first time users"] })] })),
|
|
9
|
+
description: (_jsxs(_Fragment, { children: ["Development images should be used when you are developing an application and want to use the fast", ' ', _jsx(MUILinkWithTracking, { href: "https://balena.io/docs/development/local-mode/", children: "local mode" }), ' ', "workflow", ' ', _jsx("strong", { children: "This variant should never be used in production." })] })),
|
|
10
10
|
},
|
|
11
11
|
prod: {
|
|
12
12
|
title: _jsx(Typography, { children: getOsVariantDisplayText('prod') }),
|
|
@@ -15,14 +15,14 @@ const variantInfo = {
|
|
|
15
15
|
};
|
|
16
16
|
const BuildVariants = ['dev', 'prod'];
|
|
17
17
|
export const VariantSelector = ({ version, variant, onVariantChange, }) => {
|
|
18
|
-
return (_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Select edition" }), _jsx(RadioGroup,
|
|
18
|
+
return (_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Select edition" }), _jsx(RadioGroup, { "aria-labelledby": "variant-radio-buttons-group", name: "developmentMode", value: variant === 'dev', onChange: (event) => {
|
|
19
19
|
onVariantChange(event.target.value === 'true');
|
|
20
|
-
}
|
|
20
|
+
}, children: BuildVariants.map((buildVariant, index) => {
|
|
21
21
|
const isDev = buildVariant === 'dev';
|
|
22
22
|
const isDisabled = version == null ||
|
|
23
23
|
(version.hasPrebuiltVariants && !version.rawVersions[buildVariant]);
|
|
24
|
-
return (_jsx(Tooltip,
|
|
24
|
+
return (_jsx(Tooltip, { title: isDisabled
|
|
25
25
|
? 'This edition is not available for the selected version'
|
|
26
|
-
: undefined
|
|
27
|
-
}) }
|
|
26
|
+
: undefined, children: _jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(FormControlLabel, { sx: { opacity: isDisabled ? 0.4 : 1 }, disabled: isDisabled, value: isDev, control: _jsx(Radio, {}), label: variantInfo[buildVariant].title }), _jsx(Typography, { sx: { opacity: isDisabled ? 0.4 : 1 }, variant: "bodySm", children: variantInfo[buildVariant].description })] }) }, index));
|
|
27
|
+
}) }, "varian")] }));
|
|
28
28
|
};
|
|
@@ -236,7 +236,7 @@ export const DownloadImageDialog = ({ open, applicationId, releaseId, compatible
|
|
|
236
236
|
const handleChange = useCallback((key, value) => {
|
|
237
237
|
setFromModel((oldState) => (Object.assign(Object.assign({}, oldState), { [key]: value })));
|
|
238
238
|
}, [setFromModel]);
|
|
239
|
-
return (_jsxs(DialogWithCloseButton,
|
|
239
|
+
return (_jsxs(DialogWithCloseButton, { title: _jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Avatar, { variant: "square", alt: defaultDisplayName, src: logoSrc, sx: { mr: 2 } }), _jsx(Typography, { variant: "h5", children: "Add new device" })] }), open: open, onClose: onClose, maxWidth: "lg", fullWidth: true, sx: { p: 4 }, children: [_jsx(DialogContent, { sx: { m: 0 }, children: _jsxs(Grid, { container: true, pb: 5, spacing: [0, 0, 4], children: [_jsx(Grid, { xs: 12, sm: 12, md: 6, lg: 7, children: isFetching ? (_jsx(Spinner, {})) : (_jsxs(_Fragment, { children: [isEmpty(osVersions) && (_jsx(Alert, { color: "warning", children: "No OS versions available for download" })), !!osType && !!compatibleDeviceTypes && (_jsx(ImageForm, { applicationId: applicationId, releaseId: releaseId, compatibleDeviceTypes: compatibleDeviceTypes, osVersions: osVersions, isInitialDefault: isInitialDefault, hasEsrVersions: deviceTypeHasEsr[formModel.deviceType.slug], formElement: formElement, downloadUrl: downloadUrl, authToken: authToken, osType: osType, osTypes: osTypes, model: formModel, onSelectedOsTypeChange: setOsTypeCallback, onSelectedDeviceTypeChange: (deviceType) => setFromModel(getInitialState(deviceType, applicationId, releaseId)), onChange: handleChange }))] })) }), _jsxs(Grid, { xs: 12, sm: 12, md: 6, lg: 5, pb: 0, children: [_jsx(Divider, { variant: "fullWidth", sx: {
|
|
240
240
|
mt: 2,
|
|
241
241
|
mb: 3,
|
|
242
242
|
display: {
|
|
@@ -248,19 +248,19 @@ export const DownloadImageDialog = ({ open, applicationId, releaseId, compatible
|
|
|
248
248
|
dockerImage: formModel.version
|
|
249
249
|
? getDockerArtifact(formModel.deviceType.slug, stripVersionBuild(formModel.version))
|
|
250
250
|
: '',
|
|
251
|
-
} })] })
|
|
252
|
-
return (_jsx(Grid,
|
|
253
|
-
})] })
|
|
251
|
+
} })] }), ((_f = formModel.deviceType.imageDownloadAlerts) !== null && _f !== void 0 ? _f : []).map((alert) => {
|
|
252
|
+
return (_jsx(Grid, { xs: 12, pt: 0, children: _jsx(Alert, { severity: alert.type, children: alert.message }, alert.message) }));
|
|
253
|
+
})] }) }), _jsx(DialogActions, { sx: {
|
|
254
254
|
display: 'flex',
|
|
255
255
|
position: 'absolute',
|
|
256
256
|
bottom: 0,
|
|
257
257
|
right: 0,
|
|
258
258
|
justifyContent: 'end',
|
|
259
|
-
}
|
|
259
|
+
}, children: _jsx(DropDownButton, { className: "e2e-download-image-submit", items: actions }) })] }));
|
|
260
260
|
};
|
|
261
261
|
// TODO: remove as soon as we have a generic Spinner component
|
|
262
262
|
const Spinner = () => {
|
|
263
|
-
return (_jsx(Box,
|
|
263
|
+
return (_jsx(Box, { style: {
|
|
264
264
|
position: 'absolute',
|
|
265
265
|
top: 0,
|
|
266
266
|
right: 0,
|
|
@@ -271,5 +271,5 @@ const Spinner = () => {
|
|
|
271
271
|
alignItems: 'center',
|
|
272
272
|
backgroundColor: 'rgb(0, 0, 0, 0.4)',
|
|
273
273
|
color: 'white',
|
|
274
|
-
}
|
|
274
|
+
}, children: "Loading..." }));
|
|
275
275
|
};
|
|
@@ -48,11 +48,11 @@ export const DropDownButton = (_a) => {
|
|
|
48
48
|
};
|
|
49
49
|
return (_jsxs(_Fragment, { children: [children ? (_jsx(Button, Object.assign({ "aria-controls": !!anchorEl ? 'dropdown' : undefined, "aria-expanded": !!anchorEl ? 'true' : undefined, onClick: (event) => {
|
|
50
50
|
setAnchorEl(event.currentTarget);
|
|
51
|
-
}, endIcon: anchorEl ? _jsx(KeyboardArrowUp, {}) : _jsx(KeyboardArrowDown, {}) }, buttonProps, { children: children }))) : (_jsxs(ButtonGroup, Object.assign({ variant: "contained", disableElevation: true }, buttonProps, { children: [_jsx(ButtonWithTracking,
|
|
51
|
+
}, endIcon: anchorEl ? _jsx(KeyboardArrowUp, {}) : _jsx(KeyboardArrowDown, {}) }, buttonProps, { children: children }))) : (_jsxs(ButtonGroup, Object.assign({ variant: "contained", disableElevation: true }, buttonProps, { children: [_jsx(ButtonWithTracking, { onClick: handleClick, eventName: memoizedItems[selectedIndex].eventName, eventProperties: memoizedItems[selectedIndex].eventProperties, tooltip: memoizedItems[selectedIndex].tooltip, children: memoizedItems[selectedIndex].children }), _jsx(Button, { onClick: handleToggle,
|
|
52
52
|
// It doesn't look good without it, hence the addition.
|
|
53
|
-
sx: (theme) => ({ pl: 2, pr: `calc(${theme.spacing(2)} + 2px)` })
|
|
53
|
+
sx: (theme) => ({ pl: 2, pr: `calc(${theme.spacing(2)} + 2px)` }), children: anchorEl ? _jsx(ArrowDropUp, {}) : _jsx(ArrowDropDown, {}) })] }))), _jsx(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
|
|
54
54
|
setAnchorEl(null);
|
|
55
|
-
}
|
|
55
|
+
}, children: memoizedItems.map((item, index) => (_jsx(MenuItemWithTracking, Object.assign({}, item, { onClick: (event) => handleMenuItemClick(event, index), children: item.children }), index))) })] }));
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* This MenuItem will send analytics in case the analytics context is passed through the provider (AnalyticsProvider).
|
|
@@ -69,5 +69,5 @@ export const MenuItemWithTracking = (_a) => {
|
|
|
69
69
|
const tooltipProps = tooltip && typeof tooltip === 'object' && 'title' in tooltip
|
|
70
70
|
? tooltip
|
|
71
71
|
: { title: tooltip };
|
|
72
|
-
return (_jsx(Tooltip, Object.assign({}, tooltipProps, { children: _jsx(MenuItem, Object.assign({}, menuItem, { onClick: handleClick
|
|
72
|
+
return (_jsx(Tooltip, Object.assign({}, tooltipProps, { children: _jsx(MenuItem, Object.assign({}, menuItem, { onClick: handleClick, children: children })) })));
|
|
73
73
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ObjectFieldTemplateProps, RJSFSchema } from '@rjsf/utils';
|
|
2
|
-
export declare const ObjectFieldTemplate: <T = any, S extends
|
|
1
|
+
import { FormContextType, ObjectFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
export declare const ObjectFieldTemplate: <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ObjectFieldTemplateProps<T, S, F>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,5 +11,5 @@ export const ObjectFieldTemplate = (props) => {
|
|
|
11
11
|
return (_jsxs(_Fragment, { children: [title && (_jsx(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs(Grid, Object.assign({ container: true, spacing: 2, style: { marginTop: '10px' } }, ((_b = (_a = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:grid']) === null || _a === void 0 ? void 0 : _a.container) !== null && _b !== void 0 ? _b : {}), { children: [properties.map((element, index) => {
|
|
12
12
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
13
13
|
return element.hidden ? (element.content) : (_jsx(Grid, Object.assign({ item: true, xs: 12, sx: { marginBottom: '10px' } }, ((_g = (_e = (_c = (_b = (_a = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[element.name]) === null || _a === void 0 ? void 0 : _a['ui:grid']) === null || _b === void 0 ? void 0 : _b.item) !== null && _c !== void 0 ? _c : (_d = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:grid']) === null || _d === void 0 ? void 0 : _d[element.name]) !== null && _e !== void 0 ? _e : (_f = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:grid']) === null || _f === void 0 ? void 0 : _f.item) !== null && _g !== void 0 ? _g : {}), { children: element.content }), index));
|
|
14
|
-
}), canExpand(schema, uiSchema, formData) && (_jsx(Grid,
|
|
14
|
+
}), canExpand(schema, uiSchema, formData) && (_jsx(Grid, { container: true, justifyContent: "flex-end", children: _jsx(Grid, { item: true, children: _jsx(AddButton, { className: "object-property-expand", onClick: onAddClick(schema), disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }))] }))] }));
|
|
15
15
|
};
|
|
@@ -144,13 +144,13 @@ export const FileWidget = ({ onChange, multiple, schema, uiSchema, }) => {
|
|
|
144
144
|
disabled,
|
|
145
145
|
noDrag: false,
|
|
146
146
|
});
|
|
147
|
-
return (_jsx(Tooltip,
|
|
147
|
+
return (_jsx(Tooltip, { title: disabledReason, children: _jsxs(Box, { sx: {
|
|
148
148
|
'.dropzone': Object.assign(Object.assign(Object.assign({}, (disabled
|
|
149
149
|
? disabledStyle
|
|
150
150
|
: isDragActive
|
|
151
151
|
? dragStyle
|
|
152
152
|
: restingStyle)), { '.browse-files-text': { textDecoration: 'underline' } }), (!disabled && { '&:hover': hoverStyle })),
|
|
153
|
-
}
|
|
153
|
+
}, children: [schema.title && (_jsx(InputLabel, { htmlFor: fileUploadId, children: schema.title })), _jsxs(Stack, Object.assign({ id: fileUploadId, className: "dropzone", sx: {
|
|
154
154
|
borderStyle: 'dashed',
|
|
155
155
|
borderRadius: '8px',
|
|
156
156
|
flexDirection: 'column',
|
|
@@ -159,22 +159,22 @@ export const FileWidget = ({ onChange, multiple, schema, uiSchema, }) => {
|
|
|
159
159
|
cursor: disabled ? 'default' : 'pointer',
|
|
160
160
|
gap: 3,
|
|
161
161
|
p: isSmall ? 4 : 5,
|
|
162
|
-
} }, getRootProps(), { children: [_jsx("input", Object.assign({ type: "file" }, getInputProps())), _jsxs(Stack,
|
|
162
|
+
} }, getRootProps(), { children: [_jsx("input", Object.assign({ type: "file" }, getInputProps())), _jsxs(Stack, { direction: isSmall ? 'row' : 'column', gap: isSmall ? 1 : 3, alignItems: "center", children: [_jsx(FontAwesomeIcon, Object.assign({ icon: isSmall ? faUpload : uploadIcon !== null && uploadIcon !== void 0 ? uploadIcon : faUpload }, (isSmall
|
|
163
163
|
? { size: 'lg' }
|
|
164
164
|
: // TODO: icon sizes need to be properly added to the design tokens
|
|
165
|
-
{ fontSize: '48px' }))), _jsxs(Typography,
|
|
165
|
+
{ fontSize: '48px' }))), _jsxs(Typography, { variant: "bodyLg", children: ["Drag and drop or", ' ', _jsxs(Typography, { className: "browse-files-text", variant: "bodyLg", component: Link, children: ["browse ", !!browseResourceName ? `${browseResourceName} ` : '', "files"] })] })] }), !!descriptiveText && (_jsx(Typography, { color: designTokens.color.text.subtle.value, component: "p", children: descriptiveText }))] })), _jsxs(Stack, { gap: 2, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", gap: 3, children: [_jsx(Typography, { color: designTokens.color.text.subtle.value, children: accept == null
|
|
166
166
|
? ''
|
|
167
167
|
: `Supported formats: ${uniq(Object.values(accept)
|
|
168
168
|
// The values of accept are arrays of file types, take them and flatten them
|
|
169
169
|
.flat()
|
|
170
170
|
// Remove the dot from the file type and capitalize it
|
|
171
|
-
.map((fileType) => fileType.slice(1).toUpperCase())).join(', ')}` })
|
|
171
|
+
.map((fileType) => fileType.slice(1).toUpperCase())).join(', ')}` }), maxSize != null && (_jsxs(Typography, { color: designTokens.color.text.subtle.value, align: "right", children: ["Maximum size: ", fileSizeToReadable(maxSize)] }))] }), hideUploadedFiles && !!errorFiles.length && (_jsx(Stack, { color: "error.main", gap: 1, children: errorFiles
|
|
172
172
|
.flatMap((errorFile) => errorFile.errors)
|
|
173
|
-
.map((error) => getErrorMessage(error.code, error.message, maxSize !== null && maxSize !== void 0 ? maxSize : Infinity)) }))
|
|
173
|
+
.map((error) => getErrorMessage(error.code, error.message, maxSize !== null && maxSize !== void 0 ? maxSize : Infinity)) })), !hideUploadedFiles && (_jsxs(Stack, { gap: 1, children: [files.map((file, index) => (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", gap: 2, bgcolor: designTokens.color.bg.value, p: 3, borderRadius: "8px" }, (mobile && { flexWrap: 'wrap' }), { children: [_jsxs(Stack, Object.assign({ direction: "row" }, (mobile && { justifyContent: 'space-between' }), { gap: 2, alignItems: "center", width: "100%", children: [_jsxs(Stack, { direction: "row", gap: 2, alignItems: "center", maxWidth: "45%", children: [_jsx(FontAwesomeIcon, { icon: getFileTypeIcon(file.type) }), _jsx(Typography, Object.assign({}, (mobile
|
|
174
174
|
? { maxWidth: '100%' }
|
|
175
|
-
: { width: '150px' }), { noWrap: true
|
|
175
|
+
: { width: '150px' }), { noWrap: true, children: file.name }))] }), file.loadingPercentage != null && (_jsx(LinearProgress, { variant: "determinate", value: file.loadingPercentage, sx: Object.assign(Object.assign({ width: mobile ? '100%' : '150px' }, (mobile && { maxWidth: '45%' })), { height: '8px' }) }))] })), _jsxs(Stack, Object.assign({ direction: "row" }, (mobile
|
|
176
176
|
? { justifyContent: 'space-between', width: '100%' }
|
|
177
|
-
: { gap: 2 }), { alignItems: "center"
|
|
177
|
+
: { gap: 2 }), { alignItems: "center", children: [_jsxs(Stack, { direction: "row", gap: 2, children: [_jsx(Typography, { color: designTokens.color.text.subtle.value, children: file.type }), _jsx(Typography, { color: designTokens.color.text.subtle.value, children: fileSizeToReadable(file.size) })] }), _jsx(IconButtonWithTracking, { eventName: "FileWidget: Delete uploaded file", "aria-label": "Delete uploaded file", onClick: () => removeFile(index),
|
|
178
178
|
// So that the Button padding does not affect the Stack padding
|
|
179
|
-
sx: { p: '0' }
|
|
179
|
+
sx: { p: '0' }, children: _jsx(FontAwesomeIcon, { icon: faTrash }) })] }))] })))), errorFiles.map(({ file, errors }) => (_jsxs(Stack, { gap: 1, bgcolor: designTokens.color.bg.value, p: 3, borderRadius: "8px", border: "1px solid", borderColor: designTokens.color.border.danger.value, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", gap: 2, children: [_jsxs(Stack, { direction: "row", gap: 2, alignItems: "center", width: "100%", children: [_jsx(FontAwesomeIcon, { icon: getFileTypeIcon(file.type) }), _jsx(Typography, { children: file.name })] }), _jsxs(Stack, { direction: "row", gap: 2, alignItems: "center", children: [_jsx(Typography, { color: designTokens.color.text.subtle.value, children: file.type }), _jsx(Typography, { color: designTokens.color.text.subtle.value, children: fileSizeToReadable(file.size) })] })] }), _jsx(Stack, { gap: 1, children: errors.map((error) => (_jsxs(Stack, { gap: 2, color: designTokens.color.text.danger.value, direction: "row", alignItems: "center", children: [_jsx(FontAwesomeIcon, { icon: faCircleExclamation }), getErrorMessage(error.code, error.message, maxSize !== null && maxSize !== void 0 ? maxSize : Infinity)] }))) })] })))] }))] })] }) }));
|
|
180
180
|
};
|
|
@@ -13,16 +13,14 @@ export const PasswordWidget = ({ id, label, value, disabled, name, placeholder,
|
|
|
13
13
|
const change = ({ target: { value } }) => {
|
|
14
14
|
return onChange(value === '' ? options.emptyValue : value);
|
|
15
15
|
};
|
|
16
|
-
return (_jsxs(FormControl, { children: [_jsx(TextField,
|
|
17
|
-
value,
|
|
16
|
+
return (_jsxs(FormControl, { children: [_jsx(TextField, { label: label, required: required, id: id, type: showPassword ? 'text' : 'password', value,
|
|
18
17
|
disabled,
|
|
19
18
|
name,
|
|
20
|
-
placeholder,
|
|
21
|
-
}, { onChange: change, onBlur: onBlur &&
|
|
19
|
+
placeholder, onChange: change, onBlur: onBlur &&
|
|
22
20
|
((event) => onBlur(id, event.target.value)), onFocus: onFocus &&
|
|
23
21
|
((event) => onFocus(id, event.target.value)), InputProps: {
|
|
24
|
-
endAdornment: (_jsx(InputAdornment,
|
|
22
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { onClick: () => setShowPassword((show) => !show), onMouseDown: (event) => {
|
|
25
23
|
event.preventDefault();
|
|
26
|
-
}, edge: "end"
|
|
27
|
-
} })
|
|
24
|
+
}, edge: "end", children: showPassword ? _jsx(VisibilityOff, {}) : _jsx(Visibility, {}) }) })),
|
|
25
|
+
} }), options.showPasswordStrengthMeter && (_jsx(Suspense, { fallback: null, children: _jsx(PasswordStrength, { password: value }) }))] }));
|
|
28
26
|
};
|
|
@@ -28,15 +28,13 @@ export const SelectWidget = ({ id, label, value, disabled, name, placeholder, on
|
|
|
28
28
|
// label: string;
|
|
29
29
|
// schema?: RJSFSchema | undefined;
|
|
30
30
|
// }[]
|
|
31
|
-
return (_jsxs(FormControl, { children: [_jsx(InputLabel,
|
|
31
|
+
return (_jsxs(FormControl, { children: [_jsx(InputLabel, { htmlFor: id, required: required, children: label }), _jsx(Autocomplete, Object.assign({ fullWidth: true, id: id, value: Array.isArray(value)
|
|
32
32
|
? selectOptions.filter((option) => value.some((v) => isEqual(option.value, v)))
|
|
33
33
|
: value !== undefined
|
|
34
34
|
? selectOptions.find((option) => isEqual(option.value, value))
|
|
35
|
-
: undefined
|
|
36
|
-
name,
|
|
35
|
+
: undefined, name,
|
|
37
36
|
placeholder,
|
|
38
|
-
multiple,
|
|
39
|
-
}, { disabled: disabled, options: selectOptions, isOptionEqualToValue: (option, value) => isEqual(option, value), getOptionLabel: (option) => Array.isArray(option)
|
|
37
|
+
multiple, disabled: disabled, options: selectOptions, isOptionEqualToValue: (option, value) => isEqual(option, value), getOptionLabel: (option) => Array.isArray(option)
|
|
40
38
|
? option.map((o) => o.label).join(', ')
|
|
41
39
|
: option.label, getOptionDisabled: (option) => Array.isArray(option)
|
|
42
40
|
? option.some((o) => o.disabled)
|
|
@@ -23,7 +23,7 @@ const FormWrapper = styled('div')({
|
|
|
23
23
|
export const RJSForm = forwardRef((_a, ref) => {
|
|
24
24
|
var { hideSubmitButton, submitButtonProps, actionButtons, validator = ajvValidator, widgets, children, sx, onFocus, onBlur, onClick, templates } = _a, otherProps = __rest(_a, ["hideSubmitButton", "submitButtonProps", "actionButtons", "validator", "widgets", "children", "sx", "onFocus", "onBlur", "onClick", "templates"]);
|
|
25
25
|
// paddingY is resolving an outline glitch that is truncated when inside a container.
|
|
26
|
-
return (_jsx(FormWrapper, { children: _jsx(Box,
|
|
26
|
+
return (_jsx(FormWrapper, { children: _jsx(Box, { sx: Object.assign({ paddingY: '1px' }, sx), onFocus: onFocus, onBlur: onBlur, onClick: onClick, children: _jsxs(Form, Object.assign({ ref: ref, validator: validator, showErrorList: false, widgets: Object.assign(Object.assign({}, internalWidgets), (widgets || {})), templates: Object.assign({ ObjectFieldTemplate }, templates) }, otherProps, { children: [hideSubmitButton && _jsx(Fragment, {}), actionButtons === null || actionButtons === void 0 ? void 0 : actionButtons.map((_a, index) => {
|
|
27
27
|
var { sx } = _a, buttonProps = __rest(_a, ["sx"]);
|
|
28
28
|
return (_jsx(Button, Object.assign({ sx: [
|
|
29
29
|
{
|
|
@@ -33,6 +33,6 @@ export const RJSForm = forwardRef((_a, ref) => {
|
|
|
33
33
|
},
|
|
34
34
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
35
35
|
] }, buttonProps)));
|
|
36
|
-
}), !hideSubmitButton && (_jsx(Button, Object.assign({ children: 'Submit' }, submitButtonProps, { color: "primary", variant: "contained", type: "submit" }))), children] })) })
|
|
36
|
+
}), !hideSubmitButton && (_jsx(Button, Object.assign({ children: 'Submit' }, submitButtonProps, { color: "primary", variant: "contained", type: "submit" }))), children] })) }) }));
|
|
37
37
|
});
|
|
38
38
|
export { Templates };
|
|
@@ -18,5 +18,5 @@ export const IconButtonWithTracking = (_a) => {
|
|
|
18
18
|
const tooltipProps = tooltip && typeof tooltip === 'object' && 'title' in tooltip
|
|
19
19
|
? tooltip
|
|
20
20
|
: { title: tooltip };
|
|
21
|
-
return (_jsx(Tooltip, Object.assign({}, tooltipProps, { children: _jsx(IconButton, Object.assign({}, rest, { onClick: handleClick
|
|
21
|
+
return (_jsx(Tooltip, Object.assign({}, tooltipProps, { children: _jsx(IconButton, Object.assign({}, rest, { onClick: handleClick, children: children })) })));
|
|
22
22
|
};
|
|
@@ -9,12 +9,12 @@ export const LimitedRowImages = ({ items, numberBeforeTruncate, }) => {
|
|
|
9
9
|
return _jsx(_Fragment, { children: "No supported devices" });
|
|
10
10
|
}
|
|
11
11
|
const slicedItems = items.slice(0, numberBeforeTruncate !== null && numberBeforeTruncate !== void 0 ? numberBeforeTruncate : 3);
|
|
12
|
-
return (_jsxs(Box,
|
|
12
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", children: [slicedItems.map((item, index) => {
|
|
13
13
|
var _a;
|
|
14
14
|
return (_jsx(Avatar, { variant: "square", alt: item.name, src: (_a = item.logo) !== null && _a !== void 0 ? _a : '', sx: {
|
|
15
15
|
width: 24,
|
|
16
16
|
height: 24,
|
|
17
17
|
marginRight: 1,
|
|
18
18
|
} }, index));
|
|
19
|
-
}), ' ', items.length > slicedItems.length && (_jsxs(Typography,
|
|
19
|
+
}), ' ', items.length > slicedItems.length && (_jsxs(Typography, { height: "fit-content", variant: "bodySm", children: ["+ ", items.length - slicedItems.length, " more"] }))] }));
|
|
20
20
|
};
|
|
@@ -22,5 +22,5 @@ export const MUILinkWithTracking = (_a) => {
|
|
|
22
22
|
}
|
|
23
23
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
24
24
|
};
|
|
25
|
-
return (_jsx(Link, Object.assign({}, rest, { onClick: handleClick, target: target, rel: target === '_blank' ? 'noreferrer' : undefined
|
|
25
|
+
return (_jsx(Link, Object.assign({}, rest, { onClick: handleClick, target: target, rel: target === '_blank' ? 'noreferrer' : undefined, children: children })));
|
|
26
26
|
};
|
|
@@ -98,14 +98,14 @@ const BaseMap = ({ className, data = [], dataMap, getIcon, onItemClick, apiKey,
|
|
|
98
98
|
return marker;
|
|
99
99
|
})
|
|
100
100
|
.filter((x) => !!x), [data, dataMap, getIcon, onItemClick]);
|
|
101
|
-
return (_jsx(Box,
|
|
101
|
+
return (_jsx(Box, { height: "100%", className: className, children: apiKey && (_jsx(LoadScript, { googleMapsApiKey: apiKey, version: "3", language: "en", children: _jsx(GoogleMap, { mapContainerStyle: {
|
|
102
102
|
height: '100%',
|
|
103
103
|
minHeight: '300px',
|
|
104
104
|
opacity: 1,
|
|
105
|
-
}, options: defaultMapOptions, onLoad: (map) => onGoogleMapsApiLoad(map, markers), onClick: mapClick
|
|
105
|
+
}, options: defaultMapOptions, onLoad: (map) => onGoogleMapsApiLoad(map, markers), onClick: mapClick, children: markers.map((marker) => (_jsx(Marker, { position: {
|
|
106
106
|
lat: isNaN(marker.lat) ? 0 : marker.lat,
|
|
107
107
|
lng: isNaN(marker.lng) ? 0 : marker.lng,
|
|
108
|
-
}, clickable: markers.length > 1, onClick: marker.click, title: marker.title, icon: marker.icon }, marker.id))) })
|
|
108
|
+
}, clickable: markers.length > 1, onClick: marker.click, title: marker.title, icon: marker.icon }, marker.id))) }) })) }));
|
|
109
109
|
};
|
|
110
110
|
/** [View story source](https://github.com/balena-io-modules/rendition/blob/master/src/components/Map/Map.stories.tsx) */
|
|
111
111
|
export const Map = BaseMap;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Box, ListItem, ListItemIcon, Typography, } from '@mui/material';
|
|
4
4
|
export const OrderedListItem = (_a) => {
|
|
5
5
|
var { index, children, sx } = _a, orderedListItemProps = __rest(_a, ["index", "children", "sx"]);
|
|
6
|
-
return (_jsxs(ListItem, Object.assign({ sx: Object.assign({ pl: 0 }, sx) }, orderedListItemProps, { children: [_jsx(ListItemIcon, { children: _jsx(Box,
|
|
6
|
+
return (_jsxs(ListItem, Object.assign({ sx: Object.assign({ pl: 0 }, sx) }, orderedListItemProps, { children: [_jsx(ListItemIcon, { children: _jsx(Box, { sx: {
|
|
7
7
|
borderRadius: '50%',
|
|
8
8
|
backgroundColor: 'info.main',
|
|
9
9
|
width: '1.5em',
|
|
@@ -11,5 +11,5 @@ export const OrderedListItem = (_a) => {
|
|
|
11
11
|
display: 'flex',
|
|
12
12
|
alignItems: 'center',
|
|
13
13
|
justifyContent: 'center',
|
|
14
|
-
}
|
|
14
|
+
}, children: _jsx(Typography, { variant: "body2", color: "white", children: index }) }) }), children] })));
|
|
15
15
|
};
|
|
@@ -22,5 +22,5 @@ export const RouterLinkWithTracking = (_a) => {
|
|
|
22
22
|
}
|
|
23
23
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
24
24
|
};
|
|
25
|
-
return (_jsx(Link, Object.assign({}, rest, { onClick: handleClick, "data-underline": "false"
|
|
25
|
+
return (_jsx(Link, Object.assign({}, rest, { onClick: handleClick, "data-underline": "false", children: children })));
|
|
26
26
|
};
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { Alert } from '@mui/material';
|
|
4
4
|
import { closeSnackbar, SnackbarProvider, } from 'notistack';
|
|
5
5
|
const Toast = React.forwardRef(({ message, id, variant }, ref) => {
|
|
6
|
-
return (_jsx(Alert,
|
|
6
|
+
return (_jsx(Alert, { ref: ref, onClose: () => closeSnackbar(id), severity: variant === 'default' ? 'success' : variant, sx: { alignItems: 'center' }, children: message }));
|
|
7
7
|
});
|
|
8
8
|
export const SnackbarProviderBase = (props) => (_jsx(SnackbarProvider, Object.assign({ Components: {
|
|
9
9
|
default: Toast,
|
|
@@ -4,13 +4,13 @@ import { color } from '@balena/design-tokens';
|
|
|
4
4
|
// TODO use design tokens when available
|
|
5
5
|
const SIZE_MAPPING = {
|
|
6
6
|
small: '14px',
|
|
7
|
-
medium: '20px',
|
|
7
|
+
medium: '20px', // 20px is the default size of the old rendition Spinner
|
|
8
8
|
large: '24px',
|
|
9
9
|
};
|
|
10
10
|
export const Spinner = ({ show = true, children, label, sx, bgVariant = 'light', size = 'medium', zIndex, progress, }) => {
|
|
11
|
-
const SpinnerContent = (_jsxs(_Fragment, { children: [_jsx(CircularProgress, Object.assign({ size: SIZE_MAPPING[size] }, (progress != null && { variant: 'determinate', value: progress }))), label != null && (_jsx(Typography,
|
|
11
|
+
const SpinnerContent = (_jsxs(_Fragment, { children: [_jsx(CircularProgress, Object.assign({ size: SIZE_MAPPING[size] }, (progress != null && { variant: 'determinate', value: progress }))), label != null && (_jsx(Typography, { color: bgVariant === 'dark' ? color.text.inverse.value : 'default', children: label }))] }));
|
|
12
12
|
if (children == null) {
|
|
13
|
-
return (_jsx(Box,
|
|
13
|
+
return (_jsx(Box, { sx: [
|
|
14
14
|
{
|
|
15
15
|
display: show ? 'flex' : 'none',
|
|
16
16
|
alignItems: 'center',
|
|
@@ -23,18 +23,18 @@ export const Spinner = ({ show = true, children, label, sx, bgVariant = 'light',
|
|
|
23
23
|
], onClick: (e) => {
|
|
24
24
|
e.preventDefault();
|
|
25
25
|
e.stopPropagation();
|
|
26
|
-
}
|
|
26
|
+
}, children: SpinnerContent }));
|
|
27
27
|
}
|
|
28
|
-
return (_jsxs(Box,
|
|
28
|
+
return (_jsxs(Box, { sx: [
|
|
29
29
|
{
|
|
30
30
|
position: 'relative',
|
|
31
31
|
height: '100%',
|
|
32
32
|
width: '100%',
|
|
33
33
|
},
|
|
34
34
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
35
|
-
]
|
|
35
|
+
], children: [_jsx(Box, { sx: Object.assign({ width: '100%', height: '100%' }, (show &&
|
|
36
36
|
bgVariant === 'light' && {
|
|
37
37
|
opacity: 0.4,
|
|
38
38
|
transition: 'opacity 250ms',
|
|
39
|
-
}))
|
|
39
|
+
})), children: children }), _jsx(Backdrop, { sx: Object.assign(Object.assign({ gap: 1, position: 'absolute' }, (bgVariant === 'light' && { backgroundColor: 'unset' })), { zIndex }), open: show, children: SpinnerContent })] }));
|
|
40
40
|
};
|
|
@@ -41,7 +41,7 @@ export const SurroundingOverlay = (_a) => {
|
|
|
41
41
|
scrollingElement === null || scrollingElement === void 0 ? void 0 : scrollingElement.removeEventListener('scroll', () => updateRect());
|
|
42
42
|
};
|
|
43
43
|
}, [scrollingElement, targetElement, updateRect, containerRef]);
|
|
44
|
-
return (_jsxs(Box,
|
|
44
|
+
return (_jsxs(Box, { ref: containerRef, position: "relative", children: [children, clickedRect && Object.values(clickedRect).every((v) => v != null) && (_jsxs(_Fragment, { children: [_jsx(Layer, Object.assign({}, otherProps, { sx: {
|
|
45
45
|
top: 0,
|
|
46
46
|
left: 0,
|
|
47
47
|
right: 0,
|
|
@@ -61,5 +61,5 @@ export const SurroundingOverlay = (_a) => {
|
|
|
61
61
|
right: 0,
|
|
62
62
|
height: clickedRect.height + padding * 2,
|
|
63
63
|
width: clickedRect.right - padding,
|
|
64
|
-
} }))] }))] }))
|
|
64
|
+
} }))] }))] }));
|
|
65
65
|
};
|
|
@@ -15,9 +15,9 @@ export const Tabs = ({ tabs, tabsListBoxProps, defaultTab, onTabChange, }) => {
|
|
|
15
15
|
onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(parseInt(newValue, 10));
|
|
16
16
|
};
|
|
17
17
|
const _a = tabsListBoxProps !== null && tabsListBoxProps !== void 0 ? tabsListBoxProps : {}, { sx } = _a, boxProps = __rest(_a, ["sx"]);
|
|
18
|
-
return (_jsxs(TabContext,
|
|
18
|
+
return (_jsxs(TabContext, { value: tab, children: [_jsx(Box, Object.assign({ sx: [
|
|
19
19
|
{ borderBottom: 1, borderColor: 'divider' },
|
|
20
20
|
// See: https://mui.com/system/getting-started/the-sx-prop/#passing-the-sx-prop
|
|
21
21
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
22
|
-
] }, boxProps, { children: _jsx(TabList,
|
|
22
|
+
] }, boxProps, { children: _jsx(TabList, { onChange: handleChange, children: tabs.map(({ label, tabProps }, index) => (_jsx(Tab, Object.assign({ label: label, value: index.toString() }, tabProps)))) }) })), tabs.map(({ render, tabPanelProps }, index) => (_jsx(TabPanel, Object.assign({ value: index.toString() }, tabPanelProps, { children: render }))))] }));
|
|
23
23
|
};
|
|
@@ -4,12 +4,12 @@ import { Tooltip, Typography } from '@mui/material';
|
|
|
4
4
|
* This component will truncate text depending on the settings passed by props.
|
|
5
5
|
*/
|
|
6
6
|
export const Truncate = ({ children, lineCamp, tooltip, }) => {
|
|
7
|
-
return (_jsx(Tooltip,
|
|
7
|
+
return (_jsx(Tooltip, { title: tooltip && typeof children === 'string' ? children : undefined, children: _jsx(Typography, { component: "span", sx: {
|
|
8
8
|
lineHeight: '2rem',
|
|
9
9
|
display: '-webkit-box',
|
|
10
10
|
overflow: 'hidden !important',
|
|
11
11
|
textOverflow: 'ellipsis',
|
|
12
12
|
WebkitLineClamp: lineCamp,
|
|
13
13
|
WebkitBoxOrient: 'vertical',
|
|
14
|
-
}
|
|
14
|
+
}, children: children }) }));
|
|
15
15
|
};
|
|
@@ -9,4 +9,6 @@ export interface VirtualizedAutocompleteWithPaginationProps<Value, Multiple exte
|
|
|
9
9
|
totalItems: number;
|
|
10
10
|
}>;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
declare const VirtualizedAutocompleteBase: <Value, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ renderOption, getOptionLabel, value, ...props }: VirtualizedAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> | VirtualizedAutocompleteWithPaginationProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const VirtualizedAutocomplete: typeof VirtualizedAutocompleteBase;
|
|
14
|
+
export {};
|
|
@@ -32,7 +32,7 @@ const ListboxComponent = (_a) => {
|
|
|
32
32
|
]);
|
|
33
33
|
return (_jsxs(Box, Object.assign({}, props, { style: Object.assign(Object.assign({}, props.style), { padding: 0, height: document.documentElement.clientHeight * 0.4 < optionHeightsTotal
|
|
34
34
|
? '40vh'
|
|
35
|
-
: optionHeightsTotal, display: 'flex', flexDirection: 'column' })
|
|
35
|
+
: optionHeightsTotal, display: 'flex', flexDirection: 'column' }), children: [_jsx(VList, { style: {
|
|
36
36
|
flex: 1,
|
|
37
37
|
}, onRangeChange: (_, lastItemIndex) => {
|
|
38
38
|
if (itemCount != null &&
|
|
@@ -40,12 +40,12 @@ const ListboxComponent = (_a) => {
|
|
|
40
40
|
lastItemIndex + 1 < itemCount) {
|
|
41
41
|
loadNextPage === null || loadNextPage === void 0 ? void 0 : loadNextPage();
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}, children: itemData.map((item, i) => (_createElement(ListItemButton, Object.assign({}, item.props, { key: Math.random(), sx: {
|
|
44
44
|
mt: i === 0 ? `${MUI_LIST_VERTICAL_PADDING}px` : 0,
|
|
45
45
|
mb: i === (itemCount !== null && itemCount !== void 0 ? itemCount : itemData.length) - 1
|
|
46
46
|
? `${MUI_LIST_VERTICAL_PADDING}px`
|
|
47
47
|
: 0,
|
|
48
|
-
} }), item.option))) })
|
|
48
|
+
} }), item.option))) }), isNextPageLoading && (_jsx(Box, { style: {
|
|
49
49
|
position: 'absolute',
|
|
50
50
|
top: 0,
|
|
51
51
|
right: 0,
|
|
@@ -56,7 +56,7 @@ const ListboxComponent = (_a) => {
|
|
|
56
56
|
alignItems: 'center',
|
|
57
57
|
backgroundColor: 'rgb(0, 0, 0, 0.4)',
|
|
58
58
|
color: 'white',
|
|
59
|
-
}
|
|
59
|
+
}, children: "Loading..." }))] })));
|
|
60
60
|
};
|
|
61
61
|
const VirtualizedAutocompleteBase = (_a) => {
|
|
62
62
|
var { renderOption, getOptionLabel, value } = _a, props = __rest(_a, ["renderOption", "getOptionLabel", "value"]);
|
|
@@ -68,7 +68,7 @@ export const AnalyticsContextProvider = ({ initialState, children }) => {
|
|
|
68
68
|
}
|
|
69
69
|
}, [initialState]);
|
|
70
70
|
const value = { state, dispatch };
|
|
71
|
-
return (_jsx(AnalyticsStateContext.Provider,
|
|
71
|
+
return (_jsx(AnalyticsStateContext.Provider, { value: value, children: children }));
|
|
72
72
|
};
|
|
73
73
|
export const useAnalyticsContext = () => {
|
|
74
74
|
const context = useContext(AnalyticsStateContext);
|
package/dist/docs/utils.d.ts
CHANGED
|
@@ -32,12 +32,12 @@ export declare const ColorRow: ({ token, description, }: {
|
|
|
32
32
|
/**
|
|
33
33
|
* split pascalcase into lowercase words separated with dots or dashes, and remove first separator
|
|
34
34
|
*/
|
|
35
|
-
export declare const formatTokenName: (tokenName: string, separator:
|
|
36
|
-
export declare const getVariableFromTokenName: (tokenName: string, type:
|
|
35
|
+
export declare const formatTokenName: (tokenName: string, separator: "." | "-") => string;
|
|
36
|
+
export declare const getVariableFromTokenName: (tokenName: string, type: "css" | "js") => string;
|
|
37
37
|
export declare const getCategoriesFromTokens: (tokens: JsonToken[]) => string[];
|
|
38
38
|
export declare const LensToggle: (props: ToggleButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
39
|
export declare const TypeScaleItem: ({ variant, isParagraph, }: {
|
|
40
40
|
variant: TypographyVariant;
|
|
41
|
-
isParagraph?: boolean
|
|
41
|
+
isParagraph?: boolean;
|
|
42
42
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
43
43
|
export {};
|
package/dist/docs/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { Box, ToggleButton, ToggleButtonGroup, Typography, } from '@mui/material';
|
|
4
4
|
import { GridView, TableRows } from '@mui/icons-material';
|
|
5
5
|
import { color } from '@balena/design-tokens';
|
|
6
|
-
export const ColorTable = ({ children }) => (_jsxs("table",
|
|
6
|
+
export const ColorTable = ({ children }) => (_jsxs("table", { style: { width: '100%', borderCollapse: 'collapse' }, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { textAlign: 'left', width: '75px' }, children: "Color" }), _jsx("th", { style: { textAlign: 'left' }, children: "Token" }), _jsx("th", { style: { textAlign: 'left' }, children: "Description" }), _jsx("th", { style: { textAlign: 'left' }, children: "Variables" }), _jsx("th", { style: { textAlign: 'left' }, children: "Value" })] }) }), _jsx("tbody", { children: children })] }));
|
|
7
7
|
export const ColorRow = ({ token, description, }) => {
|
|
8
8
|
return (_jsxs("tr", { children: [_jsx("td", { children: _jsx("div", { style: {
|
|
9
9
|
width: '100%',
|
|
@@ -41,11 +41,11 @@ export const LensToggle = (props) => {
|
|
|
41
41
|
const handleChange = (_, newLens) => {
|
|
42
42
|
setLens(newLens);
|
|
43
43
|
};
|
|
44
|
-
return (_jsxs(ToggleButtonGroup, Object.assign({ onChange: handleChange, exclusive: true }, props, { children: [_jsx(ToggleButton,
|
|
44
|
+
return (_jsxs(ToggleButtonGroup, Object.assign({ onChange: handleChange, exclusive: true }, props, { children: [_jsx(ToggleButton, { value: 'grid', title: "Grid lens", selected: lens === 'grid', children: _jsx(GridView, {}) }), _jsx(ToggleButton, { value: 'table', title: "Table lens", selected: lens === 'table', children: _jsx(TableRows, {}) })] })));
|
|
45
45
|
};
|
|
46
46
|
export const TypeScaleItem = ({ variant, isParagraph, }) => {
|
|
47
47
|
const text = !isParagraph
|
|
48
48
|
? 'Lorem ipsum dolor sit amet'
|
|
49
49
|
: 'Lorem ipsum dolor sit amet consectetur. Pretium consectetur et risus ac nisl egestas aliquam odio ac. Aenean urna consectetur at suspendisse. Magnis tincidunt non blandit velit accumsan orci amet mus.';
|
|
50
|
-
return (_jsxs(Box,
|
|
50
|
+
return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column' }, children: [_jsx(Typography, { variant: "overline", sx: { color: color.text.accent.value }, children: variant }), _jsxs(Typography, { variant: variant, children: [text, " "] })] }));
|
|
51
51
|
};
|
package/dist/theme.js
CHANGED
|
@@ -690,7 +690,7 @@ export const theme = createTheme({
|
|
|
690
690
|
styleOverrides: {
|
|
691
691
|
root: {
|
|
692
692
|
'--DataGrid-rowBorderColor': color.border.subtle.value,
|
|
693
|
-
'--DataGrid-containerBackground': '#f2f4fa',
|
|
693
|
+
'--DataGrid-containerBackground': '#f2f4fa', // TODO use a design token when we get rid of rendition in autoui
|
|
694
694
|
border: 'none',
|
|
695
695
|
fontSize: '1rem',
|
|
696
696
|
'.MuiDataGrid-columnHeaderTitle': {
|
|
@@ -855,9 +855,9 @@ export const theme = createTheme({
|
|
|
855
855
|
},
|
|
856
856
|
MuiCheckbox: {
|
|
857
857
|
defaultProps: {
|
|
858
|
-
icon: (_jsx("svg",
|
|
859
|
-
checkedIcon: (_jsxs("svg",
|
|
860
|
-
indeterminateIcon: (_jsxs("svg",
|
|
858
|
+
icon: (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("rect", { x: "0.5", y: "0.5", width: "19", height: "19", rx: "3.5", fill: "white", stroke: "currentColor" }) })),
|
|
859
|
+
checkedIcon: (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { width: "20", height: "20", rx: "4" }), _jsx("path", { d: "M15.2832 6.22852C15.5879 6.50977 15.5879 7.00195 15.2832 7.2832L9.2832 13.2832C9.00195 13.5879 8.50977 13.5879 8.22852 13.2832L5.22852 10.2832C4.92383 10.002 4.92383 9.50977 5.22852 9.22852C5.50977 8.92383 6.00195 8.92383 6.2832 9.22852L8.74414 11.6895L14.2285 6.22852C14.5098 5.92383 15.002 5.92383 15.2832 6.22852Z", fill: "white" })] })),
|
|
860
|
+
indeterminateIcon: (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { width: "20", height: "20", rx: "4" }), _jsx("rect", { x: "5", y: "9", width: "10", height: "2", fill: "white" })] })),
|
|
861
861
|
},
|
|
862
862
|
styleOverrides: {
|
|
863
863
|
root: {
|
|
@@ -876,8 +876,8 @@ export const theme = createTheme({
|
|
|
876
876
|
},
|
|
877
877
|
MuiRadio: {
|
|
878
878
|
defaultProps: {
|
|
879
|
-
icon: (_jsx("svg",
|
|
880
|
-
checkedIcon: (_jsxs("svg",
|
|
879
|
+
icon: (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("circle", { cx: "10", cy: "10", r: "9.5", fill: "white", stroke: "currentColor" }) })),
|
|
880
|
+
checkedIcon: (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "10", cy: "10", r: "9.5", fill: "white", stroke: "currentColor" }), _jsx("circle", { cx: "10", cy: "10", r: "4", fill: "currentColor" })] })),
|
|
881
881
|
},
|
|
882
882
|
styleOverrides: {
|
|
883
883
|
root: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"rehype-raw": "^6.1.1",
|
|
43
43
|
"remark-gfm": "^3.0.1",
|
|
44
44
|
"rimraf": "^5.0.0",
|
|
45
|
-
"typescript": "^
|
|
45
|
+
"typescript": "^5.5.2",
|
|
46
46
|
"virtua": "^0.13.0",
|
|
47
47
|
"zxcvbn": "^4.4.2"
|
|
48
48
|
},
|
|
@@ -112,6 +112,6 @@
|
|
|
112
112
|
},
|
|
113
113
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
114
114
|
"versionist": {
|
|
115
|
-
"publishedAt": "2024-06-
|
|
115
|
+
"publishedAt": "2024-06-20T21:22:31.290Z"
|
|
116
116
|
}
|
|
117
117
|
}
|