@sisense/sdk-shared-ui 0.1.0 → 1.26.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/.storybook/main.ts +44 -0
- package/.storybook/preview-head.html +4 -0
- package/.storybook/preview.tsx +34 -0
- package/dist/index.js +40 -2
- package/package.json +99 -2
- package/src/lib/CheckableList/CheckableList.module.scss +13 -0
- package/src/lib/CheckableList/CheckableList.test.tsx +61 -0
- package/src/lib/CheckableList/CheckableList.tsx +41 -0
- package/src/lib/CheckableList/index.ts +4 -0
- package/src/lib/Checkbox/Checkbox.tsx +28 -0
- package/src/lib/Checkbox/index.ts +4 -0
- package/src/lib/Checkbox/themes/checkboxTheme.ts +42 -0
- package/src/lib/Checkbox/themes/index.ts +1 -0
- package/src/lib/Checkbox/themes/uiCustomization.ts +28 -0
- package/src/lib/DEPRECATED_Button/DEPRECATED_Button.module.scss +57 -0
- package/src/lib/DEPRECATED_Button/DEPRECATED_Button.stories.tsx +169 -0
- package/src/lib/DEPRECATED_Button/DEPRECATED_Button.test.tsx +154 -0
- package/src/lib/DEPRECATED_Button/DEPRECATED_Button.tsx +129 -0
- package/src/lib/DEPRECATED_Button/index.ts +4 -0
- package/src/lib/DEPRECATED_Checkbox/Checkbox.module.scss +49 -0
- package/src/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.test.tsx +131 -0
- package/src/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.tsx +103 -0
- package/src/lib/DEPRECATED_Checkbox/index.ts +4 -0
- package/src/lib/DEPRECATED_Icon/DEPRECATED_Icon.stories.tsx +27 -0
- package/src/lib/DEPRECATED_Icon/DEPRECATED_Icon.tsx +2 -0
- package/src/lib/DEPRECATED_Toggle/DEPRECATED_Toggle.tsx +49 -0
- package/src/lib/DEPRECATED_Toggle/index.ts +4 -0
- package/src/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.module.scss +115 -0
- package/src/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.tsx +68 -0
- package/src/lib/DEPRECATED_Tooltip/index.ts +4 -0
- package/src/lib/Dropdown/Dropdown.module.scss +9 -0
- package/src/lib/Dropdown/Dropdown.tsx +150 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButton.module.scss +49 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButton.tsx +81 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonBody/DropdownButtonBody.test.tsx +121 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonBody/DropdownButtonBody.tsx +39 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonBody/index.ts +2 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/DropdownButtonSearch.module.scss +20 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/DropdownButtonSearch.tsx +44 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/constants.ts +1 -0
- package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/index.ts +2 -0
- package/src/lib/Dropdown/DropdownButton/hooks/index.tsx +1 -0
- package/src/lib/Dropdown/DropdownButton/hooks/useDropdownButtonSearch.ts +51 -0
- package/src/lib/Dropdown/DropdownButton/index.ts +1 -0
- package/src/lib/Dropdown/hooks/index.tsx +1 -0
- package/src/lib/Dropdown/hooks/useDropdown.ts +29 -0
- package/src/lib/Dropdown/index.ts +5 -0
- package/src/lib/Dropdown/types.ts +17 -0
- package/src/lib/Icon/Icon.tsx +118 -0
- package/src/lib/Icon/index.ts +4 -0
- package/src/lib/Icon/themes/iconTheme.tsx +38 -0
- package/src/lib/Icon/themes/index.ts +1 -0
- package/src/lib/Icon/themes/uiCustomization.ts +9 -0
- package/src/lib/Input/Input.module.scss +97 -0
- package/src/lib/Input/Input.test.tsx +177 -0
- package/src/lib/Input/Input.tsx +134 -0
- package/src/lib/Input/index.ts +4 -0
- package/src/lib/LazyLoader/LazyLoader.module.scss +18 -0
- package/src/lib/LazyLoader/LazyLoader.tsx +42 -0
- package/src/lib/LazyLoader/index.ts +4 -0
- package/src/lib/Menu/Confirmation/Confirmation.module.scss +48 -0
- package/src/lib/Menu/Confirmation/Confirmation.tsx +45 -0
- package/src/lib/Menu/Confirmation/index.ts +1 -0
- package/src/lib/Menu/Confirmation/translation.ts +17 -0
- package/src/lib/Menu/Menu.module.scss +178 -0
- package/src/lib/Menu/Menu.tsx +363 -0
- package/src/lib/Menu/MenuItem/MenuItem.test.tsx +241 -0
- package/src/lib/Menu/MenuItem/MenuItem.tsx +186 -0
- package/src/lib/Menu/MenuItem/index.ts +2 -0
- package/src/lib/Menu/index.ts +6 -0
- package/src/lib/Menu/utils.ts +13 -0
- package/src/lib/Popover/Popover.module.scss +15 -0
- package/src/lib/Popover/Popover.tsx +92 -0
- package/src/lib/Popover/align.interface.ts +20 -0
- package/src/lib/Popover/index.ts +6 -0
- package/src/lib/RadioButton/RadioButton.module.scss +22 -0
- package/src/lib/RadioButton/RadioButton.tsx +89 -0
- package/src/lib/RadioButton/index.ts +4 -0
- package/src/lib/TablePagination/PaginationActionsComponent/PaginationActionsComponent.tsx +87 -0
- package/src/lib/TablePagination/PaginationActionsComponent/index.ts +4 -0
- package/src/lib/TablePagination/PaginationActionsComponent/themes/index.ts +4 -0
- package/src/lib/TablePagination/PaginationActionsComponent/themes/paginationActionsComponentTheme.tsx +70 -0
- package/src/lib/TablePagination/PaginationActionsComponent/themes/uiCustomization.ts +17 -0
- package/src/lib/TablePagination/TablePagination.tsx +148 -0
- package/src/lib/TablePagination/TablePaginationContext.ts +4 -0
- package/src/lib/TablePagination/index.ts +4 -0
- package/src/lib/TablePagination/themes/index.ts +1 -0
- package/src/lib/TablePagination/themes/tablePaginationResponsiveDesign.ts +33 -0
- package/src/lib/TablePagination/themes/tablePaginationTheme.tsx +128 -0
- package/src/lib/TablePagination/themes/uiCustomization.ts +50 -0
- package/src/lib/Tooltip/Tooltip.module.scss +125 -0
- package/src/lib/Tooltip/Tooltip.tsx +34 -0
- package/src/lib/Tooltip/index.ts +5 -0
- package/src/lib/Tooltip/themes/index.ts +1 -0
- package/src/lib/Tooltip/themes/tooltipTheme.ts +30 -0
- package/src/lib/Typography/Typography.tsx +28 -0
- package/src/lib/Typography/index.ts +5 -0
- package/src/lib/Typography/themes/index.ts +1 -0
- package/src/lib/Typography/themes/typographyTheme.tsx +170 -0
- package/src/lib/Typography/themes/uiCustomization.ts +10 -0
- package/src/lib/constants/styleguideConstants.ts +8 -0
- package/src/lib/index.ts +16 -0
- package/src/lib/styles/colors.module.scss +10 -0
- package/src/lib/styles/sisenseStyleguideReactColors.scss +57 -0
- package/src/lib/styles/style_styleguide_react/_variables.deprecated.scss +107 -0
- package/src/lib/styles/style_styleguide_react/_variables.scss +100 -0
- package/src/lib/styles/style_styleguide_react/base.scss +9 -0
- package/src/lib/styles/style_styleguide_react/colors.scss +71 -0
- package/src/lib/styles/style_styleguide_react/exports/colors.exports.scss +69 -0
- package/src/lib/styles/style_styleguide_react/exports/fonts.exports.scss +33 -0
- package/src/lib/styles/style_styleguide_react/fonts.scss +27 -0
- package/src/lib/styles/style_styleguide_react/mixins.scss +90 -0
- package/src/lib/themes/colors/index.ts +1 -0
- package/src/lib/themes/colors/siColors.ts +143 -0
- package/src/lib/themes/index.ts +2 -0
- package/src/lib/themes/types/SisenseTheme.ts +12 -0
- package/src/lib/themes/types/index.ts +1 -0
- package/tsconfig.lib.json +2 -1
- package/vite.config.ts +18 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React, { ForwardedRef } from 'react';
|
|
2
|
+
import MuiTablePagination, {
|
|
3
|
+
type TablePaginationProps as MuiTablePaginationProps,
|
|
4
|
+
} from '@mui/material/TablePagination';
|
|
5
|
+
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
6
|
+
import { useMeasure } from 'react-use';
|
|
7
|
+
import { UsePaginationProps } from '@mui/material/usePagination/usePagination';
|
|
8
|
+
|
|
9
|
+
import { TablePaginationContext } from './TablePaginationContext';
|
|
10
|
+
import {
|
|
11
|
+
getCurrentBreakpoint,
|
|
12
|
+
RESPONSIVE_TABLE_PAGINATION_CLASS,
|
|
13
|
+
tablePaginationResponsiveWidth,
|
|
14
|
+
} from './themes/tablePaginationResponsiveDesign';
|
|
15
|
+
import { PaginationActionsComponent } from './PaginationActionsComponent';
|
|
16
|
+
import { Typography } from '../Typography';
|
|
17
|
+
import { Icon, type IconProps } from '../Icon';
|
|
18
|
+
|
|
19
|
+
import { siColors } from '../themes';
|
|
20
|
+
import { tablePaginationTheme, type TablePaginationTheme } from './themes';
|
|
21
|
+
|
|
22
|
+
type MuiSelectDisplayProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
23
|
+
'data-testid'?: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type TablePaginationProps = Omit<
|
|
27
|
+
MuiTablePaginationProps,
|
|
28
|
+
'onPageChange' | 'ActionsComponent' | 'labelRowsPerPage' | 'onRowsPerPageChange'
|
|
29
|
+
> & {
|
|
30
|
+
displayedLabelRows: { conjunction: string; result: string };
|
|
31
|
+
onRowsPerPageChange: (rowsPerPage: number) => void;
|
|
32
|
+
onPageChange: (page: number) => void;
|
|
33
|
+
theme?: TablePaginationTheme;
|
|
34
|
+
labelRowsPerPage: string;
|
|
35
|
+
labelRowsPerPageShort?: string;
|
|
36
|
+
dataTestId?: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const PAGE_START_ZERO_BASE_INDEX = 1;
|
|
40
|
+
|
|
41
|
+
const TablePagination = React.forwardRef(
|
|
42
|
+
// eslint-disable-next-line max-lines-per-function
|
|
43
|
+
(
|
|
44
|
+
{
|
|
45
|
+
count,
|
|
46
|
+
page,
|
|
47
|
+
rowsPerPage,
|
|
48
|
+
onRowsPerPageChange,
|
|
49
|
+
displayedLabelRows,
|
|
50
|
+
onPageChange,
|
|
51
|
+
labelRowsPerPage,
|
|
52
|
+
labelRowsPerPageShort = 'Rows',
|
|
53
|
+
rowsPerPageOptions = [10, 25, 50, 75],
|
|
54
|
+
theme = tablePaginationTheme,
|
|
55
|
+
dataTestId,
|
|
56
|
+
style,
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
|
58
|
+
...rest
|
|
59
|
+
}: TablePaginationProps,
|
|
60
|
+
ref: ForwardedRef<HTMLDivElement>,
|
|
61
|
+
) => {
|
|
62
|
+
// React sensor hook that tracks dimensions of an HTML element using the Resize Observer API
|
|
63
|
+
const [measureRef, { width }] = useMeasure<HTMLDivElement>();
|
|
64
|
+
const breakpointIsLessThanLg = width < tablePaginationResponsiveWidth.lg;
|
|
65
|
+
|
|
66
|
+
const handleLabelDisplayedRows = ({
|
|
67
|
+
from,
|
|
68
|
+
to,
|
|
69
|
+
count,
|
|
70
|
+
}: {
|
|
71
|
+
from: number;
|
|
72
|
+
to: number;
|
|
73
|
+
count: number;
|
|
74
|
+
}) => {
|
|
75
|
+
const msg = breakpointIsLessThanLg
|
|
76
|
+
? `${from}-${to} / ${count}`
|
|
77
|
+
: `${from}-${to} ${displayedLabelRows.conjunction} ${count} ${displayedLabelRows.result}`;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Typography variant={'bodyParagraph'} sx={{ color: siColors.StTextColors.secondary }}>
|
|
81
|
+
{msg}
|
|
82
|
+
</Typography>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleOnPageChange = (event: React.MouseEvent<HTMLButtonElement> | null, page: number) =>
|
|
87
|
+
onPageChange(page);
|
|
88
|
+
|
|
89
|
+
const handleOnRowsPerPage = (
|
|
90
|
+
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
|
|
91
|
+
) => onRowsPerPageChange(Number(event.target.value));
|
|
92
|
+
|
|
93
|
+
const breakpoint = getCurrentBreakpoint(width);
|
|
94
|
+
const paginationProps: UsePaginationProps = {
|
|
95
|
+
siblingCount: breakpointIsLessThanLg ? 0 : 1,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ThemeProvider theme={theme}>
|
|
100
|
+
<TablePaginationContext.Provider value={paginationProps}>
|
|
101
|
+
<div className={`${RESPONSIVE_TABLE_PAGINATION_CLASS} ${breakpoint}`} ref={measureRef}>
|
|
102
|
+
<MuiTablePagination
|
|
103
|
+
ref={ref}
|
|
104
|
+
component={'div'}
|
|
105
|
+
count={count}
|
|
106
|
+
page={page - PAGE_START_ZERO_BASE_INDEX}
|
|
107
|
+
ActionsComponent={PaginationActionsComponent}
|
|
108
|
+
onPageChange={handleOnPageChange}
|
|
109
|
+
onRowsPerPageChange={handleOnRowsPerPage}
|
|
110
|
+
rowsPerPage={rowsPerPage}
|
|
111
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
112
|
+
labelDisplayedRows={handleLabelDisplayedRows}
|
|
113
|
+
slotProps={{
|
|
114
|
+
select: {
|
|
115
|
+
SelectDisplayProps: {
|
|
116
|
+
'data-testid': 'TablePaginationSelect',
|
|
117
|
+
} as MuiSelectDisplayProps,
|
|
118
|
+
IconComponent: (props: IconProps) => (
|
|
119
|
+
<Icon {...props} name="general-arrow-big-down" />
|
|
120
|
+
),
|
|
121
|
+
renderValue: (value: unknown) => (
|
|
122
|
+
<Typography variant={'bodyParagraph'}>{String(value)}</Typography>
|
|
123
|
+
),
|
|
124
|
+
MenuProps: {
|
|
125
|
+
sx: {
|
|
126
|
+
'.MuiPaper-root': {
|
|
127
|
+
fontFamily: style?.fontFamily,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
}}
|
|
133
|
+
labelRowsPerPage={
|
|
134
|
+
<Typography variant={'bodyParagraph'}>
|
|
135
|
+
{breakpointIsLessThanLg ? labelRowsPerPageShort : labelRowsPerPage}
|
|
136
|
+
</Typography>
|
|
137
|
+
}
|
|
138
|
+
data-testid={dataTestId}
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</TablePaginationContext.Provider>
|
|
142
|
+
</ThemeProvider>
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
export default TablePagination;
|
|
148
|
+
export { TablePagination };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { tablePaginationTheme, type TablePaginationTheme } from './tablePaginationTheme';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const RESPONSIVE_TABLE_PAGINATION_CLASS = 'responsive-table-pagination';
|
|
2
|
+
|
|
3
|
+
// Each breakpoint (a key) matches with a fixed screen width in px:
|
|
4
|
+
export const tablePaginationResponsiveWidth = {
|
|
5
|
+
xs: 0,
|
|
6
|
+
sm: 200,
|
|
7
|
+
md: 439,
|
|
8
|
+
lg: 600,
|
|
9
|
+
xl: 1536,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getCurrentBreakpoint = (width: number): string => {
|
|
13
|
+
if (inRange(tablePaginationResponsiveWidth.xs, tablePaginationResponsiveWidth.sm, width)) {
|
|
14
|
+
return 'xs';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (inRange(tablePaginationResponsiveWidth.sm, tablePaginationResponsiveWidth.md, width)) {
|
|
18
|
+
return 'sm';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (inRange(tablePaginationResponsiveWidth.md, tablePaginationResponsiveWidth.lg, width)) {
|
|
22
|
+
return 'md';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (inRange(tablePaginationResponsiveWidth.lg, tablePaginationResponsiveWidth.xl, width)) {
|
|
26
|
+
return 'lg';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return 'xl';
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const inRange = (start: number, end: number, point: number): boolean =>
|
|
33
|
+
point >= start && point < end;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import createTheme from '@mui/material/styles/createTheme';
|
|
2
|
+
|
|
3
|
+
// import { injectStylesWithWrapper, themeService } from '@sbi/styleguide';
|
|
4
|
+
|
|
5
|
+
import { siColors, stEffects } from '../../themes';
|
|
6
|
+
// import { calcStyles } from './uiCustomization';
|
|
7
|
+
import { tablePaginationResponsiveWidth } from './tablePaginationResponsiveDesign';
|
|
8
|
+
|
|
9
|
+
// injectStylesWithWrapper && injectStylesWithWrapper(calcStyles);
|
|
10
|
+
export const tablePaginationTheme = createTheme({
|
|
11
|
+
breakpoints: {
|
|
12
|
+
values: tablePaginationResponsiveWidth,
|
|
13
|
+
},
|
|
14
|
+
components: {
|
|
15
|
+
MuiTablePagination: {
|
|
16
|
+
styleOverrides: {
|
|
17
|
+
root: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
justifyContent: 'space-between',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
width: '100%',
|
|
23
|
+
},
|
|
24
|
+
toolbar: {
|
|
25
|
+
'&.MuiTablePagination-toolbar': {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
padding: '0px 20px 0 20px',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
height: '30px',
|
|
31
|
+
width: '100%',
|
|
32
|
+
},
|
|
33
|
+
'.Mui-selected': {
|
|
34
|
+
margin: 0,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
spacer: {
|
|
38
|
+
display: 'none',
|
|
39
|
+
},
|
|
40
|
+
displayedRows: {
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
},
|
|
43
|
+
selectLabel: {
|
|
44
|
+
order: 4,
|
|
45
|
+
paddingLeft: '20px',
|
|
46
|
+
},
|
|
47
|
+
input: {
|
|
48
|
+
order: 5,
|
|
49
|
+
display: 'flex',
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
borderRadius: '4px',
|
|
53
|
+
marginRight: '0',
|
|
54
|
+
},
|
|
55
|
+
select: {
|
|
56
|
+
'&.MuiTablePagination-select': {
|
|
57
|
+
background: 'transparent',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
selectIcon: {
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
top: '8%',
|
|
63
|
+
},
|
|
64
|
+
menuItem: {
|
|
65
|
+
paddingLeft: '10px',
|
|
66
|
+
'&.MuiTablePagination-menuItem.Mui-selected': {
|
|
67
|
+
position: 'relative',
|
|
68
|
+
background: 'transparent',
|
|
69
|
+
// '&:hover': {
|
|
70
|
+
// backgroundColor:
|
|
71
|
+
// themeService.getDesignSettings().typography.primaryTextColor,
|
|
72
|
+
// color: themeService.getDesignSettings().typography.primaryTextColor,
|
|
73
|
+
// },
|
|
74
|
+
'&:after': {
|
|
75
|
+
marginLeft: '15px',
|
|
76
|
+
content: '""',
|
|
77
|
+
display: 'block',
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
width: '24px',
|
|
80
|
+
height: '24px',
|
|
81
|
+
top: '3px',
|
|
82
|
+
backgroundImage:
|
|
83
|
+
"url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M16.2604 8.58124L10.9174 16.0615L7 12.1442L7.70711 11.4371L10.7898 14.5197L15.4467 8L16.2604 8.58124Z' fill='%235B6372'/%3E%3C/svg%3E%0A\")",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
'&.MuiTablePagination-menuItem': {
|
|
87
|
+
fontFamily: 'inherit',
|
|
88
|
+
fontWeight: '400',
|
|
89
|
+
fontSize: '13px',
|
|
90
|
+
lineHeight: '18px',
|
|
91
|
+
color: siColors.StTextColors.content,
|
|
92
|
+
},
|
|
93
|
+
'&:hover': {
|
|
94
|
+
backgroundColor: siColors.StBackgroundColors.priority,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
actions: {
|
|
98
|
+
marginLeft: 0,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
MuiPaper: {
|
|
103
|
+
styleOverrides: {
|
|
104
|
+
root: {
|
|
105
|
+
display: 'flex',
|
|
106
|
+
flexDirection: 'column',
|
|
107
|
+
alignItems: 'flex-start',
|
|
108
|
+
padding: '4px 0px',
|
|
109
|
+
gap: '4px',
|
|
110
|
+
marginTop: '4px',
|
|
111
|
+
background: siColors.StBackgroundColors.workspace,
|
|
112
|
+
boxShadow: stEffects.Shadows.level1,
|
|
113
|
+
borderRadius: '4px',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
MuiList: {
|
|
118
|
+
styleOverrides: {
|
|
119
|
+
root: {
|
|
120
|
+
padding: 0,
|
|
121
|
+
width: '100%',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export type TablePaginationTheme = typeof tablePaginationTheme;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// import { CalcStyles, DesignSettings, utils } from '@sbi/styleguide';
|
|
3
|
+
// import { RESPONSIVE_TABLE_PAGINATION_CLASS } from './tablePaginationResponsiveDesign';
|
|
4
|
+
//
|
|
5
|
+
// const DEFAULT_OPACITY = 0.1;
|
|
6
|
+
//
|
|
7
|
+
// export const calcStyles: CalcStyles = (designSettings: DesignSettings) => ({
|
|
8
|
+
// [`.${RESPONSIVE_TABLE_PAGINATION_CLASS}`]: {
|
|
9
|
+
// '&.sm, &.xs': {
|
|
10
|
+
// '.MuiTablePagination-selectLabel, .MuiTablePagination-displayedRows, .MuiInputBase-root':
|
|
11
|
+
// {
|
|
12
|
+
// display: 'none',
|
|
13
|
+
// },
|
|
14
|
+
// '.MuiTablePagination-toolbar': {
|
|
15
|
+
// padding: 0,
|
|
16
|
+
// },
|
|
17
|
+
// },
|
|
18
|
+
// '&.xs': {
|
|
19
|
+
// '.MuiPaginationItem-page, .MuiPaginationItem-ellipsis': {
|
|
20
|
+
// display: 'none',
|
|
21
|
+
// },
|
|
22
|
+
// '.Mui-selected, .MuiPaginationItem-firstLast': {
|
|
23
|
+
// display: 'block',
|
|
24
|
+
// padding: 0,
|
|
25
|
+
// },
|
|
26
|
+
// '.MuiPaginationItem-previousNext': {
|
|
27
|
+
// width: '26px',
|
|
28
|
+
// },
|
|
29
|
+
// },
|
|
30
|
+
// width: '100%',
|
|
31
|
+
// },
|
|
32
|
+
// '.MuiTablePagination-root': {
|
|
33
|
+
// backgroundColor: utils.makeASlightlyDifferentColor(
|
|
34
|
+
// designSettings.general.backgroundColor,
|
|
35
|
+
// DEFAULT_OPACITY,
|
|
36
|
+
// ),
|
|
37
|
+
// },
|
|
38
|
+
// '.MuiTablePagination-select.MuiTablePagination-select': {
|
|
39
|
+
// backgroundColor: designSettings.general.backgroundColor,
|
|
40
|
+
// },
|
|
41
|
+
// '.MuiTablePagination-select': {
|
|
42
|
+
// color: designSettings.typography.primaryTextColor,
|
|
43
|
+
// },
|
|
44
|
+
// '.MuiTablePagination-selectIcon': {
|
|
45
|
+
// color: utils.makeASlightlyDifferentColor(
|
|
46
|
+
// designSettings.typography.secondaryTextColor,
|
|
47
|
+
// DEFAULT_OPACITY,
|
|
48
|
+
// ),
|
|
49
|
+
// },
|
|
50
|
+
// });
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import '../styles/style_styleguide_react/base';
|
|
3
|
+
|
|
4
|
+
$tooltip-max-width: 432px;
|
|
5
|
+
|
|
6
|
+
:global {
|
|
7
|
+
@import 'rc-tooltip/assets/bootstrap_white';
|
|
8
|
+
|
|
9
|
+
$arrow-size: 8px;
|
|
10
|
+
$arrow-depth: 6px; // Math.ceil(sqrt(2) * $arrow-size / 2)
|
|
11
|
+
|
|
12
|
+
.rc-tooltip {
|
|
13
|
+
padding: 0;
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
opacity: 1;
|
|
16
|
+
|
|
17
|
+
&.hide-arrow {
|
|
18
|
+
.rc-tooltip-arrow,
|
|
19
|
+
.rc-tooltip-content:before {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.rc-tooltip-placement-top,
|
|
24
|
+
&.rc-tooltip-placement-bottom,
|
|
25
|
+
&.rc-tooltip-placement-left,
|
|
26
|
+
&.rc-tooltip-placement-right {
|
|
27
|
+
padding: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rc-tooltip-inner {
|
|
31
|
+
padding: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rc-tooltip-content {
|
|
37
|
+
position: relative;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rc-tooltip-inner {
|
|
41
|
+
padding: 6px 12px;
|
|
42
|
+
min-height: 0;
|
|
43
|
+
border: 0;
|
|
44
|
+
border-radius: 4px;
|
|
45
|
+
@include boxShadow;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
color: $fore;
|
|
48
|
+
font-size: $sizeDefault;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rc-tooltip-arrow {
|
|
52
|
+
border-width: 0 !important;
|
|
53
|
+
width: $arrow-size;
|
|
54
|
+
height: $arrow-size;
|
|
55
|
+
background-color: $back;
|
|
56
|
+
@include boxShadow;
|
|
57
|
+
z-index: -1;
|
|
58
|
+
transform: rotate(45deg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.rc-tooltip-content:before {
|
|
62
|
+
content: '';
|
|
63
|
+
position: absolute;
|
|
64
|
+
width: $arrow-size;
|
|
65
|
+
height: $arrow-size;
|
|
66
|
+
background-color: $back;
|
|
67
|
+
transform: rotate(45deg);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.rc-tooltip-placement-top {
|
|
71
|
+
padding-bottom: $arrow-depth;
|
|
72
|
+
|
|
73
|
+
.rc-tooltip-arrow,
|
|
74
|
+
.rc-tooltip-content:before {
|
|
75
|
+
left: 50%;
|
|
76
|
+
margin-left: math.div(-$arrow-size, 2);
|
|
77
|
+
bottom: math.div(-$arrow-size, 2);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.rc-tooltip-placement-bottom {
|
|
82
|
+
padding-top: $arrow-depth;
|
|
83
|
+
|
|
84
|
+
.rc-tooltip-arrow,
|
|
85
|
+
.rc-tooltip-content:before {
|
|
86
|
+
left: 50%;
|
|
87
|
+
margin-left: math.div(-$arrow-size, 2);
|
|
88
|
+
top: math.div(-$arrow-size, 2);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.rc-tooltip-placement-right {
|
|
93
|
+
padding-left: $arrow-depth;
|
|
94
|
+
|
|
95
|
+
.rc-tooltip-arrow,
|
|
96
|
+
.rc-tooltip-content:before {
|
|
97
|
+
top: 50%;
|
|
98
|
+
margin-top: math.div(-$arrow-size, 2);
|
|
99
|
+
left: math.div(-$arrow-size, 2);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.rc-tooltip-placement-left {
|
|
104
|
+
padding-right: $arrow-depth;
|
|
105
|
+
|
|
106
|
+
.rc-tooltip-arrow,
|
|
107
|
+
.rc-tooltip-content:before {
|
|
108
|
+
top: 50%;
|
|
109
|
+
margin-top: math.div(-$arrow-size, 2);
|
|
110
|
+
right: math.div(-$arrow-size, 2);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.breakLongWord {
|
|
116
|
+
word-break: break-all;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.semanticText {
|
|
120
|
+
max-width: $tooltip-max-width;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:global(.sis-scope).tooltip {
|
|
124
|
+
padding: 12px 16px;
|
|
125
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import MuiTooltip, { type TooltipProps as MuiTooltipProps } from '@mui/material/Tooltip';
|
|
3
|
+
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import { tooltipTheme, type TooltipTheme } from './themes';
|
|
7
|
+
import { styleguideConstants } from '../constants/styleguideConstants';
|
|
8
|
+
import styles from './Tooltip.module.scss';
|
|
9
|
+
|
|
10
|
+
export type TooltipProps = MuiTooltipProps & { theme?: TooltipTheme };
|
|
11
|
+
|
|
12
|
+
const Tooltip = forwardRef(
|
|
13
|
+
({ title, children, arrow, theme = tooltipTheme, ...rest }: TooltipProps, ref) => {
|
|
14
|
+
const { classes: customClasses = {} } = rest;
|
|
15
|
+
const classes = {
|
|
16
|
+
...customClasses,
|
|
17
|
+
tooltip: classnames(
|
|
18
|
+
styles.tooltip,
|
|
19
|
+
customClasses.tooltip,
|
|
20
|
+
styleguideConstants.SISENSE_NAMESPACE,
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
return (
|
|
24
|
+
<ThemeProvider theme={theme}>
|
|
25
|
+
<MuiTooltip {...rest} title={title} arrow={arrow} ref={ref} classes={classes}>
|
|
26
|
+
{children}
|
|
27
|
+
</MuiTooltip>
|
|
28
|
+
</ThemeProvider>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export default Tooltip;
|
|
34
|
+
export { Tooltip };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { tooltipTheme, type TooltipTheme } from './tooltipTheme';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import createTheme from '@mui/material/styles/createTheme';
|
|
2
|
+
import { siColors } from '../../themes';
|
|
3
|
+
|
|
4
|
+
export const tooltipTheme = createTheme({
|
|
5
|
+
components: {
|
|
6
|
+
MuiTooltip: {
|
|
7
|
+
styleOverrides: {
|
|
8
|
+
arrow: {
|
|
9
|
+
color: siColors.StBackgroundColors.workspace,
|
|
10
|
+
},
|
|
11
|
+
tooltip: {
|
|
12
|
+
color: siColors.StTextColors.content,
|
|
13
|
+
maxWidth: '432px',
|
|
14
|
+
borderRadius: '4px',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
padding: '12px 16px',
|
|
20
|
+
gap: '10px',
|
|
21
|
+
backgroundColor: siColors.StBackgroundColors.workspace,
|
|
22
|
+
filter:
|
|
23
|
+
'drop-shadow(0px 1px 4px rgba(9, 9, 10, 0.1)) drop-shadow(0px 4px 12px rgba(9, 9, 10, 0.2));',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type TooltipTheme = typeof tooltipTheme;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { ForwardedRef } from 'react';
|
|
2
|
+
import MuiTypography, {
|
|
3
|
+
type TypographyProps as MuiTypographyProps,
|
|
4
|
+
} from '@mui/material/Typography';
|
|
5
|
+
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
6
|
+
|
|
7
|
+
import { typographyTheme, type TypographyTheme } from './themes';
|
|
8
|
+
|
|
9
|
+
export type TypographyProps = MuiTypographyProps & {
|
|
10
|
+
theme?: TypographyTheme;
|
|
11
|
+
dataTestId?: string;
|
|
12
|
+
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
13
|
+
|
|
14
|
+
const Typography = React.forwardRef(
|
|
15
|
+
(
|
|
16
|
+
{ children, theme = typographyTheme, dataTestId, ...rest }: TypographyProps,
|
|
17
|
+
ref: ForwardedRef<HTMLSpanElement>,
|
|
18
|
+
) => (
|
|
19
|
+
<ThemeProvider theme={theme}>
|
|
20
|
+
<MuiTypography ref={ref} {...rest} data-testid={dataTestId}>
|
|
21
|
+
{children}
|
|
22
|
+
</MuiTypography>
|
|
23
|
+
</ThemeProvider>
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default Typography;
|
|
28
|
+
export { Typography };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { typographyTheme, type TypographyTheme } from './typographyTheme';
|