@scality/core-ui 0.151.0 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dropdown/Dropdown.component.d.ts +3 -1
- package/dist/components/dropdown/Dropdown.component.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.component.js +17 -9
- package/dist/components/form/Form.component.js +1 -1
- package/dist/components/icon/CustomsIcons.d.ts +12 -0
- package/dist/components/icon/CustomsIcons.d.ts.map +1 -0
- package/dist/components/icon/CustomsIcons.js +16 -0
- package/dist/components/icon/Icon.component.d.ts +2 -1
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +9 -14
- package/dist/components/{IconHelper.d.ts → iconhelper/IconHelper.d.ts} +3 -2
- package/dist/components/iconhelper/IconHelper.d.ts.map +1 -0
- package/dist/components/iconhelper/IconHelper.js +4 -0
- package/dist/components/navbar/Navbar.component.js +2 -2
- package/dist/components/statusicon/StatusIcon.component.d.ts +11 -0
- package/dist/components/statusicon/StatusIcon.component.d.ts.map +1 -0
- package/dist/components/statusicon/StatusIcon.component.js +46 -0
- package/dist/components/tablev2/TableUtils.d.ts +5 -4
- package/dist/components/tablev2/TableUtils.d.ts.map +1 -1
- package/dist/components/tablev2/TableUtils.js +5 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/src/lib/components/dropdown/Dropdown.component.tsx +45 -30
- package/src/lib/components/form/Form.component.tsx +1 -1
- package/src/lib/components/icon/CustomsIcons.tsx +52 -0
- package/src/lib/components/icon/Icon.component.tsx +15 -49
- package/src/lib/components/iconhelper/IconHelper.test.tsx +52 -0
- package/src/lib/components/{IconHelper.tsx → iconhelper/IconHelper.tsx} +5 -3
- package/src/lib/components/navbar/Navbar.component.tsx +2 -2
- package/src/lib/components/statusicon/StatusIcon.component.tsx +55 -0
- package/src/lib/components/tablev2/TableUtils.ts +7 -6
- package/src/lib/index.ts +1 -1
- package/stories/modal.stories.tsx +1 -1
- package/stories/statusicon.stories.tsx +46 -0
- package/dist/components/IconHelper.d.ts.map +0 -1
- package/dist/components/IconHelper.js +0 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Placement } from '@floating-ui/dom';
|
|
1
2
|
export type Item = {
|
|
2
3
|
label: string;
|
|
3
4
|
name?: string;
|
|
@@ -13,7 +14,8 @@ type Props = {
|
|
|
13
14
|
items: Items;
|
|
14
15
|
icon?: JSX.Element;
|
|
15
16
|
caret?: boolean;
|
|
17
|
+
placement?: Placement;
|
|
16
18
|
};
|
|
17
|
-
declare function Dropdown({ items, text, icon, size, variant, title, caret, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function Dropdown({ items, text, icon, size, variant, title, caret, placement, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export { Dropdown };
|
|
19
21
|
//# sourceMappingURL=Dropdown.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown/Dropdown.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown/Dropdown.component.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAgB,SAAS,EAAS,MAAM,kBAAkB,CAAC;AAGlE,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC9B,CAAC;AACF,KAAK,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AA6DF,iBAAS,QAAQ,CAAC,EAChB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAa,EACb,OAA2B,EAC3B,KAAK,EACL,KAAY,EACZ,SAAoB,EACpB,GAAG,IAAI,EACR,EAAE,KAAK,2CA2EP;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
import { ButtonStyled, ButtonIcon, ButtonText, } from '../button/Button.component';
|
|
4
5
|
import { zIndex } from '../../style/theme';
|
|
@@ -8,6 +9,8 @@ import { getThemePropSelector } from '../../utils';
|
|
|
8
9
|
import { Icon } from '../icon/Icon.component';
|
|
9
10
|
import { useSelect } from 'downshift';
|
|
10
11
|
import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
|
|
12
|
+
import { flip, offset, shift } from '@floating-ui/dom';
|
|
13
|
+
import { useFloating, useInteractions, autoUpdate } from '@floating-ui/react';
|
|
11
14
|
const DropdownStyled = styled.div `
|
|
12
15
|
position: relative;
|
|
13
16
|
user-select: none;
|
|
@@ -27,7 +30,6 @@ const DropdownMenuStyled = styled.ul `
|
|
|
27
30
|
max-height: 200px;
|
|
28
31
|
min-width: 100%;
|
|
29
32
|
overflow: auto;
|
|
30
|
-
border-bottom: 0.3px solid ${getThemePropSelector('border')};
|
|
31
33
|
display: ${(props) => (props.isOpen ? 'auto' : 'none')};
|
|
32
34
|
`;
|
|
33
35
|
const DropdownMenuItemStyled = styled.li `
|
|
@@ -66,17 +68,23 @@ const TriggerStyled = styled(Trigger) `
|
|
|
66
68
|
color: ${(props) => props.theme.textPrimary};
|
|
67
69
|
}
|
|
68
70
|
`;
|
|
69
|
-
function Dropdown({ items, text, icon, size = 'base', variant = 'buttonSecondary', title, caret = true, ...rest }) {
|
|
71
|
+
function Dropdown({ items, text, icon, size = 'base', variant = 'buttonSecondary', title, caret = true, placement = 'bottom', ...rest }) {
|
|
70
72
|
const { isOpen, getToggleButtonProps, getMenuProps, getItemProps, highlightedIndex, } = useSelect({
|
|
71
73
|
items,
|
|
72
74
|
itemToString: (item) => (item === null || item === void 0 ? void 0 : item.label) || '',
|
|
73
75
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const { refs, floatingStyles } = useFloating({
|
|
77
|
+
middleware: [offset(10), flip(), shift()],
|
|
78
|
+
placement: placement,
|
|
79
|
+
whileElementsMounted: autoUpdate,
|
|
80
|
+
});
|
|
81
|
+
const { getReferenceProps, getFloatingProps } = useInteractions();
|
|
82
|
+
return (_jsxs(DropdownStyled, { variant: variant, className: "sc-dropdown", ...rest, ref: refs.setReference, children: [_jsxs(TriggerStyled, { variant: variant, size: size, className: "trigger", title: title, ...getToggleButtonProps(), ...getReferenceProps(), children: [icon && (_jsx(ButtonIcon, { text: text, size: size, children: icon })), text && _jsx(ButtonText, { className: "sc-trigger-text", children: text }), caret && (_jsx(Caret, { children: _jsx(Icon, { name: "Dropdown-down" }) }))] }), _jsx(DropdownMenuStyled, { className: "menu-item", isOpen: isOpen, style: floatingStyles, ...getFloatingProps(), ...getMenuProps({ ref: refs.setFloating }), children: items.map((item, index) => {
|
|
83
|
+
return (_jsx(DropdownMenuItemStyled, { className: "menu-item-label", variant: item.variant, ...item, ...getItemProps({
|
|
84
|
+
item,
|
|
85
|
+
index,
|
|
86
|
+
onClick: item.onClick,
|
|
87
|
+
}), isSelected: index === highlightedIndex, children: item.label }, item.label));
|
|
88
|
+
}) })] }));
|
|
81
89
|
}
|
|
82
90
|
export { Dropdown };
|
|
@@ -5,7 +5,7 @@ import { spacing, Stack, Wrap } from '../../spacing';
|
|
|
5
5
|
import { convertRemToPixels } from '../../utils';
|
|
6
6
|
import { Box } from '../box/Box';
|
|
7
7
|
import { Icon } from '../icon/Icon.component';
|
|
8
|
-
import { IconHelp } from '../IconHelper';
|
|
8
|
+
import { IconHelp } from '../iconhelper/IconHelper';
|
|
9
9
|
import { ScrollbarWrapper } from '../scrollbarwrapper/ScrollbarWrapper.component';
|
|
10
10
|
import { Text } from '../text/Text.component';
|
|
11
11
|
const DESCRIPTION_PREFIX = 'describe-';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const useGetColor: (color: string | undefined) => string;
|
|
2
|
+
export declare const RemoteUser: ({ ariaLabel, color, size }: {
|
|
3
|
+
ariaLabel: any;
|
|
4
|
+
color: any;
|
|
5
|
+
size: any;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const RemoteGroup: ({ ariaLabel, color, size }: {
|
|
8
|
+
ariaLabel: any;
|
|
9
|
+
color: any;
|
|
10
|
+
size: any;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=CustomsIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomsIcons.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/CustomsIcons.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,UAAW,MAAM,GAAG,SAAS,KAAG,MAKvD,CAAC;AAEF,eAAO,MAAM,UAAU;;;;6CAoBtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;6CAoBvB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from 'styled-components';
|
|
3
|
+
export const useGetColor = (color) => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
if (!color)
|
|
6
|
+
return 'currentColor';
|
|
7
|
+
return theme[color] || color;
|
|
8
|
+
};
|
|
9
|
+
export const RemoteUser = ({ ariaLabel, color, size }) => {
|
|
10
|
+
const getColor = useGetColor(color);
|
|
11
|
+
return (_jsxs("svg", { viewBox: "0 0 19 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: 'svg-inline--fa ' + (size ? `fa-${size}` : ''), "aria-label": ariaLabel, children: [_jsx("path", { d: "M16.5902 0.5C17.4071 0.5 18.0984 1.1875 18.0984 2V12C18.0984 12.8438 17.4071 13.5 16.5902 13.5H10.5574L11.0601 15H13.3224C13.7309 15 14.0765 15.3438 14.0765 15.75C14.0765 16.1875 13.7309 16.5 13.3224 16.5H4.77596C4.33607 16.5 4.02186 16.1875 4.02186 15.75C4.02186 15.3438 4.33607 15 4.77596 15H7.03825L7.54098 13.5H1.5082C0.659836 13.5 0 12.8438 0 12V2C0 1.1875 0.659836 0.5 1.5082 0.5H16.5902ZM16.0874 11.5V2.5H2.01093V11.5H16.0874Z", fill: getColor }), _jsx("path", { d: "M9.18043 7.97631C8.0165 7.97631 7.08207 7.01268 7.08207 5.81237C7.08207 4.62897 8.0165 3.64844 9.18043 3.64844C10.328 3.64844 11.2788 4.62897 11.2788 5.81237C11.2788 7.01268 10.328 7.97631 9.18043 7.97631ZM10.6394 8.51729C11.8526 8.51729 12.8526 9.54854 12.8526 10.7996V11.4927C12.8526 11.9492 12.4919 12.3042 12.0657 12.3042H6.29519C5.85256 12.3042 5.5083 11.9492 5.5083 11.4927V10.7996C5.5083 9.54854 6.49191 8.51729 7.70502 8.51729H7.98371C8.34437 8.70325 8.7542 8.78778 9.18043 8.78778C9.60666 8.78778 10.0001 8.70325 10.3608 8.51729H10.6394Z", fill: getColor })] }));
|
|
12
|
+
};
|
|
13
|
+
export const RemoteGroup = ({ ariaLabel, color, size }) => {
|
|
14
|
+
const getColor = useGetColor(color);
|
|
15
|
+
return (_jsxs("svg", { viewBox: "0 0 19 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: 'svg-inline--fa ' + (size ? `fa-${size}` : ''), "aria-label": ariaLabel, children: [_jsx("path", { d: "M16.5902 0.5C17.4071 0.5 18.0984 1.1875 18.0984 2V12C18.0984 12.8438 17.4071 13.5 16.5902 13.5H10.5574L11.0601 15H13.3224C13.7309 15 14.0765 15.3438 14.0765 15.75C14.0765 16.1875 13.7309 16.5 13.3224 16.5H4.77596C4.33607 16.5 4.02186 16.1875 4.02186 15.75C4.02186 15.3438 4.33607 15 4.77596 15H7.03825L7.54098 13.5H1.5082C0.659836 13.5 0 12.8438 0 12V2C0 1.1875 0.659836 0.5 1.5082 0.5H16.5902ZM16.0874 11.5V2.5H2.01093V11.5H16.0874Z", fill: getColor }), _jsx("path", { d: "M4.8 7.85714C4.125 7.85714 3.6 7.29464 3.6 6.57143C3.6 5.8683 4.125 5.28571 4.8 5.28571C5.45625 5.28571 6 5.8683 6 6.57143C6 7.29464 5.45625 7.85714 4.8 7.85714ZM13.2 7.85714C12.525 7.85714 12 7.29464 12 6.57143C12 5.8683 12.525 5.28571 13.2 5.28571C13.8563 5.28571 14.4 5.8683 14.4 6.57143C14.4 7.29464 13.8563 7.85714 13.2 7.85714ZM13.8 8.5C14.4563 8.5 15 9.08259 15 9.78571V10.4286C15 10.7902 14.7188 11.0714 14.4 11.0714H13.1625C13.0313 10.1272 12.5063 9.32366 11.7375 8.8817C11.9625 8.66071 12.2625 8.5 12.6 8.5H13.8ZM9 8.5C7.8375 8.5 6.9 7.49554 6.9 6.25C6.9 5.02455 7.8375 4 9 4C10.1438 4 11.1 5.02455 11.1 6.25C11.1 7.49554 10.1438 8.5 9 8.5ZM10.425 9.14286C11.625 9.14286 12.6 10.1875 12.6 11.4732V12.0357C12.6 12.5781 12.1875 13 11.7 13H6.3C5.79375 13 5.4 12.5781 5.4 12.0357V11.4732C5.4 10.1875 6.35625 9.14286 7.55625 9.14286H7.70625C8.1 9.34375 8.53125 9.46429 9 9.46429C9.45 9.46429 9.88125 9.34375 10.275 9.14286H10.425ZM6.24375 8.8817C5.475 9.32366 4.95 10.1272 4.81875 11.0714H3.6C3.2625 11.0714 3 10.7902 3 10.4286V9.78571C3 9.08259 3.525 8.5 4.2 8.5H5.4C5.71875 8.5 6.01875 8.66071 6.24375 8.8817Z", fill: getColor })] }));
|
|
16
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
1
2
|
import { CSSProperties } from 'react';
|
|
2
3
|
import { CoreUITheme } from '../../style/theme';
|
|
3
|
-
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
4
4
|
export declare const iconTable: {
|
|
5
5
|
Account: string;
|
|
6
6
|
Backend: string;
|
|
@@ -148,6 +148,7 @@ type Props = {
|
|
|
148
148
|
withWrapper?: boolean;
|
|
149
149
|
style?: CSSProperties;
|
|
150
150
|
onClick?: (event: MouseEvent) => void;
|
|
151
|
+
title?: string;
|
|
151
152
|
};
|
|
152
153
|
export declare const IconWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
153
154
|
size: SizeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EACL,aAAa,EAKd,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;CAOvB,CAAC;AAaF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,WAAW,CAAC;AACzE,MAAM,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC;AAC1C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAiBF,eAAO,MAAM,WAAW;UAAsB,QAAQ;SAiCrD,CAAC;AAyEF,iBAAS,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,2CAU7C;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { useEffect, useState, } from 'react';
|
|
3
|
-
import styled, { css, useTheme } from 'styled-components';
|
|
4
|
-
import { Loader } from '../loader/Loader.component';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import { useEffect, useState, } from 'react';
|
|
6
4
|
import { useQuery } from 'react-query';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import { Loader } from '../loader/Loader.component';
|
|
7
|
+
import { RemoteGroup, RemoteUser } from './CustomsIcons';
|
|
7
8
|
export const iconTable = {
|
|
8
9
|
Account: 'fas faWallet',
|
|
9
10
|
Backend: 'fas faNetworkWired',
|
|
@@ -129,15 +130,9 @@ export const iconTable = {
|
|
|
129
130
|
Stop: 'fas faStop',
|
|
130
131
|
Play: 'fas faPlay',
|
|
131
132
|
};
|
|
132
|
-
const getColor = (color) => {
|
|
133
|
-
const theme = useTheme();
|
|
134
|
-
if (!color)
|
|
135
|
-
return 'currentColor';
|
|
136
|
-
return theme[color] || color;
|
|
137
|
-
};
|
|
138
133
|
export const customIcons = {
|
|
139
|
-
'Remote-user': ({ ariaLabel, color, size }) => (
|
|
140
|
-
'Remote-group': ({ ariaLabel, color, size }) => (
|
|
134
|
+
'Remote-user': ({ ariaLabel, color, size }) => (_jsx(RemoteUser, { ariaLabel: ariaLabel, color: color, size: size })),
|
|
135
|
+
'Remote-group': ({ ariaLabel, color, size }) => (_jsx(RemoteGroup, { ariaLabel: ariaLabel, color: color, size: size })),
|
|
141
136
|
};
|
|
142
137
|
const IconStyled = styled(FontAwesomeIcon) `
|
|
143
138
|
${(props) => {
|
|
@@ -193,7 +188,7 @@ export const IconWrapper = styled.div `
|
|
|
193
188
|
align-items: center;
|
|
194
189
|
border-radius: 100%;
|
|
195
190
|
`;
|
|
196
|
-
function NonWrappedIcon({ name, size = '1x', color = undefined, ariaLabel = '', ...rest }) {
|
|
191
|
+
function NonWrappedIcon({ name, size = '1x', color = undefined, ariaLabel = '', title, ...rest }) {
|
|
197
192
|
const iconInfo = iconTable[name] || customIcons[name];
|
|
198
193
|
if (!iconInfo)
|
|
199
194
|
throw new Error(`${name}: is not a valid icon.`);
|
|
@@ -222,7 +217,7 @@ function NonWrappedIcon({ name, size = '1x', color = undefined, ariaLabel = '',
|
|
|
222
217
|
}
|
|
223
218
|
},
|
|
224
219
|
});
|
|
225
|
-
return (_jsxs(_Fragment, { children: [(status === 'loading' || status === 'error') && (_jsx(DelayedFallback, { "aria-label": `${name} ${ariaLabel}`, children: _jsx(Loader, { size: "base" }) })), status === 'success' && (_jsx(data.default, { name: name, color: color, size: size, ariaLabel: ariaLabel, ...rest }))] }));
|
|
220
|
+
return (_jsxs(_Fragment, { children: [(status === 'loading' || status === 'error') && (_jsx(DelayedFallback, { "aria-label": `${name} ${ariaLabel}`, children: _jsx(Loader, { size: "base" }) })), status === 'success' && (_jsx(data.default, { name: name, color: color, size: size, ariaLabel: ariaLabel, title: title, ...rest }))] }));
|
|
226
221
|
}
|
|
227
222
|
function Icon({ withWrapper, ...props }) {
|
|
228
223
|
if (withWrapper) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { Position } from '
|
|
2
|
+
import { Position } from '../tooltip/Tooltip.component';
|
|
3
3
|
type IconHelpProps = {
|
|
4
4
|
tooltipMessage: ReactNode;
|
|
5
5
|
placement?: Position;
|
|
6
6
|
overlayStyle?: CSSProperties;
|
|
7
|
+
title?: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const IconHelp: ({ tooltipMessage, overlayStyle, placement, }: IconHelpProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const IconHelp: ({ tooltipMessage, overlayStyle, placement, title, }: IconHelpProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=IconHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconHelper.d.ts","sourceRoot":"","sources":["../../../src/lib/components/iconhelper/IconHelper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAW,MAAM,8BAA8B,CAAC;AAEjE,KAAK,aAAa,GAAG;IACnB,cAAc,EAAE,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,QAAQ,wDAKlB,aAAa,4CAQf,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../icon/Icon.component';
|
|
3
|
+
import { Tooltip } from '../tooltip/Tooltip.component';
|
|
4
|
+
export const IconHelp = ({ tooltipMessage, overlayStyle, placement = 'right', title, }) => (_jsx(Tooltip, { overlay: tooltipMessage, placement: placement, overlayStyle: overlayStyle, children: _jsx(Icon, { name: "Info", color: "buttonSecondary", title: title }) }));
|
|
@@ -19,8 +19,8 @@ const NavbarContainer = styled.div `
|
|
|
19
19
|
.sc-trigger-text {
|
|
20
20
|
color: ${getThemePropSelector('textPrimary')};
|
|
21
21
|
}
|
|
22
|
-
border-bottom: 0.5px solid ${(props) => props.theme.backgroundLevel3};
|
|
23
22
|
box-sizing: border-box;
|
|
23
|
+
border-bottom: 0.5px solid ${(props) => props.theme.backgroundLevel2};
|
|
24
24
|
`};
|
|
25
25
|
`;
|
|
26
26
|
const NavbarMenu = styled.div `
|
|
@@ -104,7 +104,7 @@ const NavbarMenuItem = styled.div `
|
|
|
104
104
|
&:hover {
|
|
105
105
|
background-color: ${getThemePropSelector('highlight')};
|
|
106
106
|
}
|
|
107
|
-
height:
|
|
107
|
+
height: auto;
|
|
108
108
|
font-size: ${fontSize.base};
|
|
109
109
|
}
|
|
110
110
|
.menu-item {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum Status {
|
|
2
|
+
HEALTHY = "healthy",
|
|
3
|
+
WARNING = "warning",
|
|
4
|
+
CRITICAL = "critical",
|
|
5
|
+
UNKNOWN = "unknown",
|
|
6
|
+
LOADING = "loading"
|
|
7
|
+
}
|
|
8
|
+
export declare const StatusIcon: ({ status }: {
|
|
9
|
+
status: Status;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=StatusIcon.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusIcon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/statusicon/StatusIcon.component.tsx"],"names":[],"mappings":"AASA,oBAAY,MAAM;IAChB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,UAAU,eAAgB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,4CAqCxD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../icon/Icon.component';
|
|
3
|
+
import { STATUS_WARNING, STATUS_CRITICAL, STATUS_HEALTHY, } from '../../components/constants';
|
|
4
|
+
import { Loader } from '../loader/Loader.component';
|
|
5
|
+
export var Status;
|
|
6
|
+
(function (Status) {
|
|
7
|
+
Status["HEALTHY"] = "healthy";
|
|
8
|
+
Status["WARNING"] = "warning";
|
|
9
|
+
Status["CRITICAL"] = "critical";
|
|
10
|
+
Status["UNKNOWN"] = "unknown";
|
|
11
|
+
Status["LOADING"] = "loading";
|
|
12
|
+
})(Status || (Status = {}));
|
|
13
|
+
export const StatusIcon = ({ status }) => {
|
|
14
|
+
if (status === 'loading') {
|
|
15
|
+
return _jsx(Loader, {});
|
|
16
|
+
}
|
|
17
|
+
const icon = (() => {
|
|
18
|
+
switch (status) {
|
|
19
|
+
case STATUS_HEALTHY:
|
|
20
|
+
return {
|
|
21
|
+
color: 'statusHealthy',
|
|
22
|
+
name: 'Check-circle',
|
|
23
|
+
label: 'Healthy status icon',
|
|
24
|
+
};
|
|
25
|
+
case STATUS_WARNING:
|
|
26
|
+
return {
|
|
27
|
+
color: 'statusWarning',
|
|
28
|
+
name: 'Times-circle',
|
|
29
|
+
label: 'Warning status icon',
|
|
30
|
+
};
|
|
31
|
+
case STATUS_CRITICAL:
|
|
32
|
+
return {
|
|
33
|
+
color: 'statusCritical',
|
|
34
|
+
name: 'Times-circle',
|
|
35
|
+
label: 'Critical status icon',
|
|
36
|
+
};
|
|
37
|
+
default:
|
|
38
|
+
return {
|
|
39
|
+
color: 'textTertiary',
|
|
40
|
+
name: 'Info',
|
|
41
|
+
label: 'Information status icon',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
return _jsx(Icon, { color: icon.color, name: icon.name, "aria-label": icon.label });
|
|
46
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
declare const STATUS_CRITICAL = "critical";
|
|
2
|
-
declare const STATUS_WARNING = "warning";
|
|
3
|
-
declare const STATUS_NONE = "none";
|
|
4
|
-
declare const STATUS_HEALTH = "healthy";
|
|
1
|
+
export declare const STATUS_CRITICAL = "critical";
|
|
2
|
+
export declare const STATUS_WARNING = "warning";
|
|
3
|
+
export declare const STATUS_NONE = "none";
|
|
4
|
+
export declare const STATUS_HEALTH = "healthy";
|
|
5
|
+
export declare const STATUS_UNKNOWN = "unknown";
|
|
5
6
|
type StatusType = typeof STATUS_CRITICAL | typeof STATUS_WARNING | typeof STATUS_NONE | typeof STATUS_HEALTH;
|
|
6
7
|
export declare function compareHealth(status1: StatusType, status2: StatusType): number | undefined;
|
|
7
8
|
export declare function convertRemToPixels(rem: any): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/TableUtils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"TableUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/TableUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,KAAK,UAAU,GACX,OAAO,eAAe,GACtB,OAAO,cAAc,GACrB,OAAO,WAAW,GAClB,OAAO,aAAa,CAAC;AAGzB,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,UAAU,GAClB,MAAM,GAAG,SAAS,CAuBpB;AAED,wBAAgB,kBAAkB,CAAC,GAAG,KAAA,UAErC;AACD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,CAAC;AAGvB,eAAO,MAAM,cAAc;;;;;CAK1B,CAAC;AAEF,KAAK,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnE,eAAO,MAAM,kBAAkB,SACvB,iBAAiB,eACV;IACX,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,EAAE,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,WACQ,cAAc,WA2BxB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const STATUS_CRITICAL = 'critical';
|
|
2
|
-
const STATUS_WARNING = 'warning';
|
|
3
|
-
const STATUS_NONE = 'none';
|
|
4
|
-
const STATUS_HEALTH = 'healthy';
|
|
1
|
+
export const STATUS_CRITICAL = 'critical';
|
|
2
|
+
export const STATUS_WARNING = 'warning';
|
|
3
|
+
export const STATUS_NONE = 'none';
|
|
4
|
+
export const STATUS_HEALTH = 'healthy';
|
|
5
|
+
export const STATUS_UNKNOWN = 'unknown';
|
|
5
6
|
// some common customized sortTypes
|
|
6
7
|
export function compareHealth(status1, status2) {
|
|
7
8
|
if (![STATUS_WARNING, STATUS_CRITICAL, STATUS_NONE, STATUS_HEALTH].includes(status1) ||
|
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export { Stack, Wrap, spacing } from './spacing';
|
|
|
51
51
|
export { Form, FormSection, FormGroup } from './components/form/Form.component';
|
|
52
52
|
export { FormattedDateTime } from './components/date/FormattedDateTime';
|
|
53
53
|
export { getDateDaysDiff } from './components/date/dateDiffer';
|
|
54
|
-
export { IconHelp } from './components/IconHelper';
|
|
54
|
+
export { IconHelp } from './components/iconhelper/IconHelper';
|
|
55
55
|
export { Dropzone } from './components/dropzone/Dropzone';
|
|
56
56
|
export { Toast } from './components/toast/Toast.component';
|
|
57
57
|
export { ToastProvider, useToast } from './components/toast/ToastProvider';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,WAAW,EACX,cAAc,EACd,WAAW,EACX,MAAM,GACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MA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FormSection, FormGroup } from './components/form/Form.component';
|
|
52
52
|
export { FormattedDateTime } from './components/date/FormattedDateTime';
|
|
53
53
|
export { getDateDaysDiff } from './components/date/dateDiffer';
|
|
54
|
-
export { IconHelp } from './components/IconHelper';
|
|
54
|
+
export { IconHelp } from './components/iconhelper/IconHelper';
|
|
55
55
|
export { Dropzone } from './components/dropzone/Dropzone';
|
|
56
56
|
export { Toast } from './components/toast/Toast.component';
|
|
57
57
|
export { ToastProvider, useToast } from './components/toast/ToastProvider';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scality/core-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.153.0",
|
|
4
4
|
"description": "Scality common React component library",
|
|
5
5
|
"author": "Scality Engineering",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@floating-ui/dom": "^1.6.3",
|
|
101
|
+
"@floating-ui/react": "^0.26.28",
|
|
101
102
|
"@fortawesome/fontawesome-free": "^5.10.2",
|
|
102
103
|
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
|
103
104
|
"@fortawesome/free-regular-svg-icons": "^5.15.3",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
|
|
2
|
+
import styled from 'styled-components';
|
|
5
3
|
import {
|
|
6
4
|
ButtonStyled,
|
|
7
5
|
ButtonIcon,
|
|
@@ -14,6 +12,9 @@ import { getThemePropSelector } from '../../utils';
|
|
|
14
12
|
import { Icon } from '../icon/Icon.component';
|
|
15
13
|
import { useSelect } from 'downshift';
|
|
16
14
|
import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
|
|
15
|
+
import { flip, offset, Placement, shift } from '@floating-ui/dom';
|
|
16
|
+
import { useFloating, useInteractions, autoUpdate } from '@floating-ui/react';
|
|
17
|
+
|
|
17
18
|
export type Item = {
|
|
18
19
|
label: string;
|
|
19
20
|
name?: string;
|
|
@@ -29,6 +30,7 @@ type Props = {
|
|
|
29
30
|
items: Items;
|
|
30
31
|
icon?: JSX.Element;
|
|
31
32
|
caret?: boolean;
|
|
33
|
+
placement?: Placement;
|
|
32
34
|
};
|
|
33
35
|
const DropdownStyled = styled.div`
|
|
34
36
|
position: relative;
|
|
@@ -39,6 +41,7 @@ const DropdownStyled = styled.div`
|
|
|
39
41
|
border-radius: 0;
|
|
40
42
|
}
|
|
41
43
|
`;
|
|
44
|
+
|
|
42
45
|
const DropdownMenuStyled = styled.ul`
|
|
43
46
|
position: absolute;
|
|
44
47
|
margin: 0;
|
|
@@ -49,9 +52,9 @@ const DropdownMenuStyled = styled.ul`
|
|
|
49
52
|
max-height: 200px;
|
|
50
53
|
min-width: 100%;
|
|
51
54
|
overflow: auto;
|
|
52
|
-
border-bottom: 0.3px solid ${getThemePropSelector('border')};
|
|
53
55
|
display: ${(props) => (props.isOpen ? 'auto' : 'none')};
|
|
54
56
|
`;
|
|
57
|
+
|
|
55
58
|
const DropdownMenuItemStyled = styled.li`
|
|
56
59
|
display: flex;
|
|
57
60
|
align-items: center;
|
|
@@ -97,6 +100,7 @@ function Dropdown({
|
|
|
97
100
|
variant = 'buttonSecondary',
|
|
98
101
|
title,
|
|
99
102
|
caret = true,
|
|
103
|
+
placement = 'bottom',
|
|
100
104
|
...rest
|
|
101
105
|
}: Props) {
|
|
102
106
|
const {
|
|
@@ -109,12 +113,21 @@ function Dropdown({
|
|
|
109
113
|
items,
|
|
110
114
|
itemToString: (item) => item?.label || '',
|
|
111
115
|
});
|
|
116
|
+
|
|
117
|
+
const { refs, floatingStyles } = useFloating({
|
|
118
|
+
middleware: [offset(10), flip(), shift()],
|
|
119
|
+
placement: placement,
|
|
120
|
+
whileElementsMounted: autoUpdate,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const { getReferenceProps, getFloatingProps } = useInteractions();
|
|
124
|
+
|
|
112
125
|
return (
|
|
113
126
|
<DropdownStyled
|
|
114
|
-
active={open}
|
|
115
127
|
variant={variant}
|
|
116
128
|
className="sc-dropdown"
|
|
117
129
|
{...rest}
|
|
130
|
+
ref={refs.setReference}
|
|
118
131
|
>
|
|
119
132
|
<TriggerStyled
|
|
120
133
|
variant={variant}
|
|
@@ -122,6 +135,7 @@ function Dropdown({
|
|
|
122
135
|
className="trigger"
|
|
123
136
|
title={title}
|
|
124
137
|
{...getToggleButtonProps()}
|
|
138
|
+
{...getReferenceProps()}
|
|
125
139
|
>
|
|
126
140
|
{icon && (
|
|
127
141
|
<ButtonIcon text={text} size={size}>
|
|
@@ -134,32 +148,33 @@ function Dropdown({
|
|
|
134
148
|
<Icon name="Dropdown-down" />
|
|
135
149
|
</Caret>
|
|
136
150
|
)}
|
|
137
|
-
|
|
138
|
-
<DropdownMenuStyled
|
|
139
|
-
className="menu-item"
|
|
140
|
-
isOpen={isOpen}
|
|
141
|
-
{...getMenuProps()}
|
|
142
|
-
>
|
|
143
|
-
{items.map((item, index) => {
|
|
144
|
-
return (
|
|
145
|
-
<DropdownMenuItemStyled
|
|
146
|
-
className="menu-item-label"
|
|
147
|
-
key={item.label}
|
|
148
|
-
variant={item.variant}
|
|
149
|
-
{...item}
|
|
150
|
-
{...getItemProps({
|
|
151
|
-
item,
|
|
152
|
-
index,
|
|
153
|
-
onClick: item.onClick,
|
|
154
|
-
})}
|
|
155
|
-
isSelected={index === highlightedIndex}
|
|
156
|
-
>
|
|
157
|
-
{item.label}
|
|
158
|
-
</DropdownMenuItemStyled>
|
|
159
|
-
);
|
|
160
|
-
})}
|
|
161
|
-
</DropdownMenuStyled>
|
|
162
151
|
</TriggerStyled>
|
|
152
|
+
<DropdownMenuStyled
|
|
153
|
+
className="menu-item"
|
|
154
|
+
isOpen={isOpen}
|
|
155
|
+
style={floatingStyles}
|
|
156
|
+
{...getFloatingProps()}
|
|
157
|
+
{...getMenuProps({ ref: refs.setFloating })}
|
|
158
|
+
>
|
|
159
|
+
{items.map((item, index) => {
|
|
160
|
+
return (
|
|
161
|
+
<DropdownMenuItemStyled
|
|
162
|
+
className="menu-item-label"
|
|
163
|
+
key={item.label}
|
|
164
|
+
variant={item.variant}
|
|
165
|
+
{...item}
|
|
166
|
+
{...getItemProps({
|
|
167
|
+
item,
|
|
168
|
+
index,
|
|
169
|
+
onClick: item.onClick,
|
|
170
|
+
})}
|
|
171
|
+
isSelected={index === highlightedIndex}
|
|
172
|
+
>
|
|
173
|
+
{item.label}
|
|
174
|
+
</DropdownMenuItemStyled>
|
|
175
|
+
);
|
|
176
|
+
})}
|
|
177
|
+
</DropdownMenuStyled>
|
|
163
178
|
</DropdownStyled>
|
|
164
179
|
);
|
|
165
180
|
}
|
|
@@ -16,7 +16,7 @@ import { spacing, Stack, Wrap } from '../../spacing';
|
|
|
16
16
|
import { convertRemToPixels } from '../../utils';
|
|
17
17
|
import { Box } from '../box/Box';
|
|
18
18
|
import { Icon, IconName } from '../icon/Icon.component';
|
|
19
|
-
import { IconHelp } from '../IconHelper';
|
|
19
|
+
import { IconHelp } from '../iconhelper/IconHelper';
|
|
20
20
|
import { ScrollbarWrapper } from '../scrollbarwrapper/ScrollbarWrapper.component';
|
|
21
21
|
import { Text } from '../text/Text.component';
|
|
22
22
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useTheme } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const useGetColor = (color: string | undefined): string => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
if (!color) return 'currentColor';
|
|
6
|
+
|
|
7
|
+
return theme[color] || color;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const RemoteUser = ({ ariaLabel, color, size }) => {
|
|
11
|
+
const getColor = useGetColor(color);
|
|
12
|
+
return (
|
|
13
|
+
<svg
|
|
14
|
+
viewBox="0 0 19 17"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
className={'svg-inline--fa ' + (size ? `fa-${size}` : '')}
|
|
18
|
+
aria-label={ariaLabel}
|
|
19
|
+
>
|
|
20
|
+
<path
|
|
21
|
+
d="M16.5902 0.5C17.4071 0.5 18.0984 1.1875 18.0984 2V12C18.0984 12.8438 17.4071 13.5 16.5902 13.5H10.5574L11.0601 15H13.3224C13.7309 15 14.0765 15.3438 14.0765 15.75C14.0765 16.1875 13.7309 16.5 13.3224 16.5H4.77596C4.33607 16.5 4.02186 16.1875 4.02186 15.75C4.02186 15.3438 4.33607 15 4.77596 15H7.03825L7.54098 13.5H1.5082C0.659836 13.5 0 12.8438 0 12V2C0 1.1875 0.659836 0.5 1.5082 0.5H16.5902ZM16.0874 11.5V2.5H2.01093V11.5H16.0874Z"
|
|
22
|
+
fill={getColor}
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d="M9.18043 7.97631C8.0165 7.97631 7.08207 7.01268 7.08207 5.81237C7.08207 4.62897 8.0165 3.64844 9.18043 3.64844C10.328 3.64844 11.2788 4.62897 11.2788 5.81237C11.2788 7.01268 10.328 7.97631 9.18043 7.97631ZM10.6394 8.51729C11.8526 8.51729 12.8526 9.54854 12.8526 10.7996V11.4927C12.8526 11.9492 12.4919 12.3042 12.0657 12.3042H6.29519C5.85256 12.3042 5.5083 11.9492 5.5083 11.4927V10.7996C5.5083 9.54854 6.49191 8.51729 7.70502 8.51729H7.98371C8.34437 8.70325 8.7542 8.78778 9.18043 8.78778C9.60666 8.78778 10.0001 8.70325 10.3608 8.51729H10.6394Z"
|
|
26
|
+
fill={getColor}
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const RemoteGroup = ({ ariaLabel, color, size }) => {
|
|
33
|
+
const getColor = useGetColor(color);
|
|
34
|
+
return (
|
|
35
|
+
<svg
|
|
36
|
+
viewBox="0 0 19 17"
|
|
37
|
+
fill="none"
|
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
className={'svg-inline--fa ' + (size ? `fa-${size}` : '')}
|
|
40
|
+
aria-label={ariaLabel}
|
|
41
|
+
>
|
|
42
|
+
<path
|
|
43
|
+
d="M16.5902 0.5C17.4071 0.5 18.0984 1.1875 18.0984 2V12C18.0984 12.8438 17.4071 13.5 16.5902 13.5H10.5574L11.0601 15H13.3224C13.7309 15 14.0765 15.3438 14.0765 15.75C14.0765 16.1875 13.7309 16.5 13.3224 16.5H4.77596C4.33607 16.5 4.02186 16.1875 4.02186 15.75C4.02186 15.3438 4.33607 15 4.77596 15H7.03825L7.54098 13.5H1.5082C0.659836 13.5 0 12.8438 0 12V2C0 1.1875 0.659836 0.5 1.5082 0.5H16.5902ZM16.0874 11.5V2.5H2.01093V11.5H16.0874Z"
|
|
44
|
+
fill={getColor}
|
|
45
|
+
/>
|
|
46
|
+
<path
|
|
47
|
+
d="M4.8 7.85714C4.125 7.85714 3.6 7.29464 3.6 6.57143C3.6 5.8683 4.125 5.28571 4.8 5.28571C5.45625 5.28571 6 5.8683 6 6.57143C6 7.29464 5.45625 7.85714 4.8 7.85714ZM13.2 7.85714C12.525 7.85714 12 7.29464 12 6.57143C12 5.8683 12.525 5.28571 13.2 5.28571C13.8563 5.28571 14.4 5.8683 14.4 6.57143C14.4 7.29464 13.8563 7.85714 13.2 7.85714ZM13.8 8.5C14.4563 8.5 15 9.08259 15 9.78571V10.4286C15 10.7902 14.7188 11.0714 14.4 11.0714H13.1625C13.0313 10.1272 12.5063 9.32366 11.7375 8.8817C11.9625 8.66071 12.2625 8.5 12.6 8.5H13.8ZM9 8.5C7.8375 8.5 6.9 7.49554 6.9 6.25C6.9 5.02455 7.8375 4 9 4C10.1438 4 11.1 5.02455 11.1 6.25C11.1 7.49554 10.1438 8.5 9 8.5ZM10.425 9.14286C11.625 9.14286 12.6 10.1875 12.6 11.4732V12.0357C12.6 12.5781 12.1875 13 11.7 13H6.3C5.79375 13 5.4 12.5781 5.4 12.0357V11.4732C5.4 10.1875 6.35625 9.14286 7.55625 9.14286H7.70625C8.1 9.34375 8.53125 9.46429 9 9.46429C9.45 9.46429 9.88125 9.34375 10.275 9.14286H10.425ZM6.24375 8.8817C5.475 9.32366 4.95 10.1272 4.81875 11.0714H3.6C3.2625 11.0714 3 10.7902 3 10.4286V9.78571C3 9.08259 3.525 8.5 4.2 8.5H5.4C5.71875 8.5 6.01875 8.66071 6.24375 8.8817Z"
|
|
48
|
+
fill={getColor}
|
|
49
|
+
/>
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import {
|
|
2
4
|
CSSProperties,
|
|
3
5
|
HTMLProps,
|
|
4
6
|
PropsWithChildren,
|
|
5
7
|
useEffect,
|
|
6
8
|
useState,
|
|
7
9
|
} from 'react';
|
|
8
|
-
import
|
|
10
|
+
import { useQuery } from 'react-query';
|
|
11
|
+
import styled, { css } from 'styled-components';
|
|
9
12
|
import { CoreUITheme } from '../../style/theme';
|
|
10
|
-
|
|
11
13
|
import { Loader } from '../loader/Loader.component';
|
|
12
|
-
import {
|
|
13
|
-
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
14
|
-
import { useQuery } from 'react-query';
|
|
14
|
+
import { RemoteGroup, RemoteUser } from './CustomsIcons';
|
|
15
15
|
|
|
16
16
|
export const iconTable = {
|
|
17
17
|
Account: 'fas faWallet',
|
|
@@ -139,49 +139,12 @@ export const iconTable = {
|
|
|
139
139
|
Play: 'fas faPlay',
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
const getColor = (color: string | undefined): string => {
|
|
143
|
-
const theme = useTheme();
|
|
144
|
-
if (!color) return 'currentColor';
|
|
145
|
-
|
|
146
|
-
return theme[color] || color;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
142
|
export const customIcons = {
|
|
150
143
|
'Remote-user': ({ ariaLabel, color, size }) => (
|
|
151
|
-
<
|
|
152
|
-
viewBox="0 0 19 17"
|
|
153
|
-
fill="none"
|
|
154
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
155
|
-
className={'svg-inline--fa ' + (size ? `fa-${size}` : '')}
|
|
156
|
-
aria-label={ariaLabel}
|
|
157
|
-
>
|
|
158
|
-
<path
|
|
159
|
-
d="M16.5902 0.5C17.4071 0.5 18.0984 1.1875 18.0984 2V12C18.0984 12.8438 17.4071 13.5 16.5902 13.5H10.5574L11.0601 15H13.3224C13.7309 15 14.0765 15.3438 14.0765 15.75C14.0765 16.1875 13.7309 16.5 13.3224 16.5H4.77596C4.33607 16.5 4.02186 16.1875 4.02186 15.75C4.02186 15.3438 4.33607 15 4.77596 15H7.03825L7.54098 13.5H1.5082C0.659836 13.5 0 12.8438 0 12V2C0 1.1875 0.659836 0.5 1.5082 0.5H16.5902ZM16.0874 11.5V2.5H2.01093V11.5H16.0874Z"
|
|
160
|
-
fill={getColor(color)}
|
|
161
|
-
/>
|
|
162
|
-
<path
|
|
163
|
-
d="M9.18043 7.97631C8.0165 7.97631 7.08207 7.01268 7.08207 5.81237C7.08207 4.62897 8.0165 3.64844 9.18043 3.64844C10.328 3.64844 11.2788 4.62897 11.2788 5.81237C11.2788 7.01268 10.328 7.97631 9.18043 7.97631ZM10.6394 8.51729C11.8526 8.51729 12.8526 9.54854 12.8526 10.7996V11.4927C12.8526 11.9492 12.4919 12.3042 12.0657 12.3042H6.29519C5.85256 12.3042 5.5083 11.9492 5.5083 11.4927V10.7996C5.5083 9.54854 6.49191 8.51729 7.70502 8.51729H7.98371C8.34437 8.70325 8.7542 8.78778 9.18043 8.78778C9.60666 8.78778 10.0001 8.70325 10.3608 8.51729H10.6394Z"
|
|
164
|
-
fill={getColor(color)}
|
|
165
|
-
/>
|
|
166
|
-
</svg>
|
|
144
|
+
<RemoteUser ariaLabel={ariaLabel} color={color} size={size} />
|
|
167
145
|
),
|
|
168
146
|
'Remote-group': ({ ariaLabel, color, size }) => (
|
|
169
|
-
<
|
|
170
|
-
viewBox="0 0 19 17"
|
|
171
|
-
fill="none"
|
|
172
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
173
|
-
className={'svg-inline--fa ' + (size ? `fa-${size}` : '')}
|
|
174
|
-
aria-label={ariaLabel}
|
|
175
|
-
>
|
|
176
|
-
<path
|
|
177
|
-
d="M16.5902 0.5C17.4071 0.5 18.0984 1.1875 18.0984 2V12C18.0984 12.8438 17.4071 13.5 16.5902 13.5H10.5574L11.0601 15H13.3224C13.7309 15 14.0765 15.3438 14.0765 15.75C14.0765 16.1875 13.7309 16.5 13.3224 16.5H4.77596C4.33607 16.5 4.02186 16.1875 4.02186 15.75C4.02186 15.3438 4.33607 15 4.77596 15H7.03825L7.54098 13.5H1.5082C0.659836 13.5 0 12.8438 0 12V2C0 1.1875 0.659836 0.5 1.5082 0.5H16.5902ZM16.0874 11.5V2.5H2.01093V11.5H16.0874Z"
|
|
178
|
-
fill={getColor(color)}
|
|
179
|
-
/>
|
|
180
|
-
<path
|
|
181
|
-
d="M4.8 7.85714C4.125 7.85714 3.6 7.29464 3.6 6.57143C3.6 5.8683 4.125 5.28571 4.8 5.28571C5.45625 5.28571 6 5.8683 6 6.57143C6 7.29464 5.45625 7.85714 4.8 7.85714ZM13.2 7.85714C12.525 7.85714 12 7.29464 12 6.57143C12 5.8683 12.525 5.28571 13.2 5.28571C13.8563 5.28571 14.4 5.8683 14.4 6.57143C14.4 7.29464 13.8563 7.85714 13.2 7.85714ZM13.8 8.5C14.4563 8.5 15 9.08259 15 9.78571V10.4286C15 10.7902 14.7188 11.0714 14.4 11.0714H13.1625C13.0313 10.1272 12.5063 9.32366 11.7375 8.8817C11.9625 8.66071 12.2625 8.5 12.6 8.5H13.8ZM9 8.5C7.8375 8.5 6.9 7.49554 6.9 6.25C6.9 5.02455 7.8375 4 9 4C10.1438 4 11.1 5.02455 11.1 6.25C11.1 7.49554 10.1438 8.5 9 8.5ZM10.425 9.14286C11.625 9.14286 12.6 10.1875 12.6 11.4732V12.0357C12.6 12.5781 12.1875 13 11.7 13H6.3C5.79375 13 5.4 12.5781 5.4 12.0357V11.4732C5.4 10.1875 6.35625 9.14286 7.55625 9.14286H7.70625C8.1 9.34375 8.53125 9.46429 9 9.46429C9.45 9.46429 9.88125 9.34375 10.275 9.14286H10.425ZM6.24375 8.8817C5.475 9.32366 4.95 10.1272 4.81875 11.0714H3.6C3.2625 11.0714 3 10.7902 3 10.4286V9.78571C3 9.08259 3.525 8.5 4.2 8.5H5.4C5.71875 8.5 6.01875 8.66071 6.24375 8.8817Z"
|
|
182
|
-
fill={getColor(color)}
|
|
183
|
-
/>
|
|
184
|
-
</svg>
|
|
147
|
+
<RemoteGroup ariaLabel={ariaLabel} color={color} size={size} />
|
|
185
148
|
),
|
|
186
149
|
};
|
|
187
150
|
|
|
@@ -206,6 +169,7 @@ type Props = {
|
|
|
206
169
|
withWrapper?: boolean;
|
|
207
170
|
style?: CSSProperties;
|
|
208
171
|
onClick?: (event: MouseEvent) => void;
|
|
172
|
+
title?: string;
|
|
209
173
|
};
|
|
210
174
|
|
|
211
175
|
const DelayedFallback = ({
|
|
@@ -236,16 +200,16 @@ export const IconWrapper = styled.div<{ size: SizeProp }>`
|
|
|
236
200
|
height: 2.5rem;
|
|
237
201
|
`
|
|
238
202
|
: props.size === 'sm'
|
|
239
|
-
|
|
203
|
+
? `
|
|
240
204
|
width: 1.75rem;
|
|
241
205
|
height: 1.75rem;
|
|
242
206
|
`
|
|
243
|
-
|
|
244
|
-
|
|
207
|
+
: props.size === 'xs'
|
|
208
|
+
? `
|
|
245
209
|
width: 1.5rem;
|
|
246
210
|
height: 1.5rem;
|
|
247
211
|
`
|
|
248
|
-
|
|
212
|
+
: `
|
|
249
213
|
width: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
250
214
|
height: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
251
215
|
`}
|
|
@@ -263,6 +227,7 @@ function NonWrappedIcon({
|
|
|
263
227
|
size = '1x',
|
|
264
228
|
color = undefined,
|
|
265
229
|
ariaLabel = '',
|
|
230
|
+
title,
|
|
266
231
|
...rest
|
|
267
232
|
}: Omit<Props, 'withWrapper'>) {
|
|
268
233
|
const iconInfo = iconTable[name] || customIcons[name];
|
|
@@ -320,6 +285,7 @@ function NonWrappedIcon({
|
|
|
320
285
|
color={color}
|
|
321
286
|
size={size}
|
|
322
287
|
ariaLabel={ariaLabel}
|
|
288
|
+
title={title}
|
|
323
289
|
{...rest}
|
|
324
290
|
/>
|
|
325
291
|
)}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import { getWrapper } from '../../testUtils';
|
|
4
|
+
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
import { IconHelp } from './IconHelper';
|
|
7
|
+
|
|
8
|
+
describe('IconHelper', () => {
|
|
9
|
+
const selectors = {
|
|
10
|
+
icon: () => screen.getByRole('img'),
|
|
11
|
+
};
|
|
12
|
+
const renderIcon = (tooltipMessage: React.ReactNode) => {
|
|
13
|
+
const { Wrapper } = getWrapper();
|
|
14
|
+
render(
|
|
15
|
+
<Wrapper>
|
|
16
|
+
<IconHelp tooltipMessage={tooltipMessage} title="Info" />
|
|
17
|
+
</Wrapper>,
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
it('should render correctly', async () => {
|
|
21
|
+
renderIcon('This is a tooltip');
|
|
22
|
+
await waitFor(() => {
|
|
23
|
+
expect(selectors.icon()).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
it('should display tooltip on hover', async () => {
|
|
27
|
+
const tooltipMessage = 'This is another tooltip';
|
|
28
|
+
renderIcon(tooltipMessage);
|
|
29
|
+
|
|
30
|
+
await waitFor(() => {
|
|
31
|
+
expect(selectors.icon()).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
userEvent.hover(selectors.icon());
|
|
34
|
+
await waitFor(() => {
|
|
35
|
+
expect(screen.getByText(tooltipMessage)).toBeVisible();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
it('should be able to change accessible label with title', async () => {
|
|
39
|
+
const { Wrapper } = getWrapper();
|
|
40
|
+
render(
|
|
41
|
+
<Wrapper>
|
|
42
|
+
<IconHelp
|
|
43
|
+
tooltipMessage={'This is a tooltip'}
|
|
44
|
+
title="Info Helper Testing"
|
|
45
|
+
/>
|
|
46
|
+
</Wrapper>,
|
|
47
|
+
);
|
|
48
|
+
await waitFor(() => {
|
|
49
|
+
expect(screen.getByLabelText('Info Helper Testing')).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { Icon } from '
|
|
3
|
-
import { Position, Tooltip } from '
|
|
2
|
+
import { Icon } from '../icon/Icon.component';
|
|
3
|
+
import { Position, Tooltip } from '../tooltip/Tooltip.component';
|
|
4
4
|
|
|
5
5
|
type IconHelpProps = {
|
|
6
6
|
tooltipMessage: ReactNode;
|
|
7
7
|
placement?: Position;
|
|
8
8
|
overlayStyle?: CSSProperties;
|
|
9
|
+
title?: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const IconHelp = ({
|
|
12
13
|
tooltipMessage,
|
|
13
14
|
overlayStyle,
|
|
14
15
|
placement = 'right',
|
|
16
|
+
title,
|
|
15
17
|
}: IconHelpProps) => (
|
|
16
18
|
<Tooltip
|
|
17
19
|
overlay={tooltipMessage}
|
|
18
20
|
placement={placement}
|
|
19
21
|
overlayStyle={overlayStyle}
|
|
20
22
|
>
|
|
21
|
-
<Icon name="Info" color="buttonSecondary" />
|
|
23
|
+
<Icon name="Info" color="buttonSecondary" title={title} />
|
|
22
24
|
</Tooltip>
|
|
23
25
|
);
|
|
@@ -36,8 +36,8 @@ const NavbarContainer = styled.div`
|
|
|
36
36
|
.sc-trigger-text {
|
|
37
37
|
color: ${getThemePropSelector('textPrimary')};
|
|
38
38
|
}
|
|
39
|
-
border-bottom: 0.5px solid ${(props) => props.theme.backgroundLevel3};
|
|
40
39
|
box-sizing: border-box;
|
|
40
|
+
border-bottom: 0.5px solid ${(props) => props.theme.backgroundLevel2};
|
|
41
41
|
`};
|
|
42
42
|
`;
|
|
43
43
|
const NavbarMenu = styled.div`
|
|
@@ -122,7 +122,7 @@ const NavbarMenuItem = styled.div`
|
|
|
122
122
|
&:hover {
|
|
123
123
|
background-color: ${getThemePropSelector('highlight')};
|
|
124
124
|
}
|
|
125
|
-
height:
|
|
125
|
+
height: auto;
|
|
126
126
|
font-size: ${fontSize.base};
|
|
127
127
|
}
|
|
128
128
|
.menu-item {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Icon, IconName } from '../icon/Icon.component';
|
|
2
|
+
import {
|
|
3
|
+
STATUS_WARNING,
|
|
4
|
+
STATUS_CRITICAL,
|
|
5
|
+
STATUS_HEALTHY,
|
|
6
|
+
} from '../../components/constants';
|
|
7
|
+
import { CoreUITheme } from '../../style/theme';
|
|
8
|
+
import { Loader } from '../loader/Loader.component';
|
|
9
|
+
|
|
10
|
+
export enum Status {
|
|
11
|
+
HEALTHY = 'healthy',
|
|
12
|
+
WARNING = 'warning',
|
|
13
|
+
CRITICAL = 'critical',
|
|
14
|
+
UNKNOWN = 'unknown',
|
|
15
|
+
LOADING = 'loading',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const StatusIcon = ({ status }: { status: Status }) => {
|
|
19
|
+
if (status === 'loading') {
|
|
20
|
+
return <Loader />;
|
|
21
|
+
}
|
|
22
|
+
const icon: { color: keyof CoreUITheme; name: IconName; label: string } =
|
|
23
|
+
(() => {
|
|
24
|
+
switch (status) {
|
|
25
|
+
case STATUS_HEALTHY:
|
|
26
|
+
return {
|
|
27
|
+
color: 'statusHealthy',
|
|
28
|
+
name: 'Check-circle',
|
|
29
|
+
label: 'Healthy status icon',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
case STATUS_WARNING:
|
|
33
|
+
return {
|
|
34
|
+
color: 'statusWarning',
|
|
35
|
+
name: 'Times-circle',
|
|
36
|
+
label: 'Warning status icon',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
case STATUS_CRITICAL:
|
|
40
|
+
return {
|
|
41
|
+
color: 'statusCritical',
|
|
42
|
+
name: 'Times-circle',
|
|
43
|
+
label: 'Critical status icon',
|
|
44
|
+
};
|
|
45
|
+
default:
|
|
46
|
+
return {
|
|
47
|
+
color: 'textTertiary',
|
|
48
|
+
name: 'Info',
|
|
49
|
+
label: 'Information status icon',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
return <Icon color={icon.color} name={icon.name} aria-label={icon.label} />;
|
|
55
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const STATUS_CRITICAL = 'critical';
|
|
2
|
-
const STATUS_WARNING = 'warning';
|
|
3
|
-
const STATUS_NONE = 'none';
|
|
4
|
-
const STATUS_HEALTH = 'healthy';
|
|
1
|
+
export const STATUS_CRITICAL = 'critical';
|
|
2
|
+
export const STATUS_WARNING = 'warning';
|
|
3
|
+
export const STATUS_NONE = 'none';
|
|
4
|
+
export const STATUS_HEALTH = 'healthy';
|
|
5
|
+
export const STATUS_UNKNOWN = 'unknown';
|
|
5
6
|
|
|
6
7
|
type StatusType =
|
|
7
8
|
| typeof STATUS_CRITICAL
|
|
@@ -34,8 +35,8 @@ export function compareHealth(
|
|
|
34
35
|
return weights[status1] === weights[status2]
|
|
35
36
|
? 0
|
|
36
37
|
: weights[status1] > weights[status2]
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
? 1
|
|
39
|
+
: -1;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function convertRemToPixels(rem) {
|
package/src/lib/index.ts
CHANGED
|
@@ -72,7 +72,7 @@ export { Stack, Wrap, spacing } from './spacing';
|
|
|
72
72
|
export { Form, FormSection, FormGroup } from './components/form/Form.component';
|
|
73
73
|
export { FormattedDateTime } from './components/date/FormattedDateTime';
|
|
74
74
|
export { getDateDaysDiff } from './components/date/dateDiffer';
|
|
75
|
-
export { IconHelp } from './components/IconHelper';
|
|
75
|
+
export { IconHelp } from './components/iconhelper/IconHelper';
|
|
76
76
|
export { Dropzone } from './components/dropzone/Dropzone';
|
|
77
77
|
export { Toast } from './components/toast/Toast.component';
|
|
78
78
|
export { ToastProvider, useToast } from './components/toast/ToastProvider';
|
|
@@ -2,7 +2,7 @@ import { Modal } from '../src/lib/components/modal/Modal.component';
|
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { Wrapper } from './common';
|
|
4
4
|
import { Table } from '../src/lib/components/tablev2/Tablev2.component';
|
|
5
|
-
import { IconHelp } from '../src/lib/components/IconHelper';
|
|
5
|
+
import { IconHelp } from '../src/lib/components/iconhelper/IconHelper';
|
|
6
6
|
import { Stack } from '../src/lib/spacing';
|
|
7
7
|
import { Button } from '../src/lib/components/buttonv2/Buttonv2.component';
|
|
8
8
|
import { useArgs } from '@storybook/preview-api';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Status,
|
|
4
|
+
StatusIcon,
|
|
5
|
+
} from '../src/lib/components/statusicon/StatusIcon.component';
|
|
6
|
+
import { Wrapper } from './common';
|
|
7
|
+
import { Stack, Text } from '../src/lib';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Components/statusIcon',
|
|
11
|
+
component: StatusIcon,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Playground = {
|
|
15
|
+
args: {
|
|
16
|
+
status: 'healthy',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export const Default = {
|
|
20
|
+
render: ({}) => {
|
|
21
|
+
return (
|
|
22
|
+
<Wrapper>
|
|
23
|
+
<Stack>
|
|
24
|
+
<Text>Healthy status </Text>
|
|
25
|
+
<StatusIcon status={Status.HEALTHY} />{' '}
|
|
26
|
+
</Stack>
|
|
27
|
+
<Stack>
|
|
28
|
+
<Text>Warning status </Text>
|
|
29
|
+
<StatusIcon status={Status.WARNING} />
|
|
30
|
+
</Stack>
|
|
31
|
+
<Stack>
|
|
32
|
+
<Text>Critical status </Text>
|
|
33
|
+
<StatusIcon status={Status.CRITICAL} />
|
|
34
|
+
</Stack>
|
|
35
|
+
<Stack>
|
|
36
|
+
<Text>Loading status </Text>
|
|
37
|
+
<StatusIcon status={Status.LOADING} />
|
|
38
|
+
</Stack>
|
|
39
|
+
<Stack>
|
|
40
|
+
<Text>Unknown status </Text>
|
|
41
|
+
<StatusIcon status={Status.UNKNOWN} />
|
|
42
|
+
</Stack>
|
|
43
|
+
</Wrapper>
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IconHelper.d.ts","sourceRoot":"","sources":["../../src/lib/components/IconHelper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAW,MAAM,6BAA6B,CAAC;AAEhE,KAAK,aAAa,GAAG;IACnB,cAAc,EAAE,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,QAAQ,iDAIlB,aAAa,4CAQf,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Icon } from './icon/Icon.component';
|
|
3
|
-
import { Tooltip } from './tooltip/Tooltip.component';
|
|
4
|
-
export const IconHelp = ({ tooltipMessage, overlayStyle, placement = 'right', }) => (_jsx(Tooltip, { overlay: tooltipMessage, placement: placement, overlayStyle: overlayStyle, children: _jsx(Icon, { name: "Info", color: "buttonSecondary" }) }));
|