@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.
Files changed (133) hide show
  1. package/dist/components/AccordionGroup/AccordionContext.d.ts +3 -3
  2. package/dist/components/AccordionGroup/types.d.ts +1 -1
  3. package/dist/components/Badge/helpers.d.ts +2 -2
  4. package/dist/components/Button/Button.d.ts +2 -2
  5. package/dist/components/Button/ButtonText.d.ts +6 -6
  6. package/dist/components/Button/fixtures.d.ts +6 -6
  7. package/dist/components/Button/helpers.d.ts +2 -2
  8. package/dist/components/Button/types.d.ts +5 -5
  9. package/dist/components/Checkbox/Checkbox.d.ts +2 -2
  10. package/dist/components/Checkbox/CheckboxBase.d.ts +2 -2
  11. package/dist/components/Checkbox/types.d.ts +2 -2
  12. package/dist/components/Dropdown/Dropdown.d.ts +3 -3
  13. package/dist/components/Dropdown/types.d.ts +3 -3
  14. package/dist/components/DropdownOption/DropdownOption.d.ts +2 -2
  15. package/dist/components/DropdownOptions/DropdownOptions.d.ts +2 -2
  16. package/dist/components/DropdownOptions/index.d.ts +1 -1
  17. package/dist/components/DropdownOptions/types.d.ts +2 -2
  18. package/dist/components/DropdownToggle/DropdownToggle.d.ts +3 -3
  19. package/dist/components/DropdownToggle/types.d.ts +1 -1
  20. package/dist/components/FormCheckbox/FormCheckbox.d.ts +2 -2
  21. package/dist/components/FormCheckbox/types.d.ts +2 -2
  22. package/dist/components/FormHelperText/FormHelperText.d.ts +2 -2
  23. package/dist/components/FormHelperText/types.d.ts +1 -1
  24. package/dist/components/FormRadioGroup/FormRadioGroup.d.ts +2 -2
  25. package/dist/components/FormRadioGroup/types.d.ts +2 -2
  26. package/dist/components/Icon/types.d.ts +2 -2
  27. package/dist/components/LargeTab/LargeTab.d.ts +2 -2
  28. package/dist/components/LargeTab/LargeTabBase.d.ts +2 -2
  29. package/dist/components/MultipleDropdown/MultipleDropdown.context.d.ts +3 -3
  30. package/dist/components/MultipleDropdown/MultipleDropdown.d.ts +3 -3
  31. package/dist/components/MultipleDropdown/types.d.ts +3 -3
  32. package/dist/components/MultipleDropdown/utils.d.ts +2 -2
  33. package/dist/components/MultipleDropdownOptions/MultipleDropdownOptions.d.ts +2 -2
  34. package/dist/components/MultipleDropdownOptions/index.d.ts +1 -1
  35. package/dist/components/MultipleDropdownOptions/types.d.ts +2 -2
  36. package/dist/components/Popover/PopoverTrigger.d.ts +2 -2
  37. package/dist/components/Radio/Radio.d.ts +2 -2
  38. package/dist/components/Radio/types.d.ts +1 -1
  39. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  40. package/dist/components/RadioGroup/types.d.ts +3 -3
  41. package/dist/components/ResponsiveImage/ResponsiveImage.d.ts +2 -2
  42. package/dist/components/ResponsiveImage/types.d.ts +1 -1
  43. package/dist/components/Switch/Switch.d.ts +2 -2
  44. package/dist/components/Switch/SwitchContext.d.ts +3 -3
  45. package/dist/components/Switch/types.d.ts +1 -1
  46. package/dist/components/Tab/Tab.d.ts +2 -2
  47. package/dist/components/Tab/TabBase.d.ts +2 -2
  48. package/dist/components/TabBar/TabBar.d.ts +2 -2
  49. package/dist/components/TabBar/TabBarContext.d.ts +4 -4
  50. package/dist/components/TabBar/stories/helpers.d.ts +2 -2
  51. package/dist/components/TabBar/types.d.ts +9 -11
  52. package/dist/components/Tooltip/ProgressChartTooltip.d.ts +2 -2
  53. package/dist/components/Tooltip/Tooltip.d.ts +2 -2
  54. package/dist/components/Tooltip/types.d.ts +12 -14
  55. package/dist/components/Tooltip/utils.d.ts +2 -2
  56. package/dist/components/TooltipContent/TooltipContent.d.ts +2 -2
  57. package/dist/components/TooltipContent/index.d.ts +0 -1
  58. package/dist/components/TooltipTrigger/TooltipTrigger.d.ts +2 -2
  59. package/dist/components/index.d.ts +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/index.js.map +1 -1
  62. package/package.json +3 -5
  63. package/src/components/AccordionGroup/AccordionContext.tsx +4 -4
  64. package/src/components/AccordionGroup/types.ts +1 -1
  65. package/src/components/Badge/helpers.ts +18 -16
  66. package/src/components/Button/Button.spec.tsx +8 -8
  67. package/src/components/Button/Button.tsx +3 -3
  68. package/src/components/Button/ButtonText.tsx +6 -6
  69. package/src/components/Button/fixtures.ts +14 -14
  70. package/src/components/Button/helpers.ts +2 -2
  71. package/src/components/Button/types.ts +5 -5
  72. package/src/components/Checkbox/Checkbox.spec.tsx +2 -2
  73. package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
  74. package/src/components/Checkbox/Checkbox.tsx +2 -2
  75. package/src/components/Checkbox/CheckboxBase.tsx +2 -2
  76. package/src/components/Checkbox/types.ts +2 -2
  77. package/src/components/Dropdown/Dropdown.stories.tsx +3 -3
  78. package/src/components/Dropdown/Dropdown.tsx +4 -4
  79. package/src/components/Dropdown/types.ts +4 -3
  80. package/src/components/DropdownOption/DropdownOption.tsx +2 -2
  81. package/src/components/DropdownOptions/DropdownOptions.tsx +2 -2
  82. package/src/components/DropdownOptions/index.ts +1 -1
  83. package/src/components/DropdownOptions/types.ts +2 -2
  84. package/src/components/DropdownToggle/DropdownToggle.tsx +3 -3
  85. package/src/components/DropdownToggle/types.ts +1 -1
  86. package/src/components/FormCheckbox/FormCheckbox.tsx +2 -2
  87. package/src/components/FormCheckbox/types.ts +3 -3
  88. package/src/components/FormHelperText/FormHelperText.tsx +2 -2
  89. package/src/components/FormHelperText/types.ts +1 -1
  90. package/src/components/FormRadioGroup/FormRadioGroup.stories.tsx +2 -2
  91. package/src/components/FormRadioGroup/FormRadioGroup.tsx +2 -2
  92. package/src/components/FormRadioGroup/types.ts +3 -3
  93. package/src/components/Icon/Icons.spec.tsx +6 -6
  94. package/src/components/Icon/icons/index.tsx +3 -3
  95. package/src/components/Icon/types.ts +2 -2
  96. package/src/components/LargeTab/LargeTab.tsx +2 -2
  97. package/src/components/LargeTab/LargeTabBase.tsx +2 -2
  98. package/src/components/MultipleDropdown/MultipleDropdown.context.ts +3 -3
  99. package/src/components/MultipleDropdown/MultipleDropdown.tsx +7 -7
  100. package/src/components/MultipleDropdown/types.ts +3 -3
  101. package/src/components/MultipleDropdown/utils.ts +2 -2
  102. package/src/components/MultipleDropdownOptions/MultipleDropdownOptions.tsx +2 -2
  103. package/src/components/MultipleDropdownOptions/index.ts +1 -1
  104. package/src/components/MultipleDropdownOptions/types.ts +2 -2
  105. package/src/components/Popover/PopoverTrigger.tsx +3 -3
  106. package/src/components/Radio/Radio.tsx +2 -2
  107. package/src/components/Radio/types.ts +1 -1
  108. package/src/components/RadioGroup/RadioGroup.tsx +2 -2
  109. package/src/components/RadioGroup/types.ts +3 -3
  110. package/src/components/ResponsiveImage/ResponsiveImage.tsx +2 -2
  111. package/src/components/ResponsiveImage/types.ts +1 -1
  112. package/src/components/Switch/Switch.tsx +2 -2
  113. package/src/components/Switch/SwitchContext.tsx +2 -2
  114. package/src/components/Switch/types.ts +1 -1
  115. package/src/components/Tab/Tab.tsx +2 -2
  116. package/src/components/Tab/TabBase.tsx +2 -3
  117. package/src/components/TabBar/TabBar.spec.tsx +5 -5
  118. package/src/components/TabBar/TabBar.tsx +2 -2
  119. package/src/components/TabBar/TabBarContext.tsx +6 -6
  120. package/src/components/TabBar/stories/helpers.tsx +4 -4
  121. package/src/components/TabBar/types.ts +9 -12
  122. package/src/components/Tooltip/ProgressChartTooltip.tsx +2 -2
  123. package/src/components/Tooltip/Tooltip.stories.tsx +14 -29
  124. package/src/components/Tooltip/Tooltip.tsx +2 -2
  125. package/src/components/Tooltip/types.ts +12 -14
  126. package/src/components/Tooltip/utils.tsx +2 -2
  127. package/src/components/TooltipContent/TooltipContent.tsx +6 -28
  128. package/src/components/TooltipContent/index.ts +0 -1
  129. package/src/components/TooltipTrigger/TooltipTrigger.tsx +2 -2
  130. package/src/components/index.ts +1 -1
  131. package/tsbuildcache +1 -1
  132. package/dist/components/TooltipContent/constants.d.ts +0 -1
  133. 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 { IProgressChartTooltipProps } from './types';
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
- }: IProgressChartTooltipProps) => {
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 allowTags>
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
- <Fragment>
103
- <Typography variant="h6">Your progress</Typography>
104
- <div css={{ margin: '0 auto', width: '60px' }}>
105
- <ProgressCircle
106
- max={100}
107
- currentValue={80}
108
- color="purple"
109
- infoContent="80%"
110
- size={60}
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 { ITooltipProps } from './types';
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 }: ITooltipProps) => {
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 { IMapIcons } from '@components/Icon/types';
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 ITooltipProps extends CommonProps {
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<ITooltipProps, 'children'>;
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
- ITooltipProps,
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<ITooltipProps, 'size' | 'hasArrow' | 'arrowProps'>)
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 ITooltipContentProps {
59
- children: React.ReactElement;
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 ITooltipContentSizes {
64
+ export interface TooltipContentSizes {
67
65
  small: SerializedStyles;
68
66
  medium: SerializedStyles;
69
67
  large: SerializedStyles;
70
68
  }
71
69
 
72
- export interface ITooltipTriggerProps {
70
+ export interface TooltipTriggerProps {
73
71
  children: React.ReactNode;
74
72
  }
75
73
 
76
74
  export type SimpleChartTooltipProps =
77
75
  | PointTooltipProps &
78
- Pick<ITooltipProps, 'size'> & {
76
+ Pick<TooltipProps, 'size'> & {
79
77
  renderValue?: (data: Point['data']) => React.ReactNode;
80
78
  };
81
79
 
82
- export interface IProgressChartTooltipProps {
80
+ export interface ProgressChartTooltipProps {
83
81
  caption: string;
84
82
  value: number;
85
83
  valueFormatted: string;
86
- iconName?: keyof IMapIcons;
84
+ iconName?: keyof MapIconsType;
87
85
  barProps?: Partial<Omit<ProgressBarProps, 'currentValue'>>;
88
86
  }
89
87
 
@@ -1,7 +1,7 @@
1
- import { ITooltipContentSizes } from './types';
1
+ import { TooltipContentSizes } from './types';
2
2
  import { small, medium, large } from './styles';
3
3
 
4
- export const mapSizes: ITooltipContentSizes = {
4
+ export const mapSizes: TooltipContentSizes = {
5
5
  small,
6
6
  medium,
7
7
  large,
@@ -1,42 +1,20 @@
1
- import { ReactNode, forwardRef } from 'react';
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
- import * as DOMPurify from 'dompurify';
7
+
9
8
  import { TooltipArrow } from '@components/Tooltip/TooltipArrow';
10
9
  import { TooltipContentBase } from '@components/Tooltip/TooltipContentBase';
11
- import { ITooltipContentProps, TooltipSize } from '@components/Tooltip/types';
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, ITooltipContentProps>(
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
- {output}
40
+ {children}
63
41
  </TooltipContentBase>
64
42
  </FloatingFocusManager>
65
43
  )}
@@ -1,2 +1 @@
1
1
  export { default } from './TooltipContent';
2
- export { ALLOWED_TAGS } from './constants';
@@ -1,9 +1,9 @@
1
1
  import { cloneElement, isValidElement } from 'react';
2
2
 
3
- import { ITooltipTriggerProps } from '@components/Tooltip/types';
3
+ import { TooltipTriggerProps } from '@components/Tooltip/types';
4
4
  import { useTooltipContext } from '@components/Tooltip/useTooltipContext';
5
5
 
6
- const TooltipTrigger = ({ children }: ITooltipTriggerProps) => {
6
+ const TooltipTrigger = ({ children }: TooltipTriggerProps) => {
7
7
  const tooltipCtx = useTooltipContext();
8
8
 
9
9
  if (isValidElement(children)) {
@@ -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 { IDropdownOption } from './DropdownOptions';
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';