@ssa-ui-kit/widgets 0.0.28-alpha → 0.0.29-alpha
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/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
- package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_menu_opened.png +0 -0
- package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_statistics_submenu.png +0 -0
- package/custom-shots/widgets-filters--default__[w1920px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w390px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w900px].png +0 -0
- package/custom-shots/widgets-notification-menu--is-opened__[w1440px].png +0 -0
- package/custom-shots/widgets-notification-menu--is-opened__[w1920px].png +0 -0
- package/custom-shots/widgets-notification-menu--is-opened__[w900px].png +0 -0
- package/custom-shots/widgets-pagination--selected-hover__[w1920px].png +0 -0
- package/custom-shots/widgets-pagination-disabled--selected-hover__[w1920px].png +0 -0
- package/custom-shots/widgets-progressInfo__dropdown__[w1920px].png +0 -0
- package/custom-shots/widgets-progressInfo__dropdown__[w390px].png +0 -0
- package/custom-shots/widgets-progressInfo__dropdown__[w900px].png +0 -0
- package/custom-shots/widgets-searchbox--cross-icon__[w900px].png +0 -0
- package/custom-shots/widgets-table-filters--opened__[w1920px].png +0 -0
- package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
- package/custom-shots/widgets-user-profile--is-opened__[w1920px].png +0 -0
- package/dist/components/Calories/Calories.d.ts +2 -2
- package/dist/components/Calories/innerContent.d.ts +2 -2
- package/dist/components/Calories/types.d.ts +1 -1
- package/dist/components/CardList/CardList.d.ts +2 -2
- package/dist/components/CardList/types.d.ts +1 -1
- package/dist/components/CollapsibleNavBar/TriggerIcon.d.ts +2 -2
- package/dist/components/HeartRate/BPM.d.ts +2 -2
- package/dist/components/HeartRate/HeartRate.d.ts +2 -2
- package/dist/components/HeartRate/types.d.ts +3 -3
- package/dist/components/ListGoals/ListGoals.d.ts +2 -2
- package/dist/components/ListGoals/ListGoalsCard.d.ts +2 -2
- package/dist/components/ListGoals/types.d.ts +2 -2
- package/dist/components/MealNutrients/MealNutrients.d.ts +2 -2
- package/dist/components/MealNutrients/MealNutrientsTooltip.d.ts +2 -2
- package/dist/components/MealNutrients/types.d.ts +4 -4
- package/dist/components/NavBar/NavBar.d.ts +2 -2
- package/dist/components/NavBar/types.d.ts +6 -6
- package/dist/components/Pagination/ArrowButton.d.ts +2 -2
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/Pagination/PaginationButtons.d.ts +2 -2
- package/dist/components/Pagination/PaginationContext.d.ts +4 -4
- package/dist/components/Pagination/types.d.ts +6 -6
- package/dist/components/ProgressInfo/ProgressInfo.d.ts +2 -2
- package/dist/components/ProgressInfo/types.d.ts +1 -1
- package/dist/components/TableFilters/TableFilterCheckbox.d.ts +2 -2
- package/dist/components/TradingInfoCard/TradingInfoCard.d.ts +2 -2
- package/dist/components/TradingInfoCard/TradingInfoCardTooltip.d.ts +2 -2
- package/dist/components/TradingInfoCard/TradingInfoCardWrapper.d.ts +2 -2
- package/dist/components/TradingInfoCard/types.d.ts +4 -4
- package/dist/components/TradingScoreboard/TradingScoreboard.d.ts +2 -2
- package/dist/components/TradingScoreboard/types.d.ts +3 -3
- package/dist/components/UpcomingWorkouts/UpcomingWorkoutCard.d.ts +2 -2
- package/dist/components/UpcomingWorkouts/UpcomingWorkouts.d.ts +2 -2
- package/dist/components/UpcomingWorkouts/types.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Activity/Activity.tsx +3 -3
- package/src/components/Calories/Calories.tsx +2 -2
- package/src/components/Calories/innerContent.tsx +2 -2
- package/src/components/Calories/types.ts +1 -1
- package/src/components/CardList/CardList.tsx +2 -2
- package/src/components/CardList/types.ts +1 -1
- package/src/components/CollapsibleNavBar/TriggerIcon.tsx +2 -2
- package/src/components/Filters/FiltersBlock.tsx +1 -0
- package/src/components/HeartRate/BPM.tsx +2 -2
- package/src/components/HeartRate/HeartRate.tsx +2 -2
- package/src/components/HeartRate/types.ts +3 -3
- package/src/components/ListGoals/ListGoals.tsx +2 -2
- package/src/components/ListGoals/ListGoalsCard.tsx +2 -2
- package/src/components/ListGoals/types.ts +2 -2
- package/src/components/MealNutrients/MealNutrients.stories.tsx +3 -3
- package/src/components/MealNutrients/MealNutrients.tsx +2 -2
- package/src/components/MealNutrients/MealNutrientsTooltip.tsx +4 -4
- package/src/components/MealNutrients/types.ts +4 -4
- package/src/components/MealPlanner/MealPlanner.tsx +3 -3
- package/src/components/NavBar/NavBar.tsx +2 -2
- package/src/components/NavBar/types.ts +6 -6
- package/src/components/NotificationCard/NotificationCard.tsx +2 -2
- package/src/components/Pagination/ArrowButton.tsx +2 -2
- package/src/components/Pagination/Pagination.tsx +2 -2
- package/src/components/Pagination/PaginationButtons.tsx +3 -3
- package/src/components/Pagination/PaginationContext.tsx +7 -4
- package/src/components/Pagination/types.ts +6 -6
- package/src/components/ProgressInfo/ProgressInfo.stories.tsx +2 -2
- package/src/components/ProgressInfo/ProgressInfo.tsx +4 -4
- package/src/components/ProgressInfo/types.ts +1 -1
- package/src/components/TableFilters/TableFilterCheckbox.tsx +2 -2
- package/src/components/TableFilters/TableFilters.tsx +2 -2
- package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +6 -6
- package/src/components/TradingInfoCard/TradingInfoCard.tsx +3 -3
- package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +2 -2
- package/src/components/TradingInfoCard/TradingInfoCardWrapper.tsx +2 -2
- package/src/components/TradingInfoCard/types.ts +5 -5
- package/src/components/TradingScoreboard/TradingScoreboard.stories.tsx +5 -5
- package/src/components/TradingScoreboard/TradingScoreboard.tsx +2 -2
- package/src/components/TradingScoreboard/types.ts +3 -3
- package/src/components/UpcomingWorkouts/UpcomingWorkoutCard.tsx +2 -2
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.tsx +2 -2
- package/src/components/UpcomingWorkouts/types.ts +2 -2
- package/tsbuildcache +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssa-ui-kit/widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29-alpha",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"private": false,
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"js-tokens": "^4.0.0",
|
|
30
30
|
"loose-envify": "^1.4.0",
|
|
31
31
|
"scheduler": "^0.23.0",
|
|
32
|
-
"@ssa-ui-kit/core": "^0.0.
|
|
33
|
-
"@ssa-ui-kit/
|
|
34
|
-
"@ssa-ui-kit/
|
|
32
|
+
"@ssa-ui-kit/core": "^0.0.26-alpha",
|
|
33
|
+
"@ssa-ui-kit/utils": "^0.0.1-alpha",
|
|
34
|
+
"@ssa-ui-kit/hooks": "^0.0.2-alpha"
|
|
35
35
|
},
|
|
36
36
|
"browserslist": [
|
|
37
37
|
">0.1%",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
CardHeader,
|
|
8
8
|
Typography,
|
|
9
9
|
Wrapper,
|
|
10
|
-
|
|
10
|
+
DropdownOptionProps,
|
|
11
11
|
} from '@ssa-ui-kit/core';
|
|
12
12
|
|
|
13
13
|
import { ActivityResp } from './types';
|
|
@@ -19,7 +19,7 @@ import { Dropdown } from '@ssa-ui-kit/core';
|
|
|
19
19
|
|
|
20
20
|
export const Activity = ({ data }: { data: ActivityResp }) => {
|
|
21
21
|
const [selected, setSelected] = useState<string>('');
|
|
22
|
-
const [options, setOptions] = useState<
|
|
22
|
+
const [options, setOptions] = useState<DropdownOptionProps[]>([]);
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (data == null || typeof data !== 'object') {
|
|
@@ -40,7 +40,7 @@ export const Activity = ({ data }: { data: ActivityResp }) => {
|
|
|
40
40
|
}
|
|
41
41
|
}, [options]);
|
|
42
42
|
|
|
43
|
-
const handleChange = (e:
|
|
43
|
+
const handleChange = (e: DropdownOptionProps) => {
|
|
44
44
|
const value = e.value.toString().toLowerCase();
|
|
45
45
|
|
|
46
46
|
setSelected(value);
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
ResponsiveImage,
|
|
10
10
|
} from '@ssa-ui-kit/core';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { CaloriesProps } from './types';
|
|
13
13
|
import { InnerContent } from './innerContent';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
* UI Component that shows how many calories the user has burned
|
|
18
18
|
*/
|
|
19
|
-
export const Calories = ({ max, currentValue }:
|
|
19
|
+
export const Calories = ({ max, currentValue }: CaloriesProps) => {
|
|
20
20
|
const theme = useTheme();
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
2
|
import { Typography, Wrapper } from '@ssa-ui-kit/core';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { CaloriesProps } from './types';
|
|
5
5
|
|
|
6
|
-
export const InnerContent = ({ currentValue, max }:
|
|
6
|
+
export const InnerContent = ({ currentValue, max }: CaloriesProps) => {
|
|
7
7
|
const theme = useTheme();
|
|
8
8
|
return (
|
|
9
9
|
<div
|
|
@@ -3,7 +3,7 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
|
|
4
4
|
import { Typography } from '@ssa-ui-kit/core';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { CardListProps, Item } from './types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -13,7 +13,7 @@ export const CardList = <ItemType extends Item>({
|
|
|
13
13
|
title,
|
|
14
14
|
items,
|
|
15
15
|
renderItem,
|
|
16
|
-
}:
|
|
16
|
+
}: CardListProps<ItemType>) => {
|
|
17
17
|
return (
|
|
18
18
|
<Fragment>
|
|
19
19
|
<Typography variant="h5" weight="bold">
|
|
@@ -3,7 +3,7 @@ export type Item = {
|
|
|
3
3
|
[prop: string | number | symbol]: unknown;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface CardListProps<ItemType extends Item> {
|
|
7
7
|
title: string;
|
|
8
8
|
items: Array<ItemType>;
|
|
9
9
|
renderItem: (item: ItemType) => React.ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, useTheme } from '@emotion/react';
|
|
2
|
-
import { Wrapper, Icon,
|
|
2
|
+
import { Wrapper, Icon, MapIconsType, SVGProps } from '@ssa-ui-kit/core';
|
|
3
3
|
|
|
4
4
|
export const TriggerIcon = ({
|
|
5
5
|
iconName,
|
|
@@ -7,7 +7,7 @@ export const TriggerIcon = ({
|
|
|
7
7
|
className,
|
|
8
8
|
CustomIcon,
|
|
9
9
|
}: {
|
|
10
|
-
iconName: keyof
|
|
10
|
+
iconName: keyof MapIconsType;
|
|
11
11
|
iconSize?: number;
|
|
12
12
|
className?: string;
|
|
13
13
|
CustomIcon?: (props: Omit<SVGProps, 'fill'>) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { Theme, useTheme } from '@emotion/react';
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { BMPProps } from './types';
|
|
5
5
|
|
|
6
6
|
const BPMBase = styled.div`
|
|
7
7
|
text-align: center;
|
|
@@ -32,7 +32,7 @@ const getBPMLabelStyles = (theme: Theme) => css`
|
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
|
-
export const BPM = ({ value }:
|
|
35
|
+
export const BPM = ({ value }: BMPProps) => {
|
|
36
36
|
const theme = useTheme();
|
|
37
37
|
return (
|
|
38
38
|
<BPMBase>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { throttle } from '@ssa-ui-kit/utils';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { HeartRateProps } from './types';
|
|
17
17
|
import { HeartRateLineChart } from './HeartRateLineChart';
|
|
18
18
|
import { BPM } from './BPM';
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ export const HeartRate = ({
|
|
|
28
28
|
data,
|
|
29
29
|
caption = 'Heart Rate',
|
|
30
30
|
color,
|
|
31
|
-
}:
|
|
31
|
+
}: HeartRateProps) => {
|
|
32
32
|
const [bpmValue, setBpmValue] = useState<number>(
|
|
33
33
|
data?.data?.[0]?.y as number,
|
|
34
34
|
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Serie } from '@nivo/line';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface HeartRateProps {
|
|
4
4
|
data: Serie;
|
|
5
5
|
caption?: string;
|
|
6
6
|
color?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface BMPProps {
|
|
10
10
|
value: number;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface HeartRateCaptionProps {
|
|
14
14
|
caption: string;
|
|
15
15
|
}
|
|
@@ -2,13 +2,13 @@ import CardList from '@components/CardList';
|
|
|
2
2
|
|
|
3
3
|
import { ListGoalsCard } from './ListGoalsCard';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { ListGoalsProps } from './types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* UI Component that uses CardList to render a list of goals
|
|
10
10
|
*/
|
|
11
|
-
export const ListGoals = ({ goals }:
|
|
11
|
+
export const ListGoals = ({ goals }: ListGoalsProps) => {
|
|
12
12
|
return (
|
|
13
13
|
<CardList
|
|
14
14
|
title="Goals"
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
} from '@ssa-ui-kit/core';
|
|
11
11
|
|
|
12
12
|
import { content } from './styles';
|
|
13
|
-
import {
|
|
13
|
+
import { ItemCardProps, ProgressProps } from './types';
|
|
14
14
|
|
|
15
15
|
export const ListGoalsCard = ({
|
|
16
16
|
image,
|
|
17
17
|
title,
|
|
18
18
|
details,
|
|
19
19
|
progressProps,
|
|
20
|
-
}:
|
|
20
|
+
}: ItemCardProps) => {
|
|
21
21
|
const {
|
|
22
22
|
size = 50,
|
|
23
23
|
max = 100,
|
|
@@ -9,7 +9,7 @@ export type Goal = {
|
|
|
9
9
|
color: keyof MainColors;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface ListGoalsProps {
|
|
13
13
|
goals: Array<Goal>;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ export type ProgressProps = Partial<
|
|
|
17
17
|
React.ComponentProps<typeof ProgressCircle>
|
|
18
18
|
>;
|
|
19
19
|
|
|
20
|
-
export interface
|
|
20
|
+
export interface ItemCardProps {
|
|
21
21
|
image: string;
|
|
22
22
|
title: string;
|
|
23
23
|
details: string;
|
|
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
|
|
|
2
2
|
import type { Meta } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { MealNutrients } from './index';
|
|
5
|
-
import {
|
|
5
|
+
import { MealNutrientsProps } from './types';
|
|
6
6
|
|
|
7
7
|
import { mockStaticApi } from './mockMealNutrientsRequest';
|
|
8
8
|
const { getData, getOptions } = mockStaticApi;
|
|
@@ -13,8 +13,8 @@ export default {
|
|
|
13
13
|
} as Meta<typeof MealNutrients>;
|
|
14
14
|
|
|
15
15
|
export const Default = () => {
|
|
16
|
-
const [options, setOptions] = useState<
|
|
17
|
-
const [data, setData] = useState<
|
|
16
|
+
const [options, setOptions] = useState<MealNutrientsProps['options']>([]);
|
|
17
|
+
const [data, setData] = useState<MealNutrientsProps['data']>([]);
|
|
18
18
|
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
getOptions()
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { MealNutrientsLineChart } from './MealNutrientsLineChart';
|
|
13
13
|
import useChartConfig from './useChartConfig';
|
|
14
|
-
import {
|
|
14
|
+
import { MealNutrientsProps, UseChartConfig, OptionType } from './types';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
@@ -22,7 +22,7 @@ export const MealNutrients = ({
|
|
|
22
22
|
options,
|
|
23
23
|
data,
|
|
24
24
|
onOptionChange,
|
|
25
|
-
}:
|
|
25
|
+
}: MealNutrientsProps) => {
|
|
26
26
|
const [selectedOption, setSelectedOption] = useState<OptionType>();
|
|
27
27
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
28
28
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProgressChartTooltip } from '@ssa-ui-kit/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MapIconsType } from '@ssa-ui-kit/core';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { MealNutrientsTooltipProps } from './types';
|
|
5
5
|
|
|
6
6
|
const capitalize = (str: string) =>
|
|
7
7
|
`${str[0].toUpperCase()}${str.substring(1)}`;
|
|
@@ -9,13 +9,13 @@ const capitalize = (str: string) =>
|
|
|
9
9
|
export const MealNutrientsTooltip = ({
|
|
10
10
|
colorName,
|
|
11
11
|
point,
|
|
12
|
-
}:
|
|
12
|
+
}: MealNutrientsTooltipProps) => {
|
|
13
13
|
const caption = capitalize(String(point.serieId));
|
|
14
14
|
const {
|
|
15
15
|
data: { y, comp, unit },
|
|
16
16
|
} = point;
|
|
17
17
|
const iconName =
|
|
18
|
-
((comp && `arrow-${comp > 0 ? 'up' : 'down'}`) as keyof
|
|
18
|
+
((comp && `arrow-${comp > 0 ? 'up' : 'down'}`) as keyof MapIconsType) ||
|
|
19
19
|
undefined;
|
|
20
20
|
|
|
21
21
|
return (
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Point, LineSvgProps, CustomLayerProps } from '@nivo/line';
|
|
2
2
|
import { ScaleTimeSpec } from '@nivo/scales';
|
|
3
|
-
import { MainColors,
|
|
3
|
+
import { MainColors, DropdownOptionProps } from '@ssa-ui-kit/core';
|
|
4
4
|
|
|
5
|
-
export interface OptionType extends
|
|
5
|
+
export interface OptionType extends DropdownOptionProps {
|
|
6
6
|
value: 'd' | 'w' | 'm';
|
|
7
7
|
label: string;
|
|
8
8
|
precision: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export interface
|
|
11
|
+
export interface MealNutrientsProps {
|
|
12
12
|
caption?: string;
|
|
13
13
|
options: OptionType[];
|
|
14
14
|
data: LineSvgProps['data'];
|
|
15
15
|
onOptionChange?: (option: OptionType) => void;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export interface
|
|
18
|
+
export interface MealNutrientsTooltipProps {
|
|
19
19
|
colorName: keyof MainColors;
|
|
20
20
|
point: Exclude<Point, 'data'> & {
|
|
21
21
|
data: Point['data'] & { comp?: number; unit?: string };
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Typography,
|
|
9
9
|
Dropdown,
|
|
10
10
|
DropdownOption,
|
|
11
|
-
|
|
11
|
+
DropdownOptionProps,
|
|
12
12
|
} from '@ssa-ui-kit/core';
|
|
13
13
|
|
|
14
14
|
import { MealPlannerCard } from './MealPlannerCard';
|
|
@@ -24,9 +24,9 @@ const CustomOption = styled(DropdownOption)`
|
|
|
24
24
|
|
|
25
25
|
export const MealPlanner = ({ data }: MealPlannerProps) => {
|
|
26
26
|
const [selectedOption, setSelectedOption] = useState<string | null>(null);
|
|
27
|
-
const [options, setOptions] = useState<
|
|
27
|
+
const [options, setOptions] = useState<DropdownOptionProps[]>([]);
|
|
28
28
|
|
|
29
|
-
const handleChange = (e:
|
|
29
|
+
const handleChange = (e: DropdownOptionProps) => {
|
|
30
30
|
const value = e.value.toString().toLowerCase();
|
|
31
31
|
|
|
32
32
|
setSelectedOption(value);
|
|
@@ -10,12 +10,12 @@ import NavBarItem from './NavBarItem';
|
|
|
10
10
|
import NavBarLink from './NavBarLink';
|
|
11
11
|
import NavToggle from './NavToggle';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { NavBarProps } from './types';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* UI Component that shows the navigation bar
|
|
17
17
|
*/
|
|
18
|
-
export const NavBar = ({ items }:
|
|
18
|
+
export const NavBar = ({ items }: NavBarProps) => {
|
|
19
19
|
const toggleId = useId();
|
|
20
20
|
const theme = useTheme();
|
|
21
21
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
|
|
2
|
-
import {
|
|
2
|
+
import { MapIconsType } from '@ssa-ui-kit/core';
|
|
3
3
|
|
|
4
|
-
export interface
|
|
5
|
-
items: Array<{ path: string; iconName: keyof
|
|
4
|
+
export interface NavBarProps {
|
|
5
|
+
items: Array<{ path: string; iconName: keyof MapIconsType }>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export type NavBarExtendedItem = {
|
|
9
9
|
CustomIcon?: () => EmotionJSX.Element;
|
|
10
10
|
path: string;
|
|
11
|
-
iconName: keyof
|
|
11
|
+
iconName: keyof MapIconsType;
|
|
12
12
|
title: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export type NavBarExtendedGroup = {
|
|
16
16
|
CustomIcon?: () => EmotionJSX.Element;
|
|
17
17
|
prefix?: string;
|
|
18
|
-
iconName: keyof
|
|
18
|
+
iconName: keyof MapIconsType;
|
|
19
19
|
title: string;
|
|
20
20
|
items: Array<{ path: string; title: string }>;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export interface
|
|
23
|
+
export interface NavBarExtendedProps {
|
|
24
24
|
items: Array<NavBarExtendedItem | NavBarExtendedGroup>;
|
|
25
25
|
}
|
|
@@ -4,7 +4,7 @@ import { dateFormatters } from '@ssa-ui-kit/utils';
|
|
|
4
4
|
import {
|
|
5
5
|
Badge,
|
|
6
6
|
CardBase,
|
|
7
|
-
|
|
7
|
+
MapIconsType,
|
|
8
8
|
Icon,
|
|
9
9
|
Indicator,
|
|
10
10
|
MainColors,
|
|
@@ -62,7 +62,7 @@ export const NotificationCard = forwardRef<
|
|
|
62
62
|
color={notificationTypes[type].color as keyof MainColors}
|
|
63
63
|
css={notifyBadge}>
|
|
64
64
|
<Icon
|
|
65
|
-
name={notificationTypes[type].icon as keyof
|
|
65
|
+
name={notificationTypes[type].icon as keyof MapIconsType}
|
|
66
66
|
color={theme.colors.white}
|
|
67
67
|
size={14}
|
|
68
68
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
2
|
import { Button, Icon } from '@ssa-ui-kit/core';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ArrowButtonProps } from './types';
|
|
5
5
|
import { arrowBtnStyles } from './styles';
|
|
6
6
|
|
|
7
7
|
export const ArrowButton = ({
|
|
@@ -9,7 +9,7 @@ export const ArrowButton = ({
|
|
|
9
9
|
onClick,
|
|
10
10
|
isDisabled,
|
|
11
11
|
className,
|
|
12
|
-
}:
|
|
12
|
+
}: ArrowButtonProps) => {
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
return (
|
|
15
15
|
<Button
|
|
@@ -4,7 +4,7 @@ import { usePaginationRange } from '@ssa-ui-kit/hooks';
|
|
|
4
4
|
import { ArrowButton } from './ArrowButton';
|
|
5
5
|
import { PaginationButtons } from './PaginationButtons';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { PaginationProps } from './types';
|
|
8
8
|
import { usePaginationContext } from './PaginationContext';
|
|
9
9
|
|
|
10
10
|
const Nav = styled.nav``;
|
|
@@ -15,7 +15,7 @@ const Pagination = ({
|
|
|
15
15
|
as,
|
|
16
16
|
ariaLabel,
|
|
17
17
|
isDisabled,
|
|
18
|
-
}:
|
|
18
|
+
}: PaginationProps) => {
|
|
19
19
|
const { page, setPage } = usePaginationContext();
|
|
20
20
|
const range = usePaginationRange({ pagesCount, selectedPage: page });
|
|
21
21
|
|
|
@@ -3,7 +3,7 @@ import { useTheme } from '@emotion/react';
|
|
|
3
3
|
import { Button } from '@ssa-ui-kit/core';
|
|
4
4
|
|
|
5
5
|
import { pageBtnStyles, selectedPageBtnStyles } from './styles';
|
|
6
|
-
import {
|
|
6
|
+
import { PaginationButtonsProps, PageButtonProps } from './types';
|
|
7
7
|
|
|
8
8
|
const Break = () => <span css={{ cursor: 'default' }}>...</span>;
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ const PageButton = ({
|
|
|
12
12
|
isSelected,
|
|
13
13
|
page,
|
|
14
14
|
isDisabled,
|
|
15
|
-
}:
|
|
15
|
+
}: PageButtonProps) => {
|
|
16
16
|
const theme = useTheme();
|
|
17
17
|
const styles = useMemo(() => {
|
|
18
18
|
return isSelected ? selectedPageBtnStyles(theme) : pageBtnStyles(theme);
|
|
@@ -43,7 +43,7 @@ export const PaginationButtons = ({
|
|
|
43
43
|
selectedPage,
|
|
44
44
|
onClick,
|
|
45
45
|
isDisabled,
|
|
46
|
-
}:
|
|
46
|
+
}: PaginationButtonsProps) => {
|
|
47
47
|
return (
|
|
48
48
|
Array.isArray(range) &&
|
|
49
49
|
range.map((page, index) => {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { createContext, useState, useContext } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
PaginationContextProps,
|
|
4
|
+
PaginationContextProviderProps,
|
|
5
|
+
} from './types';
|
|
3
6
|
|
|
4
|
-
export const PaginationContext = createContext<
|
|
5
|
-
{} as
|
|
7
|
+
export const PaginationContext = createContext<PaginationContextProps>(
|
|
8
|
+
{} as PaginationContextProps,
|
|
6
9
|
);
|
|
7
10
|
|
|
8
11
|
export const usePaginationContext = () => useContext(PaginationContext);
|
|
@@ -10,7 +13,7 @@ export const usePaginationContext = () => useContext(PaginationContext);
|
|
|
10
13
|
export const PaginationContextProvider = ({
|
|
11
14
|
selectedPage,
|
|
12
15
|
children,
|
|
13
|
-
}:
|
|
16
|
+
}: PaginationContextProviderProps) => {
|
|
14
17
|
const [page, setPage] = useState(selectedPage);
|
|
15
18
|
return (
|
|
16
19
|
<PaginationContext.Provider value={{ page, setPage }}>
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { CommonProps } from '@ssa-ui-kit/core';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface PaginationProps extends CommonProps {
|
|
4
4
|
pagesCount: number;
|
|
5
5
|
ariaLabel?: string;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface PaginationButtonsProps {
|
|
10
10
|
range: number[];
|
|
11
11
|
selectedPage?: number;
|
|
12
12
|
onClick: (page: number) => void;
|
|
13
13
|
isDisabled?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export interface
|
|
16
|
+
export interface ArrowButtonProps {
|
|
17
17
|
direction: 'left' | 'right';
|
|
18
18
|
onClick: () => void;
|
|
19
19
|
isDisabled?: boolean;
|
|
20
20
|
className?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export interface
|
|
23
|
+
export interface PageButtonProps {
|
|
24
24
|
onClick: () => void;
|
|
25
25
|
page: number | string;
|
|
26
26
|
isSelected: boolean;
|
|
27
27
|
isDisabled?: boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export interface
|
|
30
|
+
export interface PaginationContextProps {
|
|
31
31
|
page?: number;
|
|
32
32
|
setPage: React.Dispatch<React.SetStateAction<number | undefined>>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export interface
|
|
35
|
+
export interface PaginationContextProviderProps {
|
|
36
36
|
selectedPage?: number;
|
|
37
37
|
children: React.ReactNode;
|
|
38
38
|
}
|
|
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
3
3
|
|
|
4
4
|
import { progressInfoData as data } from './mockProgressInfoRequest';
|
|
5
5
|
|
|
6
|
-
import { default as ProgressInfo,
|
|
6
|
+
import { default as ProgressInfo, ProgressInfoProps } from './index';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: 'Widgets/ProgressInfo',
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
} as Meta<typeof ProgressInfo>;
|
|
25
25
|
|
|
26
26
|
export const Default: StoryObj<typeof ProgressInfo> = (
|
|
27
|
-
args:
|
|
27
|
+
args: ProgressInfoProps,
|
|
28
28
|
) => {
|
|
29
29
|
return <ProgressInfo {...args} />;
|
|
30
30
|
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Card,
|
|
5
5
|
CardHeader,
|
|
6
6
|
Typography,
|
|
7
|
-
|
|
7
|
+
DropdownOptionProps,
|
|
8
8
|
Dropdown,
|
|
9
9
|
DropdownOption,
|
|
10
10
|
MainColors,
|
|
@@ -16,13 +16,13 @@ import { ProgressInfoTotals } from './ProgressInfoTotals';
|
|
|
16
16
|
import {
|
|
17
17
|
ProgressInfoItemProps,
|
|
18
18
|
Period,
|
|
19
|
-
|
|
19
|
+
ProgressInfoProps,
|
|
20
20
|
PeriodOption,
|
|
21
21
|
} from './types';
|
|
22
22
|
|
|
23
23
|
import { getPieChartStyles } from './styles';
|
|
24
24
|
|
|
25
|
-
export const ProgressInfo = ({ data, className }:
|
|
25
|
+
export const ProgressInfo = ({ data, className }: ProgressInfoProps) => {
|
|
26
26
|
const [options, setOptions] = useState<PeriodOption[]>([]);
|
|
27
27
|
const [selected, setSelected] = useState<PeriodOption>();
|
|
28
28
|
const [response, setResponse] = useState<ProgressInfoItemProps[]>([]);
|
|
@@ -67,7 +67,7 @@ export const ProgressInfo = ({ data, className }: IProgressInfoProps) => {
|
|
|
67
67
|
setResponse(response);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const handleChange = (e:
|
|
70
|
+
const handleChange = (e: DropdownOptionProps) => {
|
|
71
71
|
filterData(e.value as Period);
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CheckboxProps, Checkbox, checkboxStyles } from '@ssa-ui-kit/core';
|
|
2
2
|
import { Theme, css, useTheme } from '@emotion/react';
|
|
3
3
|
|
|
4
4
|
const getStyles = (theme: Theme) => css`
|
|
@@ -17,7 +17,7 @@ const getStyles = (theme: Theme) => css`
|
|
|
17
17
|
${checkboxStyles.blueInput(theme)}
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
|
-
export const TableFilterCheckbox = (props:
|
|
20
|
+
export const TableFilterCheckbox = (props: CheckboxProps) => {
|
|
21
21
|
const theme = useTheme();
|
|
22
22
|
const styles = getStyles(theme);
|
|
23
23
|
return <Checkbox {...props} css={styles} />;
|