@ssa-ui-kit/core 0.0.24-alpha → 0.0.26-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/dist/components/AccordionGroup/AccordionContext.d.ts +3 -3
- package/dist/components/AccordionGroup/types.d.ts +1 -1
- package/dist/components/Badge/helpers.d.ts +2 -2
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/ButtonText.d.ts +6 -6
- package/dist/components/Button/fixtures.d.ts +6 -6
- package/dist/components/Button/helpers.d.ts +2 -2
- package/dist/components/Button/types.d.ts +5 -5
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/components/Checkbox/types.d.ts +2 -2
- package/dist/components/Dropdown/Dropdown.d.ts +3 -3
- package/dist/components/Dropdown/types.d.ts +3 -3
- package/dist/components/DropdownOption/DropdownOption.d.ts +2 -2
- package/dist/components/DropdownOptions/DropdownOptions.d.ts +2 -2
- package/dist/components/DropdownOptions/index.d.ts +1 -1
- package/dist/components/DropdownOptions/types.d.ts +2 -2
- package/dist/components/DropdownToggle/DropdownToggle.d.ts +3 -3
- package/dist/components/DropdownToggle/types.d.ts +1 -1
- package/dist/components/FormCheckbox/FormCheckbox.d.ts +2 -2
- package/dist/components/FormCheckbox/types.d.ts +2 -2
- package/dist/components/FormHelperText/FormHelperText.d.ts +2 -2
- package/dist/components/FormHelperText/types.d.ts +1 -1
- package/dist/components/FormRadioGroup/FormRadioGroup.d.ts +2 -2
- package/dist/components/FormRadioGroup/types.d.ts +2 -2
- package/dist/components/Icon/types.d.ts +2 -2
- package/dist/components/LargeTab/LargeTab.d.ts +2 -2
- package/dist/components/LargeTab/LargeTabBase.d.ts +2 -2
- package/dist/components/MultipleDropdown/MultipleDropdown.context.d.ts +3 -3
- package/dist/components/MultipleDropdown/MultipleDropdown.d.ts +3 -3
- package/dist/components/MultipleDropdown/types.d.ts +3 -3
- package/dist/components/MultipleDropdown/utils.d.ts +2 -2
- package/dist/components/MultipleDropdownOptions/MultipleDropdownOptions.d.ts +2 -2
- package/dist/components/MultipleDropdownOptions/index.d.ts +1 -1
- package/dist/components/MultipleDropdownOptions/types.d.ts +2 -2
- package/dist/components/Popover/PopoverTrigger.d.ts +2 -2
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Radio/types.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/RadioGroup/types.d.ts +3 -3
- package/dist/components/ResponsiveImage/ResponsiveImage.d.ts +2 -2
- package/dist/components/ResponsiveImage/types.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +2 -2
- package/dist/components/Switch/SwitchContext.d.ts +3 -3
- package/dist/components/Switch/types.d.ts +1 -1
- package/dist/components/Tab/Tab.d.ts +2 -2
- package/dist/components/Tab/TabBase.d.ts +2 -2
- package/dist/components/TabBar/TabBar.d.ts +2 -2
- package/dist/components/TabBar/TabBarContext.d.ts +4 -4
- package/dist/components/TabBar/stories/helpers.d.ts +2 -2
- package/dist/components/TabBar/types.d.ts +9 -11
- package/dist/components/Tooltip/ProgressChartTooltip.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip/types.d.ts +12 -14
- package/dist/components/Tooltip/utils.d.ts +2 -2
- package/dist/components/TooltipContent/TooltipContent.d.ts +2 -2
- package/dist/components/TooltipContent/index.d.ts +0 -1
- package/dist/components/TooltipTrigger/TooltipTrigger.d.ts +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/src/components/AccordionGroup/AccordionContext.tsx +4 -4
- package/src/components/AccordionGroup/types.ts +1 -1
- package/src/components/Badge/helpers.ts +18 -16
- package/src/components/Button/Button.spec.tsx +8 -8
- package/src/components/Button/Button.tsx +3 -3
- package/src/components/Button/ButtonText.tsx +6 -6
- package/src/components/Button/fixtures.ts +14 -14
- package/src/components/Button/helpers.ts +2 -2
- package/src/components/Button/types.ts +5 -5
- package/src/components/Checkbox/Checkbox.spec.tsx +2 -2
- package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Checkbox/CheckboxBase.tsx +2 -2
- package/src/components/Checkbox/types.ts +2 -2
- package/src/components/Dropdown/Dropdown.stories.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +4 -4
- package/src/components/Dropdown/types.ts +4 -3
- package/src/components/DropdownOption/DropdownOption.tsx +2 -2
- package/src/components/DropdownOptions/DropdownOptions.tsx +2 -2
- package/src/components/DropdownOptions/index.ts +1 -1
- package/src/components/DropdownOptions/types.ts +2 -2
- package/src/components/DropdownToggle/DropdownToggle.tsx +3 -3
- package/src/components/DropdownToggle/types.ts +1 -1
- package/src/components/FormCheckbox/FormCheckbox.tsx +2 -2
- package/src/components/FormCheckbox/types.ts +3 -3
- package/src/components/FormHelperText/FormHelperText.tsx +2 -2
- package/src/components/FormHelperText/types.ts +1 -1
- package/src/components/FormRadioGroup/FormRadioGroup.stories.tsx +2 -2
- package/src/components/FormRadioGroup/FormRadioGroup.tsx +2 -2
- package/src/components/FormRadioGroup/types.ts +3 -3
- package/src/components/Icon/Icons.spec.tsx +6 -6
- package/src/components/Icon/icons/index.tsx +3 -3
- package/src/components/Icon/types.ts +2 -2
- package/src/components/LargeTab/LargeTab.tsx +2 -2
- package/src/components/LargeTab/LargeTabBase.tsx +2 -2
- package/src/components/MultipleDropdown/MultipleDropdown.context.ts +3 -3
- package/src/components/MultipleDropdown/MultipleDropdown.tsx +7 -7
- package/src/components/MultipleDropdown/types.ts +3 -3
- package/src/components/MultipleDropdown/utils.ts +2 -2
- package/src/components/MultipleDropdownOptions/MultipleDropdownOptions.tsx +2 -2
- package/src/components/MultipleDropdownOptions/index.ts +1 -1
- package/src/components/MultipleDropdownOptions/types.ts +2 -2
- package/src/components/Popover/PopoverTrigger.tsx +3 -3
- package/src/components/Radio/Radio.tsx +2 -2
- package/src/components/Radio/types.ts +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +2 -2
- package/src/components/RadioGroup/types.ts +3 -3
- package/src/components/ResponsiveImage/ResponsiveImage.tsx +2 -2
- package/src/components/ResponsiveImage/types.ts +1 -1
- package/src/components/Switch/Switch.tsx +2 -2
- package/src/components/Switch/SwitchContext.tsx +2 -2
- package/src/components/Switch/types.ts +1 -1
- package/src/components/Tab/Tab.tsx +2 -2
- package/src/components/Tab/TabBase.tsx +2 -3
- package/src/components/TabBar/TabBar.spec.tsx +5 -5
- package/src/components/TabBar/TabBar.tsx +2 -2
- package/src/components/TabBar/TabBarContext.tsx +6 -6
- package/src/components/TabBar/stories/helpers.tsx +4 -4
- package/src/components/TabBar/types.ts +9 -12
- package/src/components/Tooltip/ProgressChartTooltip.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +14 -29
- package/src/components/Tooltip/Tooltip.tsx +2 -2
- package/src/components/Tooltip/types.ts +12 -14
- package/src/components/Tooltip/utils.tsx +2 -2
- package/src/components/TooltipContent/TooltipContent.tsx +6 -28
- package/src/components/TooltipContent/index.ts +0 -1
- package/src/components/TooltipTrigger/TooltipTrigger.tsx +2 -2
- package/src/components/index.ts +1 -1
- package/tsbuildcache +1 -1
- package/dist/components/TooltipContent/constants.d.ts +0 -1
- package/src/components/TooltipContent/constants.ts +0 -16
|
@@ -3,7 +3,7 @@ import Icon from '@components/Icon';
|
|
|
3
3
|
import Typography from '@components/Typography';
|
|
4
4
|
|
|
5
5
|
import { TooltipContentBase } from './TooltipContentBase';
|
|
6
|
-
import {
|
|
6
|
+
import { ProgressChartTooltipProps } from './types';
|
|
7
7
|
import { mapSizes } from './utils';
|
|
8
8
|
|
|
9
9
|
export const ProgressChartTooltip = ({
|
|
@@ -12,7 +12,7 @@ export const ProgressChartTooltip = ({
|
|
|
12
12
|
valueFormatted,
|
|
13
13
|
iconName,
|
|
14
14
|
barProps = {},
|
|
15
|
-
}:
|
|
15
|
+
}: ProgressChartTooltipProps) => {
|
|
16
16
|
const { color } = barProps;
|
|
17
17
|
|
|
18
18
|
return (
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Fragment } from 'react';
|
|
2
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
2
|
import { useTheme } from '@emotion/react';
|
|
4
3
|
|
|
@@ -51,13 +50,7 @@ export const OnClick: StoryObj<typeof Tooltip> = (args: Args) => {
|
|
|
51
50
|
<TooltipTrigger>
|
|
52
51
|
<Button size="medium" text="Click me!" />
|
|
53
52
|
</TooltipTrigger>
|
|
54
|
-
<TooltipContent
|
|
55
|
-
<Fragment>
|
|
56
|
-
<u>
|
|
57
|
-
<b>Tooltip</b>
|
|
58
|
-
</u>
|
|
59
|
-
</Fragment>
|
|
60
|
-
</TooltipContent>
|
|
53
|
+
<TooltipContent>Tooltip</TooltipContent>
|
|
61
54
|
</Tooltip>
|
|
62
55
|
);
|
|
63
56
|
};
|
|
@@ -73,9 +66,7 @@ export const OnHover: StoryObj<typeof Tooltip> = (args: Args) => {
|
|
|
73
66
|
<TooltipTrigger>
|
|
74
67
|
<Button size="medium" text="Hover over me!" />
|
|
75
68
|
</TooltipTrigger>
|
|
76
|
-
<TooltipContent>
|
|
77
|
-
<Fragment>Tooltip</Fragment>
|
|
78
|
-
</TooltipContent>
|
|
69
|
+
<TooltipContent>Tooltip</TooltipContent>
|
|
79
70
|
</Tooltip>
|
|
80
71
|
);
|
|
81
72
|
};
|
|
@@ -99,18 +90,16 @@ export const CustomContent: StoryObj<typeof Tooltip> = (args: Args) => {
|
|
|
99
90
|
/>
|
|
100
91
|
</TooltipTrigger>
|
|
101
92
|
<TooltipContent css={{ textAlign: 'center' }}>
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</div>
|
|
113
|
-
</Fragment>
|
|
93
|
+
<Typography variant="h6">Your progress</Typography>
|
|
94
|
+
<div css={{ margin: '0 auto', width: '60px' }}>
|
|
95
|
+
<ProgressCircle
|
|
96
|
+
max={100}
|
|
97
|
+
currentValue={80}
|
|
98
|
+
color="purple"
|
|
99
|
+
infoContent="80%"
|
|
100
|
+
size={60}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
114
103
|
</TooltipContent>
|
|
115
104
|
</Tooltip>
|
|
116
105
|
);
|
|
@@ -134,9 +123,7 @@ export const NoArrow: StoryObj<typeof Tooltip> = (args: Args) => {
|
|
|
134
123
|
text="Action"
|
|
135
124
|
/>
|
|
136
125
|
</TooltipTrigger>
|
|
137
|
-
<TooltipContent>
|
|
138
|
-
<Fragment>No arrow</Fragment>
|
|
139
|
-
</TooltipContent>
|
|
126
|
+
<TooltipContent>No arrow</TooltipContent>
|
|
140
127
|
</Tooltip>
|
|
141
128
|
);
|
|
142
129
|
};
|
|
@@ -154,9 +141,7 @@ export const Opened: StoryObj<typeof Tooltip> = (args: Args) => {
|
|
|
154
141
|
<TooltipTrigger>
|
|
155
142
|
<Button size="medium" text="Hover over me!" />
|
|
156
143
|
</TooltipTrigger>
|
|
157
|
-
<TooltipContent>
|
|
158
|
-
<Fragment>Tooltip</Fragment>
|
|
159
|
-
</TooltipContent>
|
|
144
|
+
<TooltipContent>Tooltip</TooltipContent>
|
|
160
145
|
</Tooltip>
|
|
161
146
|
);
|
|
162
147
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTooltip } from './useTooltip';
|
|
2
2
|
import { TooltipContext } from './useTooltipContext';
|
|
3
|
-
import {
|
|
3
|
+
import { TooltipProps } from './types';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* <Tooltip>
|
|
@@ -10,7 +10,7 @@ import { ITooltipProps } from './types';
|
|
|
10
10
|
* <TooltipContent>Tooltip</TooltipContent>
|
|
11
11
|
* </Tooltip>
|
|
12
12
|
* */
|
|
13
|
-
const Tooltip = ({ children, ...props }:
|
|
13
|
+
const Tooltip = ({ children, ...props }: TooltipProps) => {
|
|
14
14
|
const tooltip = useTooltip(props);
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
UseFloatingReturn,
|
|
6
6
|
} from '@floating-ui/react';
|
|
7
7
|
import { PointTooltipProps, Point } from '@nivo/line';
|
|
8
|
-
import {
|
|
8
|
+
import { MapIconsType } from '@components/Icon/types';
|
|
9
9
|
import { ProgressBarProps } from '@components/ProgressBar/types';
|
|
10
10
|
import { SerializedStyles } from '@emotion/react';
|
|
11
11
|
import { CommonProps } from '@global-types/emotion';
|
|
12
12
|
|
|
13
13
|
export type TooltipSize = 'small' | 'medium' | 'large';
|
|
14
14
|
|
|
15
|
-
export interface
|
|
15
|
+
export interface TooltipProps extends CommonProps {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
placement?: Placement;
|
|
18
18
|
enableHover?: boolean;
|
|
@@ -25,7 +25,7 @@ export interface ITooltipProps extends CommonProps {
|
|
|
25
25
|
isOpen?: boolean;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export type UseTooltipArgs = Omit<
|
|
28
|
+
export type UseTooltipArgs = Omit<TooltipProps, 'children'>;
|
|
29
29
|
|
|
30
30
|
type UseInteractions = ReturnType<typeof useInteractions>;
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@ interface MutableRefObject<T> {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export type UseTooltip = (props: UseTooltipArgs) => Pick<
|
|
37
|
-
|
|
37
|
+
TooltipProps,
|
|
38
38
|
'size' | 'hasArrow' | 'arrowProps'
|
|
39
39
|
> & {
|
|
40
40
|
arrowRef: MutableRefObject<null>;
|
|
@@ -47,7 +47,7 @@ export type TooltipContextType =
|
|
|
47
47
|
ReturnType<typeof useInteractions> & {
|
|
48
48
|
isOpen: boolean;
|
|
49
49
|
arrowRef: React.Ref<SVGSVGElement>;
|
|
50
|
-
} & Pick<
|
|
50
|
+
} & Pick<TooltipProps, 'size' | 'hasArrow' | 'arrowProps'>)
|
|
51
51
|
| null;
|
|
52
52
|
|
|
53
53
|
export type TooltipArrowProps = Omit<
|
|
@@ -55,35 +55,33 @@ export type TooltipArrowProps = Omit<
|
|
|
55
55
|
'context'
|
|
56
56
|
>;
|
|
57
57
|
|
|
58
|
-
export interface
|
|
59
|
-
children: React.
|
|
58
|
+
export interface TooltipContentProps {
|
|
59
|
+
children: React.ReactNode;
|
|
60
60
|
className?: string;
|
|
61
61
|
style?: React.CSSProperties;
|
|
62
|
-
allowTags?: boolean;
|
|
63
|
-
allowedTags?: string[];
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
export interface
|
|
64
|
+
export interface TooltipContentSizes {
|
|
67
65
|
small: SerializedStyles;
|
|
68
66
|
medium: SerializedStyles;
|
|
69
67
|
large: SerializedStyles;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
export interface
|
|
70
|
+
export interface TooltipTriggerProps {
|
|
73
71
|
children: React.ReactNode;
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
export type SimpleChartTooltipProps =
|
|
77
75
|
| PointTooltipProps &
|
|
78
|
-
Pick<
|
|
76
|
+
Pick<TooltipProps, 'size'> & {
|
|
79
77
|
renderValue?: (data: Point['data']) => React.ReactNode;
|
|
80
78
|
};
|
|
81
79
|
|
|
82
|
-
export interface
|
|
80
|
+
export interface ProgressChartTooltipProps {
|
|
83
81
|
caption: string;
|
|
84
82
|
value: number;
|
|
85
83
|
valueFormatted: string;
|
|
86
|
-
iconName?: keyof
|
|
84
|
+
iconName?: keyof MapIconsType;
|
|
87
85
|
barProps?: Partial<Omit<ProgressBarProps, 'currentValue'>>;
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TooltipContentSizes } from './types';
|
|
2
2
|
import { small, medium, large } from './styles';
|
|
3
3
|
|
|
4
|
-
export const mapSizes:
|
|
4
|
+
export const mapSizes: TooltipContentSizes = {
|
|
5
5
|
small,
|
|
6
6
|
medium,
|
|
7
7
|
large,
|
|
@@ -1,42 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { renderToString } from 'react-dom/server';
|
|
1
|
+
import { forwardRef } from 'react';
|
|
3
2
|
import {
|
|
4
3
|
FloatingPortal,
|
|
5
4
|
FloatingFocusManager,
|
|
6
5
|
useMergeRefs,
|
|
7
6
|
} from '@floating-ui/react';
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
import { TooltipArrow } from '@components/Tooltip/TooltipArrow';
|
|
10
9
|
import { TooltipContentBase } from '@components/Tooltip/TooltipContentBase';
|
|
11
|
-
import {
|
|
10
|
+
import { TooltipContentProps, TooltipSize } from '@components/Tooltip/types';
|
|
12
11
|
import { useTooltipContext } from '@components/Tooltip/useTooltipContext';
|
|
13
12
|
import { mapSizes } from '@components/Tooltip/utils';
|
|
14
|
-
import { ALLOWED_TAGS } from './constants';
|
|
15
13
|
|
|
16
|
-
const TooltipContent = forwardRef<HTMLDivElement,
|
|
17
|
-
function TooltipContent(
|
|
18
|
-
{
|
|
19
|
-
children,
|
|
20
|
-
className,
|
|
21
|
-
style,
|
|
22
|
-
allowTags = false,
|
|
23
|
-
allowedTags = ALLOWED_TAGS,
|
|
24
|
-
},
|
|
25
|
-
refProp,
|
|
26
|
-
) {
|
|
14
|
+
const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(
|
|
15
|
+
function TooltipContent({ children, className, style }, refProp) {
|
|
27
16
|
const tooltipCtx = useTooltipContext();
|
|
28
17
|
const ref = useMergeRefs([tooltipCtx?.refs.setFloating, refProp]);
|
|
29
|
-
let output: string | ReactNode = '';
|
|
30
|
-
|
|
31
|
-
if (allowTags) {
|
|
32
|
-
const html = renderToString(children);
|
|
33
|
-
const htmlSanitized = DOMPurify.sanitize(html, {
|
|
34
|
-
ALLOWED_TAGS: allowedTags,
|
|
35
|
-
});
|
|
36
|
-
output = <div dangerouslySetInnerHTML={{ __html: htmlSanitized }} />;
|
|
37
|
-
} else {
|
|
38
|
-
output = children;
|
|
39
|
-
}
|
|
40
18
|
|
|
41
19
|
return (
|
|
42
20
|
<FloatingPortal>
|
|
@@ -59,7 +37,7 @@ const TooltipContent = forwardRef<HTMLDivElement, ITooltipContentProps>(
|
|
|
59
37
|
{tooltipCtx.hasArrow && (
|
|
60
38
|
<TooltipArrow {...tooltipCtx.arrowProps} />
|
|
61
39
|
)}
|
|
62
|
-
{
|
|
40
|
+
{children}
|
|
63
41
|
</TooltipContentBase>
|
|
64
42
|
</FloatingFocusManager>
|
|
65
43
|
)}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cloneElement, isValidElement } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { TooltipTriggerProps } from '@components/Tooltip/types';
|
|
4
4
|
import { useTooltipContext } from '@components/Tooltip/useTooltipContext';
|
|
5
5
|
|
|
6
|
-
const TooltipTrigger = ({ children }:
|
|
6
|
+
const TooltipTrigger = ({ children }: TooltipTriggerProps) => {
|
|
7
7
|
const tooltipCtx = useTooltipContext();
|
|
8
8
|
|
|
9
9
|
if (isValidElement(children)) {
|
package/src/components/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { default as DropdownBase } from './DropdownBase';
|
|
|
17
17
|
export { default as DropdownOption } from './DropdownOption';
|
|
18
18
|
export { default as DropdownOptions } from './DropdownOptions';
|
|
19
19
|
export { default as DropdownToggle } from './DropdownToggle';
|
|
20
|
-
export type {
|
|
20
|
+
export type { DropdownOptionProps } from './DropdownOptions';
|
|
21
21
|
export { default as Icon } from './Icon';
|
|
22
22
|
export * from './Icon';
|
|
23
23
|
export * from './Icon/types';
|