@teamturing/react-kit 2.58.3 → 2.58.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLProps } from 'react';
|
|
1
|
+
import { ComponentType, HTMLProps, SVGProps } from 'react';
|
|
2
2
|
import { SxProp } from '../../utils/styled-system';
|
|
3
3
|
type Props = {
|
|
4
4
|
file: File | Blob;
|
|
@@ -19,7 +19,11 @@ type Props = {
|
|
|
19
19
|
* 시각적인 후행 부분에 상호작용할 요소를 정의합니다.
|
|
20
20
|
*/
|
|
21
21
|
trailingAction?: React.ReactElement<HTMLProps<HTMLButtonElement>>;
|
|
22
|
+
/**
|
|
23
|
+
* file 일 때의 icon을 결정합니다.
|
|
24
|
+
*/
|
|
25
|
+
renderFileIcon?: (fileType: string, file: Props['file']) => ComponentType<SVGProps<SVGSVGElement>>;
|
|
22
26
|
} & SxProp;
|
|
23
|
-
declare const FileItem: ({ file, variant, disabled, loading, validationStatus, trailingAction, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
declare const FileItem: ({ file, variant, disabled, loading, validationStatus, trailingAction, renderFileIcon, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
24
28
|
export default FileItem;
|
|
25
29
|
export type { Props as FileItemProps };
|
|
@@ -8,6 +8,7 @@ type Props = {
|
|
|
8
8
|
size?: ResponsiveValue<OverlaySizeType>;
|
|
9
9
|
ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
|
|
10
10
|
dismissFocusRef?: RefObject<HTMLElement>;
|
|
11
|
+
initialFocusRef?: RefObject<HTMLElement>;
|
|
11
12
|
} & MaxHeightProps & SxProp & HTMLAttributes<HTMLElement>;
|
|
12
13
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
13
14
|
isOpen?: boolean | undefined;
|
|
@@ -15,6 +16,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
15
16
|
size?: ResponsiveValue<OverlaySizeType> | undefined;
|
|
16
17
|
ignoreOutsideClickRefs?: RefObject<HTMLElement>[] | undefined;
|
|
17
18
|
dismissFocusRef?: RefObject<HTMLElement> | undefined;
|
|
19
|
+
initialFocusRef?: RefObject<HTMLElement> | undefined;
|
|
18
20
|
} & MaxHeightProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxHeight<import("styled-system").TLengthStyledSystem>> & SxProp & HTMLAttributes<HTMLElement> & {
|
|
19
21
|
children?: import("react").ReactNode;
|
|
20
22
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -1250,10 +1250,12 @@ var Grid$1 = Object.assign(Grid, {
|
|
|
1250
1250
|
const StyledIcon = /*#__PURE__*/React.forwardRef(({
|
|
1251
1251
|
icon: Icon,
|
|
1252
1252
|
sx,
|
|
1253
|
+
className,
|
|
1253
1254
|
...props
|
|
1254
1255
|
}, ref) => /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
1255
1256
|
ref: ref,
|
|
1256
1257
|
...props,
|
|
1258
|
+
className: `trk-styled_icon__wrapper ${className}`,
|
|
1257
1259
|
color: props.color,
|
|
1258
1260
|
sx: {
|
|
1259
1261
|
'& svg': {
|
|
@@ -1876,6 +1878,7 @@ const Overlay = ({
|
|
|
1876
1878
|
size = 'm',
|
|
1877
1879
|
ignoreOutsideClickRefs = [],
|
|
1878
1880
|
dismissFocusRef,
|
|
1881
|
+
initialFocusRef,
|
|
1879
1882
|
maxHeight = utils.forcePixelValue(600),
|
|
1880
1883
|
...props
|
|
1881
1884
|
}, ref) => {
|
|
@@ -1903,6 +1906,10 @@ const Overlay = ({
|
|
|
1903
1906
|
}
|
|
1904
1907
|
}, [handleDismiss]);
|
|
1905
1908
|
React.useEffect(() => {
|
|
1909
|
+
if (initialFocusRef && initialFocusRef.current) {
|
|
1910
|
+
initialFocusRef.current.focus();
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1906
1913
|
if (overlayRef.current) {
|
|
1907
1914
|
const firstItem = utils$1.iterateFocusableElements(overlayRef.current).next().value;
|
|
1908
1915
|
firstItem?.focus();
|
|
@@ -6880,11 +6887,12 @@ const FileItem = ({
|
|
|
6880
6887
|
loading,
|
|
6881
6888
|
validationStatus,
|
|
6882
6889
|
trailingAction,
|
|
6890
|
+
renderFileIcon = () => icons.DocumentIcon,
|
|
6883
6891
|
...props
|
|
6884
6892
|
}) => {
|
|
6885
6893
|
const fileType = file.type.match('image/*') ? 'image' : file.type.match('video/*') ? 'video' : 'whatever';
|
|
6886
6894
|
const fileName = 'name' in file ? file.name : '';
|
|
6887
|
-
const FileIcon = fileType === 'image' ? icons.PictureIcon : fileType === 'video' ? icons.VideoIcon :
|
|
6895
|
+
const FileIcon = fileType === 'image' ? icons.PictureIcon : fileType === 'video' ? icons.VideoIcon : renderFileIcon(fileType, file);
|
|
6888
6896
|
const [objectUrl, setObjectUrl] = React.useState('');
|
|
6889
6897
|
React.useEffect(() => {
|
|
6890
6898
|
const url = URL.createObjectURL(file);
|
|
@@ -6896,7 +6904,6 @@ const FileItem = ({
|
|
|
6896
6904
|
return /*#__PURE__*/jsxRuntime.jsx(BaseFile, {
|
|
6897
6905
|
variant: variant,
|
|
6898
6906
|
disabled: disabled,
|
|
6899
|
-
loading: disabled,
|
|
6900
6907
|
validationStatus: validationStatus,
|
|
6901
6908
|
trailingAction: trailingAction,
|
|
6902
6909
|
...props,
|
|
@@ -6923,7 +6930,7 @@ const FileItem = ({
|
|
|
6923
6930
|
}), /*#__PURE__*/jsxRuntime.jsx(icons.VideoIcon, {})]
|
|
6924
6931
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6925
6932
|
className: 'file__thumbnail__whatever',
|
|
6926
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
6933
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(FileIcon, {}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
6927
6934
|
title: fileName,
|
|
6928
6935
|
children: fileName
|
|
6929
6936
|
})]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PictureIcon, VideoIcon, ExclamationPointInCircleIcon, DocumentIcon } from '@teamturing/icons';
|
|
2
2
|
import { forcePixelValue } from '@teamturing/utils';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import styled from 'styled-components';
|
|
@@ -16,11 +16,12 @@ const FileItem = ({
|
|
|
16
16
|
loading,
|
|
17
17
|
validationStatus,
|
|
18
18
|
trailingAction,
|
|
19
|
+
renderFileIcon = () => DocumentIcon,
|
|
19
20
|
...props
|
|
20
21
|
}) => {
|
|
21
22
|
const fileType = file.type.match('image/*') ? 'image' : file.type.match('video/*') ? 'video' : 'whatever';
|
|
22
23
|
const fileName = 'name' in file ? file.name : '';
|
|
23
|
-
const FileIcon = fileType === 'image' ? PictureIcon : fileType === 'video' ? VideoIcon :
|
|
24
|
+
const FileIcon = fileType === 'image' ? PictureIcon : fileType === 'video' ? VideoIcon : renderFileIcon(fileType, file);
|
|
24
25
|
const [objectUrl, setObjectUrl] = useState('');
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
const url = URL.createObjectURL(file);
|
|
@@ -32,7 +33,6 @@ const FileItem = ({
|
|
|
32
33
|
return /*#__PURE__*/jsx(BaseFile, {
|
|
33
34
|
variant: variant,
|
|
34
35
|
disabled: disabled,
|
|
35
|
-
loading: disabled,
|
|
36
36
|
validationStatus: validationStatus,
|
|
37
37
|
trailingAction: trailingAction,
|
|
38
38
|
...props,
|
|
@@ -59,7 +59,7 @@ const FileItem = ({
|
|
|
59
59
|
}), /*#__PURE__*/jsx(VideoIcon, {})]
|
|
60
60
|
}) : /*#__PURE__*/jsxs("div", {
|
|
61
61
|
className: 'file__thumbnail__whatever',
|
|
62
|
-
children: [/*#__PURE__*/jsx(
|
|
62
|
+
children: [/*#__PURE__*/jsx(FileIcon, {}), /*#__PURE__*/jsx("span", {
|
|
63
63
|
title: fileName,
|
|
64
64
|
children: fileName
|
|
65
65
|
})]
|
|
@@ -14,6 +14,7 @@ const Overlay = ({
|
|
|
14
14
|
size = 'm',
|
|
15
15
|
ignoreOutsideClickRefs = [],
|
|
16
16
|
dismissFocusRef,
|
|
17
|
+
initialFocusRef,
|
|
17
18
|
maxHeight = forcePixelValue(600),
|
|
18
19
|
...props
|
|
19
20
|
}, ref) => {
|
|
@@ -41,6 +42,10 @@ const Overlay = ({
|
|
|
41
42
|
}
|
|
42
43
|
}, [handleDismiss]);
|
|
43
44
|
useEffect(() => {
|
|
45
|
+
if (initialFocusRef && initialFocusRef.current) {
|
|
46
|
+
initialFocusRef.current.focus();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
44
49
|
if (overlayRef.current) {
|
|
45
50
|
const firstItem = iterateFocusableElements(overlayRef.current).next().value;
|
|
46
51
|
firstItem?.focus();
|
|
@@ -5,10 +5,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
5
5
|
const StyledIcon = /*#__PURE__*/forwardRef(({
|
|
6
6
|
icon: Icon,
|
|
7
7
|
sx,
|
|
8
|
+
className,
|
|
8
9
|
...props
|
|
9
10
|
}, ref) => /*#__PURE__*/jsx(View, {
|
|
10
11
|
ref: ref,
|
|
11
12
|
...props,
|
|
13
|
+
className: `trk-styled_icon__wrapper ${className}`,
|
|
12
14
|
color: props.color,
|
|
13
15
|
sx: {
|
|
14
16
|
'& svg': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.4",
|
|
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",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@floating-ui/react": "^0.27.16",
|
|
57
57
|
"@primer/behaviors": "^1.3.6",
|
|
58
|
-
"@teamturing/icons": "^1.
|
|
58
|
+
"@teamturing/icons": "^1.63.0",
|
|
59
59
|
"@teamturing/token-studio": "^1.16.3",
|
|
60
60
|
"@teamturing/utils": "^1.5.1",
|
|
61
61
|
"framer-motion": "^10.16.4",
|
|
@@ -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": "4f4dcceba45b60eb183e5f9200b354e484f32879"
|
|
70
70
|
}
|