@croquiscom/pds 10.11.1 → 10.12.0
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/CHANGELOG.md +12 -0
- package/README.md +3 -4
- package/dist/components/file-upload/FileUpload.d.ts +1 -0
- package/dist/components/file-upload/ImageUpload.d.ts +57 -0
- package/dist/components/file-upload/ImageUpload.stories.d.ts +16 -0
- package/dist/components/file-upload/ImageUploadButton.d.ts +12 -0
- package/dist/components/file-upload/ImageUploadButton.stories.d.ts +9 -0
- package/dist/components/file-upload/ImageUploadPreview.d.ts +19 -0
- package/dist/components/file-upload/ImageUploadPreview.stories.d.ts +9 -0
- package/dist/components/file-upload/index.d.ts +1 -0
- package/dist/components/toast/Toast.d.ts +3 -0
- package/dist/components/toast/Toast.stories.d.ts +0 -1
- package/dist/index.es.js +5 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts +3 -0
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ko.d.ts +3 -0
- package/locales/en.esm.js +3 -0
- package/locales/en.esm.js.map +1 -1
- package/locales/en.js +3 -0
- package/locales/en.js.map +1 -1
- package/locales/ja.esm.js +3 -0
- package/locales/ja.esm.js.map +1 -1
- package/locales/ja.js +3 -0
- package/locales/ja.js.map +1 -1
- package/locales/ko.esm.js +3 -0
- package/locales/ko.esm.js.map +1 -1
- package/locales/ko.js +3 -0
- package/locales/ko.js.map +1 -1
- package/package.json +1 -1
- package/plugin/ui.html +1 -1
- package/plugin/ui.js +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# PDS
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
PDS(파트너 디자인 시스템)은 [카카오스타일 파트너센터](https://shop.zigzag.kr/) 디자인 시스템을 위한 리액트 기반의 라이브러리입니다.
|
|
5
|
+
PDS(파트너 디자인 시스템)은 카카오스타일 파트너센터 디자인 시스템을 위한 리액트 기반의 라이브러리입니다.
|
|
8
6
|
|
|
9
7
|
## 사용
|
|
10
8
|
|
|
@@ -113,11 +111,12 @@ yarn storybook
|
|
|
113
111
|
- **types**: 타입 정의를 포함합니다.
|
|
114
112
|
- **assets**: svg 등의 에셋을 포함합니다.
|
|
115
113
|
- **locales**: 기본표기등에 사용되는 언어셋을 포함합니다.
|
|
114
|
+
- **scripts**: 플러그인 제작을 위한 스크립트를 포함합니다.
|
|
116
115
|
- **tools**: svgr template 등의 라이브러리 제작을 위한 스크립트를 포함합니다.
|
|
117
116
|
|
|
118
117
|
### 아이콘 추가
|
|
119
118
|
|
|
120
|
-
⚠️ SVGR을 통해 svg파일을 리액트 컴포넌트로 제네레이트합니다. `src/[icons|images]/generated` 하위에서 직접 수정하지 말아주세요!
|
|
119
|
+
⚠️ 기본적으로 피그마 플러그인을 통해 자동 생성합니다. 수동 추가를 할 경우 SVGR을 통해 svg파일을 리액트 컴포넌트로 제네레이트합니다. `src/[icons|images]/generated` 하위에서 직접 수정하지 말아주세요!
|
|
121
120
|
|
|
122
121
|
- `assets/icons`, `assets/images`에 svg를 추가합니다.
|
|
123
122
|
- `yarn svgr`을 실행합니다.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UploadFile } from './FileUpload';
|
|
3
|
+
export interface ImageFile extends Omit<UploadFile, 'value'> {
|
|
4
|
+
value?: File | null;
|
|
5
|
+
src?: string;
|
|
6
|
+
removable?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ImageUploadProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
objectFit?: 'contain' | 'cover' | 'fill';
|
|
12
|
+
size?: 'medium' | 'small';
|
|
13
|
+
/**
|
|
14
|
+
* size가 'medium'일 경우 width, height를 변경할 수 있습니다.
|
|
15
|
+
* 최소 width: 60, height: 60
|
|
16
|
+
*/
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
/**
|
|
20
|
+
* accept에서 image/를 제외한 영역만 지정할 수 있습니다. prefix(image/)
|
|
21
|
+
* @default *
|
|
22
|
+
*/
|
|
23
|
+
accept?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* HTMLInputElement['multiple']
|
|
28
|
+
*/
|
|
29
|
+
multiple?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 최대 업로드 파일 갯수
|
|
32
|
+
*/
|
|
33
|
+
maxCount?: number;
|
|
34
|
+
/**
|
|
35
|
+
* FileList내 삭제버튼 사용 유무
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
showRemoveButton?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* FileList를 노출하려면 지정된 UploadFile 타입으로 전달해야합니다.
|
|
41
|
+
*/
|
|
42
|
+
fileList?: ImageFile[];
|
|
43
|
+
onChange?: (file: File | File[]) => void;
|
|
44
|
+
/**
|
|
45
|
+
* 파일 업로드 버튼 클릭시 실행되는 이벤트
|
|
46
|
+
*/
|
|
47
|
+
onClick?: React.MouseEventHandler<HTMLInputElement>;
|
|
48
|
+
/**
|
|
49
|
+
* FileList 클릭시 인덱스 정보와 함께 전달합니다.
|
|
50
|
+
*/
|
|
51
|
+
onClickFile?: (image_url: string, index: number) => void;
|
|
52
|
+
/**
|
|
53
|
+
* 삭제 버튼 클릭시 인덱스 정보와 함께 전달합니다.
|
|
54
|
+
*/
|
|
55
|
+
onClickFileRemove?: (file: ImageFile, index: number) => void;
|
|
56
|
+
}
|
|
57
|
+
export declare const ImageUpload: ({ className, size, width, height, accept, objectFit, disabled, loading, multiple, maxCount, showRemoveButton, fileList, onChange, onClick, onClickFile, onClickFileRemove, }: ImageUploadProps) => React.JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ImageUpload } from './ImageUpload';
|
|
3
|
+
declare const meta: Meta<typeof ImageUpload>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ImageUpload>;
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const ObjectFitCover: Story;
|
|
8
|
+
export declare const CustomSize: Story;
|
|
9
|
+
export declare const DisabledHideRemoveButton: Story;
|
|
10
|
+
export declare const OnlyJpgFileExtension: Story;
|
|
11
|
+
export declare const ClickUploadButton: Story;
|
|
12
|
+
export declare const FileStatus: Story;
|
|
13
|
+
export declare const Disabled: Story;
|
|
14
|
+
export declare const MultipleImageUpload: Story;
|
|
15
|
+
export declare const MaxCount: Story;
|
|
16
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface ImageUploadButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
3
|
+
/** @default medium */
|
|
4
|
+
size?: 'medium' | 'small';
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
/** @default false */
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
onFileUpload?: (file: File | File[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const ImageUploadButton: ({ size, accept, width, height, disabled, className, multiple, loading, onFileUpload, ...props }: ImageUploadButtonProps) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ImageUploadButton } from './ImageUploadButton';
|
|
3
|
+
declare const meta: Meta<typeof ImageUploadButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ImageUploadButton>;
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const Disabled: Story;
|
|
8
|
+
export declare const Multiple: Story;
|
|
9
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ImageUploadPreviewProps {
|
|
3
|
+
src?: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
file?: File;
|
|
7
|
+
alt?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
objectFit: 'contain' | 'cover' | 'fill';
|
|
10
|
+
/** @default medium */
|
|
11
|
+
size?: 'medium' | 'small';
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
removable?: boolean;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
onClick?: (image_url: string) => void;
|
|
17
|
+
onClickRemove?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const ImageUploadPreview: ({ size, width, height, objectFit, src, file, alt, label, disabled, loading, error, removable, onClick, onClickRemove, }: ImageUploadPreviewProps) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ImageUploadPreview } from './ImageUploadPreview';
|
|
3
|
+
declare const meta: Meta<typeof ImageUploadPreview>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ImageUploadPreview>;
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const Disabled: Story;
|
|
8
|
+
export declare const Loading: Story;
|
|
9
|
+
export declare const Error: Story;
|
|
@@ -8,6 +8,5 @@ export declare const Base: Story;
|
|
|
8
8
|
export declare const Kind: Story;
|
|
9
9
|
export declare const Position: Story;
|
|
10
10
|
export declare const Direction: Story;
|
|
11
|
-
export declare const FullWidth: Story;
|
|
12
11
|
export declare const HandleDestroy: Story;
|
|
13
12
|
export declare const Inline: Story;
|