@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.
Files changed (119) hide show
  1. package/.storybook/main.ts +44 -0
  2. package/.storybook/preview-head.html +4 -0
  3. package/.storybook/preview.tsx +34 -0
  4. package/dist/index.js +40 -2
  5. package/package.json +135 -2
  6. package/src/lib/CheckableList/CheckableList.module.scss +13 -0
  7. package/src/lib/CheckableList/CheckableList.test.tsx +61 -0
  8. package/src/lib/CheckableList/CheckableList.tsx +41 -0
  9. package/src/lib/CheckableList/index.ts +4 -0
  10. package/src/lib/Checkbox/Checkbox.tsx +28 -0
  11. package/src/lib/Checkbox/index.ts +4 -0
  12. package/src/lib/Checkbox/themes/checkboxTheme.ts +42 -0
  13. package/src/lib/Checkbox/themes/index.ts +1 -0
  14. package/src/lib/Checkbox/themes/uiCustomization.ts +28 -0
  15. package/src/lib/DEPRECATED_Button/DEPRECATED_Button.module.scss +57 -0
  16. package/src/lib/DEPRECATED_Button/DEPRECATED_Button.stories.tsx +169 -0
  17. package/src/lib/DEPRECATED_Button/DEPRECATED_Button.test.tsx +154 -0
  18. package/src/lib/DEPRECATED_Button/DEPRECATED_Button.tsx +129 -0
  19. package/src/lib/DEPRECATED_Button/index.ts +4 -0
  20. package/src/lib/DEPRECATED_Checkbox/Checkbox.module.scss +49 -0
  21. package/src/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.test.tsx +131 -0
  22. package/src/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.tsx +103 -0
  23. package/src/lib/DEPRECATED_Checkbox/index.ts +4 -0
  24. package/src/lib/DEPRECATED_Icon/DEPRECATED_Icon.stories.tsx +27 -0
  25. package/src/lib/DEPRECATED_Icon/DEPRECATED_Icon.tsx +2 -0
  26. package/src/lib/DEPRECATED_Toggle/DEPRECATED_Toggle.tsx +49 -0
  27. package/src/lib/DEPRECATED_Toggle/index.ts +4 -0
  28. package/src/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.module.scss +115 -0
  29. package/src/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.tsx +68 -0
  30. package/src/lib/DEPRECATED_Tooltip/index.ts +4 -0
  31. package/src/lib/Dropdown/Dropdown.module.scss +9 -0
  32. package/src/lib/Dropdown/Dropdown.tsx +150 -0
  33. package/src/lib/Dropdown/DropdownButton/DropdownButton.module.scss +49 -0
  34. package/src/lib/Dropdown/DropdownButton/DropdownButton.tsx +81 -0
  35. package/src/lib/Dropdown/DropdownButton/DropdownButtonBody/DropdownButtonBody.test.tsx +121 -0
  36. package/src/lib/Dropdown/DropdownButton/DropdownButtonBody/DropdownButtonBody.tsx +39 -0
  37. package/src/lib/Dropdown/DropdownButton/DropdownButtonBody/index.ts +2 -0
  38. package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/DropdownButtonSearch.module.scss +20 -0
  39. package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/DropdownButtonSearch.tsx +44 -0
  40. package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/constants.ts +1 -0
  41. package/src/lib/Dropdown/DropdownButton/DropdownButtonSearch/index.ts +2 -0
  42. package/src/lib/Dropdown/DropdownButton/hooks/index.tsx +1 -0
  43. package/src/lib/Dropdown/DropdownButton/hooks/useDropdownButtonSearch.ts +51 -0
  44. package/src/lib/Dropdown/DropdownButton/index.ts +1 -0
  45. package/src/lib/Dropdown/hooks/index.tsx +1 -0
  46. package/src/lib/Dropdown/hooks/useDropdown.ts +29 -0
  47. package/src/lib/Dropdown/index.ts +5 -0
  48. package/src/lib/Dropdown/types.ts +17 -0
  49. package/src/lib/Icon/Icon.tsx +118 -0
  50. package/src/lib/Icon/index.ts +4 -0
  51. package/src/lib/Icon/themes/iconTheme.tsx +38 -0
  52. package/src/lib/Icon/themes/index.ts +1 -0
  53. package/src/lib/Icon/themes/uiCustomization.ts +9 -0
  54. package/src/lib/Input/Input.module.scss +97 -0
  55. package/src/lib/Input/Input.test.tsx +177 -0
  56. package/src/lib/Input/Input.tsx +134 -0
  57. package/src/lib/Input/index.ts +4 -0
  58. package/src/lib/LazyLoader/LazyLoader.module.scss +18 -0
  59. package/src/lib/LazyLoader/LazyLoader.tsx +42 -0
  60. package/src/lib/LazyLoader/index.ts +4 -0
  61. package/src/lib/Menu/Confirmation/Confirmation.module.scss +48 -0
  62. package/src/lib/Menu/Confirmation/Confirmation.tsx +45 -0
  63. package/src/lib/Menu/Confirmation/index.ts +1 -0
  64. package/src/lib/Menu/Confirmation/translation.ts +17 -0
  65. package/src/lib/Menu/Menu.module.scss +178 -0
  66. package/src/lib/Menu/Menu.tsx +363 -0
  67. package/src/lib/Menu/MenuItem/MenuItem.test.tsx +241 -0
  68. package/src/lib/Menu/MenuItem/MenuItem.tsx +186 -0
  69. package/src/lib/Menu/MenuItem/index.ts +2 -0
  70. package/src/lib/Menu/index.ts +6 -0
  71. package/src/lib/Menu/utils.ts +13 -0
  72. package/src/lib/Popover/Popover.module.scss +15 -0
  73. package/src/lib/Popover/Popover.tsx +92 -0
  74. package/src/lib/Popover/align.interface.ts +20 -0
  75. package/src/lib/Popover/index.ts +6 -0
  76. package/src/lib/RadioButton/RadioButton.module.scss +22 -0
  77. package/src/lib/RadioButton/RadioButton.tsx +89 -0
  78. package/src/lib/RadioButton/index.ts +4 -0
  79. package/src/lib/TablePagination/PaginationActionsComponent/PaginationActionsComponent.tsx +87 -0
  80. package/src/lib/TablePagination/PaginationActionsComponent/index.ts +4 -0
  81. package/src/lib/TablePagination/PaginationActionsComponent/themes/index.ts +4 -0
  82. package/src/lib/TablePagination/PaginationActionsComponent/themes/paginationActionsComponentTheme.tsx +70 -0
  83. package/src/lib/TablePagination/PaginationActionsComponent/themes/uiCustomization.ts +17 -0
  84. package/src/lib/TablePagination/TablePagination.tsx +148 -0
  85. package/src/lib/TablePagination/TablePaginationContext.ts +4 -0
  86. package/src/lib/TablePagination/index.ts +4 -0
  87. package/src/lib/TablePagination/themes/index.ts +1 -0
  88. package/src/lib/TablePagination/themes/tablePaginationResponsiveDesign.ts +33 -0
  89. package/src/lib/TablePagination/themes/tablePaginationTheme.tsx +128 -0
  90. package/src/lib/TablePagination/themes/uiCustomization.ts +50 -0
  91. package/src/lib/Tooltip/Tooltip.module.scss +125 -0
  92. package/src/lib/Tooltip/Tooltip.tsx +34 -0
  93. package/src/lib/Tooltip/index.ts +5 -0
  94. package/src/lib/Tooltip/themes/index.ts +1 -0
  95. package/src/lib/Tooltip/themes/tooltipTheme.ts +30 -0
  96. package/src/lib/Typography/Typography.tsx +28 -0
  97. package/src/lib/Typography/index.ts +5 -0
  98. package/src/lib/Typography/themes/index.ts +1 -0
  99. package/src/lib/Typography/themes/typographyTheme.tsx +170 -0
  100. package/src/lib/Typography/themes/uiCustomization.ts +10 -0
  101. package/src/lib/constants/styleguideConstants.ts +8 -0
  102. package/src/lib/index.ts +16 -0
  103. package/src/lib/styles/colors.module.scss +10 -0
  104. package/src/lib/styles/sisenseStyleguideReactColors.scss +57 -0
  105. package/src/lib/styles/style_styleguide_react/_variables.deprecated.scss +107 -0
  106. package/src/lib/styles/style_styleguide_react/_variables.scss +100 -0
  107. package/src/lib/styles/style_styleguide_react/base.scss +9 -0
  108. package/src/lib/styles/style_styleguide_react/colors.scss +71 -0
  109. package/src/lib/styles/style_styleguide_react/exports/colors.exports.scss +69 -0
  110. package/src/lib/styles/style_styleguide_react/exports/fonts.exports.scss +33 -0
  111. package/src/lib/styles/style_styleguide_react/fonts.scss +27 -0
  112. package/src/lib/styles/style_styleguide_react/mixins.scss +90 -0
  113. package/src/lib/themes/colors/index.ts +1 -0
  114. package/src/lib/themes/colors/siColors.ts +143 -0
  115. package/src/lib/themes/index.ts +2 -0
  116. package/src/lib/themes/types/SisenseTheme.ts +12 -0
  117. package/src/lib/themes/types/index.ts +1 -0
  118. package/tsconfig.lib.json +2 -1
  119. package/vite.config.ts +18 -1
@@ -0,0 +1,177 @@
1
+ import React from 'react';
2
+ import { render, fireEvent, screen } from '@testing-library/react';
3
+ import { vi } from 'vitest';
4
+
5
+ import { Input } from './Input';
6
+ import styles from './Input.module.scss';
7
+
8
+ import '@testing-library/jest-dom';
9
+
10
+ describe('Input Component', () => {
11
+ it('should render correctly with basic props', () => {
12
+ render(<Input onChange={vi.fn()} placeholder={'Enter text'} />);
13
+
14
+ const input = screen.getByPlaceholderText('Enter text');
15
+
16
+ expect(input).toBeInTheDocument();
17
+ });
18
+
19
+ it('should handle onChange and updates input value', () => {
20
+ const onChange = vi.fn();
21
+ render(<Input onChange={onChange} placeholder={'Enter text'} />);
22
+
23
+ const input = screen.getByPlaceholderText('Enter text');
24
+ fireEvent.change(input, { target: { value: 'test' } });
25
+
26
+ expect(onChange).toHaveBeenCalledWith('test');
27
+ expect(input).toHaveValue('test');
28
+ });
29
+
30
+ it('should clear input when clearable and clear icon is clicked', () => {
31
+ const onChange = vi.fn();
32
+ const { container } = render(
33
+ <Input onChange={onChange} placeholder={'Enter text'} clearable={true} value={'clear me'} />,
34
+ );
35
+
36
+ const clearIcon = container.querySelector('.app-icon.app-icon--general-x');
37
+ fireEvent.click(clearIcon as Element);
38
+
39
+ expect(onChange).toHaveBeenCalledWith('');
40
+ });
41
+
42
+ it('should render input in password mode', () => {
43
+ render(
44
+ <Input
45
+ onChange={vi.fn()}
46
+ placeholder={'Enter text'}
47
+ clearable={true}
48
+ value={'clear me'}
49
+ password={true}
50
+ />,
51
+ );
52
+
53
+ const input = screen.getByPlaceholderText('Enter text');
54
+
55
+ expect(input).toHaveAttribute('type', 'password');
56
+ });
57
+
58
+ it('should toggle password visibility', () => {
59
+ const { container } = render(
60
+ <Input
61
+ onChange={vi.fn()}
62
+ placeholder={'Enter text'}
63
+ clearable={true}
64
+ value={'clear me'}
65
+ password={true}
66
+ />,
67
+ );
68
+
69
+ const input = screen.getByPlaceholderText('Enter text');
70
+ const toggleIcon = container.querySelector('.app-icon.app-icon--general-show');
71
+ fireEvent.click(toggleIcon as Element);
72
+
73
+ expect(input).toHaveAttribute('type', 'text');
74
+ });
75
+
76
+ it('should render search icon when `search` is true', () => {
77
+ const { container } = render(
78
+ <Input onChange={vi.fn()} placeholder={'Enter text'} search={true} />,
79
+ );
80
+ const searchIcon = container.querySelector('.app-icon.app-icon--general-search-small');
81
+
82
+ expect(searchIcon).toBeInTheDocument();
83
+ });
84
+
85
+ it('should render custom icon when `icon` prop is passed', () => {
86
+ const { container } = render(
87
+ <Input
88
+ onChange={vi.fn()}
89
+ placeholder={'Enter text'}
90
+ search={true}
91
+ icon={{ placement: 'left', name: 'custom-icon' }}
92
+ />,
93
+ );
94
+
95
+ const customIcon = container.querySelector('.app-icon.app-icon--custom-icon');
96
+
97
+ expect(customIcon).toBeInTheDocument();
98
+ });
99
+
100
+ it('should apply className correctly', () => {
101
+ const { container } = render(
102
+ <Input onChange={vi.fn()} placeholder={'Enter text'} className={'custom-class'} />,
103
+ );
104
+
105
+ const wrapper = container.querySelector('.custom-class');
106
+
107
+ expect(wrapper).toHaveClass('custom-class');
108
+ });
109
+
110
+ it('should apply inputClassName correctly', () => {
111
+ render(
112
+ <Input onChange={vi.fn()} placeholder={'Enter text'} inputClassName={'custom-input-class'} />,
113
+ );
114
+
115
+ const input = screen.getByPlaceholderText('Enter text');
116
+
117
+ expect(input).toHaveClass('custom-input-class');
118
+ });
119
+
120
+ it('should handle disabled state correctly', () => {
121
+ render(<Input onChange={vi.fn()} placeholder={'Enter text'} disabled={true} />);
122
+ const input = screen.getByPlaceholderText('Enter text');
123
+
124
+ expect(input).toBeDisabled();
125
+ });
126
+
127
+ it('should trim input when trimInput is true', () => {
128
+ const onChange = vi.fn();
129
+ render(<Input onChange={onChange} placeholder={'Enter text'} trimInput={true} />);
130
+ const input = screen.getByPlaceholderText('Enter text');
131
+ fireEvent.change(input, { target: { value: ' trimmed text ' } });
132
+
133
+ expect(onChange).toHaveBeenCalledWith('trimmed text');
134
+ });
135
+
136
+ it('should prevent default behavior on mouse down for the clear icon', () => {
137
+ const { container } = render(<Input clearable value="test" onChange={vi.fn()} />);
138
+ const clearIcon = container.querySelector('.app-icon.app-icon--general-x');
139
+ const mouseDownEvent = new MouseEvent('mousedown', {
140
+ bubbles: true,
141
+ cancelable: true,
142
+ });
143
+ const preventDefaultSpy = vi.spyOn(mouseDownEvent, 'preventDefault');
144
+
145
+ clearIcon?.dispatchEvent(mouseDownEvent);
146
+
147
+ expect(preventDefaultSpy).toHaveBeenCalled();
148
+ });
149
+
150
+ it('should prevent default behavior on mouse down for the password visibility icon', () => {
151
+ const { container } = render(<Input password value="test" onChange={vi.fn()} />);
152
+ const passwordIcon = container.querySelector('.app-icon.app-icon--general-show');
153
+ const mouseDownEvent = new MouseEvent('mousedown', {
154
+ bubbles: true,
155
+ cancelable: true,
156
+ });
157
+ const preventDefaultSpy = vi.spyOn(mouseDownEvent, 'preventDefault');
158
+
159
+ (passwordIcon as Element).dispatchEvent(mouseDownEvent);
160
+
161
+ expect(preventDefaultSpy).toHaveBeenCalled();
162
+ });
163
+
164
+ it('should apply "withLeftIcon" class when icon is present and placement is left', () => {
165
+ render(
166
+ <Input
167
+ placeholder={'Enter text'}
168
+ icon={{ name: 'test-icon', placement: 'left' }}
169
+ onChange={vi.fn()}
170
+ />,
171
+ );
172
+
173
+ const input = screen.getByPlaceholderText('Enter text');
174
+
175
+ expect(input).toHaveClass(styles.withLeftIcon);
176
+ });
177
+ });
@@ -0,0 +1,134 @@
1
+ import React, { useState, useRef, useEffect, MouseEventHandler } from 'react';
2
+ import classnames from 'classnames';
3
+
4
+ import { DEPRECATED_Icon } from '../DEPRECATED_Icon';
5
+
6
+ import styles from './Input.module.scss';
7
+
8
+ export interface InputProps
9
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'small' | 'onChange'> {
10
+ className?: string;
11
+ inputClassName?: string;
12
+ onChange: (value: string) => void;
13
+ onClicked?: MouseEventHandler;
14
+ onBlur?: () => void;
15
+ placeholder?: string;
16
+ search?: boolean;
17
+ dataTestId?: string;
18
+ defaultValue?: string;
19
+ value?: string;
20
+ autoFocus?: boolean;
21
+ clearable?: boolean;
22
+ password?: boolean;
23
+ disabled?: boolean;
24
+ size?: 'small' | 'large';
25
+ icon?: { name: string; placement?: 'right' | 'left' };
26
+ trimInput?: boolean;
27
+ ariaLabel?: React.AriaAttributes['aria-label'];
28
+ }
29
+
30
+ const Input = (props: InputProps): JSX.Element => {
31
+ const {
32
+ className,
33
+ inputClassName,
34
+ onChange,
35
+ onClicked,
36
+ onBlur = () => {},
37
+ placeholder,
38
+ search,
39
+ dataTestId,
40
+ defaultValue,
41
+ value,
42
+ autoFocus,
43
+ clearable,
44
+ password,
45
+ disabled = false,
46
+ size,
47
+ icon,
48
+ trimInput,
49
+ ariaLabel = 'input',
50
+ } = props;
51
+
52
+ const [inputValue, setInputValue] = useState(defaultValue || value || '');
53
+ const [passwordIsVisible, setPasswordIsVisible] = useState(false);
54
+ const inputRef = useRef<HTMLInputElement>(null);
55
+
56
+ const { name: iconName = '', placement: iconPlacement } = icon || {};
57
+
58
+ useEffect(() => {
59
+ setInputValue(value || '');
60
+ }, [value]);
61
+
62
+ return (
63
+ <div className={classnames(styles.component, className)}>
64
+ {search && (
65
+ <DEPRECATED_Icon
66
+ className={classnames(styles.searchIcon, {
67
+ [styles.large]: size === 'large',
68
+ })}
69
+ name="general-search-small"
70
+ />
71
+ )}
72
+ <input
73
+ className={classnames(styles.input, inputClassName, {
74
+ [styles.withLeftIcon]: search || (icon && iconPlacement === 'left'),
75
+ [styles.large]: size === 'large',
76
+ })}
77
+ placeholder={placeholder}
78
+ disabled={disabled}
79
+ onChange={(e) => {
80
+ const value = trimInput ? e.target.value.trim() : e.target.value;
81
+ onChange(value);
82
+ setInputValue(e.target.value);
83
+ }}
84
+ onClick={onClicked}
85
+ onBlur={onBlur}
86
+ data-testid={dataTestId}
87
+ defaultValue={defaultValue}
88
+ value={value ?? inputValue}
89
+ autoFocus={autoFocus}
90
+ type={password && !passwordIsVisible ? 'password' : 'text'}
91
+ ref={inputRef}
92
+ aria-label={ariaLabel}
93
+ />
94
+ {clearable && !password && !icon && (
95
+ <DEPRECATED_Icon
96
+ className={classnames(styles.clearIcon, {
97
+ [styles.clearIconHidden]: inputValue === '',
98
+ [styles.large]: size === 'large',
99
+ })}
100
+ name="general-x"
101
+ onClick={() => {
102
+ setInputValue('');
103
+ onChange('');
104
+ }}
105
+ onMouseDown={(e) => e.preventDefault()}
106
+ />
107
+ )}
108
+ {password && (
109
+ <DEPRECATED_Icon
110
+ className={classnames(styles.passwordVisibilityIcon, {
111
+ [styles.large]: size === 'large',
112
+ })}
113
+ name={passwordIsVisible ? 'general-unhide' : 'general-show'}
114
+ onClick={() => {
115
+ setPasswordIsVisible(!passwordIsVisible);
116
+ }}
117
+ onMouseDown={(e) => e.preventDefault()}
118
+ />
119
+ )}
120
+ {icon && !clearable && !password && (
121
+ <DEPRECATED_Icon
122
+ className={classnames(styles.customIcon, {
123
+ [styles.large]: size === 'large',
124
+ [styles.isLeft]: iconPlacement === 'left',
125
+ })}
126
+ name={iconName}
127
+ />
128
+ )}
129
+ </div>
130
+ );
131
+ };
132
+
133
+ export default Input;
134
+ export { Input };
@@ -0,0 +1,4 @@
1
+ import Input from './Input';
2
+
3
+ export default Input;
4
+ export * from './Input';
@@ -0,0 +1,18 @@
1
+ // @import '~@sbi/styleguide/src/sass/components/_loader-two-dots.scss';
2
+
3
+ .loader {
4
+ display: flex;
5
+ align-content: center;
6
+ justify-content: center;
7
+ align-items: center;
8
+
9
+ .caption {
10
+ margin-top: 50%;
11
+ word-break: break-word;
12
+ text-align: center;
13
+
14
+ span {
15
+ position: unset;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import style from './LazyLoader.module.scss';
5
+
6
+ export type LazyLoaderProps = {
7
+ className?: string;
8
+ caption?: string;
9
+ isLoading?: boolean;
10
+ };
11
+
12
+ const LazyLoader = (props: LazyLoaderProps): JSX.Element => {
13
+ const { className = '', caption = '', isLoading = false } = props;
14
+
15
+ const hostClasses = classNames(
16
+ style['loader-two-dots'],
17
+ {
18
+ [style['loader-two-dots--inactive']]: !isLoading,
19
+ },
20
+ className,
21
+ );
22
+
23
+ const loaderIndicatorClass = classNames(style.loader, style['loader-two-dots-indicator']);
24
+ const captionClass = classNames(style.caption);
25
+
26
+ return (
27
+ <div className={hostClasses}>
28
+ {isLoading && (
29
+ <div data-testid="loader-component" className={loaderIndicatorClass}>
30
+ {caption && (
31
+ <div className={captionClass}>
32
+ <span>{caption}</span>
33
+ </div>
34
+ )}
35
+ </div>
36
+ )}
37
+ </div>
38
+ );
39
+ };
40
+
41
+ export default LazyLoader;
42
+ export { LazyLoader };
@@ -0,0 +1,4 @@
1
+ import LazyLoader from './LazyLoader';
2
+
3
+ export default LazyLoader;
4
+ export * from './LazyLoader';
@@ -0,0 +1,48 @@
1
+ $positiveSign: green;
2
+ $negativeSign: red;
3
+
4
+ $buttonYes: $positiveSign;
5
+ $buttonNo: $negativeSign;
6
+
7
+ .container {
8
+ min-width: 245px;
9
+ max-width: 350px;
10
+ padding: 12px 18px;
11
+ font-size: 13px;
12
+ user-select: none;
13
+ }
14
+
15
+ .message {
16
+ margin-top: 10px;
17
+ overflow: hidden;
18
+ white-space: pre-line;
19
+ text-overflow: ellipsis;
20
+ }
21
+
22
+ .buttons {
23
+ margin-top: 19px;
24
+ width: 100%;
25
+ text-align: right;
26
+ }
27
+
28
+ .button {
29
+ height: 25px;
30
+ width: auto;
31
+ background: transparent;
32
+ outline: none;
33
+ cursor: pointer;
34
+ border: none;
35
+
36
+ &:hover {
37
+ opacity: 0.7;
38
+ }
39
+ }
40
+
41
+ .confirm {
42
+ color: $buttonYes;
43
+ margin-right: 20px;
44
+ }
45
+
46
+ .cancel {
47
+ color: $buttonNo;
48
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import ClassNames from 'classnames';
3
+ // todo: add translations support
4
+ // import { FormattedMessage } from 'react-intl';
5
+
6
+ import { styleguideConstants } from '../../constants/styleguideConstants';
7
+
8
+ import styles from './Confirmation.module.scss';
9
+ // import messages from './translation';
10
+
11
+ export const Confirmation = ({
12
+ message,
13
+ title,
14
+ onCancel,
15
+ onConfirm,
16
+ }: {
17
+ message: string;
18
+ title: string;
19
+ onCancel: () => void;
20
+ onConfirm: () => void;
21
+ }) => {
22
+ const confirmClasses = ClassNames(styles.button, styles.confirm);
23
+ const cancelClasses = ClassNames(styles.button, styles.cancel);
24
+
25
+ return (
26
+ <div className={styles.container}>
27
+ <div className={styles.title}>{title}</div>
28
+ <div className={ClassNames(styles.message, styleguideConstants.TEXT_SECONDARY)}>
29
+ {message}
30
+ </div>
31
+ <div className={styles.buttons}>
32
+ <button className={confirmClasses} onClick={onConfirm}>
33
+ {/* eslint-disable-next-line i18next/no-literal-string */}
34
+ {/*<FormattedMessage {...messages.yes} />*/}
35
+ Yes
36
+ </button>
37
+ <button className={cancelClasses} onClick={onCancel}>
38
+ {/* eslint-disable-next-line i18next/no-literal-string */}
39
+ {/* <FormattedMessage {...messages.no} /> */}
40
+ No
41
+ </button>
42
+ </div>
43
+ </div>
44
+ );
45
+ };
@@ -0,0 +1 @@
1
+ export { Confirmation } from './Confirmation';
@@ -0,0 +1,17 @@
1
+ // import { defineMessages } from 'react-intl';
2
+
3
+ // export default defineMessages({
4
+ // yes: {
5
+ // id: 'app.confirmation.yes',
6
+ // defaultMessage: 'Yes',
7
+ // },
8
+ // no: {
9
+ // id: 'app.confirmation.no',
10
+ // defaultMessage: 'No',
11
+ // },
12
+ // areYouSure: {
13
+ // id: 'app.confirmation.inline.areYouSure',
14
+ // defaultMessage: 'Are You Sure?',
15
+ // },
16
+ // });
17
+ export {};
@@ -0,0 +1,178 @@
1
+ @use 'sass:math';
2
+ @import '../styles/sisenseStyleguideReactColors.scss';
3
+
4
+ $line-height: 18px;
5
+ $item-space: 12px;
6
+ $icon-size: 22px;
7
+ $vertical-diff: math.div($icon-size - $line-height, 2);
8
+ $item-vertical-padding: (math.div($item-space, 2) - $vertical-diff);
9
+ $disabledMenuItemColor: $stepCaption;
10
+
11
+ .container {
12
+ min-width: 128px;
13
+ position: absolute;
14
+ cursor: pointer;
15
+ padding: 0px;
16
+ background: $back;
17
+ box-shadow: 0px 0px 5px rgba(58, 67, 86, 0.2);
18
+ border-radius: 4px;
19
+
20
+ li {
21
+ list-style-type: none;
22
+ line-height: $icon-size;
23
+ display: flex;
24
+ justify-content: flex-start;
25
+ align-items: center;
26
+ padding: $item-vertical-padding 5px;
27
+ position: relative;
28
+ transition: background-color 0.3s eaSe;
29
+ cursor: pointer;
30
+
31
+ &.disabled {
32
+ opacity: 0.5;
33
+ cursor: default;
34
+ }
35
+
36
+ &.groupHeader {
37
+ pointer-events: none;
38
+ font-style: italic;
39
+ font-weight: 600;
40
+ }
41
+
42
+ &.isDrill {
43
+ &:hover,
44
+ &:global(.fakeHover) {
45
+ background-color: $highlightListItem;
46
+ }
47
+ }
48
+
49
+ &:hover:not(.disabled) {
50
+ background-color: $highlightListItem;
51
+
52
+ &:after {
53
+ opacity: 1;
54
+ }
55
+ }
56
+
57
+ &.separator {
58
+ border-top: 1px solid #e1e1e1;
59
+ }
60
+
61
+ &.noIcon {
62
+ padding-left: 16px;
63
+ padding-right: 16px;
64
+ }
65
+
66
+ &.item.checked {
67
+ &:after {
68
+ content: '';
69
+ display: block;
70
+ position: absolute;
71
+ top: 0;
72
+ left: 0;
73
+ height: 100%;
74
+ width: 2px;
75
+ background-color: $foreHover;
76
+ }
77
+ }
78
+
79
+ &.radio {
80
+ padding-left: 8px;
81
+ padding-right: 0;
82
+ line-height: $icon-size;
83
+ align-items: stretch;
84
+ }
85
+
86
+ &.checkbox {
87
+ padding-left: 0;
88
+ padding-right: 0;
89
+ line-height: $icon-size;
90
+ align-items: stretch;
91
+ }
92
+
93
+ .icon {
94
+ margin: 0 10px 0 7px;
95
+ }
96
+
97
+ .itemType {
98
+ display: flex;
99
+ width: 100%;
100
+ margin-right: 1px;
101
+ white-space: nowrap;
102
+ // Space icon to end of line
103
+ :last-child {
104
+ margin-left: auto;
105
+ }
106
+ }
107
+
108
+ .nestedType {
109
+ display: flex;
110
+ width: 100%;
111
+
112
+ .nestedIcon {
113
+ position: static !important;
114
+ }
115
+ }
116
+
117
+ .menuItemText {
118
+ flex-grow: 1;
119
+ display: flex;
120
+ align-items: center;
121
+ }
122
+ }
123
+ }
124
+
125
+ .separateGroup {
126
+ min-width: fit-content;
127
+ }
128
+
129
+ .itemCheckBox {
130
+ padding: 0 5px 0 16px;
131
+ width: 100%;
132
+ }
133
+
134
+ .itemRadioButton {
135
+ padding: 0 5px 0 8px;
136
+ width: 100%;
137
+ }
138
+
139
+ .scrollbar {
140
+ cursor: default;
141
+ > div:first-child {
142
+ position: relative !important;
143
+ }
144
+ }
145
+
146
+ .itemContainer {
147
+ display: flex;
148
+ flex-grow: 1;
149
+ }
150
+
151
+ .inlineConfirmation {
152
+ font-weight: 600;
153
+ }
154
+
155
+ .menuItemTooltip {
156
+ max-width: 180px;
157
+ overflow-wrap: break-word;
158
+
159
+ &:global(.rc-tooltip-placement-left) {
160
+ max-width: 195px;
161
+ padding-right: 15px;
162
+ }
163
+ }
164
+
165
+ .toggleButtonMenu {
166
+ pointer-events: none;
167
+ position: absolute;
168
+ top: 50%;
169
+ transform: translateY(-50%);
170
+ right: 10px;
171
+ }
172
+
173
+ .loader {
174
+ height: 25px;
175
+ position: relative;
176
+ margin: 0 auto;
177
+ width: 90%;
178
+ }