@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,44 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
|
+
|
|
4
|
+
const getAbsolutePath = (value: string): string =>
|
|
5
|
+
dirname(require.resolve(join(value, 'package.json')));
|
|
6
|
+
|
|
7
|
+
const config: StorybookConfig = {
|
|
8
|
+
framework: '@storybook/react-vite',
|
|
9
|
+
|
|
10
|
+
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
11
|
+
|
|
12
|
+
addons: [getAbsolutePath('@storybook/addon-docs'), getAbsolutePath('@storybook/addon-a11y')],
|
|
13
|
+
|
|
14
|
+
core: {
|
|
15
|
+
builder: {
|
|
16
|
+
options: {},
|
|
17
|
+
name: '@storybook/builder-vite',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
async viteFinal(config) {
|
|
22
|
+
const { mergeConfig } = await import('vite');
|
|
23
|
+
return mergeConfig(config, {
|
|
24
|
+
resolve: {
|
|
25
|
+
alias: [
|
|
26
|
+
{
|
|
27
|
+
find: '@sbi/styleguide',
|
|
28
|
+
replacement: '@sbi/styleguide/dist/styleguide',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
css: {
|
|
33
|
+
modules: {
|
|
34
|
+
scopeBehaviour: 'local',
|
|
35
|
+
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
typescript: { reactDocgen: false },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default config;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { type Preview } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
const preview: Preview = {
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
options: {
|
|
8
|
+
storySort: {
|
|
9
|
+
order: [
|
|
10
|
+
'Inputs',
|
|
11
|
+
'Data Display',
|
|
12
|
+
'Feedback',
|
|
13
|
+
'Date - Time',
|
|
14
|
+
'Surfaces',
|
|
15
|
+
'Navigation',
|
|
16
|
+
'Layout',
|
|
17
|
+
'Utils',
|
|
18
|
+
'Deprecated',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
decorators: [
|
|
24
|
+
(Story) => {
|
|
25
|
+
return <Story />;
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
(function loadStories() {
|
|
31
|
+
document.body.className += 'sis-scope';
|
|
32
|
+
})();
|
|
33
|
+
|
|
34
|
+
export default preview;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as e } from "./DEPRECATED_Icon-Dr-otczK.js";
|
|
2
|
+
import { D as a } from "./DEPRECATED_Button-BBgeRQQS.js";
|
|
3
|
+
import { C as s } from "./CheckableList-BXBenie6.js";
|
|
4
|
+
import { C as x } from "./Checkbox-BExvupXC.js";
|
|
5
|
+
import { D } from "./DEPRECATED_Checkbox-DX-zZXxW.js";
|
|
6
|
+
import { D as E } from "./DEPRECATED_Toggle-Knx8IocQ.js";
|
|
7
|
+
import { D as i } from "./DEPRECATED_Tooltip-fKwCi88g.js";
|
|
8
|
+
import { I as P } from "./Icon-BZDpDssQ.js";
|
|
9
|
+
import { I as l } from "./Input-CEdd88_6.js";
|
|
10
|
+
import { L as R } from "./LazyLoader-CqpdOYRZ.js";
|
|
11
|
+
import { A as y } from "./align.interface-DdWsijrT.js";
|
|
12
|
+
import { P as c } from "./Popover-B1WGdIWU.js";
|
|
13
|
+
import { R as _ } from "./RadioButton-2eH2Eo7p.js";
|
|
14
|
+
import { T as L, t as d } from "./Tooltip-BWlLbI8K.js";
|
|
15
|
+
import { T as M, t as B } from "./Typography-C6xMXGff.js";
|
|
16
|
+
import { T as w } from "./TablePagination-CsM1YXiW.js";
|
|
17
|
+
import { a as j, M as q, i as F } from "./Menu-O-faXiam.js";
|
|
18
|
+
import { D as H } from "./Dropdown-DGLLDuhv.js";
|
|
2
19
|
export {
|
|
3
|
-
|
|
20
|
+
y as AlignPoints,
|
|
21
|
+
s as CheckableList,
|
|
22
|
+
x as Checkbox,
|
|
23
|
+
a as DEPRECATED_Button,
|
|
24
|
+
D as DEPRECATED_Checkbox,
|
|
25
|
+
e as DEPRECATED_Icon,
|
|
26
|
+
E as DEPRECATED_Toggle,
|
|
27
|
+
i as DEPRECATED_Tooltip,
|
|
28
|
+
H as Dropdown,
|
|
29
|
+
P as Icon,
|
|
30
|
+
l as Input,
|
|
31
|
+
R as LazyLoader,
|
|
32
|
+
j as Menu,
|
|
33
|
+
q as MenuItem,
|
|
34
|
+
c as Popover,
|
|
35
|
+
_ as RadioButton,
|
|
36
|
+
w as TablePagination,
|
|
37
|
+
L as Tooltip,
|
|
38
|
+
M as Typography,
|
|
39
|
+
F as itemTypes,
|
|
40
|
+
d as tooltipTheme,
|
|
41
|
+
B as typographyTheme
|
|
4
42
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/sisense/compose-sdk-monorepo",
|
|
7
7
|
"directory": "packages/sdk-shared-ui"
|
|
8
8
|
},
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "1.26.0",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"main": "./dist/index.js",
|
|
@@ -23,6 +23,86 @@
|
|
|
23
23
|
"import": "./dist/lib/DEPRECATED_Icon/DEPRECATED_Icon.js",
|
|
24
24
|
"require": "./dist/lib/DEPRECATED_Icon/DEPRECATED_Icon.cjs",
|
|
25
25
|
"types": "./dist/lib/DEPRECATED_Icon/DEPRECATED_Icon.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./DEPRECATED_Button": {
|
|
28
|
+
"import": "./dist/lib/DEPRECATED_Button/DEPRECATED_Button.js",
|
|
29
|
+
"require": "./dist/lib/DEPRECATED_Button/DEPRECATED_Button.cjs",
|
|
30
|
+
"types": "./dist/lib/DEPRECATED_Button/DEPRECATED_Button.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./CheckableList": {
|
|
33
|
+
"import": "./dist/lib/CheckableList/CheckableList.js",
|
|
34
|
+
"require": "./dist/lib/CheckableList/CheckableList.cjs",
|
|
35
|
+
"types": "./dist/lib/CheckableList/CheckableList.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./Checkbox": {
|
|
38
|
+
"import": "./dist/lib/Checkbox/Checkbox.js",
|
|
39
|
+
"require": "./dist/lib/CheckableList/Checkbox.cjs",
|
|
40
|
+
"types": "./dist/lib/Checkbox/Checkbox.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./DEPRECATED_Checkbox": {
|
|
43
|
+
"import": "./dist/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.js",
|
|
44
|
+
"require": "./dist/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.cjs",
|
|
45
|
+
"types": "./dist/lib/DEPRECATED_Checkbox/DEPRECATED_Checkbox.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"./DEPRECATED_Toggle": {
|
|
48
|
+
"import": "./dist/lib/DEPRECATED_Toggle/DEPRECATED_Toggle.js",
|
|
49
|
+
"require": "./dist/lib/DEPRECATED_Toggle/DEPRECATED_Toggle.cjs",
|
|
50
|
+
"types": "./dist/lib/DEPRECATED_Toggle/DEPRECATED_Toggle.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"./DEPRECATED_Tooltip": {
|
|
53
|
+
"import": "./dist/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.js",
|
|
54
|
+
"require": "./dist/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.cjs",
|
|
55
|
+
"types": "./dist/lib/DEPRECATED_Tooltip/DEPRECATED_Tooltip.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./Icon": {
|
|
58
|
+
"import": "./dist/lib/Icon/Icon.js",
|
|
59
|
+
"require": "./dist/lib/Icon/Icon.cjs",
|
|
60
|
+
"types": "./dist/lib/Icon/Icon.d.ts"
|
|
61
|
+
},
|
|
62
|
+
"./Input": {
|
|
63
|
+
"import": "./dist/lib/Input/Input.js",
|
|
64
|
+
"require": "./dist/lib/Input/Input.cjs",
|
|
65
|
+
"types": "./dist/lib/Input/Input.d.ts"
|
|
66
|
+
},
|
|
67
|
+
"./LazyLoader": {
|
|
68
|
+
"import": "./dist/lib/LazyLoader/LazyLoader.js",
|
|
69
|
+
"require": "./dist/lib/LazyLoader/LazyLoader.cjs",
|
|
70
|
+
"types": "./dist/lib/LazyLoader/LazyLoader.d.ts"
|
|
71
|
+
},
|
|
72
|
+
"./Popover": {
|
|
73
|
+
"import": "./dist/lib/Popover/Popover.js",
|
|
74
|
+
"require": "./dist/lib/Popover/Popover.cjs",
|
|
75
|
+
"types": "./dist/lib/Popover/Popover.d.ts"
|
|
76
|
+
},
|
|
77
|
+
"./RadioButton": {
|
|
78
|
+
"import": "./dist/lib/RadioButton/RadioButton.js",
|
|
79
|
+
"require": "./dist/lib/RadioButton/RadioButton.cjs",
|
|
80
|
+
"types": "./dist/lib/RadioButton/RadioButton.d.ts"
|
|
81
|
+
},
|
|
82
|
+
"./Tooltip": {
|
|
83
|
+
"import": "./dist/lib/Tooltip/Tooltip.js",
|
|
84
|
+
"require": "./dist/lib/Tooltip/Tooltip.cjs",
|
|
85
|
+
"types": "./dist/lib/Tooltip/Tooltip.d.ts"
|
|
86
|
+
},
|
|
87
|
+
"./Typography": {
|
|
88
|
+
"import": "./dist/lib/Typography/Typography.js",
|
|
89
|
+
"require": "./dist/lib/Typography/Typography.cjs",
|
|
90
|
+
"types": "./dist/lib/Typography/Typography.d.ts"
|
|
91
|
+
},
|
|
92
|
+
"./TablePagination": {
|
|
93
|
+
"import": "./dist/lib/TablePagination/TablePagination.js",
|
|
94
|
+
"require": "./dist/lib/TablePagination/TablePagination.cjs",
|
|
95
|
+
"types": "./dist/lib/TablePagination/TablePagination.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./Menu": {
|
|
98
|
+
"import": "./dist/lib/Menu/Menu.js",
|
|
99
|
+
"require": "./dist/lib/Menu/Menu.cjs",
|
|
100
|
+
"types": "./dist/lib/Menu/Menu.d.ts"
|
|
101
|
+
},
|
|
102
|
+
"./Dropdown": {
|
|
103
|
+
"import": "./dist/lib/Dropdown/Dropdown.js",
|
|
104
|
+
"require": "./dist/lib/Dropdown/Dropdown.cjs",
|
|
105
|
+
"types": "./dist/lib/Dropdown/Dropdown.d.ts"
|
|
26
106
|
}
|
|
27
107
|
},
|
|
28
108
|
"typesVersions": {
|
|
@@ -35,6 +115,7 @@
|
|
|
35
115
|
"scripts": {
|
|
36
116
|
"dev": "vite",
|
|
37
117
|
"type-check": "tsc --noEmit",
|
|
118
|
+
"lint": "eslint src/ --quiet",
|
|
38
119
|
"build": "run type-check && vite build --mode development",
|
|
39
120
|
"build:prod": "run type-check && vite build",
|
|
40
121
|
"clean": "rm -rf dist coverage tsconfig.build.tsbuildinfo tsconfig.prod.tsbuildinfo",
|
|
@@ -43,12 +124,18 @@
|
|
|
43
124
|
"vitest": "run -T vitest",
|
|
44
125
|
"test": "vitest run",
|
|
45
126
|
"test:watch": "vitest watch",
|
|
46
|
-
"test:coverage": "run vitest run --coverage"
|
|
127
|
+
"test:coverage": "run vitest run --coverage",
|
|
128
|
+
"storybook:dev": "storybook dev"
|
|
47
129
|
},
|
|
48
130
|
"devDependencies": {
|
|
131
|
+
"@storybook/addon-a11y": "^8.4.7",
|
|
132
|
+
"@storybook/addon-docs": "^8.4.7",
|
|
133
|
+
"@storybook/builder-vite": "^8.4.7",
|
|
134
|
+
"@storybook/react-vite": "^8.4.7",
|
|
49
135
|
"@testing-library/jest-dom": "^6.6.3",
|
|
50
136
|
"@testing-library/react": "^16.0.1",
|
|
51
137
|
"@types/react": "^18.3.1",
|
|
138
|
+
"@types/react-custom-scrollbars": "^4.0.13",
|
|
52
139
|
"@types/react-dom": "^18.3.1",
|
|
53
140
|
"@vitejs/plugin-react": "^4.3.3",
|
|
54
141
|
"@vitest/coverage-v8": "^2.1.4",
|
|
@@ -58,6 +145,8 @@
|
|
|
58
145
|
"react": "~18.3.1",
|
|
59
146
|
"react-dom": "~18.3.1",
|
|
60
147
|
"rollup-plugin-copy": "^3.5.0",
|
|
148
|
+
"sass": "^1.83.0",
|
|
149
|
+
"storybook": "^8.4.7",
|
|
61
150
|
"typescript": "4.8.4",
|
|
62
151
|
"vite": "^5.4.11",
|
|
63
152
|
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
@@ -68,5 +157,13 @@
|
|
|
68
157
|
"classnames": "^2.3.1",
|
|
69
158
|
"react": "^17.0.0 || ^18.3.1",
|
|
70
159
|
"react-dom": "^17.0.0 || ^18.3.1"
|
|
160
|
+
},
|
|
161
|
+
"dependencies": {
|
|
162
|
+
"@mui/material": "^6.2.1",
|
|
163
|
+
"classnames": "^2.5.1",
|
|
164
|
+
"prop-types": "^15.8.1",
|
|
165
|
+
"rc-tooltip": "^6.3.2",
|
|
166
|
+
"react-custom-scrollbars": "^4.2.1",
|
|
167
|
+
"react-use": "^17.6.0"
|
|
71
168
|
}
|
|
72
169
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { describe, it, vi, expect } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { CheckableList } from './CheckableList';
|
|
6
|
+
|
|
7
|
+
import '@testing-library/jest-dom';
|
|
8
|
+
|
|
9
|
+
describe('CheckableList', () => {
|
|
10
|
+
const items = [
|
|
11
|
+
{ name: 'Item 1', value: 'item1', checked: true, dataTestId: 'item-1' },
|
|
12
|
+
{ name: 'Item 2', value: 'item2', checked: false, dataTestId: 'item-2' },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
it('should render all items', () => {
|
|
16
|
+
render(<CheckableList items={items} onChange={vi.fn()} className="custom-class" />);
|
|
17
|
+
|
|
18
|
+
items.forEach((item) => {
|
|
19
|
+
expect(screen.getByText(item.name)).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByTestId(item.dataTestId)).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should call onChange with the correct value when an item is clicked', () => {
|
|
25
|
+
const onChangeMock = vi.fn();
|
|
26
|
+
render(<CheckableList items={items} onChange={onChangeMock} className="custom-class" />);
|
|
27
|
+
|
|
28
|
+
const firstItem = screen.getByTestId('item-1');
|
|
29
|
+
fireEvent.click(firstItem);
|
|
30
|
+
|
|
31
|
+
expect(onChangeMock).toHaveBeenCalledWith('item1');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should render DEPRECATED_Icon for checked items', () => {
|
|
35
|
+
const { container } = render(
|
|
36
|
+
<CheckableList items={items} onChange={vi.fn()} className="custom-class" />,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const icon = container.querySelector(`.app-icon.app-icon--general-vi-small-white`);
|
|
40
|
+
|
|
41
|
+
expect(icon).toBeInTheDocument();
|
|
42
|
+
expect(icon).toHaveClass('app-icon app-icon--general-vi-small-white');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should not render DEPRECATED_Icon for unchecked items', () => {
|
|
46
|
+
render(<CheckableList items={items} onChange={vi.fn()} className="custom-class" />);
|
|
47
|
+
|
|
48
|
+
const uncheckedItem = screen.getByTestId('item-2');
|
|
49
|
+
const icon = uncheckedItem.querySelector(`.app-icon.app-icon--general-vi-small-white`);
|
|
50
|
+
|
|
51
|
+
expect(icon).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should apply custom className to the container', () => {
|
|
55
|
+
const { container } = render(
|
|
56
|
+
<CheckableList items={items} onChange={vi.fn()} className="custom-class" />,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
expect(container.firstChild).toHaveClass('custom-class');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { DEPRECATED_Icon } from '../DEPRECATED_Icon';
|
|
4
|
+
|
|
5
|
+
import styles from './CheckableList.module.scss';
|
|
6
|
+
|
|
7
|
+
type Item = {
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
dataTestId?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type CheckableListProps = {
|
|
15
|
+
items: Item[];
|
|
16
|
+
onChange: (value: string) => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const CheckableList = ({ items, className, onChange }: CheckableListProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<div className={className}>
|
|
23
|
+
{items.map((item) => (
|
|
24
|
+
<div
|
|
25
|
+
key={item.value}
|
|
26
|
+
className={styles.item}
|
|
27
|
+
onClick={() => onChange(item.value)}
|
|
28
|
+
data-testid={item.dataTestId}
|
|
29
|
+
>
|
|
30
|
+
<span className={styles.name}>{item.name}</span>
|
|
31
|
+
{item.checked && (
|
|
32
|
+
<DEPRECATED_Icon className={styles.icon} name="general-vi-small-white" />
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default CheckableList;
|
|
41
|
+
export { CheckableList };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import MuiCheckbox, { CheckboxProps as MuiCheckboxProps } from '@mui/material/Checkbox';
|
|
3
|
+
import ThemeProvider from '@mui/material/styles/ThemeProvider';
|
|
4
|
+
|
|
5
|
+
import { checkboxTheme, type CheckboxTheme } from './themes';
|
|
6
|
+
|
|
7
|
+
export type CheckboxProps = {
|
|
8
|
+
dataTestId?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
onDescriptionClick?: () => void;
|
|
12
|
+
text?: string;
|
|
13
|
+
textClassName?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
transparent?: boolean;
|
|
16
|
+
inputCheckboxClassName?: string;
|
|
17
|
+
} & MuiCheckboxProps & { theme?: CheckboxTheme };
|
|
18
|
+
|
|
19
|
+
const Checkbox = forwardRef<HTMLButtonElement, CheckboxProps>(
|
|
20
|
+
({ theme = checkboxTheme, dataTestId, ...rest }, ref) => (
|
|
21
|
+
<ThemeProvider theme={theme}>
|
|
22
|
+
<MuiCheckbox data-testid={dataTestId} ref={ref} {...rest} />
|
|
23
|
+
</ThemeProvider>
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default Checkbox;
|
|
28
|
+
export { Checkbox };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import createTheme from '@mui/material/styles/createTheme';
|
|
2
|
+
// import { injectStylesWithWrapper } from '@sbi/styleguide';
|
|
3
|
+
//import { calcStyles } from './uiCustomization';
|
|
4
|
+
|
|
5
|
+
// TODO: review this later
|
|
6
|
+
// injectStylesWithWrapper && injectStylesWithWrapper(calcStyles);
|
|
7
|
+
import { siColors, type SisenseTheme } from '../../themes';
|
|
8
|
+
|
|
9
|
+
declare module '@mui/material' {
|
|
10
|
+
interface Theme {
|
|
11
|
+
sisense: SisenseTheme;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ThemeOptions {
|
|
15
|
+
sisense?: Partial<SisenseTheme>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const checkboxTheme = createTheme({
|
|
20
|
+
components: {
|
|
21
|
+
MuiCheckbox: {
|
|
22
|
+
styleOverrides: {
|
|
23
|
+
root: {
|
|
24
|
+
width: '28px',
|
|
25
|
+
height: '28px',
|
|
26
|
+
'&.Mui-disabled': {
|
|
27
|
+
opacity: 0.5,
|
|
28
|
+
},
|
|
29
|
+
'&:hover': {
|
|
30
|
+
backgroundColor: siColors.StInteractionColors.defaultHover,
|
|
31
|
+
},
|
|
32
|
+
'& .MuiSvgIcon-root': {
|
|
33
|
+
fontSize: 14,
|
|
34
|
+
fill: siColors.StUiColors.default,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export type CheckboxTheme = typeof checkboxTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { checkboxTheme, type CheckboxTheme } from './checkboxTheme';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// import { CalcStyles, DesignSettings } from '@sbi/styleguide';
|
|
2
|
+
import { siColors } from '../../themes';
|
|
3
|
+
|
|
4
|
+
export type MuiCheckbox =
|
|
5
|
+
| {
|
|
6
|
+
'.MuiCheckbox-root': {
|
|
7
|
+
color: string;
|
|
8
|
+
'&:hover': {
|
|
9
|
+
color: string;
|
|
10
|
+
borderRadius: string;
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
| Record<string, never>;
|
|
16
|
+
|
|
17
|
+
export const calcStyles: any /* CalcStyles */ = (
|
|
18
|
+
designSettings: any /* DesignSettings */,
|
|
19
|
+
): MuiCheckbox => ({
|
|
20
|
+
'.MuiCheckbox-root': {
|
|
21
|
+
color: designSettings.general.primaryButtonTextColor,
|
|
22
|
+
'&:hover': {
|
|
23
|
+
color: designSettings.typography.primaryTextColor,
|
|
24
|
+
borderRadius: '50%',
|
|
25
|
+
backgroundColor: siColors.StBackgroundColors.themeAgnostic,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@import '../styles/style_styleguide_react/fonts';
|
|
2
|
+
@import '../styles/style_styleguide_react/colors';
|
|
3
|
+
|
|
4
|
+
@mixin sharedButtonText {
|
|
5
|
+
padding: 5px 20px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:global(.sis-scope) {
|
|
9
|
+
:global(.btn--dark) {
|
|
10
|
+
:global(.btn__text) {
|
|
11
|
+
@include sharedButtonText;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:global(.btn--gray) {
|
|
16
|
+
background: $buttonCancel;
|
|
17
|
+
|
|
18
|
+
&:disabled {
|
|
19
|
+
background: $buttonCancel;
|
|
20
|
+
opacity: 1;
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
background: $buttonCancelHovered;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:global(.app-icon),
|
|
27
|
+
:global(.btn__text) {
|
|
28
|
+
opacity: 0.4;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sharedComponentsButton {
|
|
34
|
+
line-height: $lineHeightMedium;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sharedComponentsButtonText {
|
|
38
|
+
@include sharedButtonText;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:global(.btn).btnSecondary {
|
|
42
|
+
border: 1px solid $wizardFore;
|
|
43
|
+
background-color: $buttonSecondary;
|
|
44
|
+
|
|
45
|
+
&:hover {
|
|
46
|
+
background-color: $buttonSecondaryHovered;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:disabled {
|
|
50
|
+
background-color: $buttonSecondary;
|
|
51
|
+
|
|
52
|
+
&:hover {
|
|
53
|
+
background-color: $buttonSecondary;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|