@croquiscom/pds 8.22.8 → 8.23.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @croquiscom/pds
2
2
 
3
+ ## 8.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fe57fc6: feat: ChipInput 컴포넌트 추가, InputChip 삭제 버튼 optional 처리
8
+
3
9
  ## 8.22.8
4
10
 
5
11
  ### Patch Changes
@@ -3,6 +3,8 @@ import { InputSize } from '../input/types';
3
3
  export interface ChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
4
4
  /** @default medium */
5
5
  size?: InputSize;
6
- onDelete: () => void;
6
+ /** @default true */
7
+ canDelete?: boolean;
8
+ onDelete?: () => void;
7
9
  }
8
10
  export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLButtonElement>>;
@@ -3,6 +3,6 @@ export declare const input_chip_base_css: import("@emotion/utils").SerializedSty
3
3
  export declare const input_chip_x_enabled_css: import("@emotion/utils").SerializedStyles;
4
4
  export declare const input_chip_x_disabled_css: import("@emotion/utils").SerializedStyles;
5
5
  export declare const input_chip_height_size_css: Record<InputSize, string>;
6
- export declare const input_chip_size_css: Record<InputSize, string>;
6
+ export declare const getInputChipSizeStyle: (size: InputSize, canDelete?: boolean) => "" | import("@emotion/utils").SerializedStyles;
7
7
  export declare const select_chip_base_css: import("@emotion/utils").SerializedStyles;
8
8
  export declare const select_chip_selected_css: import("@emotion/utils").SerializedStyles;
@@ -0,0 +1,51 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { AriaFocusProps } from '../../types/common';
3
+ import { InputSize, InputStatus } from './types';
4
+ export interface ChipInputValue {
5
+ value: string;
6
+ canDelete?: boolean;
7
+ disabled?: boolean;
8
+ }
9
+ export interface ChipInputProps extends AriaFocusProps {
10
+ value?: ChipInputValue[];
11
+ disabled?: boolean;
12
+ placeholder?: string;
13
+ /** @default large */
14
+ size?: InputSize;
15
+ /**
16
+ * `error` 이외에 상태는 별도로 UI상 표시되지 않습니다.
17
+ * @default info
18
+ * */
19
+ status?: InputStatus;
20
+ /**
21
+ * 칩 목록은 한 줄로 제한하거나 개행되도록 할 수 있습니다.
22
+ *
23
+ * - `nowrap`: 칩이 인풋의 너비를 초과하면 수평으로 스크롤됩니다.
24
+ * - `wrap`: 칩이 인풋의 너비를 초과하면 수직으로 스크롤됩니다.
25
+ * @default nowrap
26
+ * */
27
+ wrap?: 'wrap' | 'nowrap';
28
+ width?: number;
29
+ /**
30
+ * `wrap` prop이 `"wrap"`인 경우 최대 높이를 지정할 수 있습니다.
31
+ * 최대 높이를 초과하면 수직으로 스크롤됩니다.
32
+ * `maxHeight` prop이 지정되지 않으면 `size` prop에 따라 기본 높이가 적용됩니다.(small: 66px, medium: 80px, large: 90px)
33
+ */
34
+ maxHeight?: number;
35
+ className?: string;
36
+ style?: CSSProperties;
37
+ onChange?: (value: ChipInputValue[]) => void;
38
+ }
39
+ export declare const getChipInputPaddingBySize: (size: InputSize) => string;
40
+ /**
41
+ * 입력된 텍스트가 있다면 아래의 경우에 Chip이 생성 됩니다.
42
+ * - 엔터키를 입력
43
+ * - 쉼표(,)를 입력
44
+ * - blur 이벤트가 발생
45
+ * - 붙여넣기시 쉼표(,)로 구분된 값들이 칩으로 추가
46
+ *
47
+ * 아래의 경우에 Chip이 삭제 됩니다.
48
+ * - Chip의 삭제 버튼을 클릭
49
+ * - 입력된 텍스트가 없는 상태에서 백스페이스를 누르면 마지막 Chip이 삭제됩니다.
50
+ */
51
+ export declare const ChipInput: React.ForwardRefExoticComponent<ChipInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,11 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { ChipInput } from './ChipInput';
3
+ declare const meta: Meta<typeof ChipInput>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ChipInput>;
6
+ export declare const Base: Story;
7
+ export declare const Value: Story;
8
+ export declare const Wrapping: Story;
9
+ export declare const Disabled: Story;
10
+ export declare const Size: Story;
11
+ export declare const StatusWithFormField: Story;