@pylerai/design-system 2.1.0 → 2.2.1
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/README.md +27 -2
- package/dist/components/ui/badge.js +6 -6
- package/dist/components/ui/button.js +9 -9
- package/dist/components/ui/chip.js +4 -4
- package/dist/components/ui/dropdown.js +91 -86
- package/dist/components/ui/input.js +14 -14
- package/dist/components/ui/loading-bar.js +26 -26
- package/dist/components/ui/pagination.js +11 -11
- package/dist/components/ui/search-field.js +10 -10
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/tips.js +11 -11
- package/dist/components/ui/toast.js +17 -17
- package/dist/index.d.ts +2 -0
- package/dist/index.js +66 -63
- package/dist/style.css +1 -1
- package/dist/tokens/shadow-radius.d.ts +26 -0
- package/dist/tokens/shadow-radius.js +20 -0
- package/package.json +5 -3
- package/pyler-shadow-radius.cjs +25 -0
- package/tailwind-preset.cjs +2 -10
package/README.md
CHANGED
|
@@ -86,13 +86,21 @@ module.exports = {
|
|
|
86
86
|
};
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
이미 `extend
|
|
89
|
+
이미 자체 `theme.extend`가 있어 프리셋 대신 조각만 합치려면 (`darkMode` 등 프리셋의 다른 설정은 들어오지 않습니다):
|
|
90
90
|
|
|
91
91
|
```javascript
|
|
92
92
|
const { dsColors } = require("@pylerai/design-system/pyler-tailwind-colors");
|
|
93
|
+
const { pylerTypographyThemeExtend } = require("@pylerai/design-system/pyler-typography");
|
|
94
|
+
const { pylerShadowRadiusThemeExtend } = require("@pylerai/design-system/pyler-shadow-radius");
|
|
93
95
|
|
|
94
96
|
module.exports = {
|
|
95
|
-
theme: {
|
|
97
|
+
theme: {
|
|
98
|
+
extend: {
|
|
99
|
+
colors: { ds: dsColors },
|
|
100
|
+
...pylerTypographyThemeExtend, // fontFamily.sans, fontSize.text-*
|
|
101
|
+
...pylerShadowRadiusThemeExtend, // boxShadow.ds-*, borderRadius.ds-*
|
|
102
|
+
},
|
|
103
|
+
},
|
|
96
104
|
};
|
|
97
105
|
```
|
|
98
106
|
|
|
@@ -229,6 +237,23 @@ import { PYLER_TYPOGRAPHY_STYLE } from "@pylerai/design-system";
|
|
|
229
237
|
// shadow: ds-default, ds-modal
|
|
230
238
|
```
|
|
231
239
|
|
|
240
|
+
Tailwind 클래스를 쓸 수 없는 자리(Chakra `radii`/`shadows` foundation, `sx`, inline style)에는 `DS_RADIUS`·`DS_SHADOW`를 넘깁니다. 값은 `var(--ds-*)` 문자열이라 `style.css`가 로드돼 있어야 합니다.
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import { DS_RADIUS, DS_SHADOW } from "@pylerai/design-system";
|
|
244
|
+
|
|
245
|
+
// Chakra: theme foundation 에 등록하면 borderRadius="ds-md" 처럼 토큰 이름으로 쓸 수 있습니다
|
|
246
|
+
extendTheme({
|
|
247
|
+
radii: { "ds-xs": DS_RADIUS.xs, "ds-ss": DS_RADIUS.ss, "ds-md": DS_RADIUS.md, "ds-lg": DS_RADIUS.lg },
|
|
248
|
+
shadows: { "ds-default": DS_SHADOW.default, "ds-modal": DS_SHADOW.modal },
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
<Box borderRadius="ds-md" boxShadow="ds-default" />
|
|
252
|
+
<div style={{ borderRadius: DS_RADIUS.md }} />
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
앱에서 `rounded-[8px]`·`shadow-[0px_5px_16px_…]` 같은 리터럴을 새로 쓰지 않습니다. 값이 같아도 토큰이 바뀌면 리터럴만 남아 드리프트합니다.
|
|
256
|
+
|
|
232
257
|
Dim은 `var(--ds-dim-default)`로 제공됩니다. Storybook **Foundation → Radius / Shadow / Dim** 참고.
|
|
233
258
|
|
|
234
259
|
## ♿ 접근성
|
|
@@ -23,21 +23,21 @@ const b = {
|
|
|
23
23
|
md: { padding: "px-2 pt-[5px] pb-[3px]", text: "text-body-3-m" },
|
|
24
24
|
sm: { padding: "px-1 pt-[3px] pb-[1px]", text: "text-label-1-r" }
|
|
25
25
|
}, g = l.forwardRef(
|
|
26
|
-
({ color: r = "normal", size: e = "md", className: t, children: o, ...
|
|
27
|
-
const { border:
|
|
26
|
+
({ color: r = "normal", size: e = "md", className: t, children: o, ...s }, d) => {
|
|
27
|
+
const { border: a, text: n } = b[r], { padding: p, text: m } = c[e];
|
|
28
28
|
return /* @__PURE__ */ x(
|
|
29
29
|
"span",
|
|
30
30
|
{
|
|
31
|
-
ref:
|
|
31
|
+
ref: d,
|
|
32
32
|
className: i(
|
|
33
|
-
"inline-flex items-center justify-center border rounded-
|
|
34
|
-
|
|
33
|
+
"inline-flex items-center justify-center border rounded-ds-ss bg-ds-background-default whitespace-nowrap",
|
|
34
|
+
a,
|
|
35
35
|
p,
|
|
36
36
|
n,
|
|
37
37
|
m,
|
|
38
38
|
t
|
|
39
39
|
),
|
|
40
|
-
...
|
|
40
|
+
...s,
|
|
41
41
|
children: o
|
|
42
42
|
}
|
|
43
43
|
);
|
|
@@ -9,10 +9,10 @@ const v = R(
|
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
filled: "rounded-
|
|
13
|
-
outlined: "rounded-
|
|
14
|
-
text: "rounded-
|
|
15
|
-
icon: "rounded-
|
|
12
|
+
filled: "rounded-ds-md",
|
|
13
|
+
outlined: "rounded-ds-md border border-ds-line-normal bg-ds-background-default text-ds-text-strong hover:bg-ds-surface-normal active:bg-ds-surface-strong disabled:bg-ds-surface-normal disabled:text-ds-text-disabled",
|
|
14
|
+
text: "rounded-ds-md bg-transparent text-ds-text-strong disabled:text-ds-text-disabled",
|
|
15
|
+
icon: "rounded-ds-md",
|
|
16
16
|
indicator: "rounded-full inline-block"
|
|
17
17
|
},
|
|
18
18
|
color: {
|
|
@@ -116,12 +116,12 @@ const v = R(
|
|
|
116
116
|
asChild: c = !1,
|
|
117
117
|
shape: u = "square",
|
|
118
118
|
iconStyle: x = "filled",
|
|
119
|
-
leftIcon:
|
|
120
|
-
rightIcon:
|
|
119
|
+
leftIcon: d,
|
|
120
|
+
rightIcon: t,
|
|
121
121
|
children: b,
|
|
122
122
|
...h
|
|
123
123
|
}, y) => {
|
|
124
|
-
const f = c ? B : "button", N = e === "icon" && x === "outlined" ? "bg-ds-background-default border border-ds-line-normal text-ds-text-strong hover:bg-ds-surface-normal active:bg-ds-surface-strong disabled:text-ds-text-disabled" : void 0, l = !!
|
|
124
|
+
const f = c ? B : "button", N = e === "icon" && x === "outlined" ? "bg-ds-background-default border border-ds-line-normal text-ds-text-strong hover:bg-ds-surface-normal active:bg-ds-surface-strong disabled:text-ds-text-disabled" : void 0, l = !!d, p = !!t, z = e !== "icon" && e !== "indicator" && (l || p) ? (() => {
|
|
125
125
|
const n = r ?? "md", o = {
|
|
126
126
|
sm: { leftOnly: "pl-1 pr-2", rightOnly: "pl-2 pr-1", both: "px-1" },
|
|
127
127
|
md: { leftOnly: "pl-2 pr-3", rightOnly: "pl-3 pr-2", both: "px-2" },
|
|
@@ -143,9 +143,9 @@ const v = R(
|
|
|
143
143
|
ref: y,
|
|
144
144
|
...h,
|
|
145
145
|
children: c ? b : /* @__PURE__ */ O(k, { children: [
|
|
146
|
-
|
|
146
|
+
d && /* @__PURE__ */ a("span", { className: "shrink-0", children: d }),
|
|
147
147
|
b,
|
|
148
|
-
|
|
148
|
+
t && /* @__PURE__ */ a("span", { className: "shrink-0", children: t })
|
|
149
149
|
] })
|
|
150
150
|
}
|
|
151
151
|
);
|
|
@@ -4,20 +4,20 @@ import { XIcon as b } from "../../lib/icons.js";
|
|
|
4
4
|
import { cn as n } from "../../lib/utils.js";
|
|
5
5
|
import * as f from "react";
|
|
6
6
|
const h = f.forwardRef(
|
|
7
|
-
({ size: l = "md", selected: i = !1, disabled: e = !1, onRemove: a, onClick: r, children:
|
|
7
|
+
({ size: l = "md", selected: i = !1, disabled: e = !1, onRemove: a, onClick: r, children: d, className: p }, c) => {
|
|
8
8
|
const s = l === "md", t = !!a, u = r ? "button" : "span";
|
|
9
9
|
return /* @__PURE__ */ x(
|
|
10
10
|
"div",
|
|
11
11
|
{
|
|
12
12
|
ref: c,
|
|
13
13
|
className: n(
|
|
14
|
-
"inline-flex items-center border rounded-
|
|
14
|
+
"inline-flex items-center border rounded-ds-ss bg-ds-background-default select-none transition-colors",
|
|
15
15
|
// 좌우 여백은 컨테이너가 아니라 본문(클릭 대상)이 갖는다.
|
|
16
16
|
// 컨테이너에 두면 여백 영역이 클릭되지 않는 죽은 공간이 된다.
|
|
17
17
|
s ? t ? "h-8 pr-1" : "h-8" : t ? "h-[26px] pr-0.5" : "h-[26px]",
|
|
18
18
|
s ? "text-body-3-r" : "text-body-4-r",
|
|
19
19
|
e ? "border-ds-line-normal text-ds-text-disabled cursor-not-allowed" : i ? "border-ds-primary-blue-normal text-ds-text-strong cursor-pointer" : "border-ds-line-normal text-ds-text-strong cursor-pointer hover:border-ds-line-strong",
|
|
20
|
-
|
|
20
|
+
p
|
|
21
21
|
),
|
|
22
22
|
children: [
|
|
23
23
|
/* @__PURE__ */ o(
|
|
@@ -36,7 +36,7 @@ const h = f.forwardRef(
|
|
|
36
36
|
r && !e && "cursor-pointer",
|
|
37
37
|
r && "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ds-primary-blue-normal rounded-[3px]"
|
|
38
38
|
),
|
|
39
|
-
children:
|
|
39
|
+
children: d
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
42
|
t && /* @__PURE__ */ o(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { DropdownArrowIcon as
|
|
3
|
+
import { DropdownArrowIcon as V, SelectCheckIcon as ee, CheckboxCheckedIcon as te, CheckboxUncheckedIcon as re, RadioCheckedIcon as se, RadioUncheckedIcon as ne } from "../../lib/icons.js";
|
|
4
4
|
import { cn as m } from "../../lib/utils.js";
|
|
5
|
-
import * as
|
|
6
|
-
import { Button as
|
|
7
|
-
const
|
|
5
|
+
import * as n from "react";
|
|
6
|
+
import { Button as B } from "./button.js";
|
|
7
|
+
const v = {
|
|
8
8
|
lg: {
|
|
9
9
|
trigger: "h-11 pl-3 pr-2 gap-1.5",
|
|
10
10
|
option: "h-11 pl-3 pr-2",
|
|
@@ -20,111 +20,111 @@ const k = {
|
|
|
20
20
|
option: "h-8 pl-3 pr-2",
|
|
21
21
|
text: "text-body-3-r"
|
|
22
22
|
}
|
|
23
|
-
},
|
|
23
|
+
}, ae = n.forwardRef(
|
|
24
24
|
({
|
|
25
|
-
type:
|
|
26
|
-
options:
|
|
25
|
+
type: d = "default",
|
|
26
|
+
options: i,
|
|
27
27
|
value: A,
|
|
28
28
|
onValueChange: w,
|
|
29
|
-
values:
|
|
29
|
+
values: a,
|
|
30
30
|
onValuesChange: N,
|
|
31
31
|
placeholder: L = "선택해주세요",
|
|
32
|
-
label:
|
|
33
|
-
showLabel:
|
|
32
|
+
label: h,
|
|
33
|
+
showLabel: y = !0,
|
|
34
34
|
require: M,
|
|
35
|
-
size:
|
|
35
|
+
size: g = "lg",
|
|
36
36
|
disabled: x,
|
|
37
|
-
readOnly:
|
|
37
|
+
readOnly: I,
|
|
38
38
|
error: b,
|
|
39
|
-
hint:
|
|
39
|
+
hint: S,
|
|
40
40
|
leftIcon: O,
|
|
41
|
-
showButtons:
|
|
42
|
-
cancelLabel:
|
|
43
|
-
confirmLabel:
|
|
41
|
+
showButtons: H,
|
|
42
|
+
cancelLabel: F = "취소",
|
|
43
|
+
confirmLabel: G = "확인",
|
|
44
44
|
onCancel: R,
|
|
45
|
-
onConfirm:
|
|
46
|
-
wrapperClassName:
|
|
47
|
-
className:
|
|
48
|
-
"aria-label":
|
|
49
|
-
},
|
|
50
|
-
const [s,
|
|
51
|
-
|
|
45
|
+
onConfirm: D,
|
|
46
|
+
wrapperClassName: J,
|
|
47
|
+
className: P,
|
|
48
|
+
"aria-label": Q
|
|
49
|
+
}, W) => {
|
|
50
|
+
const [s, o] = n.useState(!1), [c, k] = n.useState(-1), [U, K] = n.useState("keyboard"), E = n.useRef(null), T = n.useRef(null), q = n.useRef(null), f = n.useId(), j = (e) => `${f}-option-${e}`;
|
|
51
|
+
n.useEffect(() => {
|
|
52
52
|
const e = (t) => {
|
|
53
|
-
E.current && !E.current.contains(t.target) &&
|
|
53
|
+
E.current && !E.current.contains(t.target) && o(!1);
|
|
54
54
|
};
|
|
55
55
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
56
|
-
}, []),
|
|
57
|
-
s ||
|
|
58
|
-
}, [s]),
|
|
56
|
+
}, []), n.useEffect(() => {
|
|
57
|
+
s || k(-1);
|
|
58
|
+
}, [s]), n.useEffect(() => {
|
|
59
59
|
var e, t;
|
|
60
|
-
!s || c < 0 || (t = (e =
|
|
60
|
+
!s || c < 0 || (t = (e = T.current) == null ? void 0 : e.querySelector(`#${CSS.escape(j(c))}`)) == null || t.scrollIntoView({ block: "nearest" });
|
|
61
61
|
}, [s, c]);
|
|
62
|
-
const
|
|
63
|
-
x ||
|
|
64
|
-
},
|
|
65
|
-
if (
|
|
66
|
-
const t =
|
|
62
|
+
const X = (e) => d === "checkbox" ? (a == null ? void 0 : a.includes(e)) ?? !1 : e === A, $ = i.find((e) => e.value === A), Y = () => d === "checkbox" ? !a || a.length === 0 ? L : i.filter((t) => a.includes(t.value)).map((t) => t.label).join(", ") : $ ? $.label : L, Z = () => {
|
|
63
|
+
x || I || o((e) => !e);
|
|
64
|
+
}, z = (e) => {
|
|
65
|
+
if (d === "checkbox") {
|
|
66
|
+
const t = a ?? [], l = t.includes(e) ? t.filter((p) => p !== e) : [...t, e];
|
|
67
67
|
N == null || N(l);
|
|
68
68
|
} else
|
|
69
|
-
w == null || w(e),
|
|
70
|
-
},
|
|
69
|
+
w == null || w(e), o(!1);
|
|
70
|
+
}, _ = d === "checkbox" ? ((a == null ? void 0 : a.length) ?? 0) > 0 : !!$, C = (e) => {
|
|
71
71
|
var l;
|
|
72
|
-
if (x ||
|
|
72
|
+
if (x || I) return;
|
|
73
73
|
const t = (p) => {
|
|
74
|
-
e.preventDefault(), s ||
|
|
74
|
+
e.preventDefault(), s || o(!0), K("keyboard"), k(p);
|
|
75
75
|
};
|
|
76
76
|
switch (e.key) {
|
|
77
77
|
case "ArrowDown":
|
|
78
|
-
return t(s ? Math.min(c + 1,
|
|
78
|
+
return t(s ? Math.min(c + 1, i.length - 1) : 0);
|
|
79
79
|
case "ArrowUp":
|
|
80
|
-
return t(s ? Math.max(c - 1, 0) :
|
|
80
|
+
return t(s ? Math.max(c - 1, 0) : i.length - 1);
|
|
81
81
|
case "Home":
|
|
82
82
|
return s ? t(0) : void 0;
|
|
83
83
|
case "End":
|
|
84
|
-
return s ? t(
|
|
84
|
+
return s ? t(i.length - 1) : void 0;
|
|
85
85
|
case "Enter":
|
|
86
86
|
case " ":
|
|
87
|
-
e.preventDefault(), s ? c >= 0 &&
|
|
87
|
+
e.preventDefault(), s ? c >= 0 && z(i[c].value) : o(!0);
|
|
88
88
|
return;
|
|
89
89
|
case "Escape":
|
|
90
|
-
s && (e.preventDefault(),
|
|
90
|
+
s && (e.preventDefault(), o(!1), (l = q.current) == null || l.focus());
|
|
91
91
|
return;
|
|
92
92
|
case "Tab":
|
|
93
|
-
|
|
93
|
+
o(!1);
|
|
94
94
|
return;
|
|
95
95
|
default:
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
return /* @__PURE__ */ u("div", { ref:
|
|
100
|
-
|
|
101
|
-
/* @__PURE__ */ r("span", { id: `${f}-label`, className: "text-body-2-r text-ds-text-strong", children:
|
|
99
|
+
return /* @__PURE__ */ u("div", { ref: W, className: m("flex flex-col gap-2", J), children: [
|
|
100
|
+
y && h && /* @__PURE__ */ u("div", { className: "flex items-start gap-0.5 whitespace-nowrap", children: [
|
|
101
|
+
/* @__PURE__ */ r("span", { id: `${f}-label`, className: "text-body-2-r text-ds-text-strong", children: h }),
|
|
102
102
|
M && /* @__PURE__ */ r("span", { "aria-hidden": "true", className: "text-body-2-r text-ds-primary-red-normal", children: "*" })
|
|
103
103
|
] }),
|
|
104
104
|
/* @__PURE__ */ u("div", { ref: E, className: "relative", children: [
|
|
105
105
|
/* @__PURE__ */ u(
|
|
106
106
|
"button",
|
|
107
107
|
{
|
|
108
|
-
ref:
|
|
108
|
+
ref: q,
|
|
109
109
|
type: "button",
|
|
110
110
|
role: "combobox",
|
|
111
111
|
"aria-expanded": s,
|
|
112
112
|
"aria-haspopup": "listbox",
|
|
113
113
|
"aria-controls": s ? f : void 0,
|
|
114
114
|
"aria-activedescendant": s && c >= 0 ? j(c) : void 0,
|
|
115
|
-
"aria-labelledby":
|
|
116
|
-
"aria-label":
|
|
115
|
+
"aria-labelledby": y && h ? `${f}-label` : void 0,
|
|
116
|
+
"aria-label": y && h ? void 0 : Q,
|
|
117
117
|
"aria-invalid": b ? !0 : void 0,
|
|
118
|
-
"aria-describedby": b ||
|
|
118
|
+
"aria-describedby": b || S ? `${f}-description` : void 0,
|
|
119
119
|
"aria-required": M || void 0,
|
|
120
120
|
disabled: x,
|
|
121
|
-
onClick:
|
|
122
|
-
onKeyDown:
|
|
121
|
+
onClick: Z,
|
|
122
|
+
onKeyDown: C,
|
|
123
123
|
className: m(
|
|
124
|
-
"flex items-center w-full rounded-
|
|
125
|
-
x ? "bg-ds-surface-strong border-ds-line-normal cursor-not-allowed" :
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
"flex items-center w-full rounded-ds-md border transition-colors",
|
|
125
|
+
x ? "bg-ds-surface-strong border-ds-line-normal cursor-not-allowed" : I ? "bg-ds-surface-normal border-ds-line-normal cursor-default" : b ? "bg-ds-background-default border-ds-primary-red-normal hover:bg-ds-surface-normal" : s ? "bg-ds-background-default border-ds-primary-blue-normal" : "bg-ds-background-default border-ds-line-normal hover:bg-ds-surface-normal hover:border-ds-primary-blue-normal",
|
|
126
|
+
v[g].trigger,
|
|
127
|
+
P
|
|
128
128
|
),
|
|
129
129
|
children: [
|
|
130
130
|
O && /* @__PURE__ */ r("span", { className: "shrink-0 flex items-center justify-center text-ds-icon-normal", children: O }),
|
|
@@ -133,10 +133,10 @@ const k = {
|
|
|
133
133
|
{
|
|
134
134
|
className: m(
|
|
135
135
|
"flex-1 min-w-0 text-left truncate font-sans",
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
v[g].text,
|
|
137
|
+
_ ? "text-ds-text-strong" : x ? "text-ds-text-disabled" : "text-ds-text-normal"
|
|
138
138
|
),
|
|
139
|
-
children:
|
|
139
|
+
children: Y()
|
|
140
140
|
}
|
|
141
141
|
),
|
|
142
142
|
/* @__PURE__ */ r(
|
|
@@ -147,7 +147,7 @@ const k = {
|
|
|
147
147
|
s && "rotate-180",
|
|
148
148
|
x ? "text-ds-text-disabled" : "text-ds-text-normal"
|
|
149
149
|
),
|
|
150
|
-
children: /* @__PURE__ */ r(
|
|
150
|
+
children: /* @__PURE__ */ r(V, {})
|
|
151
151
|
}
|
|
152
152
|
)
|
|
153
153
|
]
|
|
@@ -156,14 +156,17 @@ const k = {
|
|
|
156
156
|
s && /* @__PURE__ */ u(
|
|
157
157
|
"ul",
|
|
158
158
|
{
|
|
159
|
-
ref:
|
|
159
|
+
ref: T,
|
|
160
160
|
id: f,
|
|
161
161
|
role: "listbox",
|
|
162
|
-
"aria-multiselectable":
|
|
163
|
-
className: "absolute top-full left-0 z-50 mt-1 min-w-full w-max max-w-sm bg-ds-background-default border border-ds-line-normal rounded-
|
|
162
|
+
"aria-multiselectable": d === "checkbox" ? !0 : void 0,
|
|
163
|
+
className: "absolute top-full left-0 z-50 mt-1 min-w-full w-max max-w-sm bg-ds-background-default border border-ds-line-normal rounded-ds-md p-1 shadow-ds-default",
|
|
164
|
+
onMouseLeave: () => {
|
|
165
|
+
U === "mouse" && k(-1);
|
|
166
|
+
},
|
|
164
167
|
children: [
|
|
165
|
-
|
|
166
|
-
const l =
|
|
168
|
+
i.map((e, t) => {
|
|
169
|
+
const l = X(e.value), p = t === c;
|
|
167
170
|
return (
|
|
168
171
|
// 키보드 조작은 aria-activedescendant 패턴에 따라 combobox 트리거의
|
|
169
172
|
// onKeyDown이 전담한다(옵션은 포커스를 받지 않는 것이 WAI-ARIA 권고).
|
|
@@ -175,14 +178,16 @@ const k = {
|
|
|
175
178
|
id: j(t),
|
|
176
179
|
role: "option",
|
|
177
180
|
"aria-selected": l,
|
|
178
|
-
onClick: () =>
|
|
179
|
-
onMouseEnter: () =>
|
|
181
|
+
onClick: () => z(e.value),
|
|
182
|
+
onMouseEnter: () => {
|
|
183
|
+
K("mouse"), k(t);
|
|
184
|
+
},
|
|
180
185
|
className: m(
|
|
181
|
-
"flex items-center rounded-
|
|
182
|
-
|
|
186
|
+
"flex items-center rounded-ds-md cursor-pointer gap-1.5 transition-colors",
|
|
187
|
+
v[g].option,
|
|
183
188
|
l ? "bg-ds-surface-normal" : "bg-ds-background-default hover:bg-ds-surface-normal",
|
|
184
|
-
// 키보드 이동 위치 표시 (마우스 hover와 구분되도록
|
|
185
|
-
p && "ring-1 ring-inset ring-ds-primary-blue-normal"
|
|
189
|
+
// 키보드 이동 위치 표시 (마우스 hover와 구분되도록 링으로, 키보드 이동에만)
|
|
190
|
+
p && U === "keyboard" && "ring-1 ring-inset ring-ds-primary-blue-normal"
|
|
186
191
|
),
|
|
187
192
|
children: [
|
|
188
193
|
/* @__PURE__ */ r(
|
|
@@ -190,45 +195,45 @@ const k = {
|
|
|
190
195
|
{
|
|
191
196
|
className: m(
|
|
192
197
|
"flex-1 min-w-0 truncate font-sans",
|
|
193
|
-
|
|
198
|
+
v[g].text,
|
|
194
199
|
"text-ds-text-strong"
|
|
195
200
|
),
|
|
196
201
|
children: e.label
|
|
197
202
|
}
|
|
198
203
|
),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
204
|
+
d === "default" && l && /* @__PURE__ */ r("span", { className: "shrink-0 flex items-center justify-center text-ds-text-strong", children: /* @__PURE__ */ r(ee, {}) }),
|
|
205
|
+
d === "checkbox" && /* @__PURE__ */ r("span", { className: "shrink-0 flex items-center justify-center", children: l ? /* @__PURE__ */ r(te, {}) : /* @__PURE__ */ r(re, {}) }),
|
|
206
|
+
d === "radio" && /* @__PURE__ */ r("span", { className: "shrink-0 flex items-center justify-center", children: l ? /* @__PURE__ */ r(se, {}) : /* @__PURE__ */ r(ne, {}) })
|
|
202
207
|
]
|
|
203
208
|
},
|
|
204
209
|
e.value
|
|
205
210
|
)
|
|
206
211
|
);
|
|
207
212
|
}),
|
|
208
|
-
|
|
213
|
+
H && /* @__PURE__ */ u("li", { className: "flex gap-2 pt-1", children: [
|
|
209
214
|
/* @__PURE__ */ r(
|
|
210
|
-
|
|
215
|
+
B,
|
|
211
216
|
{
|
|
212
217
|
variant: "outlined",
|
|
213
218
|
size: "lg",
|
|
214
219
|
className: "flex-1",
|
|
215
220
|
onClick: () => {
|
|
216
|
-
R == null || R(),
|
|
221
|
+
R == null || R(), o(!1);
|
|
217
222
|
},
|
|
218
|
-
children:
|
|
223
|
+
children: F
|
|
219
224
|
}
|
|
220
225
|
),
|
|
221
226
|
/* @__PURE__ */ r(
|
|
222
|
-
|
|
227
|
+
B,
|
|
223
228
|
{
|
|
224
229
|
variant: "filled",
|
|
225
230
|
color: "blue",
|
|
226
231
|
size: "lg",
|
|
227
232
|
className: "flex-1",
|
|
228
233
|
onClick: () => {
|
|
229
|
-
|
|
234
|
+
D == null || D(), o(!1);
|
|
230
235
|
},
|
|
231
|
-
children:
|
|
236
|
+
children: G
|
|
232
237
|
}
|
|
233
238
|
)
|
|
234
239
|
] })
|
|
@@ -236,7 +241,7 @@ const k = {
|
|
|
236
241
|
}
|
|
237
242
|
)
|
|
238
243
|
] }),
|
|
239
|
-
(b ||
|
|
244
|
+
(b || S) && /* @__PURE__ */ r(
|
|
240
245
|
"p",
|
|
241
246
|
{
|
|
242
247
|
id: `${f}-description`,
|
|
@@ -244,13 +249,13 @@ const k = {
|
|
|
244
249
|
"text-body-4-r",
|
|
245
250
|
b ? "text-ds-primary-red-normal" : "text-ds-text-normal"
|
|
246
251
|
),
|
|
247
|
-
children: b ??
|
|
252
|
+
children: b ?? S
|
|
248
253
|
}
|
|
249
254
|
)
|
|
250
255
|
] });
|
|
251
256
|
}
|
|
252
257
|
);
|
|
253
|
-
|
|
258
|
+
ae.displayName = "Dropdown";
|
|
254
259
|
export {
|
|
255
|
-
|
|
260
|
+
ae as Dropdown
|
|
256
261
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { EyeOnIcon as E, EyeOffIcon as P } from "../../lib/icons.js";
|
|
4
|
-
import { cn as
|
|
4
|
+
import { cn as d } from "../../lib/utils.js";
|
|
5
5
|
import * as o from "react";
|
|
6
6
|
const I = {
|
|
7
7
|
lg: {
|
|
@@ -18,7 +18,7 @@ const I = {
|
|
|
18
18
|
}
|
|
19
19
|
}, V = o.forwardRef(
|
|
20
20
|
({
|
|
21
|
-
label:
|
|
21
|
+
label: r,
|
|
22
22
|
showLabel: c = !0,
|
|
23
23
|
require: l,
|
|
24
24
|
message: n,
|
|
@@ -44,17 +44,17 @@ const I = {
|
|
|
44
44
|
children: m ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ e(P, {})
|
|
45
45
|
}
|
|
46
46
|
) : null);
|
|
47
|
-
return /* @__PURE__ */ i("div", { className:
|
|
48
|
-
c &&
|
|
49
|
-
/* @__PURE__ */ e("label", { htmlFor: y, className: "text-body-2-r text-ds-text-strong", children:
|
|
47
|
+
return /* @__PURE__ */ i("div", { className: d("flex flex-col gap-2", F), children: [
|
|
48
|
+
c && r && /* @__PURE__ */ i("div", { className: "flex items-start gap-0.5 whitespace-nowrap", children: [
|
|
49
|
+
/* @__PURE__ */ e("label", { htmlFor: y, className: "text-body-2-r text-ds-text-strong", children: r }),
|
|
50
50
|
l && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "text-body-2-r text-ds-primary-red-normal", children: "*" })
|
|
51
51
|
] }),
|
|
52
52
|
n && /* @__PURE__ */ e("p", { id: N, className: "text-body-4-r text-ds-text-strong", children: n }),
|
|
53
53
|
/* @__PURE__ */ i(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
|
-
className:
|
|
57
|
-
"flex items-center overflow-hidden bg-ds-background-default border rounded-
|
|
56
|
+
className: d(
|
|
57
|
+
"flex items-center overflow-hidden bg-ds-background-default border rounded-ds-md transition-colors",
|
|
58
58
|
t ? "border-ds-primary-red-normal" : "border-ds-line-normal hover:border-ds-line-strong focus-within:border-ds-primary-blue-normal",
|
|
59
59
|
(b || f) && "bg-ds-surface-normal",
|
|
60
60
|
I[a].container
|
|
@@ -69,7 +69,7 @@ const I = {
|
|
|
69
69
|
"aria-invalid": t ? !0 : void 0,
|
|
70
70
|
"aria-describedby": B,
|
|
71
71
|
"aria-required": l || void 0,
|
|
72
|
-
className:
|
|
72
|
+
className: d(
|
|
73
73
|
"flex-1 min-w-0 bg-transparent outline-none font-sans",
|
|
74
74
|
"text-ds-text-strong placeholder:text-ds-text-normal",
|
|
75
75
|
"disabled:text-ds-text-disabled",
|
|
@@ -89,7 +89,7 @@ const I = {
|
|
|
89
89
|
"p",
|
|
90
90
|
{
|
|
91
91
|
id: v,
|
|
92
|
-
className:
|
|
92
|
+
className: d(
|
|
93
93
|
"text-body-4-r",
|
|
94
94
|
t ? "text-ds-primary-red-normal" : "text-ds-text-normal"
|
|
95
95
|
),
|
|
@@ -101,16 +101,16 @@ const I = {
|
|
|
101
101
|
);
|
|
102
102
|
V.displayName = "InputField";
|
|
103
103
|
const $ = o.forwardRef(
|
|
104
|
-
({ label:
|
|
104
|
+
({ label: r, showLabel: c = !0, wrapperClassName: l, className: n, ...s }, t) => {
|
|
105
105
|
const x = o.useId(), a = s.id ?? x;
|
|
106
|
-
return /* @__PURE__ */ i("div", { className:
|
|
107
|
-
c &&
|
|
108
|
-
/* @__PURE__ */ e("div", { className: "overflow-hidden border border-ds-line-normal bg-ds-background-default rounded-
|
|
106
|
+
return /* @__PURE__ */ i("div", { className: d("flex flex-col gap-2", l), children: [
|
|
107
|
+
c && r && /* @__PURE__ */ e("label", { htmlFor: a, className: "text-body-2-r text-ds-text-strong", children: r }),
|
|
108
|
+
/* @__PURE__ */ e("div", { className: "overflow-hidden border border-ds-line-normal bg-ds-background-default rounded-ds-md p-3 hover:border-ds-line-strong focus-within:border-ds-primary-blue-normal transition-colors", children: /* @__PURE__ */ e(
|
|
109
109
|
"textarea",
|
|
110
110
|
{
|
|
111
111
|
ref: t,
|
|
112
112
|
id: a,
|
|
113
|
-
className:
|
|
113
|
+
className: d(
|
|
114
114
|
"w-full min-h-[114px] resize-none bg-transparent outline-none font-sans",
|
|
115
115
|
"text-body-3-r text-ds-text-strong placeholder:text-ds-text-normal",
|
|
116
116
|
"disabled:text-ds-text-disabled",
|