@hivcd-printshop/design-system 1.0.0 → 1.1.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/dist/index.mjs CHANGED
@@ -27,40 +27,1136 @@ function cn(...inputs) {
27
27
  return twMerge(clsx(inputs));
28
28
  }
29
29
 
30
+ // src/assets/svgs/Icons.tsx
31
+ import { jsx, jsxs } from "react/jsx-runtime";
32
+ var IconChevronDownXS = ({
33
+ className,
34
+ stroke
35
+ }) => {
36
+ return /* @__PURE__ */ jsx(
37
+ "svg",
38
+ {
39
+ className,
40
+ width: "20",
41
+ height: "20",
42
+ viewBox: "0 0 20 20",
43
+ fill: "none",
44
+ xmlns: "http://www.w3.org/2000/svg",
45
+ children: /* @__PURE__ */ jsx(
46
+ "path",
47
+ {
48
+ d: "M5 8.3335L10 13.3335L15 8.3335",
49
+ stroke: stroke || "#121212",
50
+ strokeWidth: "1.5",
51
+ strokeLinecap: "square"
52
+ }
53
+ )
54
+ }
55
+ );
56
+ };
57
+ var IconSearch = ({ className, stroke }) => {
58
+ return /* @__PURE__ */ jsxs(
59
+ "svg",
60
+ {
61
+ className,
62
+ width: "30",
63
+ height: "30",
64
+ viewBox: "0 0 30 30",
65
+ fill: "none",
66
+ xmlns: "http://www.w3.org/2000/svg",
67
+ children: [
68
+ /* @__PURE__ */ jsx(
69
+ "path",
70
+ {
71
+ d: "M20.1161 20.6888L24.1075 25.1791",
72
+ stroke: stroke || "black",
73
+ strokeWidth: "2",
74
+ strokeLinecap: "round"
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(
78
+ "path",
79
+ {
80
+ fillRule: "evenodd",
81
+ clipRule: "evenodd",
82
+ d: "M13.9289 23.0361C18.9587 23.0361 23.0361 18.9587 23.0361 13.9289C23.0361 8.89918 18.9587 4.82178 13.9289 4.82178C8.89918 4.82178 4.82178 8.89918 4.82178 13.9289C4.82178 18.9587 8.89918 23.0361 13.9289 23.0361Z",
83
+ stroke: stroke || "black",
84
+ strokeWidth: "2"
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ );
90
+ };
91
+ var IconGoBack = ({ className, stroke }) => {
92
+ return /* @__PURE__ */ jsxs(
93
+ "svg",
94
+ {
95
+ className,
96
+ width: "32",
97
+ height: "32",
98
+ viewBox: "0 0 32 32",
99
+ fill: "none",
100
+ xmlns: "http://www.w3.org/2000/svg",
101
+ children: [
102
+ /* @__PURE__ */ jsx(
103
+ "path",
104
+ {
105
+ d: "M28 16.0001L4 16.0001",
106
+ stroke: stroke || "black",
107
+ strokeWidth: "2",
108
+ strokeLinecap: "round"
109
+ }
110
+ ),
111
+ /* @__PURE__ */ jsx("path", { d: "M12 8L4 16L12 24", stroke: stroke || "black", strokeWidth: "2", strokeLinecap: "round" })
112
+ ]
113
+ }
114
+ );
115
+ };
116
+
117
+ // src/components/BackButton/BackButton.tsx
118
+ import { jsx as jsx2 } from "react/jsx-runtime";
119
+ var BackButton = ({ onClick, className }) => {
120
+ return /* @__PURE__ */ jsx2(
121
+ "button",
122
+ {
123
+ type: "button",
124
+ onClick,
125
+ className: cn(
126
+ "w-14 h-full py-3",
127
+ "flex flex-col items-center",
128
+ "box-border border-r border-gray02",
129
+ "bg-white hover:bg-gray00 active:bg-gray01",
130
+ "cursor-pointer",
131
+ className
132
+ ),
133
+ children: /* @__PURE__ */ jsx2(IconGoBack, {})
134
+ }
135
+ );
136
+ };
137
+
30
138
  // src/components/CTA/CTA.tsx
31
- import { jsx } from "react/jsx-runtime";
139
+ import { jsx as jsx3 } from "react/jsx-runtime";
32
140
  var CTA = ({
33
- primary = true,
141
+ primary = false,
142
+ alert = false,
143
+ disabled = false,
144
+ label,
145
+ onClick,
146
+ className,
147
+ forModal = false,
148
+ ...props
149
+ }) => {
150
+ return /* @__PURE__ */ jsx3(
151
+ "button",
152
+ {
153
+ type: "button",
154
+ disabled,
155
+ className: cn(
156
+ forModal ? "h-14.5" : "h-12",
157
+ "w-full max-w-360 px-4",
158
+ "flex items-center justify-center",
159
+ "border-t box-border border-gray02",
160
+ primary && "border-none",
161
+ "text-head3-medium text-strong",
162
+ primary && "text-white",
163
+ alert && "text-danger",
164
+ disabled && "text-quaternary",
165
+ "bg-white hover:bg-gray00 active:bg-gray01 disabled:bg-gray02",
166
+ primary && "bg-black hover:bg-gray08 active:bg-gray09 disabled:bg-gray01",
167
+ "cursor-pointer disabled:cursor-default",
168
+ className
169
+ ),
170
+ onClick,
171
+ ...props,
172
+ children: label
173
+ }
174
+ );
175
+ };
176
+
177
+ // src/components/createPost/CategorySegment.tsx
178
+ import { jsx as jsx4 } from "react/jsx-runtime";
179
+ var CategorySegment = ({
180
+ selected = false,
181
+ label,
182
+ className,
183
+ onClick
184
+ }) => {
185
+ return /* @__PURE__ */ jsx4(
186
+ "div",
187
+ {
188
+ className: cn(
189
+ "w-fit h-8 px-3.5",
190
+ "flex items-center justify-center",
191
+ // 피그마랑 조금 다르게 적용하였음. 이게 더 효율적
192
+ "border-r border-gray02 cursor-pointer",
193
+ "text-body3-book text-strong",
194
+ selected ? "bg-black text-white" : "bg-white text-strong hover:bg-gray00 active:bg-gray01",
195
+ // default, hover, pressed 상태
196
+ className
197
+ ),
198
+ onClick,
199
+ children: label
200
+ }
201
+ );
202
+ };
203
+
204
+ // src/components/createPost/CategorySegmentedControl.tsx
205
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
206
+ var categorySegments = {
207
+ info: ["\uACF5\uC6A9 \uBB3C\uD488", "\uC77C\uBC18 \uAE30\uC790\uC7AC", "\uD2B9\uC218 \uAE30\uC790\uC7AC"],
208
+ archive: ["\uD504\uB9B0\uD2B8\uC2E4", "\uD64D\uC775\uC2DC\uB514"],
209
+ notice: ["\uC77C\uBC18 \uACF5\uC9C0", "\uAE34\uAE09 \uACF5\uC9C0"],
210
+ infoTag: ["\uAC00\uACF5", "\uC81C\uBCF8", "\uCD9C\uB825", "\uC2A4\uCE94", "\uAE30\uD0C0"]
211
+ };
212
+ var CategorySegmentedControl = ({
213
+ variable,
214
+ setSelectedCategory,
215
+ selectedCategory,
216
+ className
217
+ }) => {
218
+ const segments = categorySegments[variable];
219
+ return /* @__PURE__ */ jsxs2("div", { className: cn("w-full h-fit flex items-center justify-start", className), children: [
220
+ /* @__PURE__ */ jsx5(
221
+ "div",
222
+ {
223
+ className: cn(
224
+ "w-fit h-8 px-3.5",
225
+ "flex items-center justify-center",
226
+ // 피그마랑 조금 다르게 적용하였음. 이게 더 효율적
227
+ "border-r border-gray02",
228
+ "text-body3-medium text-strong"
229
+ ),
230
+ children: variable === "infoTag" ? "\uD0DC\uADF8 \uC120\uD0DD" : "\uCE74\uD14C\uACE0\uB9AC \uC120\uD0DD"
231
+ }
232
+ ),
233
+ segments.map((label) => /* @__PURE__ */ jsx5(
234
+ CategorySegment,
235
+ {
236
+ label,
237
+ selected: selectedCategory === label,
238
+ onClick: () => setSelectedCategory(label)
239
+ },
240
+ label
241
+ ))
242
+ ] });
243
+ };
244
+
245
+ // src/components/createPost/TitleInput.tsx
246
+ import { jsx as jsx6 } from "react/jsx-runtime";
247
+ var TitleInput = ({ title, onChange, className }) => {
248
+ return /* @__PURE__ */ jsx6(
249
+ "input",
250
+ {
251
+ type: "text",
252
+ value: title,
253
+ onChange: (e) => onChange(e.target.value),
254
+ placeholder: "\uC81C\uBAA9\uC744 \uC785\uB825\uD558\uC138\uC694",
255
+ className: cn(
256
+ "w-full min-w-[200px] h-12 px-3",
257
+ // 피그마랑 매우 다름. focus되었을 때 테두리 중복 문제 등
258
+ "box-border border-b border-gray02 border-t border-t-white",
259
+ "focus:border-black focus:border focus:outline-none",
260
+ "text-head2-medium text-strong placeholder:text-gray03",
261
+ className
262
+ )
263
+ }
264
+ );
265
+ };
266
+
267
+ // src/components/notice/NoticeBadge.tsx
268
+ import { jsx as jsx7 } from "react/jsx-runtime";
269
+ var NoticeBadge = ({ variable, className, onClick }) => {
270
+ return /* @__PURE__ */ jsx7(
271
+ "button",
272
+ {
273
+ type: "button",
274
+ className: cn(
275
+ // 너비 피그마에서는 fit으로 69px로 되어있는데, 69px로 하면 글자가 잘려서 72px로 잡음. 컨펌 필요
276
+ "w-18 h-8 box-border px-2 py-1 text-center text-body3-book cursor-pointer",
277
+ /** Urgent */
278
+ `${variable === "urgent" ? "bg-black text-white" : ""}`,
279
+ /** Common */
280
+ `${variable === "common" ? "border border-gray03 text-strong" : ""}`,
281
+ //이거 배경 없는 거 맞겠지...?
282
+ className
283
+ ),
284
+ onClick,
285
+ children: variable === "urgent" ? "\uAE34\uAE09 \uACF5\uC9C0" : "\uC77C\uBC18 \uACF5\uC9C0"
286
+ }
287
+ );
288
+ };
289
+
290
+ // src/components/notice/NoticeBar.tsx
291
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
292
+ var NoticeBar = ({
34
293
  variable = "default",
294
+ badgeVariable,
295
+ title,
296
+ date,
297
+ className,
298
+ onClick
299
+ }) => {
300
+ return /* @__PURE__ */ jsxs3(
301
+ "div",
302
+ {
303
+ className: cn(
304
+ "w-full min-w-200 h-15 px-4 py-3.5 flex items-center justify-between box-border border-b border-gray02 cursor-pointer",
305
+ variable === "default" && "bg-white hover:bg-gray00 active:bg-gray01",
306
+ variable === "hover" && "bg-gray00",
307
+ variable === "pressed" && "bg-gray01",
308
+ className
309
+ ),
310
+ onClick,
311
+ children: [
312
+ /* @__PURE__ */ jsxs3("section", { className: "flex items-center gap-3", children: [
313
+ /* @__PURE__ */ jsx8(NoticeBadge, { variable: badgeVariable }),
314
+ /* @__PURE__ */ jsx8("h1", { className: "text-head1-medium text-strong", children: title })
315
+ ] }),
316
+ /* @__PURE__ */ jsx8("p", { className: "text-body3-book text-tertiary", children: date })
317
+ ]
318
+ }
319
+ );
320
+ };
321
+
322
+ // src/components/SearchBar/SearchBar.tsx
323
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
324
+ var SearchBar = ({ value, onChange, className }) => {
325
+ return /* @__PURE__ */ jsxs4(
326
+ "label",
327
+ {
328
+ className: cn(
329
+ "w-full h-12 pl-4 pr-3",
330
+ "flex items-center gap-2",
331
+ "box-border border-b border-gray02 border-t border-t-white",
332
+ "focus-within:border-black focus-within:border focus-within:outline-none",
333
+ className
334
+ ),
335
+ children: [
336
+ /* @__PURE__ */ jsx9(IconSearch, {}),
337
+ /* @__PURE__ */ jsx9(
338
+ "input",
339
+ {
340
+ type: "text",
341
+ placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694",
342
+ value,
343
+ onChange: (e) => onChange?.(e.target.value),
344
+ className: cn(
345
+ "w-full focus:outline-none",
346
+ "text-body1-book text-strong placeholder:text-quaternary"
347
+ )
348
+ }
349
+ )
350
+ ]
351
+ }
352
+ );
353
+ };
354
+
355
+ // src/components/SideRadioAccordion/SideRadioAccordion.tsx
356
+ import { forwardRef } from "react";
357
+
358
+ // src/lib/useControllableState.ts
359
+ import { useCallback, useState } from "react";
360
+ function useControllableState(controlled, defaultValue) {
361
+ const isControlled = controlled !== void 0;
362
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
363
+ const value = isControlled ? controlled : uncontrolled;
364
+ const setValue = useCallback(
365
+ (next) => {
366
+ if (!isControlled) setUncontrolled(next);
367
+ },
368
+ [isControlled]
369
+ );
370
+ return [value, setValue, isControlled];
371
+ }
372
+
373
+ // src/components/SideRadioAccordion/Exclamation.svg
374
+ var Exclamation_default = "./Exclamation-IUYZYYC4.svg";
375
+
376
+ // src/components/SideRadioAccordion/ChevronDown.svg
377
+ var ChevronDown_default = "./ChevronDown-XSALXCW4.svg";
378
+
379
+ // src/components/SideRadioAccordion/RadioSelected.svg
380
+ var RadioSelected_default = "./RadioSelected-DOLVV7ZM.svg";
381
+
382
+ // src/components/SideRadioAccordion/RadioUnselected.svg
383
+ var RadioUnselected_default = "./RadioUnselected-QN74EU46.svg";
384
+
385
+ // src/components/SideRadioAccordion/SideRadioAccordion.tsx
386
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
387
+ var printColorBgClass = {
388
+ Plotter: "bg-print-plotter",
389
+ Printer: "bg-print-printer",
390
+ Riso: "bg-print-riso",
391
+ Fluorescent: "bg-print-fluorescent",
392
+ UV: "bg-print-uv",
393
+ "Seet Cutting": "bg-print-seet-cutting",
394
+ "Laser Cutting": "bg-print-laser-cutting"
395
+ };
396
+ var itemKey = (item) => item.value ?? item.title;
397
+ var SideRadioAccordion = forwardRef(
398
+ function SideRadioAccordion2({
399
+ step,
400
+ title,
401
+ radioToggleList,
402
+ selected,
403
+ defaultSelected,
404
+ onSelect,
405
+ stickyHeader = false,
406
+ collapsible = true,
407
+ defaultOpen = true,
408
+ open,
409
+ onOpenChange,
410
+ quantityLimitLabel,
411
+ onClickQuantityLimit,
412
+ className
413
+ }, ref) {
414
+ const [selectedValue, setSelectedValue] = useControllableState(
415
+ selected,
416
+ defaultSelected ?? null
417
+ );
418
+ const [isOpen, setIsOpen] = useControllableState(open, defaultOpen);
419
+ const expanded = collapsible ? isOpen : true;
420
+ const handleSelect = (value) => {
421
+ setSelectedValue(value);
422
+ onSelect?.(value);
423
+ };
424
+ const toggleOpen = () => {
425
+ if (!collapsible) return;
426
+ const next = !isOpen;
427
+ setIsOpen(next);
428
+ onOpenChange?.(next);
429
+ };
430
+ return /* @__PURE__ */ jsxs5("div", { ref, className: cn("w-full", className), children: [
431
+ /* @__PURE__ */ jsx10(
432
+ Stepper,
433
+ {
434
+ step,
435
+ title,
436
+ isOpen: expanded,
437
+ collapsible,
438
+ onClick: toggleOpen,
439
+ className: cn(stickyHeader && "sticky top-0 z-10")
440
+ }
441
+ ),
442
+ expanded && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col", children: [
443
+ radioToggleList.map((item) => /* @__PURE__ */ jsx10(
444
+ RadioToggleItem,
445
+ {
446
+ ...item,
447
+ open: selectedValue === itemKey(item),
448
+ onSelect: () => handleSelect(itemKey(item))
449
+ },
450
+ itemKey(item)
451
+ )),
452
+ quantityLimitLabel && /* @__PURE__ */ jsx10(
453
+ TextButton,
454
+ {
455
+ label: quantityLimitLabel,
456
+ onClick: onClickQuantityLimit,
457
+ className: "mt-2"
458
+ }
459
+ )
460
+ ] })
461
+ ] });
462
+ }
463
+ );
464
+ var Stepper = ({ step, title, isOpen, collapsible, onClick, className }) => {
465
+ const label = /* @__PURE__ */ jsxs5("span", { children: [
466
+ step,
467
+ " | ",
468
+ title
469
+ ] });
470
+ const base = "w-full flex items-center justify-between px-3 py-2.5 text-body1-medium text-strong text-left bg-white";
471
+ if (!collapsible) {
472
+ return /* @__PURE__ */ jsx10("div", { className: cn(base, className), children: label });
473
+ }
474
+ return /* @__PURE__ */ jsxs5(
475
+ "button",
476
+ {
477
+ type: "button",
478
+ onClick,
479
+ className: cn(base, "cursor-pointer hover:bg-gray00 active:bg-gray01", className),
480
+ children: [
481
+ label,
482
+ /* @__PURE__ */ jsx10(
483
+ "img",
484
+ {
485
+ src: ChevronDown_default,
486
+ alt: "",
487
+ className: cn("transition-transform", isOpen && "rotate-180")
488
+ }
489
+ )
490
+ ]
491
+ }
492
+ );
493
+ };
494
+ var RadioToggleItem = ({
495
+ title,
496
+ content,
497
+ badges,
498
+ printColor,
499
+ color,
500
+ className,
501
+ labelTextButton,
502
+ onClickTextButton,
503
+ open,
504
+ onSelect
505
+ }) => {
506
+ const rowBg = !open ? "bg-white hover:bg-gray00" : color ? void 0 : printColor ? printColorBgClass[printColor] : "bg-gray00";
507
+ const style = open && color ? { backgroundColor: color } : void 0;
508
+ return /* @__PURE__ */ jsxs5("div", { className: "w-full", children: [
509
+ /* @__PURE__ */ jsxs5(
510
+ "button",
511
+ {
512
+ type: "button",
513
+ onClick: onSelect,
514
+ style,
515
+ className: cn(
516
+ "w-full flex items-center gap-1.5 px-3 py-2.5",
517
+ "text-body2-regular text-primary text-left cursor-pointer",
518
+ rowBg,
519
+ className
520
+ ),
521
+ children: [
522
+ /* @__PURE__ */ jsx10(Radio, { selected: open }),
523
+ /* @__PURE__ */ jsx10("span", { children: title })
524
+ ]
525
+ }
526
+ ),
527
+ open && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 px-3 py-3 bg-white", children: [
528
+ /* @__PURE__ */ jsx10("p", { className: "text-caption-regular text-secondary", children: content }),
529
+ badges && badges.length > 0 && /* @__PURE__ */ jsx10("div", { className: "flex gap-1", children: badges.map((badge) => /* @__PURE__ */ jsx10(Badge, { label: badge }, badge)) }),
530
+ labelTextButton && /* @__PURE__ */ jsx10(
531
+ TextButton,
532
+ {
533
+ label: labelTextButton,
534
+ onClick: onClickTextButton,
535
+ showIcon: true,
536
+ className: "self-end"
537
+ }
538
+ )
539
+ ] })
540
+ ] });
541
+ };
542
+ var Radio = ({ selected = false, className }) => {
543
+ return /* @__PURE__ */ jsx10(
544
+ "img",
545
+ {
546
+ src: selected ? RadioSelected_default : RadioUnselected_default,
547
+ alt: "",
548
+ className: cn("w-4 h-4", className)
549
+ }
550
+ );
551
+ };
552
+ var TextButton = ({ label, onClick, showIcon = false, className }) => {
553
+ return /* @__PURE__ */ jsxs5(
554
+ "button",
555
+ {
556
+ type: "button",
557
+ onClick,
558
+ disabled: !onClick,
559
+ className: cn(
560
+ "w-fit h-fit px-1.5 py-0.5 flex items-center gap-1",
561
+ "text-primary text-caption-regular underline",
562
+ onClick && "cursor-pointer hover:bg-gray00 active:bg-gray01",
563
+ className
564
+ ),
565
+ children: [
566
+ showIcon && /* @__PURE__ */ jsx10("img", { src: Exclamation_default, alt: "" }),
567
+ label
568
+ ]
569
+ }
570
+ );
571
+ };
572
+ var Badge = ({ label, className }) => {
573
+ return /* @__PURE__ */ jsx10(
574
+ "div",
575
+ {
576
+ className: cn(
577
+ "w-fit h-fit px-2 py-0.5 border border-gray02",
578
+ "text-tertiary text-caption-book",
579
+ className
580
+ ),
581
+ children: label
582
+ }
583
+ );
584
+ };
585
+
586
+ // src/components/Tag/Tag.tsx
587
+ import { jsx as jsx11 } from "react/jsx-runtime";
588
+ var Tag = ({
589
+ className,
590
+ children,
591
+ selected = false,
592
+ disabled = false,
593
+ bgColor,
594
+ onClick,
595
+ ...props
596
+ }) => {
597
+ return /* @__PURE__ */ jsx11(
598
+ "button",
599
+ {
600
+ className: cn(
601
+ "tag",
602
+ "w-fit h-8 px-2.5",
603
+ "text-primary text-body2-regular transition-colors",
604
+ "box-border border border-gray02",
605
+ "bg-white",
606
+ // bgColor && `bg-[${bgColor}] border-none`,
607
+ onClick && "cursor-pointer hover:bg-gray00 active:bg-gray01 cursor-pointer has-clickable",
608
+ selected && "text-white bg-black border-black hover:bg-black active:bg-black",
609
+ "disabled:text-gray04 disabled:bg-gray02 disabled:border-gray02 disabled:cursor-not-allowed",
610
+ className
611
+ ),
612
+ onClick,
613
+ disabled,
614
+ style: bgColor ? { backgroundColor: bgColor, border: "none" } : void 0,
615
+ ...props,
616
+ children: /* @__PURE__ */ jsx11("span", { children })
617
+ }
618
+ );
619
+ };
620
+
621
+ // src/components/Timetable/Timetable.tsx
622
+ import { forwardRef as forwardRef3 } from "react";
623
+
624
+ // src/components/Timetable/WeekNavigation.tsx
625
+ import { forwardRef as forwardRef2 } from "react";
626
+
627
+ // src/components/Timetable/dateUtils.ts
628
+ var KOREAN_WEEKDAYS = ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"];
629
+ var parseISODate = (date) => {
630
+ const [year, month, day] = date.split("-").map(Number);
631
+ return new Date(year, month - 1, day);
632
+ };
633
+ var toISODate = (d) => {
634
+ const year = d.getFullYear();
635
+ const month = String(d.getMonth() + 1).padStart(2, "0");
636
+ const day = String(d.getDate()).padStart(2, "0");
637
+ return `${year}-${month}-${day}`;
638
+ };
639
+ var addDays = (date, amount) => {
640
+ const d = parseISODate(date);
641
+ d.setDate(d.getDate() + amount);
642
+ return toISODate(d);
643
+ };
644
+ var formatDayLabel = (date) => {
645
+ const d = parseISODate(date);
646
+ return `${d.getMonth() + 1}\uC6D4 ${d.getDate()}\uC77C(${KOREAN_WEEKDAYS[d.getDay()]})`;
647
+ };
648
+ var formatMMDD = (date) => {
649
+ const d = parseISODate(date);
650
+ return `${String(d.getMonth() + 1).padStart(2, "0")}.${String(d.getDate()).padStart(2, "0")}`;
651
+ };
652
+ var formatWeekRange = (weekStart) => {
653
+ const weekEnd = addDays(weekStart, 4);
654
+ return `${formatMMDD(weekStart)} ~ ${formatMMDD(weekEnd)}`;
655
+ };
656
+
657
+ // src/components/Timetable/WeekNavigation.tsx
658
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
659
+ var weekLabel = {
660
+ thisWeek: "\uC774\uBC88 \uC8FC",
661
+ nextWeek: "\uB2E4\uC74C \uC8FC",
662
+ twoWeeksLater: "\uB2E4\uB2E4\uC74C \uC8FC"
663
+ };
664
+ var WeekNavigation = forwardRef2(
665
+ function WeekNavigation2({ date, week, label, canPrev, canNext, onPrevWeek, onNextWeek, className }, ref) {
666
+ const showPrev = canPrev ?? (week ? week !== "thisWeek" : true);
667
+ const showNext = canNext ?? (week ? week !== "twoWeeksLater" : true);
668
+ const text = label ?? (week ? `${weekLabel[week]} (${formatWeekRange(date)})` : formatWeekRange(date));
669
+ return /* @__PURE__ */ jsxs6(
670
+ "div",
671
+ {
672
+ ref,
673
+ className: cn(
674
+ "flex items-center justify-between",
675
+ "w-full h-11 px-3",
676
+ "bg-white border border-gray02",
677
+ "text-body2-regular text-primary",
678
+ className
679
+ ),
680
+ children: [
681
+ /* @__PURE__ */ jsx12(ArrowButton, { direction: "left", visible: showPrev, onClick: onPrevWeek }),
682
+ /* @__PURE__ */ jsx12("span", { children: text }),
683
+ /* @__PURE__ */ jsx12(ArrowButton, { direction: "right", visible: showNext, onClick: onNextWeek })
684
+ ]
685
+ }
686
+ );
687
+ }
688
+ );
689
+ var ArrowButton = ({ direction, visible, onClick }) => {
690
+ if (!visible) {
691
+ return /* @__PURE__ */ jsx12("span", { className: "w-6 h-6" });
692
+ }
693
+ return /* @__PURE__ */ jsx12(
694
+ "button",
695
+ {
696
+ type: "button",
697
+ onClick,
698
+ className: cn(
699
+ "flex items-center justify-center w-6 h-6",
700
+ "text-gray06 cursor-pointer",
701
+ "hover:bg-gray00 active:bg-gray01"
702
+ ),
703
+ children: /* @__PURE__ */ jsx12(
704
+ IconChevronDownXS,
705
+ {
706
+ className: direction === "left" ? "rotate-90" : "-rotate-90",
707
+ stroke: "currentColor"
708
+ }
709
+ )
710
+ }
711
+ );
712
+ };
713
+
714
+ // src/components/Timetable/Timetable.tsx
715
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
716
+ var printColorHoverClass = {
717
+ Plotter: "hover:bg-print-plotter",
718
+ Printer: "hover:bg-print-printer",
719
+ Riso: "hover:bg-print-riso",
720
+ Fluorescent: "hover:bg-print-fluorescent",
721
+ UV: "hover:bg-print-uv",
722
+ "Seet Cutting": "hover:bg-print-seet-cutting",
723
+ "Laser Cutting": "hover:bg-print-laser-cutting"
724
+ };
725
+ var Timetable = forwardRef3(function Timetable2({
726
+ weekStart,
727
+ week,
728
+ days,
729
+ onPrevWeek,
730
+ onNextWeek,
731
+ onSelectSlot,
732
+ fluid = false,
733
+ hideWeekNavigation = false,
734
+ canPrevWeek,
735
+ canNextWeek,
736
+ className
737
+ }, ref) {
738
+ return /* @__PURE__ */ jsxs7("div", { ref, className: cn(fluid && "w-full", className), children: [
739
+ !hideWeekNavigation && /* @__PURE__ */ jsx13(
740
+ WeekNavigation,
741
+ {
742
+ date: weekStart,
743
+ week,
744
+ canPrev: canPrevWeek,
745
+ canNext: canNextWeek,
746
+ onPrevWeek,
747
+ onNextWeek
748
+ }
749
+ ),
750
+ /* @__PURE__ */ jsx13("div", { className: cn("flex", fluid && "w-full"), children: days.map((day) => /* @__PURE__ */ jsx13(
751
+ DailyTimetable,
752
+ {
753
+ date: day.date,
754
+ slots: day.slots,
755
+ fluid,
756
+ onSelectTime: onSelectSlot ? (time) => onSelectSlot(day.date, time) : void 0
757
+ },
758
+ day.date
759
+ )) })
760
+ ] });
761
+ });
762
+ var DailyTimetable = ({ date, slots, fluid, onSelectTime, className }) => {
763
+ return /* @__PURE__ */ jsxs7("div", { className: cn("flex flex-col", fluid ? "flex-1 min-w-0" : "w-18", className), children: [
764
+ /* @__PURE__ */ jsx13("div", { className: "h-13 flex items-center justify-center text-body3-medium text-secondary", children: formatDayLabel(date) }),
765
+ slots.map((slot) => /* @__PURE__ */ jsx13(
766
+ TimeItem,
767
+ {
768
+ state: slot.state,
769
+ label: slot.time,
770
+ printColor: slot.printColor,
771
+ color: slot.color,
772
+ fluid,
773
+ className: slot.className,
774
+ onClick: onSelectTime ? () => onSelectTime(slot.time) : void 0
775
+ },
776
+ slot.time
777
+ ))
778
+ ] });
779
+ };
780
+ var TimeItem = ({
781
+ state,
35
782
  label,
783
+ printColor,
784
+ color,
785
+ fluid,
36
786
  onClick,
37
787
  className
38
788
  }) => {
39
- return /* @__PURE__ */ jsx(
789
+ const clickable = (state === "default" || state === "selected") && !!onClick;
790
+ const style = state === "default" && color ? { "--tt-hover": color } : void 0;
791
+ return /* @__PURE__ */ jsx13(
792
+ "div",
793
+ {
794
+ onClick: clickable ? onClick : void 0,
795
+ style,
796
+ className: cn(
797
+ "h-18 flex items-center justify-center",
798
+ fluid ? "w-full" : "w-18",
799
+ "text-body1-medium text-center bg-white text-primary",
800
+ state === "none" && "bg-gray00 text-transparent",
801
+ state === "selected" && "bg-black text-gray02 hover:cursor-pointer",
802
+ state === "disabled" && "bg-gray00 text-gray03",
803
+ state === "default" && [
804
+ "hover:cursor-pointer",
805
+ color ? "hover:bg-(--tt-hover)" : printColor ? printColorHoverClass[printColor] : "hover:bg-gray00"
806
+ ],
807
+ className
808
+ ),
809
+ children: label
810
+ }
811
+ );
812
+ };
813
+
814
+ // src/components/TNB/TNB.tsx
815
+ import {
816
+ forwardRef as forwardRef4,
817
+ useCallback as useCallback2,
818
+ useState as useState2
819
+ } from "react";
820
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
821
+ function useControllableState2(controlled, defaultValue) {
822
+ const isControlled = controlled !== void 0;
823
+ const [uncontrolled, setUncontrolled] = useState2(defaultValue);
824
+ const value = isControlled ? controlled : uncontrolled;
825
+ const setValue = useCallback2(
826
+ (next) => {
827
+ if (!isControlled) setUncontrolled(next);
828
+ },
829
+ [isControlled]
830
+ );
831
+ return [value, setValue, isControlled];
832
+ }
833
+ var TNB = forwardRef4(function TNB2({
834
+ logo,
835
+ upperPartItemList,
836
+ upperPartIconList,
837
+ selected,
838
+ defaultSelected,
839
+ onSelectedChange,
840
+ selectedLower,
841
+ defaultSelectedLower,
842
+ onSelectedLowerChange,
843
+ onSelectItem,
844
+ linkComponent,
845
+ "aria-label": ariaLabel = "\uC8FC\uC694 \uBA54\uB274",
846
+ className
847
+ }, ref) {
848
+ const [upperValue, setUpperValue] = useControllableState2(
849
+ selected,
850
+ defaultSelected ?? null
851
+ );
852
+ const [lowerValueRaw, setLowerValue, lowerIsControlled] = useControllableState2(
853
+ selectedLower,
854
+ defaultSelectedLower ?? null
855
+ );
856
+ const currentUpper = upperPartItemList.find((item) => item.label === upperValue);
857
+ const currentLowerItemList = currentUpper?.lowerPartItemList ?? [];
858
+ const lowerValue = lowerIsControlled ? lowerValueRaw ?? void 0 : currentLowerItemList.some((item) => item.label === lowerValueRaw) ? lowerValueRaw : currentLowerItemList[0]?.label ?? void 0;
859
+ const handleSelectUpper = (label) => {
860
+ setUpperValue(label);
861
+ if (!lowerIsControlled) {
862
+ const nextLower = upperPartItemList.find((item) => item.label === label)?.lowerPartItemList[0]?.label ?? null;
863
+ setLowerValue(nextLower);
864
+ }
865
+ onSelectedChange?.(label);
866
+ onSelectItem?.(label);
867
+ };
868
+ const handleSelectLower = (label) => {
869
+ setLowerValue(label);
870
+ onSelectedLowerChange?.(label);
871
+ };
872
+ return /* @__PURE__ */ jsxs8("nav", { ref, "aria-label": ariaLabel, className: cn("w-full bg-white", className), children: [
873
+ /* @__PURE__ */ jsx14(
874
+ UpperPart,
875
+ {
876
+ logo,
877
+ upperPartItemList,
878
+ upperPartIconList,
879
+ selected: upperValue ?? void 0,
880
+ onSelectItem: handleSelectUpper,
881
+ linkComponent
882
+ }
883
+ ),
884
+ /* @__PURE__ */ jsx14(
885
+ LowerPart,
886
+ {
887
+ lowerPartItemList: currentLowerItemList,
888
+ selected: lowerValue,
889
+ onSelectItem: handleSelectLower,
890
+ linkComponent
891
+ }
892
+ )
893
+ ] });
894
+ });
895
+ var NavClickable = forwardRef4(function NavClickable2({ href, onClick, linkComponent: Link, current, disabled, className, children }, ref) {
896
+ const ariaCurrent = current ? "page" : void 0;
897
+ if (href && !disabled) {
898
+ if (Link) {
899
+ return /* @__PURE__ */ jsx14(
900
+ Link,
901
+ {
902
+ href,
903
+ onClick,
904
+ "aria-current": ariaCurrent,
905
+ className,
906
+ ref,
907
+ children
908
+ }
909
+ );
910
+ }
911
+ return /* @__PURE__ */ jsx14(
912
+ "a",
913
+ {
914
+ href,
915
+ onClick,
916
+ "aria-current": ariaCurrent,
917
+ className,
918
+ ref,
919
+ children
920
+ }
921
+ );
922
+ }
923
+ return /* @__PURE__ */ jsx14(
40
924
  "button",
41
925
  {
42
926
  type: "button",
927
+ onClick,
928
+ disabled,
929
+ "aria-current": ariaCurrent,
930
+ className,
931
+ ref,
932
+ children
933
+ }
934
+ );
935
+ });
936
+ var UpperPart = ({
937
+ logo,
938
+ upperPartItemList,
939
+ upperPartIconList,
940
+ selected,
941
+ onSelectItem,
942
+ linkComponent,
943
+ className
944
+ }) => {
945
+ return /* @__PURE__ */ jsxs8("div", { className: cn("w-full h-13 px-4 flex items-center justify-between", className), children: [
946
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-6", children: [
947
+ /* @__PURE__ */ jsx14(NavIconButton, { ...logo, linkComponent }),
948
+ /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-4", children: upperPartItemList.map((item) => /* @__PURE__ */ jsx14(
949
+ UpperPartTab,
950
+ {
951
+ label: item.label,
952
+ href: item.href,
953
+ selected: item.label === selected,
954
+ linkComponent,
955
+ onClick: () => {
956
+ item.onClick?.();
957
+ onSelectItem(item.label);
958
+ }
959
+ },
960
+ item.id ?? item.label
961
+ )) })
962
+ ] }),
963
+ /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2", children: upperPartIconList.map((icon, index) => /* @__PURE__ */ jsx14(
964
+ NavIconButton,
965
+ {
966
+ ...icon,
967
+ linkComponent
968
+ },
969
+ icon.id ?? icon.src ?? icon.label ?? index
970
+ )) })
971
+ ] });
972
+ };
973
+ var UpperPartTab = ({
974
+ label,
975
+ href,
976
+ selected,
977
+ onClick,
978
+ linkComponent,
979
+ className
980
+ }) => {
981
+ return /* @__PURE__ */ jsx14(
982
+ NavClickable,
983
+ {
984
+ href,
985
+ onClick,
986
+ linkComponent,
987
+ current: selected,
43
988
  className: cn(
44
- "w-full max-w-360 h-12 p-2.5 text-center text-head3-medium",
45
- `${primary ? "border-0" : "border border-gray02"}`,
46
- /** Disabled */
47
- `${variable == "disabled" ? primary ? "bg-gray01 text-gray04 border border-gray01" : "bg-gray02 text-gray04" : ""}`,
48
- /** Default */
49
- `${variable == "default" ? primary ? "bg-black text-white" : "bg-white text-strong" : ""}`,
50
- /** Hover */
51
- `${variable != "disabled" ? primary ? "hover:bg-gray08 hover:text-white" : "hover:bg-gray01 hover:text-strong" : ""}`,
52
- /** Hover */
53
- `${variable != "disabled" && "hover:cursor-pointer"}`,
54
- /** Pressed */
55
- `${variable == "pressed" ? primary ? "bg-gray09 text-white" : "bg-gray02 text-strong" : ""}`,
989
+ "inline-flex px-1 py-1.5 text-body2-regular cursor-pointer no-underline",
990
+ selected ? "text-strong font-medium underline underline-offset-4" : "text-quaternary hover:text-secondary",
56
991
  className
57
992
  ),
993
+ children: label
994
+ }
995
+ );
996
+ };
997
+ var NavIconButton = forwardRef4(
998
+ function NavIconButton2({ src, icon, alt, label, href, onClick, selected, badge, className, linkComponent }, forwardedRef) {
999
+ const interactive = Boolean(onClick || href);
1000
+ const showBadge = badge !== void 0 && badge !== null && badge !== false;
1001
+ return /* @__PURE__ */ jsxs8(
1002
+ NavClickable,
1003
+ {
1004
+ ref: forwardedRef,
1005
+ href,
1006
+ onClick,
1007
+ linkComponent,
1008
+ current: selected,
1009
+ disabled: !interactive,
1010
+ className: cn(
1011
+ "relative inline-flex h-8 min-w-8 items-center justify-center gap-1.5 rounded-full px-1.5",
1012
+ interactive && "cursor-pointer",
1013
+ selected ? "bg-black text-white" : "bg-transparent hover:bg-gray00 active:bg-gray01",
1014
+ className
1015
+ ),
1016
+ children: [
1017
+ icon ? /* @__PURE__ */ jsx14("span", { className: "inline-flex h-5 w-5 items-center justify-center", children: icon }) : src ? /* @__PURE__ */ jsx14("img", { src, alt: alt ?? label ?? "", className: "h-5 w-5" }) : null,
1018
+ label ? /* @__PURE__ */ jsx14("span", { className: cn("text-body2-regular", selected ? "text-white" : "text-secondary"), children: label }) : null,
1019
+ showBadge ? /* @__PURE__ */ jsx14(
1020
+ "span",
1021
+ {
1022
+ "aria-hidden": badge === true,
1023
+ className: cn(
1024
+ "absolute -right-0.5 -top-0.5 flex items-center justify-center rounded-full bg-danger text-white",
1025
+ badge === true ? "h-2 w-2" : "h-4 min-w-4 px-1 text-caption-regular leading-none"
1026
+ ),
1027
+ children: badge === true ? null : badge
1028
+ }
1029
+ ) : null
1030
+ ]
1031
+ }
1032
+ );
1033
+ }
1034
+ );
1035
+ var LowerPart = ({
1036
+ lowerPartItemList,
1037
+ selected,
1038
+ onSelectItem,
1039
+ linkComponent,
1040
+ className
1041
+ }) => {
1042
+ if (lowerPartItemList.length === 0) {
1043
+ return null;
1044
+ }
1045
+ return /* @__PURE__ */ jsx14(
1046
+ "div",
1047
+ {
1048
+ className: cn("w-full h-9 px-4 flex items-center gap-4 border-t border-gray02", className),
1049
+ children: lowerPartItemList.map((item) => /* @__PURE__ */ jsx14(
1050
+ LowerPartItemButton,
1051
+ {
1052
+ label: item.label,
1053
+ href: item.href,
1054
+ selected: item.label === selected,
1055
+ linkComponent,
1056
+ onClick: () => {
1057
+ item.onClick?.();
1058
+ onSelectItem(item.label);
1059
+ }
1060
+ },
1061
+ item.id ?? item.label
1062
+ ))
1063
+ }
1064
+ );
1065
+ };
1066
+ var LowerPartItemButton = ({
1067
+ label,
1068
+ href,
1069
+ selected,
1070
+ onClick,
1071
+ linkComponent,
1072
+ className
1073
+ }) => {
1074
+ return /* @__PURE__ */ jsx14(
1075
+ NavClickable,
1076
+ {
1077
+ href,
58
1078
  onClick,
1079
+ linkComponent,
1080
+ current: selected,
1081
+ className: cn(
1082
+ "inline-flex px-1.5 py-1 text-caption-regular cursor-pointer no-underline",
1083
+ "hover:bg-gray00 active:bg-gray01",
1084
+ selected ? "text-strong font-medium" : "text-quaternary",
1085
+ className
1086
+ ),
59
1087
  children: label
60
1088
  }
61
1089
  );
62
1090
  };
1091
+
1092
+ // src/components/Toast/Toast.tsx
1093
+ import { forwardRef as forwardRef5, useEffect, useState as useState3 } from "react";
1094
+ import { jsx as jsx15 } from "react/jsx-runtime";
1095
+ var EXIT_MS = 300;
1096
+ var Toast = forwardRef5(function Toast2({ message, open, duration = 3e3, onClose, position = "none", className }, ref) {
1097
+ const controlled = open !== void 0;
1098
+ const [mounted, setMounted] = useState3(!controlled || open);
1099
+ const [visible, setVisible] = useState3(!controlled || open);
1100
+ useEffect(() => {
1101
+ if (!controlled) return;
1102
+ if (open) {
1103
+ setMounted(true);
1104
+ const raf = requestAnimationFrame(() => setVisible(true));
1105
+ return () => cancelAnimationFrame(raf);
1106
+ }
1107
+ setVisible(false);
1108
+ const timer = setTimeout(() => setMounted(false), EXIT_MS);
1109
+ return () => clearTimeout(timer);
1110
+ }, [controlled, open]);
1111
+ useEffect(() => {
1112
+ if (!controlled || !open || !duration) return;
1113
+ const timer = setTimeout(() => onClose?.(), duration);
1114
+ return () => clearTimeout(timer);
1115
+ }, [controlled, open, duration, onClose]);
1116
+ if (!mounted) return null;
1117
+ const banner = /* @__PURE__ */ jsx15(
1118
+ "div",
1119
+ {
1120
+ ref,
1121
+ role: "status",
1122
+ "aria-live": "polite",
1123
+ className: cn(
1124
+ "w-full h-fit py-2.5 bg-gray06",
1125
+ "font-pretendard text-white text-center font-semibold text-[17px]",
1126
+ "shadow-[0_2px_15px_rgba(0,0,0,0.18)]",
1127
+ controlled && "transition-opacity duration-300",
1128
+ controlled && (visible ? "opacity-100" : "opacity-0"),
1129
+ className
1130
+ ),
1131
+ children: message
1132
+ }
1133
+ );
1134
+ if (position === "none") return banner;
1135
+ return /* @__PURE__ */ jsx15(
1136
+ "div",
1137
+ {
1138
+ className: cn(
1139
+ "fixed inset-x-0 z-5000 pointer-events-none",
1140
+ position === "top" ? "top-0" : "bottom-0"
1141
+ ),
1142
+ children: banner
1143
+ }
1144
+ );
1145
+ });
63
1146
  export {
64
- CTA
1147
+ BackButton,
1148
+ CTA,
1149
+ CategorySegment,
1150
+ CategorySegmentedControl,
1151
+ NoticeBadge,
1152
+ NoticeBar,
1153
+ SearchBar,
1154
+ SideRadioAccordion,
1155
+ TNB,
1156
+ Tag,
1157
+ Timetable,
1158
+ TitleInput,
1159
+ Toast,
1160
+ WeekNavigation
65
1161
  };
66
1162
  //# sourceMappingURL=index.mjs.map