@pylerai/design-system 2.2.1 → 2.3.1-rc.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/README.md +1 -1
- package/dist/components/ui/calendar.js +155 -156
- package/dist/components/ui/checkbox.js +18 -18
- package/dist/components/ui/dropdown.js +118 -120
- package/dist/components/ui/modal.d.ts +9 -3
- package/dist/components/ui/modal.js +88 -85
- package/dist/components/ui/radio.js +16 -16
- package/dist/components/ui/table.js +86 -86
- package/dist/components/ui/tabs.js +77 -77
- package/dist/components/ui/toast.js +3 -3
- package/dist/components/ui/toggle.js +16 -16
- package/dist/components/ui/use-modal.js +41 -49
- package/dist/lib/use-dialog-a11y.js +25 -26
- package/dist/style.css +1 -1
- package/dist/tokens/pyler-light.js +20 -20
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -284,7 +284,7 @@ design-system/
|
|
|
284
284
|
├── .github/workflows/
|
|
285
285
|
│ ├── pr-checks.yml # PR 검증 (tokens → lint → tsc → test → build)
|
|
286
286
|
│ ├── deploy-github-pages.yml # Storybook 배포
|
|
287
|
-
│ └── release-package.yml # GitHub Release 생성 시 npm 자동 배포
|
|
287
|
+
│ └── release-package.yml # GitHub Release 생성 시 npm 자동 배포 (Trusted Publishing, 토큰 없음)
|
|
288
288
|
├── scripts/
|
|
289
289
|
│ └── check-tokens.cjs # 토큰 정합성 검사
|
|
290
290
|
├── src/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as k, useCallback as
|
|
2
|
+
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useState as k, useCallback as M } from "react";
|
|
4
4
|
import i from "dayjs";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { CloseIcon as
|
|
5
|
+
import { cn as S } from "../../lib/utils.js";
|
|
6
|
+
import { CloseIcon as L, ArrowLeftIcon as Q, ArrowRightIcon as $ } from "../../lib/icons.js";
|
|
7
7
|
import { Radio as H } from "./radio.js";
|
|
8
|
-
import { Button as
|
|
8
|
+
import { Button as A } from "./button.js";
|
|
9
9
|
const F = ["일", "월", "화", "수", "목", "금", "토"], K = [
|
|
10
10
|
{ label: "오늘", getDays: () => ({ from: i(), to: i() }) },
|
|
11
11
|
{ label: "어제", getDays: () => ({ from: i().subtract(1, "day"), to: i().subtract(1, "day") }) },
|
|
@@ -13,258 +13,257 @@ const F = ["일", "월", "화", "수", "목", "금", "토"], K = [
|
|
|
13
13
|
{ label: "최근 14일", getDays: () => ({ from: i().subtract(13, "day"), to: i() }) },
|
|
14
14
|
{ label: "최근 31일", getDays: () => ({ from: i().subtract(30, "day"), to: i() }) }
|
|
15
15
|
];
|
|
16
|
-
function P(
|
|
17
|
-
const
|
|
18
|
-
for (let
|
|
19
|
-
o.push(i(new Date(
|
|
16
|
+
function P(c, r) {
|
|
17
|
+
const m = i(new Date(c, r, 1)), h = m.daysInMonth(), f = m.day(), o = Array(f).fill(null);
|
|
18
|
+
for (let e = 1; e <= h; e++)
|
|
19
|
+
o.push(i(new Date(c, r, e)));
|
|
20
20
|
for (; o.length % 7 !== 0; ) o.push(null);
|
|
21
|
-
const
|
|
22
|
-
for (let
|
|
23
|
-
|
|
24
|
-
return
|
|
21
|
+
const d = [];
|
|
22
|
+
for (let e = 0; e < o.length; e += 7)
|
|
23
|
+
d.push(o.slice(e, e + 7));
|
|
24
|
+
return d;
|
|
25
25
|
}
|
|
26
|
-
function q(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
f > 0 && f >= o ? n = s.add(o - 1, "day") : f < 0 && Math.abs(f) >= o && (n = s.subtract(o - 1, "day"));
|
|
26
|
+
function q(c, r, m, h, f, o) {
|
|
27
|
+
const d = i().startOf("day"), e = c.startOf("day");
|
|
28
|
+
if (h && e.isBefore(h.startOf("day")) || f && e.isAfter(f.startOf("day"))) return "disabled";
|
|
29
|
+
const s = r.from?.startOf("day") ?? null;
|
|
30
|
+
let a = r.to?.startOf("day") ?? m?.startOf("day") ?? null;
|
|
31
|
+
if (s && a && o) {
|
|
32
|
+
const l = a.diff(s, "day");
|
|
33
|
+
l > 0 && l >= o ? a = s.add(o - 1, "day") : l < 0 && Math.abs(l) >= o && (a = s.subtract(o - 1, "day"));
|
|
35
34
|
}
|
|
36
|
-
const
|
|
37
|
-
return
|
|
35
|
+
const u = s && a ? s.isBefore(a) ? s : a : s, b = s && a ? s.isBefore(a) ? a : s : null;
|
|
36
|
+
return u && e.isSame(u) ? b && !e.isSame(b) ? "range-start" : "selected" : b && e.isSame(b) ? u && !e.isSame(u) ? "range-end" : "selected" : u && b && e.isAfter(u) && e.isBefore(b) ? "range-middle" : e.isSame(d) ? "today" : "default";
|
|
38
37
|
}
|
|
39
|
-
function G({ day:
|
|
40
|
-
const o =
|
|
41
|
-
return /* @__PURE__ */
|
|
38
|
+
function G({ day: c, state: r, dayOfWeek: m, onClick: h, onMouseEnter: f }) {
|
|
39
|
+
const o = r === "disabled", d = r === "selected" || r === "range-start" || r === "range-end", e = r === "range-middle", s = r === "range-start", w = r === "range-end", a = r === "today", u = o ? "text-ds-text-disabled" : d ? "text-white" : m === 0 ? "text-ds-primary-red-normal" : m === 6 ? "text-ds-primary-blue-normal" : "text-ds-text-strong";
|
|
40
|
+
return /* @__PURE__ */ n(
|
|
42
41
|
"div",
|
|
43
42
|
{
|
|
44
|
-
className:
|
|
43
|
+
className: S(
|
|
45
44
|
"relative flex size-7 shrink-0 flex-col items-center justify-center p-0.5",
|
|
46
|
-
|
|
45
|
+
e && "border-y-2 border-ds-primary-blue-normal",
|
|
47
46
|
s && "border-y-2 border-l-2 border-ds-primary-blue-normal rounded-l-full",
|
|
48
47
|
w && "border-y-2 border-r-2 border-ds-primary-blue-normal rounded-r-full"
|
|
49
48
|
),
|
|
50
|
-
onMouseEnter:
|
|
51
|
-
children: /* @__PURE__ */
|
|
49
|
+
onMouseEnter: f,
|
|
50
|
+
children: /* @__PURE__ */ n(
|
|
52
51
|
"button",
|
|
53
52
|
{
|
|
54
53
|
type: "button",
|
|
55
|
-
"aria-label":
|
|
54
|
+
"aria-label": c.format("YYYY년 M월 D일"),
|
|
56
55
|
disabled: o,
|
|
57
|
-
onClick:
|
|
58
|
-
className:
|
|
56
|
+
onClick: h,
|
|
57
|
+
className: S(
|
|
59
58
|
"relative flex size-6 items-center justify-center rounded-full text-body-4-m transition-colors",
|
|
60
59
|
!o && "cursor-pointer",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
!o && !
|
|
64
|
-
|
|
60
|
+
d && "bg-ds-primary-blue-normal",
|
|
61
|
+
a && !d && "bg-ds-surface-strong",
|
|
62
|
+
!o && !d && !a && "hover:bg-ds-surface-strong",
|
|
63
|
+
u
|
|
65
64
|
),
|
|
66
|
-
children:
|
|
65
|
+
children: c.date()
|
|
67
66
|
}
|
|
68
67
|
)
|
|
69
68
|
}
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
|
-
function
|
|
73
|
-
year:
|
|
74
|
-
month:
|
|
75
|
-
range:
|
|
76
|
-
hovered:
|
|
77
|
-
onDayClick:
|
|
71
|
+
function B({
|
|
72
|
+
year: c,
|
|
73
|
+
month: r,
|
|
74
|
+
range: m,
|
|
75
|
+
hovered: h,
|
|
76
|
+
onDayClick: f,
|
|
78
77
|
onDayHover: o,
|
|
79
|
-
disabledBefore:
|
|
80
|
-
disabledAfter:
|
|
78
|
+
disabledBefore: d,
|
|
79
|
+
disabledAfter: e,
|
|
81
80
|
maxDays: s,
|
|
82
81
|
showPrevArrow: w,
|
|
83
|
-
showNextArrow:
|
|
84
|
-
onPrev:
|
|
85
|
-
onNext:
|
|
82
|
+
showNextArrow: a,
|
|
83
|
+
onPrev: u,
|
|
84
|
+
onNext: b
|
|
86
85
|
}) {
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
w ? /* @__PURE__ */
|
|
86
|
+
const l = P(c, r);
|
|
87
|
+
return /* @__PURE__ */ g("div", { className: "flex flex-col gap-3", children: [
|
|
88
|
+
/* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
89
|
+
w ? /* @__PURE__ */ n(
|
|
91
90
|
"button",
|
|
92
91
|
{
|
|
93
92
|
type: "button",
|
|
94
93
|
"aria-label": "이전 달",
|
|
95
|
-
onClick:
|
|
94
|
+
onClick: u,
|
|
96
95
|
className: "flex size-5 items-center justify-center text-ds-text-strong hover:text-ds-primary-blue-normal",
|
|
97
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ n(Q, { className: "size-5" })
|
|
98
97
|
}
|
|
99
|
-
) : /* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
|
|
98
|
+
) : /* @__PURE__ */ n("div", { className: "size-5" }),
|
|
99
|
+
/* @__PURE__ */ g("p", { className: "flex-1 text-center text-body-3-r text-ds-text-strong", children: [
|
|
100
|
+
c,
|
|
102
101
|
"년 ",
|
|
103
|
-
|
|
102
|
+
r + 1,
|
|
104
103
|
"월"
|
|
105
104
|
] }),
|
|
106
|
-
|
|
105
|
+
a ? /* @__PURE__ */ n(
|
|
107
106
|
"button",
|
|
108
107
|
{
|
|
109
108
|
type: "button",
|
|
110
109
|
"aria-label": "다음 달",
|
|
111
|
-
onClick:
|
|
110
|
+
onClick: b,
|
|
112
111
|
className: "flex size-5 items-center justify-center text-ds-text-strong hover:text-ds-primary-blue-normal",
|
|
113
|
-
children: /* @__PURE__ */
|
|
112
|
+
children: /* @__PURE__ */ n($, { className: "size-5" })
|
|
114
113
|
}
|
|
115
|
-
) : /* @__PURE__ */
|
|
114
|
+
) : /* @__PURE__ */ n("div", { className: "size-5" })
|
|
116
115
|
] }),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
F.map((
|
|
116
|
+
/* @__PURE__ */ g("div", { className: "grid grid-cols-7", children: [
|
|
117
|
+
F.map((p, v) => /* @__PURE__ */ n("div", { className: "flex size-7 items-center justify-center", children: /* @__PURE__ */ n(
|
|
119
118
|
"span",
|
|
120
119
|
{
|
|
121
|
-
className:
|
|
120
|
+
className: S(
|
|
122
121
|
"text-body-4-r",
|
|
123
|
-
|
|
122
|
+
v === 0 ? "text-ds-primary-red-normal" : v === 6 ? "text-ds-primary-blue-normal" : "text-ds-text-strong"
|
|
124
123
|
),
|
|
125
|
-
children:
|
|
124
|
+
children: p
|
|
126
125
|
}
|
|
127
|
-
) },
|
|
128
|
-
|
|
129
|
-
(
|
|
130
|
-
(
|
|
126
|
+
) }, p)),
|
|
127
|
+
l.map(
|
|
128
|
+
(p, v) => p.map(
|
|
129
|
+
(y, N) => y ? /* @__PURE__ */ n(
|
|
131
130
|
G,
|
|
132
131
|
{
|
|
133
|
-
day:
|
|
134
|
-
dayOfWeek:
|
|
135
|
-
state: q(
|
|
136
|
-
onClick: () =>
|
|
137
|
-
onMouseEnter: () => o(
|
|
132
|
+
day: y,
|
|
133
|
+
dayOfWeek: N,
|
|
134
|
+
state: q(y, m, h, d, e, s),
|
|
135
|
+
onClick: () => f(y),
|
|
136
|
+
onMouseEnter: () => o(y)
|
|
138
137
|
},
|
|
139
|
-
`${
|
|
140
|
-
) : /* @__PURE__ */
|
|
138
|
+
`${v}-${N}`
|
|
139
|
+
) : /* @__PURE__ */ n("div", { className: "size-7" }, `${v}-${N}`)
|
|
141
140
|
)
|
|
142
141
|
)
|
|
143
142
|
] })
|
|
144
143
|
] });
|
|
145
144
|
}
|
|
146
145
|
function ee({
|
|
147
|
-
value:
|
|
148
|
-
onChange:
|
|
149
|
-
onClose:
|
|
150
|
-
onConfirm:
|
|
151
|
-
maxDays:
|
|
146
|
+
value: c,
|
|
147
|
+
onChange: r,
|
|
148
|
+
onClose: m,
|
|
149
|
+
onConfirm: h,
|
|
150
|
+
maxDays: f = 31,
|
|
152
151
|
disabledBefore: o,
|
|
153
|
-
disabledAfter:
|
|
154
|
-
className:
|
|
152
|
+
disabledAfter: d = i(),
|
|
153
|
+
className: e
|
|
155
154
|
}) {
|
|
156
|
-
const s = i(), [w,
|
|
157
|
-
(
|
|
158
|
-
if (!
|
|
159
|
-
|
|
155
|
+
const s = i(), [w, a] = k({ year: s.year(), month: s.month() - 1 < 0 ? 11 : s.month() - 1 }), [u, b] = k({ year: s.year(), month: s.month() }), [l, p] = k(c ?? { from: null, to: null }), [v, y] = k(null), [N, z] = k(!1), [O, D] = k(null), j = M(
|
|
156
|
+
(t) => {
|
|
157
|
+
if (!N || l.from === null)
|
|
158
|
+
p({ from: t, to: null }), z(!0), D(null);
|
|
160
159
|
else {
|
|
161
|
-
const
|
|
162
|
-
|
|
160
|
+
const x = l.from, C = x.isBefore(t) ? { from: x, to: t } : { from: t, to: x };
|
|
161
|
+
p(C), z(!1), y(null), r?.(C);
|
|
163
162
|
}
|
|
164
163
|
},
|
|
165
|
-
[
|
|
166
|
-
),
|
|
167
|
-
(
|
|
168
|
-
const
|
|
169
|
-
|
|
164
|
+
[N, l.from, r]
|
|
165
|
+
), E = M(
|
|
166
|
+
(t, x) => {
|
|
167
|
+
const C = x();
|
|
168
|
+
p(C), z(!1), y(null), D(t), r?.(C);
|
|
170
169
|
},
|
|
171
|
-
[
|
|
172
|
-
),
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
return
|
|
170
|
+
[r]
|
|
171
|
+
), I = M(() => {
|
|
172
|
+
a((t) => {
|
|
173
|
+
const x = t.month === 0 ? { year: t.year - 1, month: 11 } : { year: t.year, month: t.month - 1 };
|
|
174
|
+
return b(t), x;
|
|
176
175
|
});
|
|
177
|
-
}, []),
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
return
|
|
176
|
+
}, []), T = M(() => {
|
|
177
|
+
b((t) => {
|
|
178
|
+
const x = t.month === 11 ? { year: t.year + 1, month: 0 } : { year: t.year, month: t.month + 1 };
|
|
179
|
+
return a(t), x;
|
|
181
180
|
});
|
|
182
|
-
}, []),
|
|
183
|
-
|
|
184
|
-
}, [
|
|
185
|
-
return /* @__PURE__ */
|
|
181
|
+
}, []), Y = M(() => {
|
|
182
|
+
l.from && l.to && h?.({ from: l.from, to: l.to });
|
|
183
|
+
}, [l, h]), R = o ?? s.subtract(1, "year");
|
|
184
|
+
return /* @__PURE__ */ g(
|
|
186
185
|
"div",
|
|
187
186
|
{
|
|
188
|
-
className:
|
|
187
|
+
className: S(
|
|
189
188
|
"flex w-[612px] flex-col overflow-hidden rounded-ds-lg bg-ds-background-default shadow-ds-modal",
|
|
190
|
-
|
|
189
|
+
e
|
|
191
190
|
),
|
|
192
|
-
onMouseLeave: () =>
|
|
191
|
+
onMouseLeave: () => y(null),
|
|
193
192
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ g("div", { className: "flex items-center justify-between px-5 pt-5 pb-3", children: [
|
|
194
|
+
/* @__PURE__ */ n("span", { className: "text-body-2-m text-ds-text-strong", children: "기간 설정" }),
|
|
195
|
+
/* @__PURE__ */ n(
|
|
197
196
|
"button",
|
|
198
197
|
{
|
|
199
198
|
type: "button",
|
|
200
199
|
"aria-label": "닫기",
|
|
201
|
-
onClick:
|
|
200
|
+
onClick: m,
|
|
202
201
|
className: "text-ds-text-normal hover:text-ds-text-strong",
|
|
203
|
-
children: /* @__PURE__ */
|
|
202
|
+
children: /* @__PURE__ */ n(L, { className: "size-5" })
|
|
204
203
|
}
|
|
205
204
|
)
|
|
206
205
|
] }),
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ n("div", { className: "mx-5 h-px bg-ds-line-normal" }),
|
|
207
|
+
/* @__PURE__ */ g("div", { className: "flex min-h-0 flex-1", children: [
|
|
208
|
+
/* @__PURE__ */ n("div", { className: "flex w-40 shrink-0 flex-col border-r border-b border-ds-line-normal px-5 pt-5 pb-5 gap-0.5", children: K.map(({ label: t, getDays: x }) => (
|
|
210
209
|
// Radio가 자체적으로 <label>을 렌더하므로 밖에서 또 감싸면 label이
|
|
211
210
|
// 중첩되어 연결이 깨진다. 텍스트는 children으로 넘긴다.
|
|
212
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ n(
|
|
213
212
|
H,
|
|
214
213
|
{
|
|
215
214
|
name: "quick-select",
|
|
216
|
-
value:
|
|
217
|
-
checked:
|
|
218
|
-
onChange: () =>
|
|
215
|
+
value: t,
|
|
216
|
+
checked: O === t,
|
|
217
|
+
onChange: () => E(t, x),
|
|
219
218
|
className: "h-8 w-full rounded-ds-ss px-1 text-body-3-r text-ds-text-strong hover:bg-ds-surface-normal",
|
|
220
|
-
children:
|
|
219
|
+
children: t
|
|
221
220
|
},
|
|
222
|
-
|
|
221
|
+
t
|
|
223
222
|
)
|
|
224
223
|
)) }),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
|
|
224
|
+
/* @__PURE__ */ g("div", { className: "flex flex-col flex-1 border-b border-ds-line-normal p-5 gap-3", children: [
|
|
225
|
+
/* @__PURE__ */ g("div", { className: "flex gap-5 justify-between", children: [
|
|
226
|
+
/* @__PURE__ */ n(
|
|
227
|
+
B,
|
|
229
228
|
{
|
|
230
229
|
...w,
|
|
231
|
-
range:
|
|
232
|
-
hovered:
|
|
233
|
-
onDayClick:
|
|
234
|
-
onDayHover:
|
|
235
|
-
disabledBefore:
|
|
236
|
-
disabledAfter:
|
|
237
|
-
maxDays:
|
|
230
|
+
range: l,
|
|
231
|
+
hovered: N ? v : null,
|
|
232
|
+
onDayClick: j,
|
|
233
|
+
onDayHover: y,
|
|
234
|
+
disabledBefore: R,
|
|
235
|
+
disabledAfter: d,
|
|
236
|
+
maxDays: f,
|
|
238
237
|
showPrevArrow: !0,
|
|
239
|
-
onPrev:
|
|
238
|
+
onPrev: I
|
|
240
239
|
}
|
|
241
240
|
),
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
|
|
241
|
+
/* @__PURE__ */ n(
|
|
242
|
+
B,
|
|
244
243
|
{
|
|
245
|
-
...
|
|
246
|
-
range:
|
|
247
|
-
hovered:
|
|
248
|
-
onDayClick:
|
|
249
|
-
onDayHover:
|
|
250
|
-
disabledBefore:
|
|
251
|
-
disabledAfter:
|
|
252
|
-
maxDays:
|
|
244
|
+
...u,
|
|
245
|
+
range: l,
|
|
246
|
+
hovered: N ? v : null,
|
|
247
|
+
onDayClick: j,
|
|
248
|
+
onDayHover: y,
|
|
249
|
+
disabledBefore: R,
|
|
250
|
+
disabledAfter: d,
|
|
251
|
+
maxDays: f,
|
|
253
252
|
showNextArrow: !0,
|
|
254
|
-
onNext:
|
|
253
|
+
onNext: T
|
|
255
254
|
}
|
|
256
255
|
)
|
|
257
256
|
] }),
|
|
258
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ g("p", { className: "text-body-4-r text-ds-text-normal", children: [
|
|
259
258
|
"설정 가능한 최대 기간은 ",
|
|
260
|
-
|
|
259
|
+
f,
|
|
261
260
|
"일이고, 최대 1년 전까지만 설정 가능합니다."
|
|
262
261
|
] })
|
|
263
262
|
] })
|
|
264
263
|
] }),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ g("div", { className: "flex items-center justify-end gap-2 px-5 py-3", children: [
|
|
265
|
+
/* @__PURE__ */ n(A, { variant: "outlined", size: "lg", onClick: m, children: "취소" }),
|
|
266
|
+
/* @__PURE__ */ n(A, { variant: "filled", color: "blue", size: "lg", disabled: !l.from || !l.to, onClick: Y, children: "적용" })
|
|
268
267
|
] })
|
|
269
268
|
]
|
|
270
269
|
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { CheckboxIndeterminateDisabledIcon as
|
|
4
|
-
import { cn as
|
|
2
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { CheckboxIndeterminateDisabledIcon as x, CheckboxCheckedDisabledIcon as p, CheckboxUncheckedDisabledIcon as u, CheckboxIndeterminateIcon as b, CheckboxCheckedIcon as C, CheckboxUncheckedIcon as I } from "../../lib/icons.js";
|
|
4
|
+
import { cn as d } from "../../lib/utils.js";
|
|
5
5
|
import * as o from "react";
|
|
6
6
|
const N = o.forwardRef(
|
|
7
|
-
({ className:
|
|
8
|
-
const
|
|
9
|
-
o.useImperativeHandle(
|
|
10
|
-
|
|
7
|
+
({ className: a, checked: r, indeterminate: c, disabled: s, onChange: i, children: t, ...l }, h) => {
|
|
8
|
+
const n = o.useRef(null);
|
|
9
|
+
o.useImperativeHandle(h, () => n.current, []), o.useEffect(() => {
|
|
10
|
+
n.current && (n.current.indeterminate = !!c);
|
|
11
11
|
}, [c]);
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
const f = s ? c ? /* @__PURE__ */ e(x, {}) : r ? /* @__PURE__ */ e(p, {}) : /* @__PURE__ */ e(u, {}) : c ? /* @__PURE__ */ e(b, {}) : r ? /* @__PURE__ */ e(C, {}) : /* @__PURE__ */ e(I, {});
|
|
13
|
+
return /* @__PURE__ */ m(
|
|
14
14
|
"label",
|
|
15
15
|
{
|
|
16
|
-
className:
|
|
16
|
+
className: d(
|
|
17
17
|
"relative inline-flex items-center gap-1",
|
|
18
|
-
|
|
18
|
+
t ? "" : "shrink-0",
|
|
19
19
|
s ? "cursor-not-allowed" : "cursor-pointer",
|
|
20
|
-
|
|
20
|
+
a
|
|
21
21
|
),
|
|
22
22
|
children: [
|
|
23
23
|
/* @__PURE__ */ e(
|
|
24
24
|
"input",
|
|
25
25
|
{
|
|
26
26
|
type: "checkbox",
|
|
27
|
-
ref:
|
|
28
|
-
checked:
|
|
27
|
+
ref: n,
|
|
28
|
+
checked: r,
|
|
29
29
|
disabled: s,
|
|
30
|
-
onChange: (
|
|
30
|
+
onChange: (k) => i?.(k.target.checked),
|
|
31
31
|
className: "sr-only",
|
|
32
|
-
...
|
|
32
|
+
...l
|
|
33
33
|
}
|
|
34
34
|
),
|
|
35
|
-
/* @__PURE__ */ e("span", { className: "shrink-0 inline-flex", children:
|
|
36
|
-
|
|
35
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 inline-flex", children: f }),
|
|
36
|
+
t
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
);
|