@seamapi/react 0.25.0 → 0.26.1
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 +5 -4
- package/index.css +20 -0
- package/index.css.map +1 -1
- package/index.min.css +1 -1
- package/index.min.css.map +1 -1
- package/lib/copy-to-clipboard.d.ts +1 -0
- package/lib/copy-to-clipboard.js +4 -0
- package/lib/copy-to-clipboard.js.map +1 -0
- package/lib/ui/AccessCodeTable/AccessCodeTable.js +4 -4
- package/lib/ui/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/ui/AccessCodeTable/CodeDetails.js +3 -1
- package/lib/ui/AccessCodeTable/CodeDetails.js.map +1 -1
- package/lib/ui/Alert/Alert.d.ts +6 -4
- package/lib/ui/Alert/Alert.js +7 -4
- package/lib/ui/Alert/Alert.js.map +1 -1
- package/lib/ui/Alert/Alerts.d.ts +4 -4
- package/lib/ui/Alert/Alerts.js +4 -2
- package/lib/ui/Alert/Alerts.js.map +1 -1
- package/lib/ui/DeviceDetails/DeviceDetails.js +2 -3
- package/lib/ui/DeviceDetails/DeviceDetails.js.map +1 -1
- package/lib/ui/DeviceTable/DeviceRow.d.ts +2 -2
- package/lib/ui/DeviceTable/DeviceRow.js +1 -2
- package/lib/ui/DeviceTable/DeviceRow.js.map +1 -1
- package/lib/ui/Menu/Menu.d.ts +9 -10
- package/lib/ui/Menu/Menu.js +23 -21
- package/lib/ui/Menu/Menu.js.map +1 -1
- package/lib/ui/Menu/MenuItem.d.ts +4 -4
- package/lib/ui/Menu/MenuItem.js +1 -1
- package/lib/ui/Menu/MenuItem.js.map +1 -1
- package/lib/ui/Menu/MoreActionsMenu.d.ts +5 -4
- package/lib/ui/Menu/MoreActionsMenu.js +6 -6
- package/lib/ui/Menu/MoreActionsMenu.js.map +1 -1
- package/lib/ui/SupportedDevices/SupportedDeviceRow.d.ts +1 -1
- package/lib/ui/SupportedDevices/SupportedDeviceRow.js +8 -14
- package/lib/ui/SupportedDevices/SupportedDeviceRow.js.map +1 -1
- package/lib/ui/SupportedDevices/SupportedDevices.js +2 -2
- package/lib/ui/SupportedDevices/SupportedDevices.js.map +1 -1
- package/lib/ui/SupportedDevices/SupportedDevicesHeader.d.ts +1 -1
- package/lib/ui/SupportedDevices/SupportedDevicesHeader.js +1 -1
- package/lib/ui/SupportedDevices/SupportedDevicesHeader.js.map +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterBar.d.ts +3 -2
- package/lib/ui/Table/TableFilterBar/TableFilterBar.js +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterBar.js.map +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterItem.d.ts +2 -1
- package/lib/ui/Table/TableFilterBar/TableFilterItem.js +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterItem.js.map +1 -1
- package/lib/ui/TextField/TextField.d.ts +1 -1
- package/lib/ui/TextField/TextField.js +2 -2
- package/lib/ui/TextField/TextField.js.map +1 -1
- package/lib/ui/device/BatteryStatus.d.ts +2 -1
- package/lib/ui/device/LockStatus.d.ts +2 -1
- package/lib/ui/device/OnlineStatus.d.ts +2 -1
- package/lib/ui/types.d.ts +1 -0
- package/lib/ui/typography/Title.d.ts +2 -2
- package/lib/ui/typography/Title.js +3 -2
- package/lib/ui/typography/Title.js.map +1 -1
- package/lib/use-toggle.d.ts +1 -2
- package/lib/use-toggle.js +1 -2
- package/lib/use-toggle.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/copy-to-clipboard.ts +3 -0
- package/src/lib/ui/AccessCodeTable/AccessCodeTable.tsx +5 -5
- package/src/lib/ui/AccessCodeTable/CodeDetails.tsx +6 -1
- package/src/lib/ui/Alert/Alert.tsx +21 -18
- package/src/lib/ui/Alert/Alerts.tsx +7 -5
- package/src/lib/ui/DeviceDetails/DeviceDetails.tsx +3 -6
- package/src/lib/ui/DeviceTable/DeviceRow.tsx +5 -5
- package/src/lib/ui/Menu/Menu.tsx +34 -34
- package/src/lib/ui/Menu/MenuItem.tsx +6 -4
- package/src/lib/ui/Menu/MoreActionsMenu.tsx +15 -10
- package/src/lib/ui/SupportedDevices/SupportedDeviceRow.tsx +9 -20
- package/src/lib/ui/SupportedDevices/SupportedDevices.tsx +2 -2
- package/src/lib/ui/SupportedDevices/SupportedDevicesHeader.tsx +1 -1
- package/src/lib/ui/Table/TableFilterBar/TableFilterBar.tsx +5 -3
- package/src/lib/ui/Table/TableFilterBar/TableFilterItem.tsx +2 -2
- package/src/lib/ui/TextField/TextField.tsx +2 -2
- package/src/lib/ui/device/BatteryStatus.tsx +1 -1
- package/src/lib/ui/device/LockStatus.tsx +1 -1
- package/src/lib/ui/device/OnlineStatus.tsx +1 -1
- package/src/lib/ui/types.ts +1 -0
- package/src/lib/ui/typography/Title.tsx +13 -3
- package/src/lib/use-toggle.ts +3 -3
- package/src/styles/_access-code-table.scss +11 -0
- package/src/styles/_device-table.scss +5 -0
- package/src/styles/_supported-devices.scss +0 -1
- package/src/styles/_typography.scss +11 -0
- package/lib/copy.d.ts +0 -1
- package/lib/copy.js +0 -4
- package/lib/copy.js.map +0 -1
- package/src/lib/copy.ts +0 -3
package/lib/ui/Menu/Menu.js
CHANGED
|
@@ -2,15 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useState, } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const menuContext = createContext({
|
|
6
|
+
close: () => { },
|
|
7
|
+
});
|
|
8
|
+
export function Menu({ verticalOffset = 5, horizontalOffset = 0, edgeOffset = 5, children, renderButton, backgroundProps, }) {
|
|
9
|
+
const { Provider } = menuContext;
|
|
7
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
8
11
|
const [documentEl, setDocumentEl] = useState(null);
|
|
9
12
|
const [contentEl, setContentEl] = useState(null);
|
|
10
13
|
const [top, setTop] = useState(0);
|
|
11
14
|
const [left, setLeft] = useState(0);
|
|
12
15
|
useEffect(() => {
|
|
13
|
-
const containers = document
|
|
16
|
+
const containers = globalThis?.document?.querySelectorAll('.seam-components');
|
|
17
|
+
if (containers == null)
|
|
18
|
+
return;
|
|
14
19
|
const el = containers[containers.length - 1];
|
|
15
20
|
if (el != null) {
|
|
16
21
|
setDocumentEl(el);
|
|
@@ -19,7 +24,7 @@ const Menu = ({ verticalOffset = 5, horizontalOffset = 0, edgeOffset = 5, childr
|
|
|
19
24
|
const handleClose = () => {
|
|
20
25
|
setAnchorEl(null);
|
|
21
26
|
};
|
|
22
|
-
const
|
|
27
|
+
const handleOpen = (event) => {
|
|
23
28
|
setAnchorEl(event.currentTarget);
|
|
24
29
|
};
|
|
25
30
|
const setPositions = useCallback(() => {
|
|
@@ -33,15 +38,13 @@ const Menu = ({ verticalOffset = 5, horizontalOffset = 0, edgeOffset = 5, childr
|
|
|
33
38
|
const left = anchorLeft + horizontalOffset;
|
|
34
39
|
const right = left + contentWidth;
|
|
35
40
|
const bottom = top + contentHeight;
|
|
36
|
-
// If the content would overflow right,
|
|
37
|
-
// to the right of the container.
|
|
41
|
+
// If the content would overflow right, set it relative to the right of the container.
|
|
38
42
|
const isOverflowingRight = right > containerRight;
|
|
39
43
|
const visibleLeft = isOverflowingRight
|
|
40
44
|
? containerRight - contentWidth - horizontalOffset - edgeOffset
|
|
41
45
|
: left;
|
|
42
46
|
setLeft(visibleLeft);
|
|
43
|
-
// If the content would overflow bottom,
|
|
44
|
-
// above the anchor.
|
|
47
|
+
// If the content would overflow bottom, position it above the anchor.
|
|
45
48
|
const isOverFlowingBottom = bottom > containerBottom;
|
|
46
49
|
const visibleTop = isOverFlowingBottom
|
|
47
50
|
? anchorTop - contentHeight - verticalOffset
|
|
@@ -55,39 +58,38 @@ const Menu = ({ verticalOffset = 5, horizontalOffset = 0, edgeOffset = 5, childr
|
|
|
55
58
|
documentEl,
|
|
56
59
|
edgeOffset,
|
|
57
60
|
]);
|
|
58
|
-
const isOpen = Boolean(anchorEl);
|
|
59
61
|
useLayoutEffect(() => {
|
|
60
62
|
setPositions();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
globalThis?.addEventListener('scroll', setPositions);
|
|
64
|
+
globalThis?.addEventListener('resize', setPositions);
|
|
63
65
|
return () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
globalThis?.removeEventListener('scroll', setPositions);
|
|
67
|
+
globalThis?.removeEventListener('resize', setPositions);
|
|
66
68
|
};
|
|
67
69
|
}, [setPositions]);
|
|
70
|
+
const isOpen = anchorEl != null;
|
|
68
71
|
const hasSetPosition = top !== 0 && left !== 0;
|
|
69
72
|
const visible = isOpen && hasSetPosition;
|
|
70
73
|
if (documentEl == null) {
|
|
71
74
|
return null;
|
|
72
75
|
}
|
|
73
|
-
return (_jsxs(
|
|
76
|
+
return (_jsxs(Provider, { value: {
|
|
74
77
|
close: handleClose,
|
|
75
|
-
}, children: [
|
|
78
|
+
}, children: [renderButton({ onOpen: handleOpen }), createPortal(_jsx("div", { className: classNames('seam-menu-bg', backgroundProps?.className), style: {
|
|
76
79
|
display: visible ? 'flex' : 'none',
|
|
77
|
-
}, onClick: (
|
|
78
|
-
|
|
80
|
+
}, onClick: (event) => {
|
|
81
|
+
event.stopPropagation();
|
|
79
82
|
handleClose();
|
|
80
83
|
}, children: _jsx("div", { className: 'seam-menu-content', style: {
|
|
81
84
|
top,
|
|
82
85
|
left,
|
|
83
86
|
}, children: children }) }), documentEl), _jsx("div", { className: 'seam-menu-shadow', children: _jsx("div", { className: 'seam-menu-content', ref: setContentEl, children: children }) })] }));
|
|
84
|
-
}
|
|
87
|
+
}
|
|
85
88
|
export function useMenu() {
|
|
86
|
-
const context = useContext(
|
|
87
|
-
if (context
|
|
89
|
+
const context = useContext(menuContext);
|
|
90
|
+
if (context == null) {
|
|
88
91
|
throw new Error('useMenu must be used within a Menu.');
|
|
89
92
|
}
|
|
90
93
|
return context;
|
|
91
94
|
}
|
|
92
|
-
export default Menu;
|
|
93
95
|
//# sourceMappingURL=Menu.js.map
|
package/lib/ui/Menu/Menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/lib/ui/Menu/Menu.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/lib/ui/Menu/Menu.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EACL,aAAa,EAGb,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAkBxC,MAAM,WAAW,GAAG,aAAa,CAAmB;IAClD,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC,CAAA;AAEF,MAAM,UAAU,IAAI,CAAC,EACnB,cAAc,GAAG,CAAC,EAClB,gBAAgB,GAAG,CAAC,EACpB,UAAU,GAAG,CAAC,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,GACc;IAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAA;IAChC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAqB,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAA;IACvE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACjC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAA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AO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,MAAC,QAAQ,IACP,KAAK,EAAE;YACL,KAAK,EAAE,WAAW;SACnB,aAEA,YAAY,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EACpC,YAAY,CACX,cACE,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE,eAAe,EAAE,SAAS,CAAC,EACjE,KAAK,EAAE;oBACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;iBACnC,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBACjB,KAAK,CAAC,eAAe,EAAE,CAAA;oBACvB,WAAW,EAAE,CAAA;gBACf,CAAC,YAED,cACE,SAAS,EAAC,mBAAmB,EAC7B,KAAK,EAAE;wBACL,GAAG;wBACH,IAAI;qBACL,YAEA,QAAQ,GACL,GACF,EACN,UAAU,CACX,EAMD,cAAK,SAAS,EAAC,kBAAkB,YAC/B,cAAK,SAAS,EAAC,mBAAmB,EAAC,GAAG,EAAE,YAAY,YACjD,QAAQ,GACL,GACF,IACG,CACZ,CAAA;AACH,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACvC,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;KACvD;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
children: ReactNode;
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
interface MenuItemProps {
|
|
4
3
|
onClick: () => void;
|
|
5
4
|
}
|
|
6
|
-
export declare function MenuItem({ children,
|
|
5
|
+
export declare function MenuItem({ onClick, children, }: PropsWithChildren<MenuItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
package/lib/ui/Menu/MenuItem.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMenu } from '../../../lib/ui/Menu/Menu.js';
|
|
3
|
-
export function MenuItem({ children,
|
|
3
|
+
export function MenuItem({ onClick, children, }) {
|
|
4
4
|
const { close: closeMenu } = useMenu();
|
|
5
5
|
return (_jsx("div", { className: 'seam-menu-item', onClick: () => {
|
|
6
6
|
onClick();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../src/lib/ui/Menu/MenuItem.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../src/lib/ui/Menu/MenuItem.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAM7C,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,EACP,QAAQ,GACyB;IACjC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAA;IAEtC,OAAO,CACL,cACE,SAAS,EAAC,gBAAgB,EAC1B,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,EAAE,CAAA;YACT,SAAS,EAAE,CAAA;QACb,CAAC,YAEA,QAAQ,GACL,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
1
2
|
import { type MenuProps } from '../../../lib/ui/Menu/Menu.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
MenuProps?: Partial<MenuProps>;
|
|
3
|
+
interface MoreActionsMenuProps {
|
|
4
|
+
menuProps?: Partial<MenuProps>;
|
|
5
5
|
}
|
|
6
|
-
export declare function MoreActionsMenu({ children,
|
|
6
|
+
export declare function MoreActionsMenu({ children, menuProps, }: PropsWithChildren<MoreActionsMenuProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { DotsEllipsisMoreIcon } from '../../../lib/icons/DotsEllipsisMore.js';
|
|
3
3
|
import { IconButton } from '../../../lib/ui/IconButton.js';
|
|
4
|
-
import Menu
|
|
5
|
-
export function MoreActionsMenu({ children,
|
|
6
|
-
return (_jsx(Menu, {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, children: _jsx(DotsEllipsisMoreIcon, {}) })), ...
|
|
4
|
+
import { Menu } from '../../../lib/ui/Menu/Menu.js';
|
|
5
|
+
export function MoreActionsMenu({ children, menuProps, }) {
|
|
6
|
+
return (_jsx(Menu, { renderButton: ({ onOpen }) => (_jsx(IconButton, { onClick: (event) => {
|
|
7
|
+
event.stopPropagation();
|
|
8
|
+
onOpen(event);
|
|
9
|
+
}, children: _jsx(DotsEllipsisMoreIcon, {}) })), ...menuProps, children: children }));
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=MoreActionsMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoreActionsMenu.js","sourceRoot":"","sources":["../../../src/lib/ui/Menu/MoreActionsMenu.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"MoreActionsMenu.js","sourceRoot":"","sources":["../../../src/lib/ui/Menu/MoreActionsMenu.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAkB,MAAM,qBAAqB,CAAA;AAM1D,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,SAAS,GAC+B;IACxC,OAAO,CACL,KAAC,IAAI,IACH,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAC5B,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACjB,KAAK,CAAC,eAAe,EAAE,CAAA;gBACvB,MAAM,CAAC,KAAK,CAAC,CAAA;YACf,CAAC,YAED,KAAC,oBAAoB,KAAG,GACb,CACd,KACG,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAA;AACH,CAAC"}
|
|
@@ -2,4 +2,4 @@ import type { DeviceModel } from '../../../lib/ui/SupportedDevices/types.js';
|
|
|
2
2
|
export interface SupportedDeviceRowProps {
|
|
3
3
|
deviceModel: DeviceModel;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export declare function SupportedDeviceRow({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
case 'Live':
|
|
7
|
-
return 'green';
|
|
8
|
-
case 'Beta':
|
|
9
|
-
return 'blue';
|
|
10
|
-
case 'Unsupported':
|
|
11
|
-
return 'orange';
|
|
12
|
-
default:
|
|
13
|
-
return 'gray';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return (_jsxs("tr", { children: [_jsx("td", { children: _jsx("img", { style: { width: 40 }, src: deviceModel.icon_url }) }), _jsx("td", { children: deviceModel.main_category }), _jsx("td", { children: deviceModel.model_name }), _jsx("td", { children: deviceModel.manufacturer_model_id }), _jsx("td", { children: deviceModel.connection_type }), _jsx("td", { children: _jsx("div", { className: classNames('seam-status-pill', `status-${getColorFromSupportLevel()}`), children: _jsx("span", { children: deviceModel.support_level }) }) })] }));
|
|
3
|
+
export function SupportedDeviceRow({ deviceModel }) {
|
|
4
|
+
const statusColor = supportLevelColors[deviceModel.support_level] ?? 'gray';
|
|
5
|
+
return (_jsxs("tr", { children: [_jsx("td", { children: _jsx("img", { style: { width: 40 }, src: deviceModel.icon_url }) }), _jsx("td", { children: deviceModel.main_category }), _jsx("td", { children: deviceModel.model_name }), _jsx("td", { children: deviceModel.manufacturer_model_id }), _jsx("td", { children: deviceModel.connection_type }), _jsx("td", { children: _jsx("div", { className: classNames('seam-status-pill', `status-${statusColor}`), children: _jsx("span", { children: deviceModel.support_level }) }) })] }));
|
|
17
6
|
}
|
|
7
|
+
const supportLevelColors = {
|
|
8
|
+
Live: 'green',
|
|
9
|
+
Beta: 'blue',
|
|
10
|
+
Unsupported: 'orange',
|
|
11
|
+
};
|
|
18
12
|
//# sourceMappingURL=SupportedDeviceRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDevices/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,
|
|
1
|
+
{"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDevices/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,kBAAkB,CAAC,EAAE,WAAW,EAA2B;IACzE,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,MAAM,CAAA;IAC3E,OAAO,CACL,yBACE,uBACE,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,CAAC,QAAQ,GAAI,GACrD,EACL,uBAAK,WAAW,CAAC,aAAa,GAAM,EACpC,uBAAK,WAAW,CAAC,UAAU,GAAM,EACjC,uBAAK,WAAW,CAAC,qBAAqB,GAAM,EAC5C,uBAAK,WAAW,CAAC,eAAe,GAAM,EACtC,uBACE,cACE,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,UAAU,WAAW,EAAE,CAAC,YAElE,yBAAO,WAAW,CAAC,aAAa,GAAQ,GACpC,GACH,IACF,CACN,CAAA;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,QAAQ;CACtB,CAAA"}
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useQuery } from '@tanstack/react-query';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { Button } from '../../../lib/ui/Button.js';
|
|
5
|
-
import SupportedDeviceRow from './SupportedDeviceRow.js';
|
|
6
|
-
import SupportedDevicesHeader from './SupportedDevicesHeader.js';
|
|
5
|
+
import { SupportedDeviceRow } from './SupportedDeviceRow.js';
|
|
6
|
+
import { SupportedDevicesHeader } from './SupportedDevicesHeader.js';
|
|
7
7
|
export function SupportedDevices() {
|
|
8
8
|
const { data, isLoading, isError, refetch } = useQuery({
|
|
9
9
|
queryKey: ['supported_devices'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDevices.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDevices/SupportedDevices.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGzC,OAAO,kBAAkB,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"SupportedDevices.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDevices/SupportedDevices.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGzC,OAAO,EAAE,kBAAk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): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export
|
|
2
|
+
export function SupportedDevicesHeader() {
|
|
3
3
|
return (_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { children: "Category" }), _jsx("th", { children: "Model Name" }), _jsx("th", { children: "Manufacturer Model ID" }), _jsx("th", { children: "Connection Type" }), _jsx("th", { children: "Status" })] }) }));
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=SupportedDevicesHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDevicesHeader.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDevices/SupportedDevicesHeader.tsx"],"names":[],"mappings":";AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"SupportedDevicesHeader.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDevices/SupportedDevicesHeader.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,sBAAsB;IACpC,OAAO,CACL,0BACE,yBACE,cAAM,EACN,oCAAiB,EACjB,sCAAmB,EACnB,iDAA8B,EAC9B,2CAAwB,EACxB,kCAAe,IACZ,GACC,CACT,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DivProps } from '../../../../lib/ui/types.js';
|
|
2
|
-
|
|
2
|
+
interface TableFilterBarProps extends DivProps {
|
|
3
3
|
isFilterCleared?: boolean;
|
|
4
4
|
onFilterClear?: () => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function TableFilterBar({ isFilterCleared, onFilterClear, children, ...props }:
|
|
6
|
+
export declare function TableFilterBar({ isFilterCleared, onFilterClear, children, ...props }: TableFilterBarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { ArrowRestartIcon } from '../../../../lib/icons/ArrowRestart.js';
|
|
|
3
3
|
import { IconButton } from '../../../../lib/ui/IconButton.js';
|
|
4
4
|
export function TableFilterBar({ isFilterCleared, onFilterClear, children, ...props }) {
|
|
5
5
|
const showClearFilterButton = isFilterCleared === false;
|
|
6
|
-
return (_jsxs("div", { className: 'seam-table-filter-bar', ...props, children: [children, ' ', showClearFilterButton
|
|
6
|
+
return (_jsxs("div", { className: 'seam-table-filter-bar', ...props, children: [children, ' ', showClearFilterButton ? (_jsx(ClearFiltersButton, { onClick: onFilterClear })) : null] }));
|
|
7
7
|
}
|
|
8
8
|
function ClearFiltersButton(props) {
|
|
9
9
|
return (_jsx(IconButton, { ...props, className: 'seam-clear-filters-button', children: _jsx(ArrowRestartIcon, {}) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFilterBar.js","sourceRoot":"","sources":["../../../../src/lib/ui/Table/TableFilterBar/TableFilterBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAQjD,MAAM,UAAU,cAAc,CAAC,EAC7B,eAAe,EACf,aAAa,EACb,QAAQ,EACR,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"TableFilterBar.js","sourceRoot":"","sources":["../../../../src/lib/ui/Table/TableFilterBar/TableFilterBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAQjD,MAAM,UAAU,cAAc,CAAC,EAC7B,eAAe,EACf,aAAa,EACb,QAAQ,EACR,GAAG,KAAK,EACY;IACpB,MAAM,qBAAqB,GAAG,eAAe,KAAK,KAAK,CAAA;IACvD,OAAO,CACL,eAAK,SAAS,EAAC,uBAAuB,KAAK,KAAK,aAC7C,QAAQ,EAAE,GAAG,EACb,qBAAqB,CAAC,CAAC,CAAC,CACvB,KAAC,kBAAkB,IAAC,OAAO,EAAE,aAAa,GAAI,CAC/C,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAkB;IAC5C,OAAO,CACL,KAAC,UAAU,OAAK,KAAK,EAAE,SAAS,EAAC,2BAA2B,YAC1D,KAAC,gBAAgB,KAAG,GACT,CACd,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DivProps } from '../../../../lib/ui/types.js';
|
|
2
|
-
|
|
2
|
+
interface TableFilterItemProps extends DivProps {
|
|
3
3
|
selected?: boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare function TableFilterItem({ onClick, selected, ...props }: TableFilterItemProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
export function TableFilterItem({ onClick, selected, ...props }) {
|
|
4
4
|
return (_jsx("div", { onClick: onClick, className: classNames('seam-table-filter-item', {
|
|
5
|
-
'seam-clickable': onClick
|
|
5
|
+
'seam-clickable': onClick != null,
|
|
6
6
|
'seam-selected': selected,
|
|
7
7
|
}), ...props }));
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFilterItem.js","sourceRoot":"","sources":["../../../../src/lib/ui/Table/TableFilterBar/TableFilterItem.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,eAAe,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACa;IACrB,OAAO,CACL,cACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,CAAC,wBAAwB,EAAE;YAC9C,gBAAgB,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"TableFilterItem.js","sourceRoot":"","sources":["../../../../src/lib/ui/Table/TableFilterBar/TableFilterItem.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,eAAe,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACa;IACrB,OAAO,CACL,cACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,CAAC,wBAAwB,EAAE;YAC9C,gBAAgB,EAAE,OAAO,IAAI,IAAI;YACjC,eAAe,EAAE,QAAQ;SAC1B,CAAC,KACE,KAAK,GACT,CACH,CAAA;AACH,CAAC"}
|
|
@@ -4,4 +4,4 @@ export type TextFieldProps = {
|
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
5
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'>;
|
|
6
6
|
export declare function TextField(props: TextFieldProps): JSX.Element;
|
|
7
|
-
export declare const handleString: (setter: (v: string) => void) => (
|
|
7
|
+
export declare const handleString: (setter: (v: string) => void) => (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
@@ -4,7 +4,7 @@ export function TextField(props) {
|
|
|
4
4
|
const { value, onChange, className, ...inputProps } = props;
|
|
5
5
|
return (_jsx("input", { className: classNames('seam-text-field', className), value: value, onChange: handleString(onChange), type: 'text', ...inputProps }));
|
|
6
6
|
}
|
|
7
|
-
export const handleString = (setter) => (
|
|
8
|
-
setter(
|
|
7
|
+
export const handleString = (setter) => (event) => {
|
|
8
|
+
setter(event.currentTarget.value);
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=TextField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/lib/ui/TextField/TextField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAA;IAC3D,OAAO,CACL,gBACE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,EACnD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAChC,IAAI,EAAC,MAAM,KACP,UAAU,GACd,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,MAA2B,EAAE,EAAE,CAChC,CAAC,
|
|
1
|
+
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/lib/ui/TextField/TextField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAA;IAC3D,OAAO,CACL,gBACE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,EACnD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAChC,IAAI,EAAC,MAAM,KACP,UAAU,GACd,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,MAA2B,EAAE,EAAE,CAChC,CAAC,KAA0D,EAAQ,EAAE;IACnE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC,CAAA"}
|
package/lib/ui/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function Title({ children }:
|
|
1
|
+
import type { SpanProps } from '../../../lib/ui/types.js';
|
|
2
|
+
export declare function Title({ children, className, ...props }: SpanProps): JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
export function Title({ children, className, ...props }) {
|
|
4
|
+
return (_jsx("span", { className: classNames('seam-title', className), ...props, children: children }));
|
|
4
5
|
}
|
|
5
6
|
//# sourceMappingURL=Title.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.js","sourceRoot":"","sources":["../../../src/lib/ui/typography/Title.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Title.js","sourceRoot":"","sources":["../../../src/lib/ui/typography/Title.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAInC,MAAM,UAAU,KAAK,CAAC,EACpB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACE;IACV,OAAO,CACL,eAAM,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,KAAM,KAAK,YAC5D,QAAQ,GACJ,CACR,CAAA;AACH,CAAC"}
|
package/lib/use-toggle.d.ts
CHANGED
package/lib/use-toggle.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useCallback, useState } from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Simple util to quickly handle on/off states.
|
|
4
4
|
*/
|
|
5
|
-
const useToggle = (initialState = false) => {
|
|
5
|
+
export const useToggle = (initialState = false) => {
|
|
6
6
|
const [isTrue, setIsTrue] = useState(initialState);
|
|
7
7
|
// use callback otherwise it would yield unexpected results in promises
|
|
8
8
|
const toggle = useCallback(() => {
|
|
@@ -10,5 +10,4 @@ const useToggle = (initialState = false) => {
|
|
|
10
10
|
}, [setIsTrue]);
|
|
11
11
|
return [isTrue, toggle];
|
|
12
12
|
};
|
|
13
|
-
export default useToggle;
|
|
14
13
|
//# sourceMappingURL=use-toggle.js.map
|
package/lib/use-toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-toggle.js","sourceRoot":"","sources":["../src/lib/use-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE7C;;GAEG;AACH,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"use-toggle.js","sourceRoot":"","sources":["../src/lib/use-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,eAAwB,KAAK,EACN,EAAE;IACzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IAElD,uEAAuE;IAEvE,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;IAEf,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACzB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import type { AccessCode } from 'seamapi'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { copyToClipboard } from 'lib/copy-to-clipboard.js'
|
|
5
5
|
import { AccessCodeKeyIcon } from 'lib/icons/AccessCodeKey.js'
|
|
6
6
|
import { CopyIcon } from 'lib/icons/Copy.js'
|
|
7
7
|
import {
|
|
@@ -107,20 +107,20 @@ function AccessCodeRow(props: {
|
|
|
107
107
|
</div>
|
|
108
108
|
</TableCell>
|
|
109
109
|
<TableCell className='seam-name-cell'>
|
|
110
|
-
<Title>{accessCode.name}</Title>
|
|
110
|
+
<Title className='seam-truncated-text'>{accessCode.name}</Title>
|
|
111
111
|
<CodeDetails accessCode={accessCode} />
|
|
112
112
|
</TableCell>
|
|
113
113
|
<TableCell className='seam-action-cell'>
|
|
114
114
|
<MoreActionsMenu
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
menuProps={{
|
|
116
|
+
backgroundProps: {
|
|
117
117
|
className: 'seam-access-code-table-action-menu',
|
|
118
118
|
},
|
|
119
119
|
}}
|
|
120
120
|
>
|
|
121
121
|
<MenuItem
|
|
122
122
|
onClick={() => {
|
|
123
|
-
void
|
|
123
|
+
void copyToClipboard(accessCode.code ?? '')
|
|
124
124
|
}}
|
|
125
125
|
>
|
|
126
126
|
<div className='menu-item-copy'>
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { DateTime } from 'luxon'
|
|
2
2
|
import type { AccessCode } from 'seamapi'
|
|
3
3
|
|
|
4
|
+
import { useDevice } from 'lib/index.js'
|
|
5
|
+
|
|
4
6
|
import { DotDivider } from 'lib/ui/layout/DotDivider.js'
|
|
5
7
|
import { useIsDateInPast } from 'lib/use-is-date-in-past.js'
|
|
6
8
|
|
|
7
9
|
export function CodeDetails(props: { accessCode: AccessCode }): JSX.Element {
|
|
8
10
|
const { accessCode } = props
|
|
11
|
+
const { device } = useDevice({ device_id: accessCode.device_id })
|
|
9
12
|
|
|
10
13
|
return (
|
|
11
14
|
<div className='seam-code-details'>
|
|
12
|
-
|
|
15
|
+
<span className='seam-device-name seam-truncated-text'>
|
|
16
|
+
{device?.properties.name}
|
|
17
|
+
</span>
|
|
13
18
|
<DotDivider />
|
|
14
19
|
<Duration accessCode={accessCode} />
|
|
15
20
|
<DotDivider />
|
|
@@ -7,24 +7,21 @@ import { TriangleWarningIcon } from 'lib/icons/TriangleWarning.js'
|
|
|
7
7
|
export interface AlertProps {
|
|
8
8
|
variant: 'warning' | 'error'
|
|
9
9
|
message: string
|
|
10
|
-
action?:
|
|
11
|
-
label: string
|
|
12
|
-
onClick: MouseEventHandler
|
|
13
|
-
}
|
|
10
|
+
action?: ActionProps
|
|
14
11
|
className?: string
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
interface ActionProps {
|
|
15
|
+
label: string
|
|
16
|
+
onClick: MouseEventHandler
|
|
17
|
+
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
export function Alert(props: AlertProps): JSX.Element {
|
|
20
|
+
const { variant, message, className } = props
|
|
23
21
|
|
|
24
22
|
return (
|
|
25
23
|
<div
|
|
26
24
|
className={classNames('seam-alert', `seam-${variant}-alert`, className)}
|
|
27
|
-
{...rest}
|
|
28
25
|
>
|
|
29
26
|
<div className='seam-alert-content'>
|
|
30
27
|
<div className='seam-alert-icon'>
|
|
@@ -34,19 +31,25 @@ export function Alert(props: AlertProps): JSX.Element {
|
|
|
34
31
|
<ExclamationCircleIcon />
|
|
35
32
|
)}
|
|
36
33
|
</div>
|
|
37
|
-
|
|
38
34
|
<div className='seam-alert-message-wrap'>
|
|
39
35
|
<p className='seam-alert-message'>{message}</p>
|
|
40
36
|
</div>
|
|
41
37
|
</div>
|
|
38
|
+
{props.action == null ? null : <Action {...props.action} />}
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
function Action(props: ActionProps): JSX.Element | null {
|
|
44
|
+
const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {
|
|
45
|
+
props.onClick(event)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className='seam-alert-action-wrap'>
|
|
50
|
+
<button onClick={handleClick} className='seam-alert-action'>
|
|
51
|
+
{props.label}
|
|
52
|
+
</button>
|
|
50
53
|
</div>
|
|
51
54
|
)
|
|
52
55
|
}
|
|
@@ -2,17 +2,19 @@ import classNames from 'classnames'
|
|
|
2
2
|
|
|
3
3
|
import { Alert, type AlertProps } from 'lib/ui/Alert/Alert.js'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface AlertsProps {
|
|
6
6
|
alerts?: AlertProps[]
|
|
7
|
-
children?:
|
|
7
|
+
children?: JSX.Element
|
|
8
8
|
className?: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function Alerts(props: AlertsProps): JSX.Element {
|
|
12
|
-
const { alerts, children, className
|
|
11
|
+
export function Alerts(props: AlertsProps): JSX.Element | null {
|
|
12
|
+
const { alerts, children, className } = props
|
|
13
|
+
|
|
14
|
+
if (alerts?.length === 0) return null
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
|
-
<div className={classNames('seam-alerts', className)}
|
|
17
|
+
<div className={classNames('seam-alerts', className)}>
|
|
16
18
|
{alerts?.map((alert, index) => (
|
|
17
19
|
<Alert key={`${index}:${alert.message}`} {...alert} />
|
|
18
20
|
))}
|