@uniai-fe/uds-primitives 0.13.1 → 0.13.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniai-fe/uds-primitives",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "UNIAI Design System; Primitives Components Package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
"@types/react": "^19.2.18",
|
|
84
84
|
"@types/react-dom": "^19.2.5",
|
|
85
85
|
"eslint": "^9.39.5",
|
|
86
|
-
"prettier": "^3.9.
|
|
86
|
+
"prettier": "^3.9.10",
|
|
87
87
|
"react-hook-form": "^7.86.0",
|
|
88
88
|
"sass": "^1.102.0",
|
|
89
89
|
"typescript": "6.0.3",
|
|
90
|
-
"@uniai-fe/
|
|
90
|
+
"@uniai-fe/eslint-config": "0.4.5",
|
|
91
91
|
"@uniai-fe/next-devkit": "0.4.1",
|
|
92
|
-
"@uniai-fe/
|
|
92
|
+
"@uniai-fe/tsconfig": "0.2.0",
|
|
93
93
|
"@uniai-fe/uds-foundation": "0.6.0",
|
|
94
94
|
"@uniai-fe/util-functions": "0.4.3"
|
|
95
95
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
+
import type { MouseEvent } from "react";
|
|
4
5
|
|
|
5
6
|
import RemoveIcon from "../../img/remove.svg";
|
|
6
7
|
import type { SelectMultipleChipProps } from "../../types/multiple";
|
|
@@ -8,12 +9,12 @@ import type { SelectMultipleChipProps } from "../../types/multiple";
|
|
|
8
9
|
/**
|
|
9
10
|
* Select Markup; Multiple 선택값 Chip 렌더링 컴포넌트
|
|
10
11
|
* @component
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
12
|
+
* @property {React.ReactNode} label chip 라벨
|
|
13
|
+
* @property {React.ReactNode} [suffix] 라벨 뒤에 붙는 서브 라벨
|
|
14
|
+
* @property {boolean} [removable=true] remove 버튼 노출 여부
|
|
15
|
+
* @property {() => void} [onRemove] remove 클릭 핸들러
|
|
16
|
+
* @property {"value" | "summary"} [kind="value"] chip 용도 구분
|
|
17
|
+
* @desc native 제거 버튼의 기본 활성화를 유지하고 부모 Select trigger의 열림 동작과 분리한다.
|
|
17
18
|
* @example
|
|
18
19
|
* <SelectMultipleSelectedChip label="Apple" removable onRemove={() => {}} />
|
|
19
20
|
*/
|
|
@@ -25,7 +26,9 @@ export function SelectMultipleSelectedChip({
|
|
|
25
26
|
kind = "value",
|
|
26
27
|
}: SelectMultipleChipProps) {
|
|
27
28
|
const isRemovable = removable && typeof onRemove === "function";
|
|
28
|
-
|
|
29
|
+
// 제거 클릭은 소비자 콜백만 실행하고 부모 trigger의 클릭으로 전파하지 않는다.
|
|
30
|
+
const handleRemove = (event: MouseEvent<HTMLButtonElement>) => {
|
|
31
|
+
event.stopPropagation();
|
|
29
32
|
if (isRemovable) {
|
|
30
33
|
onRemove?.();
|
|
31
34
|
}
|
|
@@ -49,6 +52,13 @@ export function SelectMultipleSelectedChip({
|
|
|
49
52
|
type="button"
|
|
50
53
|
className="select-tag-remove"
|
|
51
54
|
aria-label="remove tag"
|
|
55
|
+
onPointerDown={event => event.stopPropagation()}
|
|
56
|
+
onKeyDown={event => {
|
|
57
|
+
// native 클릭은 취소하지 않고 부모 trigger의 Enter·Space 처리만 막는다.
|
|
58
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
52
62
|
onClick={handleRemove}
|
|
53
63
|
>
|
|
54
64
|
<RemoveIcon width={16} height={16} />
|