@sisense/sdk-shared-ui 0.1.0 → 1.27.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 +135 -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,186 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { DEPRECATED_Icon } from '../../DEPRECATED_Icon';
|
|
5
|
+
|
|
6
|
+
import { RadioButton } from '../../RadioButton';
|
|
7
|
+
import { DEPRECATED_Toggle } from '../../DEPRECATED_Toggle';
|
|
8
|
+
import { DEPRECATED_Checkbox } from '../../DEPRECATED_Checkbox';
|
|
9
|
+
import { DEPRECATED_Tooltip } from '../../DEPRECATED_Tooltip';
|
|
10
|
+
|
|
11
|
+
import styles from '../Menu.module.scss';
|
|
12
|
+
|
|
13
|
+
import { styleguideConstants } from '../../constants/styleguideConstants';
|
|
14
|
+
|
|
15
|
+
export type ItemType = 'item' | 'radio' | 'checkbox' | 'toggle' | 'nested';
|
|
16
|
+
|
|
17
|
+
export const itemTypes: { [key: string]: ItemType } = Object.freeze({
|
|
18
|
+
ITEM: 'item',
|
|
19
|
+
RADIO: 'radio',
|
|
20
|
+
CHECKBOX: 'checkbox',
|
|
21
|
+
TOGGLE: 'toggle',
|
|
22
|
+
NESTED: 'nested',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type MenuItemProps = {
|
|
26
|
+
checked?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
dataTestId?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
handleClick: () => void;
|
|
31
|
+
handleOut?: () => void;
|
|
32
|
+
handleOver?: () => void;
|
|
33
|
+
iconClass?: string;
|
|
34
|
+
iconName?: string;
|
|
35
|
+
isDrill?: boolean;
|
|
36
|
+
caption: string;
|
|
37
|
+
subCaption?: string;
|
|
38
|
+
level?: number;
|
|
39
|
+
tooltip?: string | React.ReactFragment;
|
|
40
|
+
classNameTooltip?: string;
|
|
41
|
+
type: ItemType;
|
|
42
|
+
selected?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export class MenuItem extends Component<MenuItemProps, unknown> {
|
|
46
|
+
static defaultProps = {
|
|
47
|
+
className: '',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
constructor(props: MenuItemProps) {
|
|
51
|
+
super(props);
|
|
52
|
+
this.state = { inInlineConfirmation: false };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getContent() {
|
|
56
|
+
const { type, caption, subCaption, checked, selected } = this.props;
|
|
57
|
+
switch (type) {
|
|
58
|
+
case itemTypes.RADIO:
|
|
59
|
+
return (
|
|
60
|
+
<RadioButton
|
|
61
|
+
text={caption}
|
|
62
|
+
name={caption}
|
|
63
|
+
onChange={() => null}
|
|
64
|
+
value={caption}
|
|
65
|
+
checked={Boolean(checked)}
|
|
66
|
+
preventClick
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
case itemTypes.CHECKBOX:
|
|
70
|
+
return (
|
|
71
|
+
<DEPRECATED_Checkbox
|
|
72
|
+
title={caption}
|
|
73
|
+
text={caption}
|
|
74
|
+
onChange={() => null}
|
|
75
|
+
checked={Boolean(checked)}
|
|
76
|
+
className={styles.itemCheckBox}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
case itemTypes.TOGGLE:
|
|
80
|
+
return (
|
|
81
|
+
<div>
|
|
82
|
+
<span>{caption}</span>
|
|
83
|
+
<DEPRECATED_Toggle
|
|
84
|
+
onChange={() => null}
|
|
85
|
+
className={styles.toggleButtonMenu}
|
|
86
|
+
checked={Boolean(checked)}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
case itemTypes.NESTED:
|
|
91
|
+
return (
|
|
92
|
+
<div className={styles.nestedType}>
|
|
93
|
+
<div>{caption}</div>
|
|
94
|
+
<DEPRECATED_Icon className={styles.nestedIcon} name="general-double-arrow-front" />
|
|
95
|
+
<div>{subCaption}</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
default:
|
|
99
|
+
return (
|
|
100
|
+
<div className={styles.itemType}>
|
|
101
|
+
{caption}
|
|
102
|
+
{selected && <DEPRECATED_Icon name="general-vi-small-white" />}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
handleClick(e: React.MouseEvent) {
|
|
109
|
+
//This line is must-to-have if we update rc-tooltip version to 3.7.3 or upper
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
const { handleClick, disabled } = this.props;
|
|
112
|
+
|
|
113
|
+
if (disabled) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
handleClick();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
renderRegularMenuItem = () => {
|
|
121
|
+
const { dataTestId, iconName, iconClass, isDrill } = this.props;
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<span className={styles.itemContainer}>
|
|
125
|
+
{iconName && <DEPRECATED_Icon name={iconName} className={iconClass} />}
|
|
126
|
+
<span
|
|
127
|
+
data-testid={dataTestId}
|
|
128
|
+
className={classnames(styles.menuItemText, styleguideConstants.TEXT_PRIMARY)}
|
|
129
|
+
>
|
|
130
|
+
{this.getContent()}
|
|
131
|
+
</span>
|
|
132
|
+
{isDrill && <DEPRECATED_Icon name={'general-arrow-right'} />}
|
|
133
|
+
</span>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
renderMenuItem = () => {
|
|
138
|
+
const { tooltip, classNameTooltip, level } = this.props;
|
|
139
|
+
const menuItemContent = this.renderRegularMenuItem();
|
|
140
|
+
|
|
141
|
+
if (tooltip) {
|
|
142
|
+
const overlay = <div>{tooltip}</div>;
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<DEPRECATED_Tooltip
|
|
146
|
+
overlay={overlay}
|
|
147
|
+
placement="right"
|
|
148
|
+
overlayClassName={classnames(classNameTooltip, styles.menuItemTooltip)}
|
|
149
|
+
mouseLeaveDelay={0}
|
|
150
|
+
align={{ offset: [level ? 5 : 10, 0] }}
|
|
151
|
+
>
|
|
152
|
+
{menuItemContent}
|
|
153
|
+
</DEPRECATED_Tooltip>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return menuItemContent;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
render() {
|
|
161
|
+
const { checked, className, iconName, handleOver, handleOut, disabled } = this.props;
|
|
162
|
+
// const { inInlineConfirmation } = this.state;
|
|
163
|
+
const inInlineConfirmation = false;
|
|
164
|
+
|
|
165
|
+
const itemClasses = classnames(className, {
|
|
166
|
+
[styles.checked]: checked,
|
|
167
|
+
[styles.noIcon]: !iconName || inInlineConfirmation,
|
|
168
|
+
[styles.disabled]: disabled,
|
|
169
|
+
[styleguideConstants.TEXT_PRIMARY]: checked,
|
|
170
|
+
[styleguideConstants.TEXT_SECONDARY_HOVER]: !checked && !disabled,
|
|
171
|
+
[styleguideConstants.TEXT_SECONDARY]: disabled,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<li
|
|
176
|
+
data-menu-item
|
|
177
|
+
className={itemClasses}
|
|
178
|
+
onClick={this.handleClick.bind(this)}
|
|
179
|
+
onMouseOver={handleOver}
|
|
180
|
+
onMouseOut={handleOut}
|
|
181
|
+
>
|
|
182
|
+
{this.renderMenuItem()}
|
|
183
|
+
</li>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Groups<T> = { [group: string]: T[] };
|
|
2
|
+
|
|
3
|
+
export function groupBy<T>(arr: Array<T>, groupFunc: (val: T) => string): Groups<T> {
|
|
4
|
+
const initialGroups: Groups<T> = {};
|
|
5
|
+
return arr.reduce(function (acc, curr) {
|
|
6
|
+
const key = groupFunc(curr);
|
|
7
|
+
if (!acc[key]) {
|
|
8
|
+
acc[key] = [];
|
|
9
|
+
}
|
|
10
|
+
acc[key].push(curr);
|
|
11
|
+
return acc;
|
|
12
|
+
}, initialGroups);
|
|
13
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import type { TooltipProps } from 'rc-tooltip/lib/Tooltip';
|
|
5
|
+
|
|
6
|
+
import { DEPRECATED_Tooltip } from '../DEPRECATED_Tooltip';
|
|
7
|
+
|
|
8
|
+
import type { PositioningConfig } from './align.interface';
|
|
9
|
+
|
|
10
|
+
const noop = () => {};
|
|
11
|
+
|
|
12
|
+
import styles from './Popover.module.scss';
|
|
13
|
+
|
|
14
|
+
const DEFAULT_Z_INDEX = 1069;
|
|
15
|
+
|
|
16
|
+
export type PopoverProps = Pick<
|
|
17
|
+
TooltipProps,
|
|
18
|
+
'children' | 'onVisibleChange' | 'overlay' | 'placement' | 'trigger' | 'visible' | 'overlayStyle'
|
|
19
|
+
> & {
|
|
20
|
+
align?: PositioningConfig;
|
|
21
|
+
level?: number;
|
|
22
|
+
bubbleMouseEvents?: boolean;
|
|
23
|
+
mask?: boolean;
|
|
24
|
+
maskClassName?: string;
|
|
25
|
+
onRequestClose?: (ev: Event) => void;
|
|
26
|
+
zIndex?: number;
|
|
27
|
+
getTooltipContainer?: () => HTMLElement;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const Popover = (props: PopoverProps): JSX.Element => {
|
|
31
|
+
const {
|
|
32
|
+
bubbleMouseEvents = false,
|
|
33
|
+
level = 0,
|
|
34
|
+
mask: maskVisible = true,
|
|
35
|
+
onRequestClose = noop,
|
|
36
|
+
visible = false,
|
|
37
|
+
zIndex = DEFAULT_Z_INDEX,
|
|
38
|
+
maskClassName,
|
|
39
|
+
getTooltipContainer,
|
|
40
|
+
} = props;
|
|
41
|
+
|
|
42
|
+
const getMaskContainer = () => {
|
|
43
|
+
let container = document.body;
|
|
44
|
+
|
|
45
|
+
if (getTooltipContainer) {
|
|
46
|
+
container = getTooltipContainer();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return container;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onClick = (e: Event) => {
|
|
53
|
+
if (bubbleMouseEvents) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
{visible && maskVisible && (
|
|
64
|
+
<PortalFunctionalComponentWrapper portalRootEl={getMaskContainer()}>
|
|
65
|
+
<div
|
|
66
|
+
className={classNames(styles.popoverMask, maskClassName)}
|
|
67
|
+
style={{ zIndex: (zIndex + level).toString() }}
|
|
68
|
+
onClick={(event) => onRequestClose?.(event.nativeEvent)}
|
|
69
|
+
/>
|
|
70
|
+
</PortalFunctionalComponentWrapper>
|
|
71
|
+
)}
|
|
72
|
+
<DEPRECATED_Tooltip
|
|
73
|
+
{...props}
|
|
74
|
+
overlayClassName={styles.popover}
|
|
75
|
+
hideArrow
|
|
76
|
+
onClick={onClick}
|
|
77
|
+
zIndex={zIndex + level + 1}
|
|
78
|
+
align={props.align}
|
|
79
|
+
/>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const PortalFunctionalComponentWrapper = (props: {
|
|
85
|
+
children: React.ReactNode;
|
|
86
|
+
portalRootEl: HTMLElement;
|
|
87
|
+
}) => {
|
|
88
|
+
return ReactDOM.createPortal(props.children, props.portalRootEl);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default Popover;
|
|
92
|
+
export { Popover };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export enum AlignPoints {
|
|
2
|
+
topLeft = 'tl',
|
|
3
|
+
topCenter = 'tc',
|
|
4
|
+
topRight = 'tr',
|
|
5
|
+
centerLeft = 'cl',
|
|
6
|
+
centerCenter = 'cc',
|
|
7
|
+
centerRight = 'cr',
|
|
8
|
+
bottomLeft = 'bl',
|
|
9
|
+
bottomCenter = 'bc',
|
|
10
|
+
bottomRight = 'br',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type OffsetType = number | `${number}%`;
|
|
14
|
+
|
|
15
|
+
export interface PositioningConfig {
|
|
16
|
+
points?: AlignPoints[];
|
|
17
|
+
offset?: OffsetType[];
|
|
18
|
+
targetOffset?: OffsetType[]; // ['30%', '40%'] - the offset targetNode by 30% of targetNode width in x and 40% of targetNode height in y
|
|
19
|
+
overflow?: { adjustX?: boolean; adjustY?: boolean };
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.sharedComponentsInputRadioButton {
|
|
2
|
+
width: 28px;
|
|
3
|
+
height: 28px;
|
|
4
|
+
padding: 8px;
|
|
5
|
+
|
|
6
|
+
&:hover {
|
|
7
|
+
background-color: rgba(91, 99, 114, 0.1);
|
|
8
|
+
border-radius: 50%;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:global(.sis-scope .custom-radiobtn__text) {
|
|
13
|
+
padding-left: 4px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.disabled {
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
|
|
19
|
+
:global(.custom-radiobtn__text) {
|
|
20
|
+
color: rgba(91, 99, 114, 0.4);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import style from './RadioButton.module.scss';
|
|
5
|
+
|
|
6
|
+
export type RadioButtonProps = {
|
|
7
|
+
checked: boolean;
|
|
8
|
+
value: string;
|
|
9
|
+
text: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
inline?: boolean;
|
|
12
|
+
name?: string;
|
|
13
|
+
onChange: (evt: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
preventClick?: boolean;
|
|
15
|
+
title?: string;
|
|
16
|
+
inputRadioButtonClassName?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
textClassName?: string;
|
|
19
|
+
dataTestId?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const RadioButton = ({
|
|
23
|
+
checked,
|
|
24
|
+
text,
|
|
25
|
+
disabled = false,
|
|
26
|
+
inline = false,
|
|
27
|
+
title = '',
|
|
28
|
+
name = '',
|
|
29
|
+
value,
|
|
30
|
+
onChange,
|
|
31
|
+
preventClick,
|
|
32
|
+
inputRadioButtonClassName,
|
|
33
|
+
className,
|
|
34
|
+
textClassName,
|
|
35
|
+
dataTestId = undefined,
|
|
36
|
+
}: RadioButtonProps) => {
|
|
37
|
+
const inputProps = {
|
|
38
|
+
disabled,
|
|
39
|
+
name,
|
|
40
|
+
value,
|
|
41
|
+
...(title && !disabled && { title }),
|
|
42
|
+
};
|
|
43
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
44
|
+
if (preventClick) {
|
|
45
|
+
evt.preventDefault();
|
|
46
|
+
evt.stopPropagation();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onChange(evt);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const radioButtonClasses = classnames(
|
|
54
|
+
'custom-radiobtn',
|
|
55
|
+
{
|
|
56
|
+
'custom-radiobtn--inline': inline,
|
|
57
|
+
[style.disabled]: disabled,
|
|
58
|
+
},
|
|
59
|
+
className,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div className={radioButtonClasses}>
|
|
64
|
+
<label className="custom-radiobtn__label">
|
|
65
|
+
<div
|
|
66
|
+
className={classnames(
|
|
67
|
+
style.sharedComponentsInputRadioButton,
|
|
68
|
+
inputRadioButtonClassName,
|
|
69
|
+
{},
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
<input
|
|
73
|
+
className="custom-radiobtn__input"
|
|
74
|
+
type="radio"
|
|
75
|
+
onChange={handleChange}
|
|
76
|
+
checked={checked}
|
|
77
|
+
data-testid={dataTestId}
|
|
78
|
+
{...inputProps}
|
|
79
|
+
/>
|
|
80
|
+
<span className="custom-radiobtn__icon" />
|
|
81
|
+
</div>
|
|
82
|
+
<span className={classnames('custom-radiobtn__text', textClassName)}>{text}</span>
|
|
83
|
+
</label>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default RadioButton;
|
|
89
|
+
export { RadioButton };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { ForwardedRef, useContext } from 'react';
|
|
2
|
+
import Pagination, { type PaginationRenderItemParams } from '@mui/material/Pagination';
|
|
3
|
+
import PaginationItem from '@mui/material/PaginationItem';
|
|
4
|
+
import { TablePaginationActionsProps } from '@mui/material/TablePagination/TablePaginationActions';
|
|
5
|
+
|
|
6
|
+
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
7
|
+
|
|
8
|
+
import { Icon } from '../../Icon';
|
|
9
|
+
import { paginationActionsComponentTheme } from './themes';
|
|
10
|
+
import { Typography } from '../../Typography';
|
|
11
|
+
import { siColors } from '../../themes';
|
|
12
|
+
import { TablePaginationContext } from '../TablePaginationContext';
|
|
13
|
+
|
|
14
|
+
export type PaginationActionsComponentProps = Omit<
|
|
15
|
+
TablePaginationActionsProps,
|
|
16
|
+
'onPageChange' | 'color' | 'getItemAriaLabel'
|
|
17
|
+
> & {
|
|
18
|
+
onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const PAGE_START_INDEX = 1;
|
|
22
|
+
export const PaginationActionsComponent = React.forwardRef(
|
|
23
|
+
(
|
|
24
|
+
// { onPageChange, count, rowsPerPage, page, ...rest }: PaginationActionsComponentProps,
|
|
25
|
+
{ onPageChange, count, rowsPerPage, page }: PaginationActionsComponentProps,
|
|
26
|
+
ref: ForwardedRef<HTMLElement>,
|
|
27
|
+
) => {
|
|
28
|
+
const context = useContext(TablePaginationContext);
|
|
29
|
+
|
|
30
|
+
const handleOnPageChange = (event: React.ChangeEvent<unknown>, page: number) =>
|
|
31
|
+
onPageChange(null, page);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<ThemeProvider theme={paginationActionsComponentTheme}>
|
|
35
|
+
<Pagination
|
|
36
|
+
//{...rest}
|
|
37
|
+
ref={ref}
|
|
38
|
+
count={Math.ceil(count / rowsPerPage)}
|
|
39
|
+
page={Number(page) + PAGE_START_INDEX}
|
|
40
|
+
siblingCount={context.siblingCount}
|
|
41
|
+
onChange={handleOnPageChange}
|
|
42
|
+
showFirstButton={true}
|
|
43
|
+
showLastButton={true}
|
|
44
|
+
size={'small'}
|
|
45
|
+
boundaryCount={PAGE_START_INDEX}
|
|
46
|
+
renderItem={(item: PaginationRenderItemParams) => (
|
|
47
|
+
<PaginationItem
|
|
48
|
+
components={{
|
|
49
|
+
first: () => (
|
|
50
|
+
<Icon
|
|
51
|
+
sx={{ color: siColors.StUiColors.additional }}
|
|
52
|
+
name={'general-double-arrow-back'}
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
last: () => (
|
|
56
|
+
<Icon
|
|
57
|
+
sx={{ color: siColors.StUiColors.additional }}
|
|
58
|
+
name={'general-double-arrow-front'}
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
next: () => (
|
|
62
|
+
<Icon
|
|
63
|
+
sx={{ color: siColors.StUiColors.additional }}
|
|
64
|
+
name={'general-arrow-right'}
|
|
65
|
+
/>
|
|
66
|
+
),
|
|
67
|
+
previous: () => (
|
|
68
|
+
<Icon
|
|
69
|
+
sx={{ color: siColors.StUiColors.additional }}
|
|
70
|
+
name={'general-arrow-left'}
|
|
71
|
+
/>
|
|
72
|
+
),
|
|
73
|
+
}}
|
|
74
|
+
{...item}
|
|
75
|
+
page={
|
|
76
|
+
<Typography variant="bodyLabel" dataTestId={`PaginationPage-${item.page}`}>
|
|
77
|
+
{item.page}
|
|
78
|
+
</Typography>
|
|
79
|
+
}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
data-testid={'PaginationActionsComponent'}
|
|
83
|
+
/>
|
|
84
|
+
</ThemeProvider>
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import createTheme from '@mui/material/styles/createTheme';
|
|
2
|
+
|
|
3
|
+
// import { injectStylesWithWrapper, themeService } from '@sbi/styleguide';
|
|
4
|
+
|
|
5
|
+
import { siColors } from '../../../themes';
|
|
6
|
+
// import { calcStyles } from './uiCustomization';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_HEIGHT = '24px';
|
|
9
|
+
const DEFAULT_WIDTH = '24px';
|
|
10
|
+
|
|
11
|
+
// injectStylesWithWrapper && injectStylesWithWrapper(calcStyles);
|
|
12
|
+
|
|
13
|
+
export const paginationActionsComponentTheme = createTheme({
|
|
14
|
+
components: {
|
|
15
|
+
MuiPagination: {
|
|
16
|
+
styleOverrides: {
|
|
17
|
+
root: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
justifyContent: 'space-around',
|
|
20
|
+
flexGrow: 1,
|
|
21
|
+
'.MuiPagination-ul': {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
height: DEFAULT_HEIGHT,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
MuiPaginationItem: {
|
|
32
|
+
styleOverrides: {
|
|
33
|
+
root: {
|
|
34
|
+
height: DEFAULT_HEIGHT,
|
|
35
|
+
minWidth: DEFAULT_WIDTH,
|
|
36
|
+
margin: '0 2px',
|
|
37
|
+
'&.Mui-selected': {
|
|
38
|
+
border: `1px solid ${siColors.StUiColors.default}`,
|
|
39
|
+
borderRadius: '12px',
|
|
40
|
+
backgroundColor: 'transparent',
|
|
41
|
+
'&:hover': {
|
|
42
|
+
backgroundColor: siColors.StBackgroundColors.themeAgnostic,
|
|
43
|
+
// color: themeService.getDesignSettings().typography.primaryTextColor,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
'&:hover': {
|
|
47
|
+
backgroundColor: siColors.StBackgroundColors.themeAgnostic,
|
|
48
|
+
// color: themeService.getDesignSettings().typography.primaryTextColor,
|
|
49
|
+
},
|
|
50
|
+
'&.MuiPaginationItem-ellipsis': {
|
|
51
|
+
background: 'transparent',
|
|
52
|
+
fontFamily: 'Open Sans',
|
|
53
|
+
fontWeight: '400',
|
|
54
|
+
fontSize: '13px',
|
|
55
|
+
lineHeight: '18px',
|
|
56
|
+
paddingTop: '4px',
|
|
57
|
+
},
|
|
58
|
+
'&.MuiPaginationItem-firstLast': {
|
|
59
|
+
display: 'none',
|
|
60
|
+
},
|
|
61
|
+
'&.MuiPaginationItem-previousNext': {
|
|
62
|
+
width: '40px',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type PaginationActionsComponentTheme = typeof paginationActionsComponentTheme;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// import { CalcStyles, DesignSettings, utils } from '@sbi/styleguide';
|
|
3
|
+
//
|
|
4
|
+
// export const calcStyles: CalcStyles = (designSettings: DesignSettings) => ({
|
|
5
|
+
// '.Mui-selected': {
|
|
6
|
+
// borderColor: designSettings.typography.secondaryTextColor,
|
|
7
|
+
// },
|
|
8
|
+
// '.MuiPaginationItem-previousNext .MuiSvgIcon-root': {
|
|
9
|
+
// color: utils.makeASlightlyDifferentColor(designSettings.typography.secondaryTextColor, 0.1),
|
|
10
|
+
// '&:hover': {
|
|
11
|
+
// backgroundColor: 'transparent',
|
|
12
|
+
// },
|
|
13
|
+
// },
|
|
14
|
+
// '.MuiPaginationItem-ellipsis': {
|
|
15
|
+
// color: utils.makeASlightlyDifferentColor(designSettings.typography.secondaryTextColor, 0.1),
|
|
16
|
+
// },
|
|
17
|
+
// });
|