@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,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import { DropdownButtonBody } from './DropdownButtonBody';
|
|
5
|
+
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
|
|
8
|
+
describe('DropdownButtonBody', () => {
|
|
9
|
+
it('should render with selected item and icon', () => {
|
|
10
|
+
const selectedItem = {
|
|
11
|
+
caption: 'Selected Item',
|
|
12
|
+
iconName: 'check-icon',
|
|
13
|
+
id: 'selected-item-id',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const { container } = render(
|
|
17
|
+
<DropdownButtonBody
|
|
18
|
+
selectedItem={selectedItem}
|
|
19
|
+
selectedShowIcon={true}
|
|
20
|
+
placeholder="Placeholder"
|
|
21
|
+
/>,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(screen.getByText('Selected Item')).toBeInTheDocument();
|
|
25
|
+
expect(screen.queryByText('Placeholder')).toBeNull();
|
|
26
|
+
const icon = container.querySelector(`.app-icon.app-icon`);
|
|
27
|
+
expect(icon).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should render with placeholder when no selected item', () => {
|
|
31
|
+
render(
|
|
32
|
+
<DropdownButtonBody
|
|
33
|
+
selectedItem={undefined}
|
|
34
|
+
selectedShowIcon={false}
|
|
35
|
+
placeholder="No item selected"
|
|
36
|
+
/>,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
expect(screen.getByText('No item selected')).toBeInTheDocument();
|
|
40
|
+
expect(screen.queryByText('general-arrow-down')).toBeNull();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should render the default icon', () => {
|
|
44
|
+
const selectedItem = {
|
|
45
|
+
caption: 'Selected Item',
|
|
46
|
+
iconName: 'check-icon',
|
|
47
|
+
id: 'selected-item-id',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const { container } = render(
|
|
51
|
+
<DropdownButtonBody selectedItem={selectedItem} selectedShowIcon={true} />,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const icon = container.querySelector(`.app-icon.app-icon--general-arrow-down`);
|
|
55
|
+
expect(icon).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should render conditionally the custom icon when selectedShowIcon is true', () => {
|
|
59
|
+
const selectedItem = {
|
|
60
|
+
caption: 'Selected Item',
|
|
61
|
+
iconName: 'check-icon',
|
|
62
|
+
id: 'selected-item-id',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const { container } = render(
|
|
66
|
+
<DropdownButtonBody selectedItem={selectedItem} selectedShowIcon={true} />,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const customIcon = container.querySelector(`.app-icon.app-icon--check-icon`);
|
|
70
|
+
expect(customIcon).toBeInTheDocument();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should not render the custom icon when selectedShowIcon is false', () => {
|
|
74
|
+
const selectedItem = {
|
|
75
|
+
caption: 'Selected Item',
|
|
76
|
+
iconName: 'check-icon',
|
|
77
|
+
id: 'selected-item-id',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const { container } = render(
|
|
81
|
+
<DropdownButtonBody selectedItem={selectedItem} selectedShowIcon={false} />,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const customIcon = container.querySelector(`.app-icon.app-icon--check-icon`);
|
|
85
|
+
expect(customIcon).toBeNull();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should apply custom dropDownButtonClasses when provided', () => {
|
|
89
|
+
const selectedItem = {
|
|
90
|
+
caption: 'Selected Item',
|
|
91
|
+
iconName: 'check-icon',
|
|
92
|
+
id: 'selected-item-id',
|
|
93
|
+
};
|
|
94
|
+
const { container } = render(
|
|
95
|
+
<DropdownButtonBody selectedItem={selectedItem} dropDownButtonClasses={'custom-class'} />,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const containerDiv = container.querySelector('.custom-class');
|
|
99
|
+
|
|
100
|
+
expect(containerDiv).toBeInTheDocument();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should apply the width style when provided', () => {
|
|
104
|
+
const selectedItem = {
|
|
105
|
+
caption: 'Selected Item',
|
|
106
|
+
iconName: 'check-icon',
|
|
107
|
+
id: 'selected-item-id',
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const { container } = render(
|
|
111
|
+
<DropdownButtonBody
|
|
112
|
+
dropDownButtonClasses={'custom-class'}
|
|
113
|
+
selectedItem={selectedItem}
|
|
114
|
+
width={200}
|
|
115
|
+
/>,
|
|
116
|
+
);
|
|
117
|
+
const containerDiv = container.querySelector('.custom-class');
|
|
118
|
+
|
|
119
|
+
expect(containerDiv).toHaveStyle('width: 200px');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { DEPRECATED_Icon } from '../../../DEPRECATED_Icon';
|
|
4
|
+
|
|
5
|
+
import type { DropdownItem } from '../../types';
|
|
6
|
+
|
|
7
|
+
import style from '../DropdownButton.module.scss';
|
|
8
|
+
|
|
9
|
+
export type DropdownButtonBodyProps = {
|
|
10
|
+
selectedItem?: DropdownItem;
|
|
11
|
+
width?: number;
|
|
12
|
+
dropDownButtonClasses?: string;
|
|
13
|
+
resolvedCaptionClassName?: string;
|
|
14
|
+
selectedShowIcon?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const DropdownButtonBody: FC<DropdownButtonBodyProps> = ({
|
|
19
|
+
selectedItem,
|
|
20
|
+
width,
|
|
21
|
+
dropDownButtonClasses,
|
|
22
|
+
selectedShowIcon = true,
|
|
23
|
+
placeholder = '',
|
|
24
|
+
}) => {
|
|
25
|
+
const { caption, iconName } = selectedItem || {};
|
|
26
|
+
const styles = width ? { width, minWidth: 'inherit' } : {};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className={dropDownButtonClasses} title={caption} style={styles}>
|
|
30
|
+
{selectedShowIcon && iconName && (
|
|
31
|
+
<DEPRECATED_Icon className={style.selectedIcon} name={iconName} />
|
|
32
|
+
)}
|
|
33
|
+
<div className={style.chosenTitle}>{caption || placeholder}</div>
|
|
34
|
+
<div className={style.clickIcon}>
|
|
35
|
+
<DEPRECATED_Icon name={'general-arrow-down'} />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@import '../../../styles/colors.module';
|
|
2
|
+
|
|
3
|
+
.searchInputWrapper {
|
|
4
|
+
div {
|
|
5
|
+
background: $ATHENS_GRAY;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
border: 1px solid $COLOR-TEXT;
|
|
8
|
+
span {
|
|
9
|
+
margin-left: -6px;
|
|
10
|
+
z-index: 1071 !important;
|
|
11
|
+
}
|
|
12
|
+
input {
|
|
13
|
+
position: relative;
|
|
14
|
+
z-index: 1070;
|
|
15
|
+
background: transparent;
|
|
16
|
+
text-indent: 0;
|
|
17
|
+
border: none !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { forwardRef, MouseEventHandler } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Input } from '../../../Input';
|
|
5
|
+
|
|
6
|
+
import type { DropdownInputProps } from '../../types';
|
|
7
|
+
import { DEFAULT_SEARCH_WIDTH } from './constants';
|
|
8
|
+
|
|
9
|
+
import style from './DropdownButtonSearch.module.scss';
|
|
10
|
+
|
|
11
|
+
const noop = () => {};
|
|
12
|
+
|
|
13
|
+
export type DropdownButtonSearchProps = {
|
|
14
|
+
width?: number;
|
|
15
|
+
onClick?: MouseEventHandler;
|
|
16
|
+
className?: string;
|
|
17
|
+
inputProps?: DropdownInputProps;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const DropdownButtonSearch = forwardRef<HTMLDivElement, DropdownButtonSearchProps>(
|
|
21
|
+
(
|
|
22
|
+
{
|
|
23
|
+
width = DEFAULT_SEARCH_WIDTH,
|
|
24
|
+
onClick = noop,
|
|
25
|
+
inputProps = { onChange: noop },
|
|
26
|
+
className = '',
|
|
27
|
+
},
|
|
28
|
+
ref,
|
|
29
|
+
) => {
|
|
30
|
+
const dropdownSearchClass = classNames(className || style.searchInputWrapper);
|
|
31
|
+
const styles = { width };
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
ref={ref}
|
|
36
|
+
style={styles}
|
|
37
|
+
className={dropdownSearchClass}
|
|
38
|
+
data-testid="search_input_container"
|
|
39
|
+
>
|
|
40
|
+
<Input onClicked={onClick} {...inputProps} />
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_SEARCH_WIDTH = 136;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDropdownButtonSearch } from './useDropdownButtonSearch';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RefObject, SyntheticEvent, useEffect, useState, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { DropdownInputProps, DropdownItem } from '../../types';
|
|
4
|
+
|
|
5
|
+
export const useDropdownButtonSearch = (
|
|
6
|
+
isOpen: boolean,
|
|
7
|
+
selectedItem?: DropdownItem,
|
|
8
|
+
searchInputProps?: DropdownInputProps,
|
|
9
|
+
ref?: RefObject<HTMLDivElement>,
|
|
10
|
+
) => {
|
|
11
|
+
const [inputProps, setInputProps] = useState({
|
|
12
|
+
...searchInputProps,
|
|
13
|
+
value: selectedItem?.caption,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const handleOnSearchInputClick = (event: SyntheticEvent): void => {
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const handleOnSearchInputChange = (value: string): void => {
|
|
21
|
+
searchInputProps?.onChange(value);
|
|
22
|
+
setInputProps({ ...searchInputProps, value });
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const selectInputValue = useCallback((): void => {
|
|
26
|
+
const inputElement = ref?.current?.getElementsByTagName('input')[0];
|
|
27
|
+
inputElement?.select();
|
|
28
|
+
}, [ref]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isOpen) {
|
|
32
|
+
setInputProps({ ...searchInputProps, value: selectedItem?.caption });
|
|
33
|
+
selectInputValue();
|
|
34
|
+
} else {
|
|
35
|
+
searchInputProps?.onChange('');
|
|
36
|
+
}
|
|
37
|
+
}, [isOpen, searchInputProps, selectedItem?.caption, selectInputValue]);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (isOpen && inputProps.value !== searchInputProps?.value) {
|
|
41
|
+
selectInputValue();
|
|
42
|
+
}
|
|
43
|
+
}, [inputProps.value, isOpen, searchInputProps?.value, selectInputValue]);
|
|
44
|
+
|
|
45
|
+
const handlers = {
|
|
46
|
+
handleOnSearchInputClick,
|
|
47
|
+
handleOnSearchInputChange,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return { handlers, inputProps };
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownButton } from './DropdownButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDropdown } from './useDropdown';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { MenuItemConfig } from '../../Menu';
|
|
4
|
+
|
|
5
|
+
export const useDropdown = (
|
|
6
|
+
onSelectItem: (item: MenuItemConfig) => void,
|
|
7
|
+
open: boolean,
|
|
8
|
+
disabled: boolean,
|
|
9
|
+
) => {
|
|
10
|
+
const [isOpen, setIsOpen] = useState(open);
|
|
11
|
+
|
|
12
|
+
const handleDropdownClick = () => {
|
|
13
|
+
if (!disabled) {
|
|
14
|
+
setIsOpen(!isOpen);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const handleOnSelectItem = (item: MenuItemConfig) => {
|
|
19
|
+
onSelectItem(item);
|
|
20
|
+
handleDropdownClick();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handlers = {
|
|
24
|
+
handleOnSelectItem,
|
|
25
|
+
handleDropdownClick,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return { handlers, isOpen };
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Input } from '../Input';
|
|
4
|
+
|
|
5
|
+
export type DropdownInputProps = Pick<
|
|
6
|
+
React.ComponentProps<typeof Input>,
|
|
7
|
+
'onChange' | 'value' | 'search' | 'onClicked'
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
export type DropdownItem = {
|
|
11
|
+
id: string;
|
|
12
|
+
caption: string;
|
|
13
|
+
iconName?: string;
|
|
14
|
+
iconClass?: string;
|
|
15
|
+
tooltip?: string | React.ReactFragment;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { type ForwardedRef, forwardRef } from 'react';
|
|
2
|
+
import { IconProps as MuiIconProps } from '@mui/material';
|
|
3
|
+
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
4
|
+
import SvgIcon from '@mui/material/SvgIcon';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
import { iconTheme } from './themes';
|
|
8
|
+
|
|
9
|
+
export type IconProps = {
|
|
10
|
+
className?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
dataTestId?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
} & MuiIconProps &
|
|
16
|
+
React.HTMLAttributes<HTMLSpanElement>;
|
|
17
|
+
|
|
18
|
+
const SisenseSvgIcon = (props: IconProps) => {
|
|
19
|
+
const { name, sx } = props;
|
|
20
|
+
const svgClassName = classNames('app-icon__svg');
|
|
21
|
+
return (
|
|
22
|
+
<SvgIcon classes={{ root: svgClassName }} sx={sx} inheritViewBox={true}>
|
|
23
|
+
<use xlinkHref={`#${name}`} />
|
|
24
|
+
<symbol id="general-arrow-big-down" viewBox="0 0 24 24">
|
|
25
|
+
<path
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
d="M7.589 10L7 10.777 11.99 15 17 10.777 16.413 10l-4.422 3.727z"
|
|
28
|
+
></path>
|
|
29
|
+
</symbol>
|
|
30
|
+
<symbol id="general-arrow-left" viewBox="0 0 24 24">
|
|
31
|
+
<path
|
|
32
|
+
fill="currentColor"
|
|
33
|
+
d="M13.878 9.325a.5.5 0 1 0-.76-.65l-2.998 3.5a.5.5 0 0 0 0 .65l2.999 3.5a.5.5 0 1 0 .76-.65l-2.72-3.175 2.72-3.175z"
|
|
34
|
+
></path>
|
|
35
|
+
</symbol>
|
|
36
|
+
|
|
37
|
+
<symbol id="general-arrow-long-right" viewBox="0 0 29 8">
|
|
38
|
+
<path
|
|
39
|
+
d="M28.354 4.354a.5.5 0 0 0 0-.708L25.172.464a.5.5 0 1 0-.707.708L27.293 4l-2.828 2.828a.5.5 0 1 0 .707.708l3.182-3.182zM0 4.5h28v-1H0v1z"
|
|
40
|
+
fill="#3A4356"
|
|
41
|
+
></path>
|
|
42
|
+
</symbol>
|
|
43
|
+
|
|
44
|
+
<symbol id="general-arrow-right" viewBox="0 0 24 24">
|
|
45
|
+
<path
|
|
46
|
+
fill="currentColor"
|
|
47
|
+
d="M13.34 12.5l-2.72-3.175a.5.5 0 1 1 .76-.65l2.998 3.5a.5.5 0 0 1 0 .65l-2.998 3.5a.5.5 0 1 1-.76-.65l2.72-3.175z"
|
|
48
|
+
></path>
|
|
49
|
+
</symbol>
|
|
50
|
+
|
|
51
|
+
<symbol id="general-arrow-up" viewBox="0 0 24 24">
|
|
52
|
+
<path
|
|
53
|
+
fill="currentColor"
|
|
54
|
+
d="M12 10.16l-3.174 2.719a.5.5 0 0 1-.65-.76l3.5-2.998a.5.5 0 0 1 .65 0l3.5 2.998a.5.5 0 1 1-.65.76L12 10.159z"
|
|
55
|
+
></path>
|
|
56
|
+
</symbol>
|
|
57
|
+
|
|
58
|
+
<symbol id="general-arrow-up-down" viewBox="0 0 24 24">
|
|
59
|
+
<path
|
|
60
|
+
fill="currentColor"
|
|
61
|
+
d="M15.646 14.646a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L12 18.293l3.646-3.647zm0-5.292L12 5.707 8.354 9.354a.5.5 0 1 1-.708-.708l4-4a.5.5 0 0 1 .708 0l4 4a.5.5 0 0 1-.708.708z"
|
|
62
|
+
></path>
|
|
63
|
+
</symbol>
|
|
64
|
+
|
|
65
|
+
<symbol id="general-double-arrow-back" viewBox="0 0 24 24">
|
|
66
|
+
<path
|
|
67
|
+
fill="currentColor"
|
|
68
|
+
d="M9.658 12.5l2.72 3.175a.5.5 0 1 1-.76.65l-2.998-3.5a.5.5 0 0 1 0-.65l2.999-3.5a.5.5 0 1 1 .76.65L9.658 12.5zm5.719-3.175l-2.72 3.175 2.72 3.175a.5.5 0 1 1-.76.65l-2.998-3.5a.5.5 0 0 1 0-.65l2.998-3.5a.5.5 0 1 1 .76.65z"
|
|
69
|
+
></path>
|
|
70
|
+
</symbol>
|
|
71
|
+
|
|
72
|
+
<symbol id="general-double-arrow-front" viewBox="0 0 24 24">
|
|
73
|
+
<path
|
|
74
|
+
fill="currentColor"
|
|
75
|
+
d="M11.34 12.5L8.62 9.325a.5.5 0 0 1 .76-.65l2.998 3.5a.5.5 0 0 1 0 .65l-2.998 3.5a.5.5 0 1 1-.76-.65l2.72-3.175zm.279-3.175a.5.5 0 0 1 .76-.65l2.998 3.5a.5.5 0 0 1 0 .65l-2.999 3.5a.5.5 0 1 1-.76-.65l2.72-3.175-2.72-3.175z"
|
|
76
|
+
></path>
|
|
77
|
+
</symbol>
|
|
78
|
+
|
|
79
|
+
<symbol id="general-double-big-arrow-back" viewBox="0 0 31 31">
|
|
80
|
+
<g fill="currentColor">
|
|
81
|
+
<path d="M16 11.825l-3.842 4.297 3.662 4.087a.5.5 0 1 1-.76.65l-3.94-4.412a.5.5 0 0 1 0-.65l4.12-4.622a.5.5 0 1 1 .76.65zm5 0l-3.842 4.297 3.662 4.087a.5.5 0 1 1-.76.65l-3.94-4.412a.5.5 0 0 1 0-.65l4.12-4.622a.5.5 0 1 1 .76.65z"></path>
|
|
82
|
+
<path d="M10 11.5a.5.5 0 0 1 1 0v9a.5.5 0 0 1-1 0v-9z"></path>
|
|
83
|
+
</g>
|
|
84
|
+
</symbol>
|
|
85
|
+
|
|
86
|
+
<symbol id="general-double-big-arrow-front" viewBox="0 0 31 31">
|
|
87
|
+
<g fill="currentColor">
|
|
88
|
+
<path d="M15 20.175l3.842-4.297-3.662-4.087a.5.5 0 1 1 .76-.65l3.94 4.412a.5.5 0 0 1 0 .65l-4.12 4.622a.5.5 0 1 1-.76-.65zm-5 0l3.842-4.297-3.662-4.087a.5.5 0 1 1 .76-.65l3.94 4.412a.5.5 0 0 1 0 .65l-4.12 4.622a.5.5 0 1 1-.76-.65z"></path>
|
|
89
|
+
<path d="M21 20.5a.5.5 0 0 1-1 0v-9a.5.5 0 0 1 1 0v9z"></path>
|
|
90
|
+
</g>
|
|
91
|
+
</symbol>
|
|
92
|
+
|
|
93
|
+
<symbol id="general-x" viewBox="0 0 24 24">
|
|
94
|
+
<path
|
|
95
|
+
fill="currentColor"
|
|
96
|
+
d="M12 12.293L6.854 7.146a.5.5 0 1 0-.708.708L11.293 13l-5.147 5.146a.5.5 0 0 0 .708.708L12 13.707l5.146 5.147a.5.5 0 0 0 .708-.708L12.707 13l5.147-5.146a.5.5 0 0 0-.708-.708L12 12.293z"
|
|
97
|
+
></path>
|
|
98
|
+
</symbol>
|
|
99
|
+
</SvgIcon>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const Icon = forwardRef((props: IconProps, ref: ForwardedRef<HTMLSpanElement>) => {
|
|
104
|
+
const { dataTestId, name, className } = props;
|
|
105
|
+
const returnedIconComponent = <SisenseSvgIcon {...props} />;
|
|
106
|
+
const iconClassName = classNames('app-icon', `app-icon--${name}`, className);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<ThemeProvider theme={iconTheme}>
|
|
110
|
+
<span data-testid={dataTestId} {...props} ref={ref} className={iconClassName}>
|
|
111
|
+
{returnedIconComponent}
|
|
112
|
+
</span>
|
|
113
|
+
</ThemeProvider>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export default Icon;
|
|
118
|
+
export { Icon };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import createTheme from '@mui/material/styles/createTheme';
|
|
2
|
+
// import { injectStylesWithWrapper, themeService, utils } from '@sbi/styleguide';
|
|
3
|
+
|
|
4
|
+
// import { calcStyles } from './uiCustomization';
|
|
5
|
+
import { siColors } from '../../themes';
|
|
6
|
+
|
|
7
|
+
// injectStylesWithWrapper && injectStylesWithWrapper(calcStyles);
|
|
8
|
+
|
|
9
|
+
declare module '@mui/material/Icon' {
|
|
10
|
+
interface IconPropsVariantOverrides {
|
|
11
|
+
gray: true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const iconTheme = createTheme({
|
|
16
|
+
components: {
|
|
17
|
+
MuiIcon: {
|
|
18
|
+
styleOverrides: {
|
|
19
|
+
root: {
|
|
20
|
+
color: `${siColors.StPrimaryColors.primary}`,
|
|
21
|
+
top: 0,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
MuiSvgIcon: {
|
|
26
|
+
// styleOverrides: {
|
|
27
|
+
// root: {
|
|
28
|
+
// fill: utils.makeASlightlyDifferentColor(
|
|
29
|
+
// themeService.getDesignSettings().typography.primaryTextColor,
|
|
30
|
+
// 0.9,
|
|
31
|
+
// ),
|
|
32
|
+
// },
|
|
33
|
+
// },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type IconTheme = typeof iconTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { iconTheme, type IconTheme } from './iconTheme';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// import { CalcStyles, DesignSettings, utils } from '@sbi/styleguide';
|
|
3
|
+
//
|
|
4
|
+
// export const calcStyles: CalcStyles = (designSettings: DesignSettings) => ({
|
|
5
|
+
// '.MuiSvgIcon-root': {
|
|
6
|
+
// fill: utils.makeASlightlyDifferentColor(designSettings.typography.secondaryTextColor, 0.1),
|
|
7
|
+
// color: utils.makeASlightlyDifferentColor(designSettings.typography.secondaryTextColor, 0.1),
|
|
8
|
+
// },
|
|
9
|
+
// });
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@import '../styles/style_styleguide_react/_variables';
|
|
2
|
+
|
|
3
|
+
@mixin component {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
// .component .icon conflicts with .sis-scope .app-icon on position
|
|
8
|
+
.searchIcon.searchIcon {
|
|
9
|
+
position: absolute;
|
|
10
|
+
left: 8px;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
opacity: 40%;
|
|
13
|
+
&.large {
|
|
14
|
+
top: 4px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
.clearIcon.clearIcon {
|
|
18
|
+
width: 15px;
|
|
19
|
+
height: 15px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 3px;
|
|
22
|
+
right: 4px;
|
|
23
|
+
border-radius: 20px;
|
|
24
|
+
padding: 4px;
|
|
25
|
+
&:hover {
|
|
26
|
+
background-color: $color-gray-2;
|
|
27
|
+
}
|
|
28
|
+
&.clearIconHidden {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
&.large {
|
|
32
|
+
width: 15px;
|
|
33
|
+
height: 15px;
|
|
34
|
+
top: 4px;
|
|
35
|
+
padding: 5px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.passwordVisibilityIcon.passwordVisibilityIcon {
|
|
39
|
+
width: 24px;
|
|
40
|
+
height: 24px;
|
|
41
|
+
position: absolute;
|
|
42
|
+
right: 8px;
|
|
43
|
+
&.large {
|
|
44
|
+
width: 24px;
|
|
45
|
+
height: 24px;
|
|
46
|
+
top: 5px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.customIcon {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 3px;
|
|
53
|
+
right: 4px;
|
|
54
|
+
|
|
55
|
+
&.isLeft {
|
|
56
|
+
right: 0;
|
|
57
|
+
left: 8px;
|
|
58
|
+
}
|
|
59
|
+
&.large {
|
|
60
|
+
top: 5px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.input {
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
outline: none;
|
|
67
|
+
background: $color-gray-4;
|
|
68
|
+
line-height: 28px;
|
|
69
|
+
height: 28px;
|
|
70
|
+
border: none;
|
|
71
|
+
text-indent: 8px;
|
|
72
|
+
width: 100%;
|
|
73
|
+
&.withLeftIcon {
|
|
74
|
+
text-indent: 32px;
|
|
75
|
+
}
|
|
76
|
+
&::placeholder {
|
|
77
|
+
color: #b0b5bf;
|
|
78
|
+
}
|
|
79
|
+
&:focus {
|
|
80
|
+
border: 1px solid $color-text;
|
|
81
|
+
}
|
|
82
|
+
&.large {
|
|
83
|
+
height: 34px;
|
|
84
|
+
line-height: 34px;
|
|
85
|
+
}
|
|
86
|
+
&::-ms-reveal {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.component {
|
|
93
|
+
@include component;
|
|
94
|
+
}
|
|
95
|
+
:global(.sis-scope) .component {
|
|
96
|
+
@include component;
|
|
97
|
+
}
|