@uniai-fe/uds-primitives 0.6.13 → 0.6.14
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/styles.css
CHANGED
|
@@ -3572,14 +3572,21 @@ figure.chip {
|
|
|
3572
3572
|
}
|
|
3573
3573
|
|
|
3574
3574
|
.input-date-trigger-icon {
|
|
3575
|
-
|
|
3576
|
-
display: inline-flex;
|
|
3575
|
+
display: flex;
|
|
3577
3576
|
align-items: center;
|
|
3578
3577
|
justify-content: center;
|
|
3578
|
+
flex: 0 0 28px;
|
|
3579
3579
|
width: 28px;
|
|
3580
3580
|
height: 28px;
|
|
3581
|
+
margin: 0;
|
|
3582
|
+
padding: 0;
|
|
3583
|
+
border: 0;
|
|
3584
|
+
background-color: transparent;
|
|
3581
3585
|
color: var(--color-label-alternative);
|
|
3582
|
-
|
|
3586
|
+
cursor: pointer;
|
|
3587
|
+
}
|
|
3588
|
+
.input-date-trigger-icon:where([aria-disabled=true]) {
|
|
3589
|
+
cursor: default;
|
|
3583
3590
|
}
|
|
3584
3591
|
|
|
3585
3592
|
.input-date-trigger-input.input-priority-table .input-field {
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
KeyboardEvent,
|
|
9
9
|
MouseEvent,
|
|
10
10
|
} from "react";
|
|
11
|
-
import { forwardRef } from "react";
|
|
11
|
+
import { forwardRef, useCallback, useRef } from "react";
|
|
12
12
|
import { Calendar } from "../../../calendar";
|
|
13
13
|
import { InputFoundation } from "../foundation";
|
|
14
14
|
import type { InputCalendarTriggerViewProps } from "../../types";
|
|
@@ -52,6 +52,22 @@ const InputDateTrigger = forwardRef<
|
|
|
52
52
|
},
|
|
53
53
|
ref,
|
|
54
54
|
) => {
|
|
55
|
+
const triggerInputRef = useRef<HTMLInputElement | null>(null);
|
|
56
|
+
|
|
57
|
+
const setTriggerInputRef = useCallback(
|
|
58
|
+
(node: HTMLInputElement | null) => {
|
|
59
|
+
triggerInputRef.current = node;
|
|
60
|
+
if (typeof ref === "function") {
|
|
61
|
+
ref(node);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (ref) {
|
|
65
|
+
ref.current = node;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[ref],
|
|
69
|
+
);
|
|
70
|
+
|
|
55
71
|
/**
|
|
56
72
|
* Radix `asChild`가 주입한 onClick을 보존하기 위해 restProps.onClick을 병합한다.
|
|
57
73
|
* (Input Date 자체 onClick 계약도 함께 실행)
|
|
@@ -63,6 +79,17 @@ const InputDateTrigger = forwardRef<
|
|
|
63
79
|
}
|
|
64
80
|
onClick?.(event as never);
|
|
65
81
|
};
|
|
82
|
+
|
|
83
|
+
const handleIconClick = (event: MouseEvent<HTMLButtonElement>) => {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
if (disabled || readOnly) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
triggerInputRef.current?.focus();
|
|
90
|
+
triggerInputRef.current?.click();
|
|
91
|
+
};
|
|
92
|
+
|
|
66
93
|
// 변경: Date trigger는 기본적으로 직접 타이핑을 막고, 달력 선택을 단일 입력 경로로 유지한다.
|
|
67
94
|
const shouldBlockTyping = !disabled && !readOnly;
|
|
68
95
|
|
|
@@ -113,10 +140,23 @@ const InputDateTrigger = forwardRef<
|
|
|
113
140
|
}
|
|
114
141
|
};
|
|
115
142
|
|
|
143
|
+
const calendarIcon = (
|
|
144
|
+
<button
|
|
145
|
+
type="button"
|
|
146
|
+
className="input-date-trigger-icon"
|
|
147
|
+
tabIndex={-1}
|
|
148
|
+
aria-label="달력 열기"
|
|
149
|
+
aria-disabled={disabled || readOnly ? true : undefined}
|
|
150
|
+
onClick={handleIconClick}
|
|
151
|
+
>
|
|
152
|
+
<Calendar.Icon.Calendar />
|
|
153
|
+
</button>
|
|
154
|
+
);
|
|
155
|
+
|
|
116
156
|
return (
|
|
117
157
|
<InputFoundation.Base
|
|
118
158
|
{...restProps}
|
|
119
|
-
ref={
|
|
159
|
+
ref={setTriggerInputRef}
|
|
120
160
|
value={displayValue}
|
|
121
161
|
// PopOver.Trigger(asChild)가 주입한 `type="button"`으로 placeholder가 사라지는 문제를 막기 위해
|
|
122
162
|
// Date trigger는 항상 text type을 유지한다.
|
|
@@ -137,21 +177,9 @@ const InputDateTrigger = forwardRef<
|
|
|
137
177
|
onPaste={handlePaste}
|
|
138
178
|
onDrop={handleDrop}
|
|
139
179
|
// table priority는 icon을 왼쪽 슬롯에 배치한다.
|
|
140
|
-
left={
|
|
141
|
-
priority === "table" ? (
|
|
142
|
-
<figure className="input-date-trigger-icon" aria-hidden="true">
|
|
143
|
-
<Calendar.Icon.Calendar />
|
|
144
|
-
</figure>
|
|
145
|
-
) : undefined
|
|
146
|
-
}
|
|
180
|
+
left={priority === "table" ? calendarIcon : undefined}
|
|
147
181
|
// 기본(priority != table)은 기존처럼 icon을 오른쪽 슬롯에 유지한다.
|
|
148
|
-
right={
|
|
149
|
-
priority === "table" ? undefined : (
|
|
150
|
-
<figure className="input-date-trigger-icon" aria-hidden="true">
|
|
151
|
-
<Calendar.Icon.Calendar />
|
|
152
|
-
</figure>
|
|
153
|
-
)
|
|
154
|
-
}
|
|
182
|
+
right={priority === "table" ? undefined : calendarIcon}
|
|
155
183
|
/>
|
|
156
184
|
);
|
|
157
185
|
},
|
|
@@ -10,15 +10,22 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.input-date-trigger-icon {
|
|
13
|
-
|
|
14
|
-
display: inline-flex;
|
|
13
|
+
display: flex;
|
|
15
14
|
align-items: center;
|
|
16
15
|
justify-content: center;
|
|
16
|
+
flex: 0 0 28px;
|
|
17
17
|
width: 28px;
|
|
18
18
|
height: 28px;
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 0;
|
|
22
|
+
background-color: transparent;
|
|
19
23
|
color: var(--color-label-alternative);
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
|
|
26
|
+
&:where([aria-disabled="true"]) {
|
|
27
|
+
cursor: default;
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
.input-date-trigger-input.input-priority-table {
|