@scality/core-ui 0.161.0 → 0.162.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/README.md +15 -15
- package/dist/components/accordion/Accordion.component.d.ts +0 -1
- package/dist/components/accordion/Accordion.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.d.ts +55 -0
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -0
- package/dist/components/barchartv2/Barchart.component.js +76 -0
- package/dist/components/barchartv2/utils.d.ts +95 -0
- package/dist/components/barchartv2/utils.d.ts.map +1 -0
- package/dist/components/barchartv2/utils.js +305 -0
- package/dist/components/buttonv2/Buttonv2.component.d.ts +1 -1
- package/dist/components/buttonv2/Buttonv2.component.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts +2 -1
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.js +5 -4
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts +0 -1
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.d.ts +1 -0
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +5 -0
- package/dist/components/emptytable/Emptytable.component.d.ts +0 -1
- package/dist/components/emptytable/Emptytable.component.d.ts.map +1 -1
- package/dist/components/emptytable/Emptytable.component.js +1 -0
- package/dist/components/error-pages/ErrorPage401.component.d.ts +0 -1
- package/dist/components/error-pages/ErrorPage401.component.d.ts.map +1 -1
- package/dist/components/error-pages/ErrorPage404.component.d.ts +0 -1
- package/dist/components/error-pages/ErrorPage404.component.d.ts.map +1 -1
- package/dist/components/error-pages/ErrorPage500.component.d.ts +0 -1
- package/dist/components/error-pages/ErrorPage500.component.d.ts.map +1 -1
- package/dist/components/error-pages/ErrorPageAuth.component.d.ts.map +1 -1
- package/dist/components/form/Form.component.d.ts +2 -2
- package/dist/components/form/Form.component.d.ts.map +1 -1
- package/dist/components/infomessage/InfoMessage.component.d.ts +0 -1
- package/dist/components/infomessage/InfoMessage.component.d.ts.map +1 -1
- package/dist/components/lateralnavbarlayout/LateralNavbarLayout.component.d.ts.map +1 -1
- package/dist/components/layout/Layout.component.d.ts.map +1 -1
- package/dist/components/layout/v2/panels.d.ts.map +1 -1
- package/dist/components/modal/Modal.component.js +2 -2
- package/dist/components/navbar/Navbar.component.js +2 -2
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.d.ts +0 -1
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.d.ts.map +1 -1
- package/dist/components/searchinput/SearchInput.component.d.ts +1 -2
- package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
- package/dist/components/selectv2/Selectv2.component.d.ts +5 -5
- package/dist/components/selectv2/Selectv2.component.d.ts.map +1 -1
- package/dist/components/statuswrapper/Statuswrapper.component.d.ts +0 -1
- package/dist/components/statuswrapper/Statuswrapper.component.d.ts.map +1 -1
- package/dist/components/tablev2/Search.js +2 -2
- package/dist/components/tablev2/SingleSelectableContent.d.ts +1 -2
- package/dist/components/tablev2/SingleSelectableContent.d.ts.map +1 -1
- package/dist/components/tablev2/TableCommon.d.ts +2 -2
- package/dist/components/tablev2/TableCommon.d.ts.map +1 -1
- package/dist/components/tablev2/TableSync.d.ts +8 -0
- package/dist/components/tablev2/TableSync.d.ts.map +1 -0
- package/dist/components/tablev2/TableSync.js +11 -0
- package/dist/components/tablev2/Tablev2.component.d.ts +2 -1
- package/dist/components/tablev2/Tablev2.component.d.ts.map +1 -1
- package/dist/components/tablev2/Tablev2.component.js +10 -9
- package/dist/components/tabsv2/ScrollButton.d.ts +1 -2
- package/dist/components/tabsv2/ScrollButton.d.ts.map +1 -1
- package/dist/components/tabsv2/ScrollButton.js +2 -2
- package/dist/components/tabsv2/Tabsv2.component.d.ts +2 -2
- package/dist/components/tabsv2/Tabsv2.component.d.ts.map +1 -1
- package/dist/components/tabsv2/Tabsv2.component.js +2 -2
- package/dist/components/text/Text.component.d.ts +0 -1
- package/dist/components/text/Text.component.d.ts.map +1 -1
- package/dist/components/textarea/TextArea.component.d.ts +3 -3
- package/dist/components/textarea/TextArea.component.d.ts.map +1 -1
- package/dist/components/textbadge/TextBadge.component.d.ts +0 -1
- package/dist/components/textbadge/TextBadge.component.d.ts.map +1 -1
- package/dist/components/toast/Toast.component.d.ts +1 -1
- package/dist/components/toast/Toast.component.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/vegachartv2/SyncedCursorCharts.d.ts +1 -2
- package/dist/components/vegachartv2/SyncedCursorCharts.d.ts.map +1 -1
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts +1 -2
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts.map +1 -1
- package/dist/components/vegachartv2/VegaChartV2.component.js +2 -2
- package/dist/icons/branding.d.ts.map +1 -1
- package/dist/icons/scality-loading.d.ts.map +1 -1
- package/dist/next.d.ts +1 -0
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +1 -0
- package/dist/style/theme.d.ts +19 -0
- package/dist/style/theme.d.ts.map +1 -1
- package/dist/style/theme.js +18 -1
- package/package.json +6 -3
- package/setupTests.js +6 -0
- package/src/lib/components/accordion/Accordion.component.tsx +1 -1
- package/src/lib/components/barchartv2/Barchart.component.test.tsx +383 -0
- package/src/lib/components/barchartv2/Barchart.component.tsx +309 -0
- package/src/lib/components/barchartv2/utils.test.ts +782 -0
- package/src/lib/components/barchartv2/utils.ts +486 -0
- package/src/lib/components/buttonv2/Buttonv2.component.tsx +1 -1
- package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +22 -3
- package/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx +0 -1
- package/src/lib/components/date/FormattedDateTime.tsx +6 -0
- package/src/lib/components/emptytable/Emptytable.component.tsx +1 -1
- package/src/lib/components/error-pages/ErrorPage401.component.tsx +0 -1
- package/src/lib/components/error-pages/ErrorPage404.component.tsx +0 -1
- package/src/lib/components/error-pages/ErrorPage500.component.tsx +0 -1
- package/src/lib/components/error-pages/ErrorPageAuth.component.tsx +0 -1
- package/src/lib/components/form/Form.component.tsx +1 -1
- package/src/lib/components/infomessage/InfoMessage.component.tsx +0 -1
- package/src/lib/components/lateralnavbarlayout/LateralNavbarLayout.component.tsx +0 -1
- package/src/lib/components/layout/Layout.component.tsx +0 -1
- package/src/lib/components/layout/v2/panels.tsx +1 -1
- package/src/lib/components/modal/Modal.component.tsx +2 -2
- package/src/lib/components/navbar/Navbar.component.tsx +2 -2
- package/src/lib/components/scrollbarwrapper/ScrollbarWrapper.component.tsx +0 -1
- package/src/lib/components/searchinput/SearchInput.component.tsx +0 -1
- package/src/lib/components/selectv2/Selectv2.component.tsx +11 -9
- package/src/lib/components/sidebar/Sidebar.component.tsx +1 -1
- package/src/lib/components/statuswrapper/Statuswrapper.component.tsx +0 -1
- package/src/lib/components/tablev2/Search.tsx +2 -2
- package/src/lib/components/tablev2/SingleSelectableContent.tsx +2 -2
- package/src/lib/components/tablev2/TableCommon.tsx +1 -1
- package/src/lib/components/tablev2/TableSync.test.tsx +31 -0
- package/src/lib/components/tablev2/TableSync.tsx +36 -0
- package/src/lib/components/tablev2/Tablev2.component.tsx +11 -9
- package/src/lib/components/tabsv2/ScrollButton.tsx +2 -2
- package/src/lib/components/tabsv2/Tabsv2.component.tsx +6 -6
- package/src/lib/components/text/Text.component.tsx +4 -5
- package/src/lib/components/textarea/TextArea.component.tsx +3 -2
- package/src/lib/components/textbadge/TextBadge.component.tsx +0 -1
- package/src/lib/components/toast/Toast.component.tsx +1 -1
- package/src/lib/components/toast/ToastProvider.tsx +3 -1
- package/src/lib/components/vegachartv2/SyncedCursorCharts.tsx +1 -1
- package/src/lib/components/vegachartv2/VegaChartV2.component.tsx +2 -2
- package/src/lib/icons/branding.tsx +0 -2
- package/src/lib/icons/scality-loading.tsx +0 -2
- package/src/lib/next.ts +5 -0
- package/src/lib/style/theme.ts +24 -1
- package/stories/BarChart/barchart.stories.tsx +655 -0
- package/stories/areachart.stories.tsx +0 -1
- package/stories/tablev2.stories.tsx +41 -0
- package/tsconfig.json +5 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
createContext,
|
|
3
3
|
useContext,
|
|
4
4
|
useState,
|
|
@@ -8,6 +8,8 @@ import React, {
|
|
|
8
8
|
ForwardRefExoticComponent,
|
|
9
9
|
RefAttributes,
|
|
10
10
|
useImperativeHandle,
|
|
11
|
+
ReactNode,
|
|
12
|
+
Ref,
|
|
11
13
|
} from 'react';
|
|
12
14
|
import { ScrollbarWrapper, Tooltip } from '../../index';
|
|
13
15
|
import {
|
|
@@ -31,10 +33,10 @@ const NOPT_SEARCH = 8;
|
|
|
31
33
|
export type OptionProps = {
|
|
32
34
|
title?: string;
|
|
33
35
|
disabled?: boolean;
|
|
34
|
-
icon?:
|
|
35
|
-
children?:
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
children?: ReactNode;
|
|
36
38
|
value: string;
|
|
37
|
-
disabledReason?:
|
|
39
|
+
disabledReason?: ReactNode;
|
|
38
40
|
};
|
|
39
41
|
const usePreviousValue = (value) => {
|
|
40
42
|
const ref = useRef(null);
|
|
@@ -335,7 +337,7 @@ export type SelectProps = {
|
|
|
335
337
|
id: string;
|
|
336
338
|
placeholder?: string;
|
|
337
339
|
disabled?: boolean;
|
|
338
|
-
children?:
|
|
340
|
+
children?: ReactNode;
|
|
339
341
|
value?: string;
|
|
340
342
|
onFocus?: (event: FocusEvent) => void;
|
|
341
343
|
onBlur?: (event: FocusEvent) => void;
|
|
@@ -349,11 +351,11 @@ export type SelectProps = {
|
|
|
349
351
|
|
|
350
352
|
type SelectOptionProps = {
|
|
351
353
|
value: string;
|
|
352
|
-
label:
|
|
354
|
+
label: ReactNode;
|
|
353
355
|
isDisabled: boolean;
|
|
354
|
-
icon?:
|
|
356
|
+
icon?: ReactNode;
|
|
355
357
|
optionProps: any;
|
|
356
|
-
disabledReason?:
|
|
358
|
+
disabledReason?: ReactNode;
|
|
357
359
|
};
|
|
358
360
|
|
|
359
361
|
type SelectComponentType<
|
|
@@ -388,7 +390,7 @@ function SelectBox<
|
|
|
388
390
|
selectRef,
|
|
389
391
|
...rest
|
|
390
392
|
}: SelectProps & {
|
|
391
|
-
selectRef?:
|
|
393
|
+
selectRef?: Ref<SelectRef<OptionType, IsMulti, GroupType>>;
|
|
392
394
|
}) {
|
|
393
395
|
const [keyboardFocusEnabled, setKeyboardFocusEnabled] = useState(false);
|
|
394
396
|
const [searchSelection, setSearchSelection] = useState('');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import styled from 'styled-components';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
3
|
import { useTableContext } from './Tablev2.component';
|
|
4
4
|
import { SearchInput } from '../searchinput/SearchInput.component';
|
|
5
5
|
import { Props } from '../searchinput/SearchInput.component';
|
|
@@ -74,7 +74,7 @@ export function TableSearch(props: SearchProps) {
|
|
|
74
74
|
entityName = { en: { singular: 'result', plural: 'results' } },
|
|
75
75
|
} = useTableContext();
|
|
76
76
|
const totalDispayedRows = totalCount ? totalCount : rows.length;
|
|
77
|
-
|
|
77
|
+
useEffect(() => {
|
|
78
78
|
setGlobalFilter(value);
|
|
79
79
|
}, [value, setGlobalFilter, preGlobalFilteredRows]);
|
|
80
80
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { memo, useEffect } from 'react';
|
|
2
2
|
import { areEqual } from 'react-window';
|
|
3
3
|
import { Row } from 'react-table';
|
|
4
4
|
import { useTableContext } from './Tablev2.component';
|
|
@@ -32,7 +32,7 @@ export type SingleSelectableContentProps<
|
|
|
32
32
|
customItemKey?: (index: number, data: DATA_ROW) => string;
|
|
33
33
|
hasScrollbar?: boolean;
|
|
34
34
|
isLoadingMoreItems?: boolean;
|
|
35
|
-
children?: (rows:
|
|
35
|
+
children?: (rows: JSX.Element) => JSX.Element;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export function SingleSelectableContent<
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TableSync } from './TableSync';
|
|
4
|
+
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
5
|
+
|
|
6
|
+
describe('TableSync', () => {
|
|
7
|
+
it('should render correctly', () => {
|
|
8
|
+
const onSync = jest.fn();
|
|
9
|
+
render(
|
|
10
|
+
<QueryClientProvider client={new QueryClient()}>
|
|
11
|
+
<TableSync onSync={onSync} />
|
|
12
|
+
</QueryClientProvider>,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const button = screen.getByRole('button');
|
|
16
|
+
expect(button).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should call onSync when clicked', () => {
|
|
20
|
+
const onSync = jest.fn();
|
|
21
|
+
render(
|
|
22
|
+
<QueryClientProvider client={new QueryClient()}>
|
|
23
|
+
<TableSync onSync={onSync} />
|
|
24
|
+
</QueryClientProvider>,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const button = screen.getByRole('button');
|
|
28
|
+
fireEvent.click(button);
|
|
29
|
+
expect(onSync).toHaveBeenCalledTimes(1);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button } from '../buttonv2/Buttonv2.component';
|
|
4
|
+
import { Icon } from '../icon/Icon.component';
|
|
5
|
+
|
|
6
|
+
export type TableSyncProps = {
|
|
7
|
+
onSync: () => void;
|
|
8
|
+
tooltipOverlay?: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;
|
|
11
|
+
|
|
12
|
+
const TableSyncContainer = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export function TableSync({
|
|
18
|
+
onSync,
|
|
19
|
+
tooltipOverlay,
|
|
20
|
+
loading = false,
|
|
21
|
+
...rest
|
|
22
|
+
}: TableSyncProps) {
|
|
23
|
+
return (
|
|
24
|
+
<TableSyncContainer>
|
|
25
|
+
<Button
|
|
26
|
+
icon={<Icon name="Sync" />}
|
|
27
|
+
tooltip={tooltipOverlay ? { overlay: tooltipOverlay } : undefined}
|
|
28
|
+
onClick={onSync}
|
|
29
|
+
aria-label="Synchronize table data"
|
|
30
|
+
role="button"
|
|
31
|
+
isLoading={loading}
|
|
32
|
+
{...rest}
|
|
33
|
+
/>
|
|
34
|
+
</TableSyncContainer>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="react-table-config.ts" />
|
|
2
|
-
|
|
3
|
-
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
Column as TableColumn,
|
|
6
6
|
CellProps as TableCellProps,
|
|
@@ -33,6 +33,7 @@ import { TableWrapper, TooltipContent } from './Tablestyle';
|
|
|
33
33
|
import { compareHealth, TableHeightKeyType } from './TableUtils';
|
|
34
34
|
import { useCheckbox } from './useCheckbox';
|
|
35
35
|
import { Icon } from '../icon/Icon.component';
|
|
36
|
+
import { TableSync } from './TableSync';
|
|
36
37
|
|
|
37
38
|
type UpdateTableData<
|
|
38
39
|
DATA_ROW extends Record<string, unknown> = Record<string, unknown>,
|
|
@@ -110,12 +111,12 @@ type TableContextType<
|
|
|
110
111
|
setHasScrollbar: React.Dispatch<React.SetStateAction<boolean>>;
|
|
111
112
|
hasScrollbar?: boolean;
|
|
112
113
|
};
|
|
113
|
-
const TableContext =
|
|
114
|
+
const TableContext = createContext<TableContextType | null>(null);
|
|
114
115
|
|
|
115
116
|
export const useTableContext = <
|
|
116
117
|
DATA_ROW extends Record<string, unknown> = Record<string, unknown>,
|
|
117
118
|
>() => {
|
|
118
|
-
const tableProps =
|
|
119
|
+
const tableProps = useContext(TableContext);
|
|
119
120
|
|
|
120
121
|
if (!tableProps) {
|
|
121
122
|
throw new Error(
|
|
@@ -192,7 +193,7 @@ function Table<
|
|
|
192
193
|
...sortTypes,
|
|
193
194
|
};
|
|
194
195
|
|
|
195
|
-
const stringifyFilter =
|
|
196
|
+
const stringifyFilter = useMemo(() => {
|
|
196
197
|
return (rows: Row<object>[], columnIds: string[], value) => {
|
|
197
198
|
const filteredRows = rows.filter((row) => {
|
|
198
199
|
// we stringify the object to make sure we can match the value
|
|
@@ -204,7 +205,7 @@ function Table<
|
|
|
204
205
|
};
|
|
205
206
|
}, []);
|
|
206
207
|
|
|
207
|
-
const formattedInitiallySelectedRows =
|
|
208
|
+
const formattedInitiallySelectedRows = useMemo(() => {
|
|
208
209
|
if (initiallySelectedRowsIds) {
|
|
209
210
|
return Array.from(initiallySelectedRowsIds).reduce(
|
|
210
211
|
(accumulatedValue, currentValue) => ({
|
|
@@ -217,13 +218,13 @@ function Table<
|
|
|
217
218
|
return {};
|
|
218
219
|
}, []) as Record<IdType<DATA_ROW>, boolean>;
|
|
219
220
|
|
|
220
|
-
const [rowHeight, setRowHeight] =
|
|
221
|
+
const [rowHeight, setRowHeight] = useState<TableHeightKeyType>('h40');
|
|
221
222
|
|
|
222
|
-
const [syncScrollListener, setSyncScrollListener] =
|
|
223
|
+
const [syncScrollListener, setSyncScrollListener] = useState<
|
|
223
224
|
((event: Event) => void) | null
|
|
224
225
|
>(null);
|
|
225
226
|
|
|
226
|
-
const [hasScrollbar, setHasScrollbar] =
|
|
227
|
+
const [hasScrollbar, setHasScrollbar] = useState<boolean>(false);
|
|
227
228
|
|
|
228
229
|
const {
|
|
229
230
|
headerGroups,
|
|
@@ -341,4 +342,5 @@ Table.SingleSelectableContent = SingleSelectableContent;
|
|
|
341
342
|
Table.MultiSelectableContent = MultiSelectableContent;
|
|
342
343
|
Table.Search = Search;
|
|
343
344
|
Table.SearchWithQueryParams = SearchWithQueryParams;
|
|
345
|
+
Table.Sync = TableSync;
|
|
344
346
|
export { Table };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
import { zIndex } from '../../style/theme';
|
|
4
3
|
import { spacing } from '../../spacing';
|
|
5
4
|
import { getThemePropSelector } from '../../utils';
|
|
6
5
|
import { Icon } from '../icon/Icon.component';
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
7
|
|
|
8
8
|
const StyledScrollButton = styled.div`
|
|
9
9
|
display: flex;
|
|
@@ -28,7 +28,7 @@ type Props = {
|
|
|
28
28
|
direction: 'left' | 'right';
|
|
29
29
|
onClick: (arg0: React.SyntheticEvent<HTMLDivElement>) => void;
|
|
30
30
|
};
|
|
31
|
-
const ScrollButton =
|
|
31
|
+
const ScrollButton = forwardRef(({ direction, onClick }: Props, ref) => {
|
|
32
32
|
return (
|
|
33
33
|
// @ts-ignore
|
|
34
34
|
<StyledScrollButton direction={direction} onClick={onClick} ref={ref}>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
createContext,
|
|
3
3
|
ReactElement,
|
|
4
4
|
useCallback,
|
|
5
5
|
useEffect,
|
|
6
6
|
useState,
|
|
7
|
+
Children,
|
|
8
|
+
isValidElement,
|
|
7
9
|
} from 'react';
|
|
8
10
|
import {
|
|
9
11
|
matchPath,
|
|
@@ -65,10 +67,10 @@ function Tabs({
|
|
|
65
67
|
number | null | undefined
|
|
66
68
|
>(null);
|
|
67
69
|
const queryURL = new URLSearchParams(location.search);
|
|
68
|
-
const filteredTabsChildren: ReactElement<TabProps>[] =
|
|
70
|
+
const filteredTabsChildren: ReactElement<TabProps>[] = Children.toArray(
|
|
69
71
|
children,
|
|
70
72
|
).filter(
|
|
71
|
-
(child) =>
|
|
73
|
+
(child) => isValidElement(child) && child.type === Tab,
|
|
72
74
|
) as ReactElement<TabProps>[];
|
|
73
75
|
|
|
74
76
|
const matchQuery = useCallback(
|
|
@@ -234,9 +236,7 @@ function Tabs({
|
|
|
234
236
|
return (
|
|
235
237
|
<Route
|
|
236
238
|
key={index}
|
|
237
|
-
path={
|
|
238
|
-
tab.props.path.startsWith('/') ? '/' + path : path
|
|
239
|
-
}
|
|
239
|
+
path={tab.props.path.startsWith('/') ? '/' + path : path}
|
|
240
240
|
element={
|
|
241
241
|
<>
|
|
242
242
|
<TabContent
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
import { spacing } from '../../spacing';
|
|
4
3
|
import { CoreUITheme } from '../../style/theme';
|
|
@@ -142,17 +141,17 @@ export const Text = styled.span<{
|
|
|
142
141
|
line-height: 1.5;
|
|
143
142
|
`
|
|
144
143
|
: props.variant === 'Large'
|
|
145
|
-
|
|
144
|
+
? `
|
|
146
145
|
font-size: 1.14rem;
|
|
147
146
|
line-height: 1.5;
|
|
148
147
|
`
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
: props.variant === 'Smaller'
|
|
149
|
+
? `
|
|
151
150
|
font-size: 0.71rem;
|
|
152
151
|
line-height: 1.4;
|
|
153
152
|
letter-spacing: 2%;// to be defined, percentage value is not valid
|
|
154
153
|
`
|
|
155
|
-
|
|
154
|
+
: `
|
|
156
155
|
font-size: 1rem;
|
|
157
156
|
line-height: ${spacing.r24};
|
|
158
157
|
`}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
CSSProperties,
|
|
3
3
|
forwardRef,
|
|
4
4
|
TextareaHTMLAttributes,
|
|
5
|
+
ForwardedRef,
|
|
5
6
|
} from 'react';
|
|
6
7
|
import styled, { css } from 'styled-components';
|
|
7
8
|
import { spacing } from '../../spacing';
|
|
@@ -77,7 +78,7 @@ const TextAreaContainer = styled.textarea<{
|
|
|
77
78
|
|
|
78
79
|
function TextAreaElement(
|
|
79
80
|
{ rows = 3, cols = 20, width, height, variant = 'code', ...rest }: Props,
|
|
80
|
-
ref:
|
|
81
|
+
ref: ForwardedRef<RefType>,
|
|
81
82
|
) {
|
|
82
83
|
if (width || height) {
|
|
83
84
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { motion } from 'framer-motion';
|
|
2
|
-
import
|
|
2
|
+
import { ReactNode, useRef } from 'react';
|
|
3
3
|
import { useTheme } from 'styled-components';
|
|
4
4
|
import { Box } from '../box/Box';
|
|
5
5
|
import { Button } from '../buttonv2/Buttonv2.component';
|
|
@@ -14,7 +14,9 @@ export const ToastContext = createContext<ToastContextType | undefined>(
|
|
|
14
14
|
interface ToastProviderProps {
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
}
|
|
17
|
-
export const ToastProvider: React.FC<
|
|
17
|
+
export const ToastProvider: React.FC<
|
|
18
|
+
React.PropsWithChildren<ToastProviderProps>
|
|
19
|
+
> = ({ children }) => {
|
|
18
20
|
const [toastProps, setToastProps] = useState<ToastContextState | null>(null);
|
|
19
21
|
|
|
20
22
|
const showToast = (toastProps: ToastContextState) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import
|
|
2
|
+
import { useEffect, useRef, useLayoutEffect, useMemo, forwardRef } from 'react';
|
|
3
3
|
import * as vega from 'vega';
|
|
4
4
|
import vegaEmbed, { Result } from 'vega-embed';
|
|
5
5
|
import { createGlobalStyle, css, useTheme } from 'styled-components';
|
|
@@ -273,4 +273,4 @@ function VegaChartInternal(
|
|
|
273
273
|
);
|
|
274
274
|
} // @ts-expect-error
|
|
275
275
|
|
|
276
|
-
export const VegaChart =
|
|
276
|
+
export const VegaChart = forwardRef(VegaChartInternal);
|
package/src/lib/next.ts
CHANGED
|
@@ -16,3 +16,8 @@ export { CoreUiThemeProvider } from './components/coreuithemeprovider/CoreUiThem
|
|
|
16
16
|
export { Box } from './components/box/Box';
|
|
17
17
|
export { Input } from './components/inputv2/inputv2';
|
|
18
18
|
export { Accordion } from './components/accordion/Accordion.component';
|
|
19
|
+
export {
|
|
20
|
+
Barchart,
|
|
21
|
+
BarchartSortFn,
|
|
22
|
+
BarchartTooltipFn,
|
|
23
|
+
} from './components/barchartv2/Barchart.component';
|
package/src/lib/style/theme.ts
CHANGED
|
@@ -149,10 +149,19 @@ export const coreUIAvailableThemes: Record<CoreUIThemeName, CoreUITheme> = {
|
|
|
149
149
|
*/
|
|
150
150
|
export const defaultTheme = coreUIAvailableThemes;
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated
|
|
154
|
+
* Instead should use useTheme()
|
|
155
|
+
* import { useTheme } from 'styled-components';
|
|
156
|
+
* const theme = useTheme();
|
|
157
|
+
* e.g: color={theme.statusHealthy}
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
|
|
153
161
|
export const brand = coreUIAvailableThemes.darkRebrand;
|
|
154
162
|
|
|
155
163
|
export type ThemeColors = keyof CoreUITheme;
|
|
164
|
+
|
|
156
165
|
// LineChart colors
|
|
157
166
|
export const lineColor1 = '#A14FBF';
|
|
158
167
|
export const lineColor2 = '#BE9A40';
|
|
@@ -162,6 +171,20 @@ export const lineColor5 = '#E3FF73';
|
|
|
162
171
|
export const lineColor6 = '#BE2543';
|
|
163
172
|
export const lineColor7 = '#FD8144';
|
|
164
173
|
export const lineColor8 = '#F6B187';
|
|
174
|
+
|
|
175
|
+
export type ChartColors = keyof typeof chartColors;
|
|
176
|
+
|
|
177
|
+
export const chartColors = {
|
|
178
|
+
lineColor1,
|
|
179
|
+
lineColor2,
|
|
180
|
+
lineColor3,
|
|
181
|
+
lineColor4,
|
|
182
|
+
lineColor5,
|
|
183
|
+
lineColor6,
|
|
184
|
+
lineColor7,
|
|
185
|
+
lineColor8,
|
|
186
|
+
};
|
|
187
|
+
|
|
165
188
|
export const fontSize = {
|
|
166
189
|
smaller: '0.71rem',
|
|
167
190
|
small: '0.85rem',
|