@ssa-ui-kit/core 1.1.7 → 1.1.8
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/dist/components/Charts/BarLineComplexChart/BarLIneComplexChart.context.d.ts +3 -0
- package/dist/components/Charts/BarLineComplexChart/BarLineComplexChart.d.ts +2 -0
- package/dist/components/Charts/BarLineComplexChart/BarLineComplexChartInternal.d.ts +2 -0
- package/dist/components/Charts/BarLineComplexChart/BarLineComplexChartTooltip.d.ts +2 -0
- package/dist/components/Charts/BarLineComplexChart/__mock__/data.d.ts +3 -0
- package/dist/components/Charts/BarLineComplexChart/colorPalette.d.ts +1 -0
- package/dist/components/Charts/BarLineComplexChart/index.d.ts +1 -0
- package/dist/components/Charts/BarLineComplexChart/types.d.ts +28 -0
- package/dist/components/Charts/BarLineComplexChart/useChartInfo.d.ts +10 -0
- package/dist/components/{PieChart → Charts/PieChart}/PieChartLegendMarker.d.ts +1 -1
- package/dist/components/{PieChart → Charts/PieChart}/styles.d.ts +1 -1
- package/dist/components/{PieChart → Charts/PieChart}/types.d.ts +1 -1
- package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/types.d.ts +3 -3
- package/dist/components/Charts/hooks/index.d.ts +1 -0
- package/dist/components/Charts/hooks/usePlotlyDefaultConfig.d.ts +10 -0
- package/dist/components/Charts/index.d.ts +3 -0
- package/dist/components/Input/InputStatusError.d.ts +3 -1
- package/dist/components/Input/InputStatusSuccess.d.ts +3 -1
- package/dist/components/Input/types.d.ts +2 -0
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Pagination/types.d.ts +2 -0
- package/dist/components/Tooltip/types.d.ts +5 -3
- package/dist/components/WidgetCard/WidgetCard.d.ts +1 -1
- package/dist/components/WidgetCard/WidgetCardBase.d.ts +2 -0
- package/dist/components/WidgetCard/WithWidgetCard.d.ts +1 -1
- package/dist/components/WidgetCard/types.d.ts +2 -0
- package/dist/components/index.d.ts +1 -2
- package/dist/contexts/Translation/TranslationContext.d.ts +9 -0
- package/dist/contexts/Translation/config.d.ts +3 -0
- package/dist/contexts/Translation/index.d.ts +2 -0
- package/dist/contexts/Translation/types.d.ts +8 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/json.d.ts +5 -0
- package/jest-setup.ts +3 -0
- package/package.json +6 -3
- package/src/components/Charts/BarLineComplexChart/BarLIneComplexChart.context.tsx +54 -0
- package/src/components/Charts/BarLineComplexChart/BarLineComplexChart.stories.tsx +47 -0
- package/src/components/Charts/BarLineComplexChart/BarLineComplexChart.tsx +26 -0
- package/src/components/Charts/BarLineComplexChart/BarLineComplexChartInternal.tsx +118 -0
- package/src/components/Charts/BarLineComplexChart/BarLineComplexChartTooltip.tsx +43 -0
- package/src/components/Charts/BarLineComplexChart/__mock__/data.ts +141 -0
- package/src/components/Charts/BarLineComplexChart/colorPalette.ts +23 -0
- package/src/components/Charts/BarLineComplexChart/index.ts +1 -0
- package/src/components/Charts/BarLineComplexChart/types.ts +36 -0
- package/src/components/Charts/BarLineComplexChart/useChartInfo.ts +68 -0
- package/src/components/{PieChart → Charts/PieChart}/types.ts +1 -1
- package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/stories/SegmentedPieChart.stories.tsx +1 -1
- package/src/components/Charts/hooks/index.ts +1 -0
- package/src/components/Charts/hooks/usePlotlyDefaultConfig.ts +39 -0
- package/src/components/Charts/index.ts +3 -0
- package/src/components/Input/Input.tsx +8 -2
- package/src/components/Input/InputStatusError.tsx +6 -2
- package/src/components/Input/InputStatusSuccess.tsx +6 -2
- package/src/components/Input/types.ts +2 -0
- package/src/components/Pagination/Pagination.stories.tsx +12 -0
- package/src/components/Pagination/Pagination.tsx +9 -4
- package/src/components/Pagination/components/RowsPerPageDropdown/RowsPerPageDropdown.tsx +1 -1
- package/src/components/Pagination/styles.tsx +1 -2
- package/src/components/Pagination/types.ts +2 -0
- package/src/components/ProgressInfo/ProgressInfo.tsx +1 -1
- package/src/components/Tooltip/types.ts +5 -2
- package/src/components/Tooltip/useTooltip.tsx +4 -2
- package/src/components/WidgetCard/WidgetCard.tsx +5 -1
- package/src/components/WidgetCard/WidgetCardBase.tsx +4 -2
- package/src/components/WidgetCard/WithWidgetCard.tsx +1 -1
- package/src/components/WidgetCard/types.ts +2 -0
- package/src/components/index.ts +1 -2
- package/src/contexts/Translation/TranslationContext.tsx +53 -0
- package/src/contexts/Translation/config.ts +3 -0
- package/src/contexts/Translation/index.ts +2 -0
- package/src/contexts/Translation/types.ts +9 -0
- package/src/contexts/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/types/json.ts +7 -0
- package/tsbuildcache +1 -1
- package/tsconfig.build.json +2 -0
- package/tsconfig.json +2 -0
- package/webpack.config.js +1 -0
- /package/dist/components/{PieChart → Charts/PieChart}/PieChart.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/PieChartBases.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/PieChartHeader.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/PieChartLegend.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/PieChartLegendList.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/PieChartLegendListItem.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/colorPalettes.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/index.d.ts +0 -0
- /package/dist/components/{PieChart → Charts/PieChart}/stories/fixtures.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/SegmentedPieChart.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/SegmentedPieChartContext.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/colorPalettes.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/ChartTitle.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/ChartTooltip.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/LegendItem.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/index.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/hooks/index.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/hooks/useData.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/index.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/stories/fixtures.d.ts +0 -0
- /package/dist/components/{SegmentedPieChart → Charts/SegmentedPieChart}/utils.d.ts +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChart.spec.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChart.stories.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChart.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChartBases.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChartHeader.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChartLegend.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChartLegendList.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChartLegendListItem.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/PieChartLegendMarker.tsx +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/colorPalettes.ts +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/index.ts +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/stories/fixtures.ts +0 -0
- /package/src/components/{PieChart → Charts/PieChart}/styles.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/SegmentedPieChart.spec.tsx +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/SegmentedPieChart.tsx +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/SegmentedPieChartContext.tsx +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/colorPalettes.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/ChartTitle.tsx +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/ChartTooltip.tsx +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/LegendItem.tsx +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/components/index.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/hooks/index.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/hooks/useData.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/index.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/stories/fixtures.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/types.ts +0 -0
- /package/src/components/{SegmentedPieChart → Charts/SegmentedPieChart}/utils.ts +0 -0
|
@@ -27,6 +27,8 @@ const InputInner = (
|
|
|
27
27
|
className,
|
|
28
28
|
wrapperClassName,
|
|
29
29
|
inputProps = {},
|
|
30
|
+
errorTooltip,
|
|
31
|
+
successTooltip,
|
|
30
32
|
register,
|
|
31
33
|
onKeyUp,
|
|
32
34
|
}: InputProps,
|
|
@@ -63,8 +65,12 @@ const InputInner = (
|
|
|
63
65
|
ref={useMergeRefs([registerResult?.ref, inputRef])}
|
|
64
66
|
/>
|
|
65
67
|
|
|
66
|
-
{status === 'error' && showStatusIcon() ?
|
|
67
|
-
|
|
68
|
+
{status === 'error' && showStatusIcon() ? (
|
|
69
|
+
<InputStatusError errorTooltip={errorTooltip} />
|
|
70
|
+
) : null}
|
|
71
|
+
{status === 'success' && showStatusIcon() ? (
|
|
72
|
+
<InputStatusSuccess successTooltip={successTooltip} />
|
|
73
|
+
) : null}
|
|
68
74
|
|
|
69
75
|
{endElement ? <div css={S.endElement}>{endElement}</div> : null}
|
|
70
76
|
</InputGroup>
|
|
@@ -13,8 +13,12 @@ export const InputError = styled.div`
|
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
|
-
export const InputStatusError = (
|
|
16
|
+
export const InputStatusError = ({
|
|
17
|
+
errorTooltip,
|
|
18
|
+
}: {
|
|
19
|
+
errorTooltip?: string;
|
|
20
|
+
}) => (
|
|
17
21
|
<InputError css={inputStatus}>
|
|
18
|
-
<Icon name="union" size={10} color="#fff" />
|
|
22
|
+
<Icon name="union" size={10} color="#fff" tooltip={errorTooltip} />
|
|
19
23
|
</InputError>
|
|
20
24
|
);
|
|
@@ -9,8 +9,12 @@ export const InputSuccess = styled.div`
|
|
|
9
9
|
`linear-gradient(68.38deg, ${theme.colors.greenLighter}, ${theme.colors.green});`};
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
|
-
export const InputStatusSuccess = (
|
|
12
|
+
export const InputStatusSuccess = ({
|
|
13
|
+
successTooltip,
|
|
14
|
+
}: {
|
|
15
|
+
successTooltip?: string;
|
|
16
|
+
}) => (
|
|
13
17
|
<InputSuccess css={inputStatus}>
|
|
14
|
-
<Icon name="check" size={10} color="#fff" />
|
|
18
|
+
<Icon name="check" size={10} color="#fff" tooltip={successTooltip} />
|
|
15
19
|
</InputSuccess>
|
|
16
20
|
);
|
|
@@ -22,6 +22,8 @@ export interface InputProps
|
|
|
22
22
|
endElement?: React.ReactElement;
|
|
23
23
|
css?: Interpolation<Theme>;
|
|
24
24
|
inputProps?: ExtendedInputProps;
|
|
25
|
+
errorTooltip?: string;
|
|
26
|
+
successTooltip?: string;
|
|
25
27
|
onKeyUp?: KeyboardEventHandler<HTMLInputElement>;
|
|
26
28
|
onStartElementClick?: (event: BaseSyntheticEvent) => void;
|
|
27
29
|
onEndElementClick?: (event: BaseSyntheticEvent) => void;
|
|
@@ -70,5 +70,17 @@ export const WithManualPageSettingAndPerPage: StoryAnnotations = {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
export const WithoutPageFromCount: StoryAnnotations = {
|
|
74
|
+
args: {
|
|
75
|
+
pagesCount: 10,
|
|
76
|
+
isPageSettingVisible: true,
|
|
77
|
+
isRowPerPageVisible: true,
|
|
78
|
+
isPageFromCountVisible: false,
|
|
79
|
+
},
|
|
80
|
+
parameters: {
|
|
81
|
+
selectedPage: 1,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
73
85
|
WithManualPageSettingAndPerPage.storyName =
|
|
74
86
|
'With records per page and page number setting';
|
|
@@ -16,7 +16,9 @@ const Pagination = ({
|
|
|
16
16
|
ariaLabel,
|
|
17
17
|
isDisabled,
|
|
18
18
|
pageNumberPlaceholder = 'Page №',
|
|
19
|
+
errorTooltip = 'The value is out of range',
|
|
19
20
|
isPageSettingVisible = false,
|
|
21
|
+
isPageFromCountVisible = true,
|
|
20
22
|
isRowPerPageVisible = false,
|
|
21
23
|
rowPerPageProps,
|
|
22
24
|
manualPageNumberProps,
|
|
@@ -44,21 +46,24 @@ const Pagination = ({
|
|
|
44
46
|
aria-label={ariaLabel || 'Pagination'}>
|
|
45
47
|
{isRowPerPageVisible && <RowsPerPageDropdown {...rowPerPageProps} />}
|
|
46
48
|
{isPageSettingVisible && (
|
|
47
|
-
<Wrapper css={{ width: 'auto', marginRight:
|
|
49
|
+
<Wrapper css={{ width: 'auto', marginRight: 5 }}>
|
|
48
50
|
<S.PageNumberInput
|
|
49
51
|
name="page-number"
|
|
50
52
|
placeholder={pageNumberPlaceholder}
|
|
51
53
|
onKeyUp={handlePageNumberChange}
|
|
52
54
|
status={inputStatus}
|
|
53
55
|
type="number"
|
|
56
|
+
errorTooltip={errorTooltip}
|
|
54
57
|
inputProps={{
|
|
55
58
|
autoComplete: 'off',
|
|
56
59
|
}}
|
|
57
60
|
{...manualPageNumberProps}
|
|
58
61
|
/>
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
+
{isPageFromCountVisible && (
|
|
63
|
+
<span css={{ textWrap: 'nowrap', fontSize: 14, marginLeft: 16 }}>
|
|
64
|
+
{page || 0} / {pagesCount}
|
|
65
|
+
</span>
|
|
66
|
+
)}
|
|
62
67
|
</Wrapper>
|
|
63
68
|
)}
|
|
64
69
|
<Wrapper>
|
|
@@ -104,8 +104,7 @@ export const PaginationNav = styled.nav`
|
|
|
104
104
|
`;
|
|
105
105
|
|
|
106
106
|
export const PageNumberInput = styled(Input)`
|
|
107
|
-
width:
|
|
108
|
-
margin-right: 16px;
|
|
107
|
+
width: 65px;
|
|
109
108
|
-moz-appearance: textfield;
|
|
110
109
|
appearance: textfield;
|
|
111
110
|
&::-webkit-outer-spin-button,
|
|
@@ -9,8 +9,10 @@ export interface PaginationProps extends CommonProps {
|
|
|
9
9
|
pageNumberPlaceholder?: string;
|
|
10
10
|
isPageSettingVisible?: boolean;
|
|
11
11
|
isRowPerPageVisible?: boolean;
|
|
12
|
+
isPageFromCountVisible?: boolean;
|
|
12
13
|
rowPerPageProps?: RowsPerPageDropdownProps;
|
|
13
14
|
manualPageNumberProps?: InputProps;
|
|
15
|
+
errorTooltip?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export interface PaginationButtonsProps {
|
|
@@ -7,7 +7,7 @@ import Card from '@components/Card';
|
|
|
7
7
|
import CardHeader from '@components/CardHeader';
|
|
8
8
|
import Typography from '@components/Typography';
|
|
9
9
|
|
|
10
|
-
import { PieChart, PieChartLegend } from '@components/PieChart';
|
|
10
|
+
import { PieChart, PieChartLegend } from '@components/Charts/PieChart';
|
|
11
11
|
import { ProgressInfoTotals } from './ProgressInfoTotals';
|
|
12
12
|
|
|
13
13
|
import {
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
FloatingArrow,
|
|
4
4
|
Placement,
|
|
5
5
|
UseFloatingReturn,
|
|
6
|
+
OffsetOptions,
|
|
6
7
|
} from '@floating-ui/react';
|
|
7
8
|
import { PointTooltipProps, Point } from '@nivo/line';
|
|
8
9
|
import { MapIconsType } from '@components/Icon/types';
|
|
@@ -17,7 +18,7 @@ export interface TooltipProps extends CommonProps {
|
|
|
17
18
|
placement?: Placement;
|
|
18
19
|
enableHover?: boolean;
|
|
19
20
|
enableClick?: boolean;
|
|
20
|
-
|
|
21
|
+
offsetOptions?: OffsetOptions;
|
|
21
22
|
// TooltipContent-related props
|
|
22
23
|
size?: TooltipSize;
|
|
23
24
|
hasArrow?: boolean;
|
|
@@ -39,14 +40,16 @@ export type UseTooltip = (props: UseTooltipArgs) => Pick<
|
|
|
39
40
|
> & {
|
|
40
41
|
arrowRef: MutableRefObject<null>;
|
|
41
42
|
isOpen: boolean;
|
|
43
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
42
44
|
} & UseFloatingReturn &
|
|
43
45
|
UseInteractions;
|
|
44
46
|
|
|
45
47
|
export type TooltipContextType =
|
|
46
48
|
| (UseFloatingReturn &
|
|
47
49
|
ReturnType<typeof useInteractions> & {
|
|
48
|
-
isOpen: boolean;
|
|
49
50
|
arrowRef: React.Ref<SVGSVGElement>;
|
|
51
|
+
isOpen: boolean;
|
|
52
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
50
53
|
} & Pick<TooltipProps, 'size' | 'hasArrow' | 'arrowProps'>)
|
|
51
54
|
| null;
|
|
52
55
|
|
|
@@ -18,7 +18,7 @@ export const useTooltip: UseTooltip = ({
|
|
|
18
18
|
placement,
|
|
19
19
|
enableClick = true,
|
|
20
20
|
enableHover = false,
|
|
21
|
-
|
|
21
|
+
offsetOptions = 12,
|
|
22
22
|
size = 'small',
|
|
23
23
|
hasArrow = true,
|
|
24
24
|
arrowProps = {},
|
|
@@ -32,7 +32,7 @@ export const useTooltip: UseTooltip = ({
|
|
|
32
32
|
onOpenChange: setIsOpen,
|
|
33
33
|
placement,
|
|
34
34
|
middleware: [
|
|
35
|
-
offset(
|
|
35
|
+
offset(offsetOptions),
|
|
36
36
|
flip(),
|
|
37
37
|
shift(),
|
|
38
38
|
arrow({
|
|
@@ -54,6 +54,7 @@ export const useTooltip: UseTooltip = ({
|
|
|
54
54
|
return useMemo(
|
|
55
55
|
() => ({
|
|
56
56
|
isOpen,
|
|
57
|
+
setIsOpen,
|
|
57
58
|
arrowRef,
|
|
58
59
|
size,
|
|
59
60
|
hasArrow,
|
|
@@ -63,6 +64,7 @@ export const useTooltip: UseTooltip = ({
|
|
|
63
64
|
}),
|
|
64
65
|
[
|
|
65
66
|
isOpen,
|
|
67
|
+
setIsOpen,
|
|
66
68
|
arrowRef,
|
|
67
69
|
size,
|
|
68
70
|
hasArrow,
|
|
@@ -13,6 +13,8 @@ export const WidgetCard = ({
|
|
|
13
13
|
headerContent,
|
|
14
14
|
link,
|
|
15
15
|
children,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
16
18
|
onClick,
|
|
17
19
|
}: WidgetCardProps) => {
|
|
18
20
|
const { isFullscreenMode } = useFullscreenMode();
|
|
@@ -21,7 +23,9 @@ export const WidgetCard = ({
|
|
|
21
23
|
<WidgetCardBase
|
|
22
24
|
className={className}
|
|
23
25
|
onClick={link ? undefined : onClick}
|
|
24
|
-
isFullscreenMode={isFullscreenMode}
|
|
26
|
+
isFullscreenMode={isFullscreenMode}
|
|
27
|
+
width={width}
|
|
28
|
+
height={height}>
|
|
25
29
|
<Header title={title} className={headerClassName}>
|
|
26
30
|
{headerContent}
|
|
27
31
|
</Header>
|
|
@@ -3,11 +3,13 @@ import Card from '@components/Card';
|
|
|
3
3
|
|
|
4
4
|
export const WidgetCardBase = styled(Card)<{
|
|
5
5
|
isFullscreenMode?: boolean;
|
|
6
|
+
width?: string;
|
|
7
|
+
height?: string;
|
|
6
8
|
}>`
|
|
7
9
|
border-radius: 20px;
|
|
8
10
|
padding: 5px 10px;
|
|
9
|
-
width: 100
|
|
10
|
-
height: 100
|
|
11
|
+
width: ${({ width }) => width ?? '100%'};
|
|
12
|
+
height: ${({ height }) => height ?? '100%'};
|
|
11
13
|
position: ${({ isFullscreenMode }) =>
|
|
12
14
|
isFullscreenMode ? 'absolute' : 'static'};
|
|
13
15
|
top: ${({ isFullscreenMode }) => isFullscreenMode && 0};
|
package/src/components/index.ts
CHANGED
|
@@ -82,12 +82,11 @@ export * from './NavBar';
|
|
|
82
82
|
export * from './NotificationCard';
|
|
83
83
|
export * from './NotificationMenu';
|
|
84
84
|
export * from './Pagination';
|
|
85
|
-
export * from './
|
|
85
|
+
export * from './Charts';
|
|
86
86
|
export * from './Popover';
|
|
87
87
|
export * from './ProgressInfo';
|
|
88
88
|
export * from './ResponsiveImage';
|
|
89
89
|
export * from './SearchBox';
|
|
90
|
-
export * from './SegmentedPieChart';
|
|
91
90
|
export * from './Switch';
|
|
92
91
|
export * from './TabBar';
|
|
93
92
|
export * from './TableFilters';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createContext, ReactNode, useContext, useState } from 'react';
|
|
2
|
+
import { pathOr } from '@ssa-ui-kit/utils';
|
|
3
|
+
import { JSONObject } from '@global-types/json';
|
|
4
|
+
import { config as translationConfig } from './config';
|
|
5
|
+
import { TranslationContextContent } from './types';
|
|
6
|
+
|
|
7
|
+
export const TranslationContext = createContext<TranslationContextContent>({
|
|
8
|
+
language: translationConfig.defaultLanguage,
|
|
9
|
+
t() {
|
|
10
|
+
return '';
|
|
11
|
+
},
|
|
12
|
+
setLanguage() {
|
|
13
|
+
/* no-op */
|
|
14
|
+
},
|
|
15
|
+
setTranslations() {
|
|
16
|
+
/* no-op */
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const TranslationProvider = ({
|
|
21
|
+
children,
|
|
22
|
+
defaultTranslations = {},
|
|
23
|
+
}: {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
defaultTranslations?: JSONObject;
|
|
26
|
+
}) => {
|
|
27
|
+
const [language, setLanguage] = useState<string>(
|
|
28
|
+
translationConfig.defaultLanguage,
|
|
29
|
+
);
|
|
30
|
+
const [translations, setTranslations] =
|
|
31
|
+
useState<JSONObject>(defaultTranslations);
|
|
32
|
+
const t = (translationKey: string) => {
|
|
33
|
+
const translationKeyArray = translationKey.split('.');
|
|
34
|
+
const translation = pathOr<JSONObject, string>(translationKey, [
|
|
35
|
+
language,
|
|
36
|
+
...translationKeyArray,
|
|
37
|
+
])(translations);
|
|
38
|
+
return translation;
|
|
39
|
+
};
|
|
40
|
+
return (
|
|
41
|
+
<TranslationContext.Provider
|
|
42
|
+
value={{
|
|
43
|
+
language,
|
|
44
|
+
t,
|
|
45
|
+
setLanguage,
|
|
46
|
+
setTranslations,
|
|
47
|
+
}}>
|
|
48
|
+
{children}
|
|
49
|
+
</TranslationContext.Provider>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const useTranslation = () => useContext(TranslationContext);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { JSONObject } from '@global-types/json';
|
|
3
|
+
|
|
4
|
+
export type TranslationContextContent = {
|
|
5
|
+
language: string;
|
|
6
|
+
t: (translationKey: string) => string;
|
|
7
|
+
setLanguage: Dispatch<SetStateAction<string>>;
|
|
8
|
+
setTranslations: Dispatch<SetStateAction<JSONObject>>;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Translation';
|
package/src/index.ts
CHANGED