@balena/ui-shared-components 2.0.1 → 2.0.2
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/ButtonWithTracking/index.d.ts +2 -2
- package/dist/components/ButtonWithTracking/index.js +2 -1
- package/dist/components/DownloadImageDialog/index.js +6 -3
- package/dist/components/DropDownButton/index.d.ts +3 -3
- package/dist/components/DropDownButton/index.js +2 -2
- package/dist_esm5/components/ButtonWithTracking/index.d.ts +2 -2
- package/dist_esm5/components/ButtonWithTracking/index.js +2 -1
- package/dist_esm5/components/DownloadImageDialog/index.js +6 -3
- package/dist_esm5/components/DropDownButton/index.d.ts +3 -3
- package/dist_esm5/components/DropDownButton/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps } from '@mui/material';
|
|
2
|
+
import { type ButtonProps, type TooltipProps } from '@mui/material';
|
|
3
3
|
export interface ButtonWithTrackingProps extends ButtonProps {
|
|
4
4
|
eventName: string;
|
|
5
5
|
eventProperties?: {
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
};
|
|
8
|
-
tooltip?: string
|
|
8
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* This button will send analytics in case the analytics context is passed through the provider (AnalyticsProvider).
|
|
@@ -36,5 +36,6 @@ export var ButtonWithTracking = function (_a) {
|
|
|
36
36
|
}
|
|
37
37
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
var tooltipProps = typeof tooltip === 'string' || !tooltip ? { title: tooltip } : tooltip;
|
|
40
|
+
return (_jsx(Tooltip, __assign({}, tooltipProps, { children: _jsx(Button, __assign({}, rest, { onClick: handleClick, disableElevation: true }, { children: children })) })));
|
|
40
41
|
};
|
|
@@ -203,9 +203,12 @@ export var DownloadImageDialog = function (_a) {
|
|
|
203
203
|
},
|
|
204
204
|
children: (_jsxs(_Fragment, { children: [_jsx("img", { width: "20px", alt: "etcher", src: etcherLogoBase64 }), " Flash"] })),
|
|
205
205
|
disabled: hasDockerImageDownload,
|
|
206
|
-
tooltip:
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
tooltip: {
|
|
207
|
+
title: hasDockerImageDownload
|
|
208
|
+
? 'This image is deployed to docker so you can only download its config'
|
|
209
|
+
: 'Etcher v1.7.2 or greater is required',
|
|
210
|
+
placement: 'top',
|
|
211
|
+
},
|
|
209
212
|
},
|
|
210
213
|
{
|
|
211
214
|
eventName: 'Download balenaOS Clicked',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonGroupProps, MenuItemProps, ButtonProps } from '@mui/material';
|
|
2
|
+
import { ButtonGroupProps, MenuItemProps, ButtonProps, TooltipProps } from '@mui/material';
|
|
3
3
|
type MenuItemType<T> = MenuItemWithTrackingProps & T & {
|
|
4
|
-
tooltip?: string |
|
|
4
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
5
5
|
};
|
|
6
6
|
export interface DropDownButtonProps<T = unknown> extends Omit<ButtonGroupProps & ButtonProps, 'onClick'> {
|
|
7
7
|
items: Array<MenuItemType<T>>;
|
|
@@ -19,7 +19,7 @@ export interface MenuItemWithTrackingProps extends Omit<MenuItemProps, 'onClick'
|
|
|
19
19
|
eventProperties?: {
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
};
|
|
22
|
-
tooltip?: string
|
|
22
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
23
23
|
onClick?: React.MouseEventHandler<HTMLLIElement | HTMLButtonElement>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
@@ -80,7 +80,6 @@ export var DropDownButton = function (_a) {
|
|
|
80
80
|
}, [items, groupByProp]);
|
|
81
81
|
var handleClick = function (event) {
|
|
82
82
|
var _a, _b, _c;
|
|
83
|
-
setAnchorEl(event.currentTarget);
|
|
84
83
|
return ((_c = (_b = (_a = items === null || items === void 0 ? void 0 : items[selectedIndex]) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event)) !== null && _c !== void 0 ? _c : onClick === null || onClick === void 0 ? void 0 : onClick(event, items[selectedIndex]));
|
|
85
84
|
};
|
|
86
85
|
var handleMenuItemClick = function (event, index) {
|
|
@@ -114,5 +113,6 @@ export var MenuItemWithTracking = function (_a) {
|
|
|
114
113
|
}
|
|
115
114
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
116
115
|
};
|
|
117
|
-
|
|
116
|
+
var tooltipProps = typeof tooltip === 'string' || !tooltip ? { title: tooltip } : tooltip;
|
|
117
|
+
return (_jsx(Tooltip, __assign({}, tooltipProps, { children: _jsx(MenuItem, __assign({}, menuItem, { onClick: handleClick }, { children: children })) })));
|
|
118
118
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps } from '@mui/material';
|
|
2
|
+
import { type ButtonProps, type TooltipProps } from '@mui/material';
|
|
3
3
|
export interface ButtonWithTrackingProps extends ButtonProps {
|
|
4
4
|
eventName: string;
|
|
5
5
|
eventProperties?: {
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
};
|
|
8
|
-
tooltip?: string
|
|
8
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* This button will send analytics in case the analytics context is passed through the provider (AnalyticsProvider).
|
|
@@ -15,5 +15,6 @@ export var ButtonWithTracking = function (_a) {
|
|
|
15
15
|
}
|
|
16
16
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
var tooltipProps = typeof tooltip === 'string' || !tooltip ? { title: tooltip } : tooltip;
|
|
19
|
+
return (_jsx(Tooltip, __assign({}, tooltipProps, { children: _jsx(Button, __assign({}, rest, { onClick: handleClick, disableElevation: true }, { children: children })) })));
|
|
19
20
|
};
|
|
@@ -132,9 +132,12 @@ export var DownloadImageDialog = function (_a) {
|
|
|
132
132
|
},
|
|
133
133
|
children: (_jsxs(_Fragment, { children: [_jsx("img", { width: "20px", alt: "etcher", src: etcherLogoBase64 }), " Flash"] })),
|
|
134
134
|
disabled: hasDockerImageDownload,
|
|
135
|
-
tooltip:
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
tooltip: {
|
|
136
|
+
title: hasDockerImageDownload
|
|
137
|
+
? 'This image is deployed to docker so you can only download its config'
|
|
138
|
+
: 'Etcher v1.7.2 or greater is required',
|
|
139
|
+
placement: 'top',
|
|
140
|
+
},
|
|
138
141
|
},
|
|
139
142
|
{
|
|
140
143
|
eventName: 'Download balenaOS Clicked',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonGroupProps, MenuItemProps, ButtonProps } from '@mui/material';
|
|
2
|
+
import { ButtonGroupProps, MenuItemProps, ButtonProps, TooltipProps } from '@mui/material';
|
|
3
3
|
type MenuItemType<T> = MenuItemWithTrackingProps & T & {
|
|
4
|
-
tooltip?: string |
|
|
4
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
5
5
|
};
|
|
6
6
|
export interface DropDownButtonProps<T = unknown> extends Omit<ButtonGroupProps & ButtonProps, 'onClick'> {
|
|
7
7
|
items: Array<MenuItemType<T>>;
|
|
@@ -19,7 +19,7 @@ export interface MenuItemWithTrackingProps extends Omit<MenuItemProps, 'onClick'
|
|
|
19
19
|
eventProperties?: {
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
};
|
|
22
|
-
tooltip?: string
|
|
22
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
23
23
|
onClick?: React.MouseEventHandler<HTMLLIElement | HTMLButtonElement>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
@@ -34,7 +34,6 @@ export var DropDownButton = function (_a) {
|
|
|
34
34
|
}, [items, groupByProp]);
|
|
35
35
|
var handleClick = function (event) {
|
|
36
36
|
var _a, _b, _c;
|
|
37
|
-
setAnchorEl(event.currentTarget);
|
|
38
37
|
return ((_c = (_b = (_a = items === null || items === void 0 ? void 0 : items[selectedIndex]) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event)) !== null && _c !== void 0 ? _c : onClick === null || onClick === void 0 ? void 0 : onClick(event, items[selectedIndex]));
|
|
39
38
|
};
|
|
40
39
|
var handleMenuItemClick = function (event, index) {
|
|
@@ -68,5 +67,6 @@ export var MenuItemWithTracking = function (_a) {
|
|
|
68
67
|
}
|
|
69
68
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
70
69
|
};
|
|
71
|
-
|
|
70
|
+
var tooltipProps = typeof tooltip === 'string' || !tooltip ? { title: tooltip } : tooltip;
|
|
71
|
+
return (_jsx(Tooltip, __assign({}, tooltipProps, { children: _jsx(MenuItem, __assign({}, menuItem, { onClick: handleClick }, { children: children })) })));
|
|
72
72
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist_esm5/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -112,6 +112,6 @@
|
|
|
112
112
|
},
|
|
113
113
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
114
114
|
"versionist": {
|
|
115
|
-
"publishedAt": "2024-02-
|
|
115
|
+
"publishedAt": "2024-02-13T11:45:12.685Z"
|
|
116
116
|
}
|
|
117
117
|
}
|