@teamturing/react-kit 2.46.3 → 2.46.5
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/core/StyledIcon/index.d.ts +6 -1
- package/dist/core/Tooltip/index.d.ts +7 -2
- package/dist/core/Tooltip/useTooltip.d.ts +4 -4
- package/dist/index.js +16 -8
- package/esm/core/StyledIcon/index.js +5 -3
- package/esm/core/Tooltip/BaseTooltip.js +3 -0
- package/esm/core/Tooltip/index.js +6 -3
- package/esm/core/Tooltip/useTooltip.js +3 -2
- package/package.json +2 -2
|
@@ -6,6 +6,11 @@ type Props = {
|
|
|
6
6
|
*/
|
|
7
7
|
icon: ComponentType<SVGProps<SVGSVGElement>>;
|
|
8
8
|
} & Pick<ViewProps, 'size' | 'color' | 'sx'> & Pick<HTMLAttributes<HTMLDivElement>, 'className'>;
|
|
9
|
-
declare const StyledIcon:
|
|
9
|
+
declare const StyledIcon: import("react").ForwardRefExoticComponent<{
|
|
10
|
+
/**
|
|
11
|
+
* @teamturing/icons와 함께 사용
|
|
12
|
+
*/
|
|
13
|
+
icon: ComponentType<SVGProps<SVGSVGElement>>;
|
|
14
|
+
} & Pick<ViewProps, "color" | "size" | "sx"> & Pick<HTMLAttributes<HTMLDivElement>, "className"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
15
|
export default StyledIcon;
|
|
11
16
|
export type { Props as StyledIconProps };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TooltipOptions } from './useTooltip';
|
|
2
3
|
type Props = {
|
|
3
4
|
/**
|
|
4
5
|
* children 컴포넌트 기준으로 Tooltip의 위치를 정의합니다.
|
|
@@ -8,7 +9,11 @@ type Props = {
|
|
|
8
9
|
* Tooltip의 텍스트를 정의합니다.
|
|
9
10
|
*/
|
|
10
11
|
text?: string;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Tooltip의 활성화 여부를 정의합니다.
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
} & PropsWithChildren & Pick<TooltipOptions, 'mouseOnly'>;
|
|
17
|
+
declare const Tooltip: ({ children, direction, text, disabled, mouseOnly }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
18
|
export default Tooltip;
|
|
14
19
|
export type { Props as TooltipProps };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type Placement, type UseFloatingReturn, type UseInteractionsReturn } from '@floating-ui/react';
|
|
1
|
+
import { type Placement, type UseFloatingReturn, type UseInteractionsReturn, type UseHoverProps } from '@floating-ui/react';
|
|
2
2
|
import { type MutableRefObject } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type TooltipOptions = {
|
|
4
4
|
initialOpen?: boolean;
|
|
5
5
|
placement?: Placement;
|
|
6
6
|
open?: boolean;
|
|
7
7
|
onOpenChange?: (open: boolean) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function useTooltip({ initialOpen, placement, open: controlledOpen, onOpenChange: setControlledOpen, }?: TooltipOptions): {
|
|
8
|
+
} & Pick<UseHoverProps, 'mouseOnly'>;
|
|
9
|
+
export declare function useTooltip({ initialOpen, placement, open: controlledOpen, onOpenChange: setControlledOpen, mouseOnly, }?: TooltipOptions): {
|
|
10
10
|
open: boolean;
|
|
11
11
|
setOpen: (open: boolean) => void;
|
|
12
12
|
} & UseInteractionsReturn & UseFloatingReturn & {
|
package/dist/index.js
CHANGED
|
@@ -7031,11 +7031,12 @@ var Grid$1 = Object.assign(Grid, {
|
|
|
7031
7031
|
Unit
|
|
7032
7032
|
});
|
|
7033
7033
|
|
|
7034
|
-
const StyledIcon = ({
|
|
7034
|
+
const StyledIcon = /*#__PURE__*/React.forwardRef(({
|
|
7035
7035
|
icon: Icon,
|
|
7036
7036
|
sx,
|
|
7037
7037
|
...props
|
|
7038
|
-
}) => /*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
7038
|
+
}, ref) => /*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
7039
|
+
ref: ref,
|
|
7039
7040
|
...props,
|
|
7040
7041
|
color: props.color,
|
|
7041
7042
|
sx: {
|
|
@@ -7047,7 +7048,7 @@ const StyledIcon = ({
|
|
|
7047
7048
|
...sx
|
|
7048
7049
|
},
|
|
7049
7050
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(Icon, {})
|
|
7050
|
-
});
|
|
7051
|
+
}));
|
|
7051
7052
|
|
|
7052
7053
|
const Text = styled__default.default.span({
|
|
7053
7054
|
'display': 'block',
|
|
@@ -34120,7 +34121,8 @@ function useTooltip({
|
|
|
34120
34121
|
initialOpen = false,
|
|
34121
34122
|
placement = 'top',
|
|
34122
34123
|
open: controlledOpen,
|
|
34123
|
-
onOpenChange: setControlledOpen
|
|
34124
|
+
onOpenChange: setControlledOpen,
|
|
34125
|
+
mouseOnly = true
|
|
34124
34126
|
} = {}) {
|
|
34125
34127
|
const theme = styled.useTheme();
|
|
34126
34128
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(initialOpen);
|
|
@@ -34147,7 +34149,7 @@ function useTooltip({
|
|
|
34147
34149
|
move: false,
|
|
34148
34150
|
restMs: 300,
|
|
34149
34151
|
enabled: controlledOpen == null,
|
|
34150
|
-
mouseOnly
|
|
34152
|
+
mouseOnly
|
|
34151
34153
|
});
|
|
34152
34154
|
const focus = useFocus(context, {
|
|
34153
34155
|
enabled: controlledOpen == null
|
|
@@ -34251,6 +34253,9 @@ const StyledBaseTooltipContent = styled__default.default.div`
|
|
|
34251
34253
|
border-radius: ${({
|
|
34252
34254
|
theme
|
|
34253
34255
|
}) => forcePixelValue(theme.radii.xs)};
|
|
34256
|
+
box-shadow: ${({
|
|
34257
|
+
theme
|
|
34258
|
+
}) => theme.shadows['shadow/overlay']};
|
|
34254
34259
|
padding: ${({
|
|
34255
34260
|
theme
|
|
34256
34261
|
}) => `${forcePixelValue(theme.space[2])} ${forcePixelValue(theme.space[3])}`};
|
|
@@ -34293,7 +34298,9 @@ const StyledBaseTooltipContent = styled__default.default.div`
|
|
|
34293
34298
|
const Tooltip = ({
|
|
34294
34299
|
children,
|
|
34295
34300
|
direction = 'top-center',
|
|
34296
|
-
text
|
|
34301
|
+
text,
|
|
34302
|
+
disabled = false,
|
|
34303
|
+
mouseOnly = true
|
|
34297
34304
|
}) => {
|
|
34298
34305
|
const directionToPlacement = {
|
|
34299
34306
|
'top-center': 'top',
|
|
@@ -34307,13 +34314,14 @@ const Tooltip = ({
|
|
|
34307
34314
|
}[direction];
|
|
34308
34315
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(BaseTooltip, {
|
|
34309
34316
|
placement: directionToPlacement,
|
|
34317
|
+
mouseOnly: mouseOnly,
|
|
34310
34318
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(BaseTooltipTrigger, {
|
|
34311
34319
|
className: 'tooltip__tooltip_trigger',
|
|
34312
34320
|
children: children
|
|
34313
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsx(BaseTooltipContent, {
|
|
34321
|
+
}), !disabled ? /*#__PURE__*/jsxRuntimeExports.jsx(BaseTooltipContent, {
|
|
34314
34322
|
className: 'tooltip__tooltip_content',
|
|
34315
34323
|
children: text
|
|
34316
|
-
})]
|
|
34324
|
+
}) : null]
|
|
34317
34325
|
});
|
|
34318
34326
|
};
|
|
34319
34327
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import View from '../View/index.js';
|
|
2
3
|
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
3
4
|
|
|
4
|
-
const StyledIcon = ({
|
|
5
|
+
const StyledIcon = /*#__PURE__*/forwardRef(({
|
|
5
6
|
icon: Icon,
|
|
6
7
|
sx,
|
|
7
8
|
...props
|
|
8
|
-
}) => /*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
9
|
+
}, ref) => /*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
10
|
+
ref: ref,
|
|
9
11
|
...props,
|
|
10
12
|
color: props.color,
|
|
11
13
|
sx: {
|
|
@@ -17,6 +19,6 @@ const StyledIcon = ({
|
|
|
17
19
|
...sx
|
|
18
20
|
},
|
|
19
21
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(Icon, {})
|
|
20
|
-
});
|
|
22
|
+
}));
|
|
21
23
|
|
|
22
24
|
export { StyledIcon as default };
|
|
@@ -83,6 +83,9 @@ const StyledBaseTooltipContent = styled.div`
|
|
|
83
83
|
border-radius: ${({
|
|
84
84
|
theme
|
|
85
85
|
}) => forcePixelValue(theme.radii.xs)};
|
|
86
|
+
box-shadow: ${({
|
|
87
|
+
theme
|
|
88
|
+
}) => theme.shadows['shadow/overlay']};
|
|
86
89
|
padding: ${({
|
|
87
90
|
theme
|
|
88
91
|
}) => `${forcePixelValue(theme.space[2])} ${forcePixelValue(theme.space[3])}`};
|
|
@@ -4,7 +4,9 @@ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js'
|
|
|
4
4
|
const Tooltip = ({
|
|
5
5
|
children,
|
|
6
6
|
direction = 'top-center',
|
|
7
|
-
text
|
|
7
|
+
text,
|
|
8
|
+
disabled = false,
|
|
9
|
+
mouseOnly = true
|
|
8
10
|
}) => {
|
|
9
11
|
const directionToPlacement = {
|
|
10
12
|
'top-center': 'top',
|
|
@@ -18,13 +20,14 @@ const Tooltip = ({
|
|
|
18
20
|
}[direction];
|
|
19
21
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(BaseTooltip, {
|
|
20
22
|
placement: directionToPlacement,
|
|
23
|
+
mouseOnly: mouseOnly,
|
|
21
24
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(BaseTooltipTrigger, {
|
|
22
25
|
className: 'tooltip__tooltip_trigger',
|
|
23
26
|
children: children
|
|
24
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsx(BaseTooltipContent, {
|
|
27
|
+
}), !disabled ? /*#__PURE__*/jsxRuntimeExports.jsx(BaseTooltipContent, {
|
|
25
28
|
className: 'tooltip__tooltip_content',
|
|
26
29
|
children: text
|
|
27
|
-
})]
|
|
30
|
+
}) : null]
|
|
28
31
|
});
|
|
29
32
|
};
|
|
30
33
|
|
|
@@ -8,7 +8,8 @@ function useTooltip({
|
|
|
8
8
|
initialOpen = false,
|
|
9
9
|
placement = 'top',
|
|
10
10
|
open: controlledOpen,
|
|
11
|
-
onOpenChange: setControlledOpen
|
|
11
|
+
onOpenChange: setControlledOpen,
|
|
12
|
+
mouseOnly = true
|
|
12
13
|
} = {}) {
|
|
13
14
|
const theme = useTheme();
|
|
14
15
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);
|
|
@@ -35,7 +36,7 @@ function useTooltip({
|
|
|
35
36
|
move: false,
|
|
36
37
|
restMs: 300,
|
|
37
38
|
enabled: controlledOpen == null,
|
|
38
|
-
mouseOnly
|
|
39
|
+
mouseOnly
|
|
39
40
|
});
|
|
40
41
|
const focus = useFocus(context, {
|
|
41
42
|
enabled: controlledOpen == null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.46.
|
|
3
|
+
"version": "2.46.5",
|
|
4
4
|
"description": "React components, hooks for create teamturing web application",
|
|
5
5
|
"author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
|
|
6
6
|
"homepage": "https://github.com/weareteamturing/bombe#readme",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react-textarea-autosize": "^8.5.3",
|
|
67
67
|
"styled-system": "^5.1.5"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "fc093fecce517059d071cf41c0993cfafe8e2f90"
|
|
70
70
|
}
|