@nurimedia/react-ui 0.1.0 → 0.1.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/dist/AlertDialog/index.cjs +4 -180
- package/dist/AlertDialog/index.cjs.map +1 -1
- package/dist/AlertDialog/index.js +5 -144
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/Button/index.cjs +4 -131
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.js +5 -105
- package/dist/Button/index.js.map +1 -1
- package/dist/Checkbox/index.cjs +4 -78
- package/dist/Checkbox/index.cjs.map +1 -1
- package/dist/Checkbox/index.js +5 -42
- package/dist/Checkbox/index.js.map +1 -1
- package/dist/Input/index.cjs +4 -98
- package/dist/Input/index.cjs.map +1 -1
- package/dist/Input/index.js +5 -72
- package/dist/Input/index.js.map +1 -1
- package/dist/Modal/index.cjs +4 -115
- package/dist/Modal/index.cjs.map +1 -1
- package/dist/Modal/index.js +5 -79
- package/dist/Modal/index.js.map +1 -1
- package/dist/Radio/index.cjs +6 -81
- package/dist/Radio/index.cjs.map +1 -1
- package/dist/Radio/index.js +6 -43
- package/dist/Radio/index.js.map +1 -1
- package/dist/Select/index.cjs +4 -111
- package/dist/Select/index.cjs.map +1 -1
- package/dist/Select/index.js +5 -75
- package/dist/Select/index.js.map +1 -1
- package/dist/Switch/index.cjs +4 -66
- package/dist/Switch/index.cjs.map +1 -1
- package/dist/Switch/index.js +5 -30
- package/dist/Switch/index.js.map +1 -1
- package/dist/Textarea/index.cjs +4 -122
- package/dist/Textarea/index.cjs.map +1 -1
- package/dist/Textarea/index.js +5 -96
- package/dist/Textarea/index.js.map +1 -1
- package/dist/Toast/index.cjs +4 -177
- package/dist/Toast/index.cjs.map +1 -1
- package/dist/Toast/index.js +6 -141
- package/dist/Toast/index.js.map +1 -1
- package/dist/Tooltip/index.cjs +6 -100
- package/dist/Tooltip/index.cjs.map +1 -1
- package/dist/Tooltip/index.js +6 -62
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/chunk-2LFW4MM6.cjs +47 -0
- package/dist/chunk-2LFW4MM6.cjs.map +1 -0
- package/dist/chunk-2WKLA5RC.cjs +82 -0
- package/dist/chunk-2WKLA5RC.cjs.map +1 -0
- package/dist/chunk-2YGYLCCA.js +66 -0
- package/dist/chunk-2YGYLCCA.js.map +1 -0
- package/dist/chunk-323VGYMK.cjs +147 -0
- package/dist/chunk-323VGYMK.cjs.map +1 -0
- package/dist/chunk-3H47QMKS.js +47 -0
- package/dist/chunk-3H47QMKS.js.map +1 -0
- package/dist/chunk-3QSLHLC2.cjs +45 -0
- package/dist/chunk-3QSLHLC2.cjs.map +1 -0
- package/dist/chunk-4N5JIGIU.js +82 -0
- package/dist/chunk-4N5JIGIU.js.map +1 -0
- package/dist/chunk-DTGPVOJK.js +99 -0
- package/dist/chunk-DTGPVOJK.js.map +1 -0
- package/dist/chunk-DTQE42F7.js +33 -0
- package/dist/chunk-DTQE42F7.js.map +1 -0
- package/dist/chunk-DYO4PIBB.js +75 -0
- package/dist/chunk-DYO4PIBB.js.map +1 -0
- package/dist/chunk-GBMYANHH.js +149 -0
- package/dist/chunk-GBMYANHH.js.map +1 -0
- package/dist/chunk-I7KJ7WTN.cjs +149 -0
- package/dist/chunk-I7KJ7WTN.cjs.map +1 -0
- package/dist/chunk-JM4HDCLU.cjs +110 -0
- package/dist/chunk-JM4HDCLU.cjs.map +1 -0
- package/dist/chunk-JXJ6G634.cjs +75 -0
- package/dist/chunk-JXJ6G634.cjs.map +1 -0
- package/dist/chunk-LAPTEQ5N.js +45 -0
- package/dist/chunk-LAPTEQ5N.js.map +1 -0
- package/dist/chunk-LRATCHCB.cjs +66 -0
- package/dist/chunk-LRATCHCB.cjs.map +1 -0
- package/dist/chunk-OM4QMC4F.js +110 -0
- package/dist/chunk-OM4QMC4F.js.map +1 -0
- package/dist/chunk-PAXRFQUJ.cjs +33 -0
- package/dist/chunk-PAXRFQUJ.cjs.map +1 -0
- package/dist/chunk-PC3B67B4.cjs +78 -0
- package/dist/chunk-PC3B67B4.cjs.map +1 -0
- package/dist/chunk-PS6QXS5Z.js +11 -0
- package/dist/chunk-PS6QXS5Z.js.map +1 -0
- package/dist/chunk-Q26BJSLP.cjs +99 -0
- package/dist/chunk-Q26BJSLP.cjs.map +1 -0
- package/dist/chunk-R4E4BIPC.cjs +11 -0
- package/dist/chunk-R4E4BIPC.cjs.map +1 -0
- package/dist/chunk-R757N7RU.js +78 -0
- package/dist/chunk-R757N7RU.js.map +1 -0
- package/dist/chunk-RC773ZEY.js +147 -0
- package/dist/chunk-RC773ZEY.js.map +1 -0
- package/dist/index.cjs +54 -899
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -833
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport './styles.css';\nimport * as Dialog from '@radix-ui/react-dialog';\nimport { forwardRef } from 'react';\nimport type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { cx } from '../utils/cx.js';\n\ntype Placement = 'center' | 'bottom';\ntype Size = 'sm' | 'md' | 'lg';\n\n/**\n * 모달 루트. open/onOpenChange로 제어하거나, Modal.Trigger와 함께 비제어로도 사용.\n * Radix Dialog 기반 — 포커스 트랩·Esc·스크롤 락·포커스 복귀·aria 연결을 자동 제공.\n *\n * @example 제어형\n * <Modal open={open} onOpenChange={setOpen}>\n * <Modal.Content>...</Modal.Content>\n * </Modal>\n *\n * @example 비제어 (트리거)\n * <Modal>\n * <Modal.Trigger asChild><Button>열기</Button></Modal.Trigger>\n * <Modal.Content>...</Modal.Content>\n * </Modal>\n */\nconst Root = (props: ComponentPropsWithoutRef<typeof Dialog.Root>) => <Dialog.Root {...props} />;\nRoot.displayName = 'Modal';\n\n/** 모달을 여는 트리거. `asChild`로 임의 엘리먼트(Button 등)에 위임. */\nconst Trigger = Dialog.Trigger;\n\nexport interface ModalContentProps extends ComponentPropsWithoutRef<typeof Dialog.Content> {\n /**\n * 표시 위치.\n * - `center`: 화면 중앙 다이얼로그 (기본)\n * - `bottom`: 하단 바텀시트 (모바일에서 아래에서 올라옴)\n * @default 'center'\n */\n placement?: Placement;\n /**\n * 최대 너비. **`placement=\"center\"`에서만 적용** (bottom 바텀시트는 항상 풀 width).\n * @default 'md'\n */\n size?: Size;\n /** 백드롭(오버레이) 표시 여부. @default true */\n overlay?: boolean;\n /** 포털 렌더 대상. 기본은 document.body. 다른 요소에 렌더하려면 지정. */\n container?: HTMLElement | null;\n}\n\n/**\n * 오버레이 + 포털 + 다이얼로그 패널을 한 번에 렌더.\n * 내부에 Modal.Header / Modal.Body / Modal.Footer를 자유롭게 합성.\n */\nconst Content = forwardRef<ElementRef<typeof Dialog.Content>, ModalContentProps>(\n function ModalContent(\n { placement = 'center', size = 'md', overlay = true, container, className, children, ...rest },\n ref,\n ) {\n const classes = cx('nuri-modal', `nuri-modal--${placement}`, `nuri-modal--${size}`, className);\n\n return (\n <Dialog.Portal container={container}>\n {overlay && <Dialog.Overlay className=\"nuri-modal__overlay\" />}\n <Dialog.Content ref={ref} className={classes} {...rest}>\n {children}\n </Dialog.Content>\n </Dialog.Portal>\n );\n },\n);\n\n/** 헤더 영역 (Title/Description/CloseButton을 담는 레이아웃 슬롯). */\nconst Header = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function ModalHeader(\n { className, ...rest },\n ref,\n) {\n return <div ref={ref} className={cx('nuri-modal__header', className)} {...rest} />;\n});\n\nexport interface ModalTitleProps extends ComponentPropsWithoutRef<typeof Dialog.Title> {\n /**\n * 시각적으로는 숨기되 스크린리더에는 노출. 시각적 제목이 없는 모달도\n * 접근 가능한 이름을 가져야 하므로(Radix Dialog는 Title 필수), 이 옵션으로 처리.\n * @example <Modal.Title visuallyHidden>이미지 미리보기</Modal.Title>\n */\n visuallyHidden?: boolean;\n}\n\n/** 모달 제목. 렌더 시 자동으로 `aria-labelledby`로 연결됨 (Radix Dialog.Title). */\nconst Title = forwardRef<ElementRef<typeof Dialog.Title>, ModalTitleProps>(function ModalTitle(\n { visuallyHidden = false, className, ...rest },\n ref,\n) {\n return (\n <Dialog.Title\n ref={ref}\n className={cx('nuri-modal__title', visuallyHidden && 'nuri-sr-only', className)}\n {...rest}\n />\n );\n});\n\n/** 모달 설명. 렌더 시 자동으로 `aria-describedby`로 연결됨 (Radix Dialog.Description). */\nconst Description = forwardRef<\n ElementRef<typeof Dialog.Description>,\n ComponentPropsWithoutRef<typeof Dialog.Description>\n>(function ModalDescription({ className, ...rest }, ref) {\n return (\n <Dialog.Description ref={ref} className={cx('nuri-modal__description', className)} {...rest} />\n );\n});\n\n/** 본문 영역 (스크롤 가능). */\nconst Body = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function ModalBody(\n { className, ...rest },\n ref,\n) {\n return <div ref={ref} className={cx('nuri-modal__body', className)} {...rest} />;\n});\n\nexport interface ModalFooterProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * 액션 버튼 정렬.\n * - `end`: 우측 (기본, 데스크탑 관례)\n * - `start`: 좌측\n * - `center`: 가운데\n * - `between`: 양끝 분산 (예: 좌측 위험 액션 + 우측 확인)\n * - `full`: 버튼들이 가로를 균등하게 채움 (모바일 전체너비)\n * @default 'end'\n */\n align?: 'start' | 'center' | 'end' | 'between' | 'full';\n}\n\n/** 푸터 영역 (액션 버튼 배치). 정렬은 `align` prop으로 제어. */\nconst Footer = forwardRef<HTMLDivElement, ModalFooterProps>(function ModalFooter(\n { align = 'end', className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx('nuri-modal__footer', `nuri-modal__footer--${align}`, className)}\n {...rest}\n />\n );\n});\n\n/**\n * 모달을 닫는 액션. `asChild`로 임의 엘리먼트에 위임.\n * @example <Modal.Close asChild><Button variant=\"outline\">취소</Button></Modal.Close>\n */\nconst Close = Dialog.Close;\n\nconst CloseIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 5l10 10M15 5L5 15\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n);\n\n/** 우상단 X 닫기 버튼 (미리 스타일링됨). 기본 `aria-label=\"닫기\"`. */\nconst CloseButton = forwardRef<\n HTMLButtonElement,\n Omit<ComponentPropsWithoutRef<'button'>, 'children'> & { children?: ReactNode }\n>(function ModalCloseButton(\n { className, 'aria-label': ariaLabel = '닫기', children, ...rest },\n ref,\n) {\n return (\n <Dialog.Close asChild>\n <button\n ref={ref}\n type=\"button\"\n aria-label={ariaLabel}\n className={cx('nuri-modal__close', className)}\n {...rest}\n >\n {children ?? <CloseIcon />}\n </button>\n </Dialog.Close>\n );\n});\n\nexport const Modal = Object.assign(Root, {\n Trigger,\n Content,\n Header,\n Title,\n Description,\n Body,\n Footer,\n Close,\n CloseButton,\n});\n"],"mappings":";;;;;;AAEA,OAAO;AACP,YAAY,YAAY;AACxB,SAAS,kBAAkB;AAsB2C,cAqChE,YArCgE;AAAtE,IAAMA,QAAO,CAAC,UAAwD,oBAAQ,aAAP,EAAa,GAAG,OAAO;AAC9FA,MAAK,cAAc;AAGnB,IAAMC,WAAiB;AAyBvB,IAAMC,WAAU;AAAA,EACd,SAAS,aACP,EAAE,YAAY,UAAU,OAAO,MAAM,UAAU,MAAM,WAAW,WAAW,UAAU,GAAG,KAAK,GAC7F,KACA;AACA,UAAM,UAAU,GAAG,cAAc,eAAe,SAAS,IAAI,eAAe,IAAI,IAAI,SAAS;AAE7F,WACE,qBAAQ,eAAP,EAAc,WACZ;AAAA,iBAAW,oBAAQ,gBAAP,EAAe,WAAU,uBAAsB;AAAA,MAC5D,oBAAQ,gBAAP,EAAe,KAAU,WAAW,SAAU,GAAG,MAC/C,UACH;AAAA,OACF;AAAA,EAEJ;AACF;AAGA,IAAM,SAAS,WAA4D,SAAS,YAClF,EAAE,WAAW,GAAG,K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,MACnB;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,WAAW,GAAG,qBAAqB,SAAS;AAAA,MAC3C,GAAG;AAAA,MAEH,sBAAY,oBAAC,aAAU;AAAA;AAAA,EAC1B,GACF;AAEJ,CAAC;AAEM,IAAM,QAAQ,OAAO,OAAOL,OAAM;AAAA,EACvC,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAAC;AAAA,EACA;AACF,CAAC;","names":["Root","Trigger","Content","Title","Description","Close"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
cx
|
|
4
|
+
} from "./chunk-PS6QXS5Z.js";
|
|
5
|
+
|
|
6
|
+
// src/Textarea/Textarea.tsx
|
|
7
|
+
import "./Textarea/styles.css";
|
|
8
|
+
import { forwardRef, useCallback, useId, useLayoutEffect, useRef } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var Textarea = forwardRef(function Textarea2({
|
|
11
|
+
label,
|
|
12
|
+
hideLabel = false,
|
|
13
|
+
description,
|
|
14
|
+
invalid = false,
|
|
15
|
+
errorMessage,
|
|
16
|
+
block = false,
|
|
17
|
+
resize = "vertical",
|
|
18
|
+
autosize = false,
|
|
19
|
+
maxRows,
|
|
20
|
+
rows = 3,
|
|
21
|
+
disabled = false,
|
|
22
|
+
className,
|
|
23
|
+
id: idProp,
|
|
24
|
+
value,
|
|
25
|
+
onChange,
|
|
26
|
+
"aria-describedby": ariaDescribedby,
|
|
27
|
+
...rest
|
|
28
|
+
}, ref) {
|
|
29
|
+
const reactId = useId();
|
|
30
|
+
const id = idProp ?? `nuri-textarea-${reactId}`;
|
|
31
|
+
const messageId = `${id}-message`;
|
|
32
|
+
const innerRef = useRef(null);
|
|
33
|
+
const setRefs = useCallback(
|
|
34
|
+
(node) => {
|
|
35
|
+
innerRef.current = node;
|
|
36
|
+
if (typeof ref === "function") ref(node);
|
|
37
|
+
else if (ref) ref.current = node;
|
|
38
|
+
},
|
|
39
|
+
[ref]
|
|
40
|
+
);
|
|
41
|
+
const fitHeight = useCallback(() => {
|
|
42
|
+
const el = innerRef.current;
|
|
43
|
+
if (!el) return;
|
|
44
|
+
const cs = getComputedStyle(el);
|
|
45
|
+
const borders = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
|
46
|
+
const lineHeight = parseFloat(cs.lineHeight);
|
|
47
|
+
const maxHeight = maxRows != null && !Number.isNaN(lineHeight) ? maxRows * lineHeight + parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom) + borders : Infinity;
|
|
48
|
+
el.style.height = "auto";
|
|
49
|
+
const contentHeight = el.scrollHeight + borders;
|
|
50
|
+
const next = Math.min(contentHeight, maxHeight);
|
|
51
|
+
if (!Number.isNaN(next)) el.style.height = `${next}px`;
|
|
52
|
+
el.style.overflowY = contentHeight > maxHeight ? "auto" : "hidden";
|
|
53
|
+
}, [maxRows]);
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
if (autosize) fitHeight();
|
|
56
|
+
}, [autosize, fitHeight, value]);
|
|
57
|
+
const handleChange = (e) => {
|
|
58
|
+
onChange?.(e);
|
|
59
|
+
if (autosize) fitHeight();
|
|
60
|
+
};
|
|
61
|
+
const message = invalid && errorMessage != null ? errorMessage : description;
|
|
62
|
+
const hasMessage = message != null;
|
|
63
|
+
const describedBy = cx(hasMessage ? messageId : void 0, ariaDescribedby) || void 0;
|
|
64
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("nuri-textarea", block && "nuri-textarea--block", className), children: [
|
|
65
|
+
label != null && /* @__PURE__ */ jsx("label", { htmlFor: id, className: cx("nuri-textarea__label", hideLabel && "nuri-sr-only"), children: label }),
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"textarea",
|
|
68
|
+
{
|
|
69
|
+
ref: setRefs,
|
|
70
|
+
id,
|
|
71
|
+
rows,
|
|
72
|
+
value,
|
|
73
|
+
onChange: handleChange,
|
|
74
|
+
className: cx(
|
|
75
|
+
"nuri-textarea__control",
|
|
76
|
+
invalid && "nuri-textarea__control--invalid",
|
|
77
|
+
(resize === "none" || autosize) && "nuri-textarea__control--resize-none"
|
|
78
|
+
),
|
|
79
|
+
disabled,
|
|
80
|
+
"aria-invalid": invalid || void 0,
|
|
81
|
+
"aria-describedby": describedBy,
|
|
82
|
+
...rest
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
hasMessage && /* @__PURE__ */ jsx(
|
|
86
|
+
"p",
|
|
87
|
+
{
|
|
88
|
+
id: messageId,
|
|
89
|
+
className: cx("nuri-textarea__message", invalid && "nuri-textarea__message--error"),
|
|
90
|
+
children: message
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] });
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
Textarea
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=chunk-DTGPVOJK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Textarea/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport './styles.css';\nimport { forwardRef, useCallback, useId, useLayoutEffect, useRef } from 'react';\nimport type { ChangeEvent, TextareaHTMLAttributes, ReactNode } from 'react';\nimport { cx } from '../utils/cx.js';\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /**\n * 라벨 (필드 위). 지정 시 `<label>`로 렌더되어 자동 연결됨.\n * 라벨을 두지 않으면 `aria-label`로 접근 가능한 이름을 주세요.\n */\n label?: ReactNode;\n /** 라벨을 시각적으로만 숨김 (스크린리더에는 노출). @default false */\n hideLabel?: boolean;\n /** 평상시 힌트 (회색, 필드 아래). `aria-describedby`로 연결됨. */\n description?: ReactNode;\n /** 에러 상태 — 보더·텍스트·배경이 에러색으로 바뀌고 `aria-invalid`가 설정됨. */\n invalid?: boolean;\n /** `invalid`일 때 표시할 에러 메시지 (빨강). 있으면 description을 대체. */\n errorMessage?: ReactNode;\n /** 컨테이너 전체 너비로 확장. @default false */\n block?: boolean;\n /**\n * 크기 조절 핸들. 세로 조절 허용이 기본 — 긴 입력을 사용자가 늘려 볼 수 있게.\n * `autosize`가 켜지면 무시된다(자동 크기와 수동 핸들은 충돌).\n * @default 'vertical'\n */\n resize?: 'vertical' | 'none';\n /**\n * 내용에 따라 높이 자동 조절. `rows`(최소)에서 시작해 내용만큼 늘어나고,\n * `maxRows`에 도달하면 멈추고 스크롤이 생긴다.\n * @default false\n */\n autosize?: boolean;\n /** `autosize`일 때 최대 줄 수 — 넘으면 스크롤. 미지정 시 무제한 확장. */\n maxRows?: number;\n}\n\n/**\n * 여러 줄 텍스트 입력. Input과 동일한 디자인 언어(보더·상태·타이포)와\n * 라벨/힌트/에러 자동 연결 패턴을 따르는 자체 완결형.\n * 높이는 native `rows`(기본 3)로 제어하고, `autosize`로 자동 확장도 지원한다.\n *\n * @example\n * <Textarea label=\"문의 내용\" rows={5} block />\n *\n * @example 자동 높이 — 3줄에서 시작해 8줄까지 늘어난 뒤 스크롤\n * <Textarea label=\"댓글\" autosize rows={3} maxRows={8} />\n */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n label,\n hideLabel = false,\n description,\n invalid = false,\n errorMessage,\n block = false,\n resize = 'vertical',\n autosize = false,\n maxRows,\n rows = 3,\n disabled = false,\n className,\n id: idProp,\n value,\n onChange,\n 'aria-describedby': ariaDescribedby,\n ...rest\n },\n ref,\n) {\n const reactId = useId();\n const id = idProp ?? `nuri-textarea-${reactId}`;\n const messageId = `${id}-message`;\n\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n const setRefs = useCallback(\n (node: HTMLTextAreaElement | null) => {\n innerRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n // autosize: height를 내용(scrollHeight)에 맞추되 maxRows 상한에서 클램프.\n const fitHeight = useCallback(() => {\n const el = innerRef.current;\n if (!el) return;\n const cs = getComputedStyle(el);\n const borders = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);\n const lineHeight = parseFloat(cs.lineHeight);\n // maxRows → px 상한 (line-height 계산 불가 환경에서는 무제한)\n const maxHeight =\n maxRows != null && !Number.isNaN(lineHeight)\n ? maxRows * lineHeight + parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom) + borders\n : Infinity;\n\n el.style.height = 'auto'; // 줄어드는 경우도 반영되도록 초기화 후 측정\n const contentHeight = el.scrollHeight + borders; // scrollHeight는 border 미포함(border-box 보정)\n const next = Math.min(contentHeight, maxHeight);\n if (!Number.isNaN(next)) el.style.height = `${next}px`;\n el.style.overflowY = contentHeight > maxHeight ? 'auto' : 'hidden';\n }, [maxRows]);\n\n // 마운트·제어형 value 변경·autosize 토글 시 재계산\n useLayoutEffect(() => {\n if (autosize) fitHeight();\n }, [autosize, fitHeight, value]);\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(e);\n if (autosize) fitHeight(); // 비제어형 입력에도 반응\n };\n\n // invalid + errorMessage → 에러 메시지 / 아니면 힌트. 시각 슬롯은 항상 한 줄. (Input과 동일)\n const message = invalid && errorMessage != null ? errorMessage : description;\n const hasMessage = message != null;\n const describedBy =\n cx(hasMessage ? messageId : undefined, ariaDescribedby as string | undefined) || undefined;\n\n return (\n <div className={cx('nuri-textarea', block && 'nuri-textarea--block', className)}>\n {label != null && (\n <label htmlFor={id} className={cx('nuri-textarea__label', hideLabel && 'nuri-sr-only')}>\n {label}\n </label>\n )}\n\n <textarea\n ref={setRefs}\n id={id}\n rows={rows}\n value={value}\n onChange={handleChange}\n className={cx(\n 'nuri-textarea__control',\n invalid && 'nuri-textarea__control--invalid',\n (resize === 'none' || autosize) && 'nuri-textarea__control--resize-none',\n )}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n {...rest}\n />\n\n {hasMessage && (\n <p\n id={messageId}\n className={cx('nuri-textarea__message', invalid && 'nuri-textarea__message--error')}\n >\n {message}\n </p>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;AAEA,OAAO;AACP,SAAS,YAAY,aAAa,OAAO,iBAAiB,cAAc;AAwHpE,SAEI,KAFJ;AAzEG,IAAM,WAAW,WAA+C,SAASA,UAC9E;AAAA,EACE;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AAAA,EACX;AAAA,EACA,OAAO;AAAA,EACP,WAAW;AAAA,EACX;AAAA,EACA,IAAI;AAAA,EACJ;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAU,MAAM;AACtB,QAAM,KAAK,UAAU,iBAAiB,OAAO;AAC7C,QAAM,YAAY,GAAG,EAAE;AAEvB,QAAM,WAAW,OAAmC,IAAI;AACxD,QAAM,UAAU;AAAA,IACd,CAAC,SAAqC;AACpC,eAAS,UAAU;AACnB,UAAI,OAAO,QAAQ,WAAY,KAAI,IAAI;AAAA,eAC9B,IAAK,KAAI,UAAU;AAAA,IAC9B;AAAA,IACA,CAAC,GAAG;AAAA,EACN;AAGA,QAAM,YAAY,YAAY,MAAM;AAClC,UAAM,KAAK,SAAS;AACpB,QAAI,CAAC,GAAI;AACT,UAAM,KAAK,iBAAiB,EAAE;AAC9B,UAAM,UAAU,WAAW,GAAG,cAAc,IAAI,WAAW,GAAG,iBAAiB;AAC/E,UAAM,aAAa,WAAW,GAAG,UAAU;AAE3C,UAAM,YACJ,WAAW,QAAQ,CAAC,OAAO,MAAM,UAAU,IACvC,UAAU,aAAa,WAAW,GAAG,UAAU,IAAI,WAAW,GAAG,aAAa,IAAI,UAClF;AAEN,OAAG,MAAM,SAAS;AAClB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-PS6QXS5Z.js";
|
|
5
|
+
|
|
6
|
+
// src/Switch/Switch.tsx
|
|
7
|
+
import "./Switch/styles.css";
|
|
8
|
+
import * as RadixSwitch from "@radix-ui/react-switch";
|
|
9
|
+
import { forwardRef, useId } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var Switch = forwardRef(function Switch2({ label, disabled = false, id: idProp, className, ...rest }, ref) {
|
|
12
|
+
const reactId = useId();
|
|
13
|
+
const id = idProp ?? `nuri-switch-${reactId}`;
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("nuri-switch", className), children: [
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
RadixSwitch.Root,
|
|
17
|
+
{
|
|
18
|
+
ref,
|
|
19
|
+
id,
|
|
20
|
+
className: "nuri-switch__control",
|
|
21
|
+
disabled,
|
|
22
|
+
...rest,
|
|
23
|
+
children: /* @__PURE__ */ jsx(RadixSwitch.Thumb, { className: "nuri-switch__thumb" })
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
label != null && /* @__PURE__ */ jsx("label", { htmlFor: id, className: "nuri-switch__label", children: label })
|
|
27
|
+
] });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
Switch
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-DTQE42F7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Switch/Switch.tsx"],"sourcesContent":["'use client';\n\nimport './styles.css';\nimport * as RadixSwitch from '@radix-ui/react-switch';\nimport { forwardRef, useId } from 'react';\nimport type { ReactNode } from 'react';\nimport { cx } from '../utils/cx.js';\n\nexport interface SwitchProps {\n /**\n * 라벨 (컨트롤 우측). 디자인 시스템의 Toggle은 컨트롤 단독 정의지만,\n * 범용 사용을 위해 라벨을 지원한다(Checkbox 라벨 스타일 준용). 없으면 `aria-label` 필수.\n */\n label?: ReactNode;\n /** 켜짐 상태 (제어형). */\n checked?: boolean;\n /** 초기 상태 (비제어형). */\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n disabled?: boolean;\n /** 폼 전송용 name. */\n name?: string;\n /** 폼 전송 시 값. @default 'on' */\n value?: string;\n required?: boolean;\n id?: string;\n className?: string;\n 'aria-label'?: string;\n}\n\n/**\n * 스위치(토글). Radix Switch 기반 — `role=\"switch\"`·Space/Enter 토글·폼 참여 자동.\n * 즉시 적용되는 켬/끔 설정에 사용한다 (제출이 필요한 선택은 Checkbox).\n *\n * @example\n * <Switch label=\"알림 받기\" checked={on} onCheckedChange={setOn} />\n */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n { label, disabled = false, id: idProp, className, ...rest },\n ref,\n) {\n const reactId = useId();\n const id = idProp ?? `nuri-switch-${reactId}`;\n\n return (\n <div className={cx('nuri-switch', className)}>\n <RadixSwitch.Root\n ref={ref}\n id={id}\n className=\"nuri-switch__control\"\n disabled={disabled}\n {...rest}\n >\n <RadixSwitch.Thumb className=\"nuri-switch__thumb\" />\n </RadixSwitch.Root>\n {label != null && (\n <label htmlFor={id} className=\"nuri-switch__label\">\n {label}\n </label>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;AAEA,OAAO;AACP,YAAY,iBAAiB;AAC7B,SAAS,YAAY,aAAa;AAyC9B,SAQI,KARJ;AARG,IAAM,SAAS,WAA2C,SAASA,QACxE,EAAE,OAAO,WAAW,OAAO,IAAI,QAAQ,WAAW,GAAG,KAAK,GAC1D,KACA;AACA,QAAM,UAAU,MAAM;AACtB,QAAM,KAAK,UAAU,eAAe,OAAO;AAE3C,SACE,qBAAC,SAAI,WAAW,GAAG,eAAe,SAAS,GACzC;AAAA;AAAA,MAAa;AAAA,MAAZ;AAAA,QACC;AAAA,QACA;AAAA,QACA,WAAU;AAAA,QACV;AAAA,QACC,GAAG;AAAA,QAEJ,8BAAa,mBAAZ,EAAkB,WAAU,sBAAqB;AAAA;AAAA,IACpD;AAAA,IACC,SAAS,QACR,oBAAC,WAAM,SAAS,IAAI,WAAU,sBAC3B,iBACH;AAAA,KAEJ;AAEJ,CAAC;","names":["Switch"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
cx
|
|
4
|
+
} from "./chunk-PS6QXS5Z.js";
|
|
5
|
+
|
|
6
|
+
// src/Input/Input.tsx
|
|
7
|
+
import "./Input/styles.css";
|
|
8
|
+
import { forwardRef, useId } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var Input = forwardRef(function Input2({
|
|
11
|
+
size = "md",
|
|
12
|
+
label,
|
|
13
|
+
hideLabel = false,
|
|
14
|
+
description,
|
|
15
|
+
invalid = false,
|
|
16
|
+
errorMessage,
|
|
17
|
+
iconLeft,
|
|
18
|
+
iconRight,
|
|
19
|
+
block = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
className,
|
|
22
|
+
id: idProp,
|
|
23
|
+
"aria-describedby": ariaDescribedby,
|
|
24
|
+
...rest
|
|
25
|
+
}, ref) {
|
|
26
|
+
const reactId = useId();
|
|
27
|
+
const id = idProp ?? `nuri-input-${reactId}`;
|
|
28
|
+
const messageId = `${id}-message`;
|
|
29
|
+
const message = invalid && errorMessage != null ? errorMessage : description;
|
|
30
|
+
const hasMessage = message != null;
|
|
31
|
+
const describedBy = cx(hasMessage ? messageId : void 0, ariaDescribedby) || void 0;
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("nuri-input", block && "nuri-input--block", className), children: [
|
|
33
|
+
label != null && /* @__PURE__ */ jsx("label", { htmlFor: id, className: cx("nuri-input__label", hideLabel && "nuri-sr-only"), children: label }),
|
|
34
|
+
/* @__PURE__ */ jsxs(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: cx(
|
|
38
|
+
"nuri-input__field",
|
|
39
|
+
`nuri-input__field--${size}`,
|
|
40
|
+
invalid && "nuri-input__field--invalid",
|
|
41
|
+
disabled && "nuri-input__field--disabled"
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
iconLeft != null && /* @__PURE__ */ jsx("span", { className: "nuri-input__icon", "aria-hidden": "true", children: iconLeft }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"input",
|
|
47
|
+
{
|
|
48
|
+
ref,
|
|
49
|
+
id,
|
|
50
|
+
className: "nuri-input__control",
|
|
51
|
+
disabled,
|
|
52
|
+
"aria-invalid": invalid || void 0,
|
|
53
|
+
"aria-describedby": describedBy,
|
|
54
|
+
...rest
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
iconRight != null && /* @__PURE__ */ jsx("span", { className: "nuri-input__icon", "aria-hidden": "true", children: iconRight })
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
hasMessage && /* @__PURE__ */ jsx(
|
|
62
|
+
"p",
|
|
63
|
+
{
|
|
64
|
+
id: messageId,
|
|
65
|
+
className: cx("nuri-input__message", invalid && "nuri-input__message--error"),
|
|
66
|
+
children: message
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
Input
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-DYO4PIBB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Input/Input.tsx"],"sourcesContent":["'use client';\n\nimport './styles.css';\nimport { forwardRef, useId } from 'react';\nimport type { InputHTMLAttributes, ReactNode } from 'react';\nimport { cx } from '../utils/cx.js';\n\ntype Size = 'sm' | 'md' | 'lg';\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * 사이즈. sm 36 / md 42 / lg 48 px 높이.\n * @default 'md'\n */\n size?: Size;\n /**\n * 라벨 (필드 위). 지정 시 `<label>`로 렌더되어 자동 연결됨.\n * 라벨을 두지 않으면 `aria-label`로 접근 가능한 이름을 주세요\n * (placeholder는 이름을 대체하지 못함 — 입력 시 사라지고 대비가 낮음).\n */\n label?: ReactNode;\n /**\n * 라벨을 시각적으로만 숨김 (스크린리더에는 노출). 디자인상 라벨을 안 보이게 하되\n * 접근성 이름은 유지할 때 사용.\n * @default false\n */\n hideLabel?: boolean;\n /** 평상시 힌트 (회색, 필드 아래). `aria-describedby`로 연결됨. */\n description?: ReactNode;\n /** 에러 상태 — 보더·텍스트·배경이 에러색으로 바뀌고 `aria-invalid`가 설정됨. */\n invalid?: boolean;\n /** `invalid`일 때 표시할 에러 메시지 (빨강). 있으면 description을 대체. */\n errorMessage?: ReactNode;\n /** 좌측 어도먼트 (아이콘 등). */\n iconLeft?: ReactNode;\n /** 우측 어도먼트 (아이콘·clear·버튼 등). */\n iconRight?: ReactNode;\n /** 컨테이너 전체 너비로 확장. @default false */\n block?: boolean;\n}\n\n/**\n * 텍스트 입력 필드. 옵션으로 라벨(위)·헬퍼/에러 메시지(아래)를 포함하는 자체 완결형.\n * 상태(default/focus/invalid/disabled)는 CSS로, 값 채움(filled)은 네이티브로 처리.\n *\n * @example 기본\n * <Input placeholder=\"검색어\" aria-label=\"검색\" />\n *\n * @example 라벨 + 헬퍼 + 에러\n * <Input\n * label=\"비밀번호\"\n * description=\"8자 이상 입력하세요\"\n * invalid\n * errorMessage=\"비밀번호가 일치하지 않습니다\"\n * />\n */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n size = 'md',\n label,\n hideLabel = false,\n description,\n invalid = false,\n errorMessage,\n iconLeft,\n iconRight,\n block = false,\n disabled = false,\n className,\n id: idProp,\n 'aria-describedby': ariaDescribedby,\n ...rest\n },\n ref,\n) {\n const reactId = useId();\n const id = idProp ?? `nuri-input-${reactId}`;\n const messageId = `${id}-message`;\n\n // invalid + errorMessage → 에러 메시지 / 아니면 힌트. 시각 슬롯은 항상 한 줄.\n const message = invalid && errorMessage != null ? errorMessage : description;\n const hasMessage = message != null;\n const describedBy =\n cx(hasMessage ? messageId : undefined, ariaDescribedby as string | undefined) || undefined;\n\n return (\n <div className={cx('nuri-input', block && 'nuri-input--block', className)}>\n {label != null && (\n <label htmlFor={id} className={cx('nuri-input__label', hideLabel && 'nuri-sr-only')}>\n {label}\n </label>\n )}\n\n <div\n className={cx(\n 'nuri-input__field',\n `nuri-input__field--${size}`,\n invalid && 'nuri-input__field--invalid',\n disabled && 'nuri-input__field--disabled',\n )}\n >\n {iconLeft != null && (\n <span className=\"nuri-input__icon\" aria-hidden=\"true\">\n {iconLeft}\n </span>\n )}\n <input\n ref={ref}\n id={id}\n className=\"nuri-input__control\"\n disabled={disabled}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n {...rest}\n />\n {iconRight != null && (\n <span className=\"nuri-input__icon\" aria-hidden=\"true\">\n {iconRight}\n </span>\n )}\n </div>\n\n {hasMessage && (\n <p\n id={messageId}\n className={cx('nuri-input__message', invalid && 'nuri-input__message--error')}\n >\n {message}\n </p>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;AAEA,OAAO;AACP,SAAS,YAAY,aAAa;AAqF1B,cAKF,YALE;AAhCD,IAAM,QAAQ,WAAyC,SAASA,OACrE;AAAA,EACE,OAAO;AAAA,EACP;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,WAAW;AAAA,EACX;AAAA,EACA,IAAI;AAAA,EACJ,oBAAoB;AAAA,EACpB,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAU,MAAM;AACtB,QAAM,KAAK,UAAU,cAAc,OAAO;AAC1C,QAAM,YAAY,GAAG,EAAE;AAGvB,QAAM,UAAU,WAAW,gBAAgB,OAAO,eAAe;AACjE,QAAM,aAAa,WAAW;AAC9B,QAAM,cACJ,GAAG,aAAa,YAAY,QAAW,eAAqC,KAAK;AAEnF,SACE,qBAAC,SAAI,WAAW,GAAG,cAAc,SAAS,qBAAqB,SAAS,GACrE;AAAA,aAAS,QACR,oBAAC,WAAM,SAAS,IAAI,WAAW,GAAG,qBAAqB,aAAa,cAAc,GAC/E,iBACH;AAAA,IAGF;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,sBAAsB,IAAI;AAAA,UAC1B,WAAW;AAAA,UACX,YAAY;AAAA,QACd;AAAA,QAEC;AAAA,sBAAY,QACX,oBAAC,UAAK,WAAU,oBAAmB,eAAY,QAC5C,oBACH;AAAA,UAEF;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA,WAAU;AAAA,cACV;AAAA,cACA,gBAAc,WAAW;AAAA,cACzB,oBAAkB;AAAA,cACjB,GAAG;AAAA;AAAA,UACN;AAAA,UACC,aAAa,QACZ,oBAAC,UAAK,WAAU,oBAAmB,eAAY,QAC5C,qBACH;AAAA;AAAA;AAAA,IAEJ;AAAA,IAEC,cACC;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,WAAW,GAAG,uBAAuB,WAAW,4BAA4B;AAAA,QAE3E;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ,CAAC;","names":["Input"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
cx
|
|
4
|
+
} from "./chunk-PS6QXS5Z.js";
|
|
5
|
+
|
|
6
|
+
// src/AlertDialog/AlertDialog.tsx
|
|
7
|
+
import "./AlertDialog/styles.css";
|
|
8
|
+
import * as Alert from "@radix-ui/react-alert-dialog";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
|
|
11
|
+
// src/AlertDialog/icons.tsx
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var SuccessIcon = () => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
14
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "12", fill: "var(--nuri-alert-tone-success-bg)" }),
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
"path",
|
|
17
|
+
{
|
|
18
|
+
d: "M15.77 9.58L10.65 14.70L8.90 12.95",
|
|
19
|
+
stroke: "var(--nuri-alert-tone-success-fg)",
|
|
20
|
+
strokeWidth: "2.5",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round"
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
] });
|
|
26
|
+
var WarningIcon = () => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
27
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "12", fill: "var(--nuri-alert-tone-warning-bg)" }),
|
|
28
|
+
/* @__PURE__ */ jsx(
|
|
29
|
+
"path",
|
|
30
|
+
{
|
|
31
|
+
d: "M12 6.75V12",
|
|
32
|
+
stroke: "var(--nuri-alert-tone-warning-fg)",
|
|
33
|
+
strokeWidth: "2.5",
|
|
34
|
+
strokeLinecap: "round"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "16.31", r: "1.1", fill: "var(--nuri-alert-tone-warning-fg)" })
|
|
38
|
+
] });
|
|
39
|
+
var InfoIcon = () => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "12", fill: "var(--nuri-alert-tone-info-bg)" }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"path",
|
|
43
|
+
{
|
|
44
|
+
d: "M12.25 7h0.01",
|
|
45
|
+
stroke: "var(--nuri-alert-tone-info-fg)",
|
|
46
|
+
strokeWidth: "3",
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round"
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
"path",
|
|
53
|
+
{
|
|
54
|
+
d: "M11 12h1.25v5h1.25",
|
|
55
|
+
stroke: "var(--nuri-alert-tone-info-fg)",
|
|
56
|
+
strokeWidth: "2.5",
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] });
|
|
62
|
+
var defaultToneIcon = {
|
|
63
|
+
info: /* @__PURE__ */ jsx(InfoIcon, {}),
|
|
64
|
+
success: /* @__PURE__ */ jsx(SuccessIcon, {}),
|
|
65
|
+
warning: /* @__PURE__ */ jsx(WarningIcon, {})
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/AlertDialog/AlertDialog.tsx
|
|
69
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
70
|
+
var Root2 = (props) => /* @__PURE__ */ jsx2(Alert.Root, { ...props });
|
|
71
|
+
Root2.displayName = "AlertDialog";
|
|
72
|
+
var Trigger2 = Alert.Trigger;
|
|
73
|
+
var Content2 = forwardRef(
|
|
74
|
+
function AlertDialogContent({ tone = "info", icon, overlay = true, container, className, children, ...rest }, ref) {
|
|
75
|
+
const resolvedIcon = icon === void 0 ? defaultToneIcon[tone] : icon;
|
|
76
|
+
return /* @__PURE__ */ jsxs2(Alert.Portal, { container, children: [
|
|
77
|
+
overlay && /* @__PURE__ */ jsx2(Alert.Overlay, { className: "nuri-alert__overlay" }),
|
|
78
|
+
/* @__PURE__ */ jsxs2(
|
|
79
|
+
Alert.Content,
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
className: cx("nuri-alert", `nuri-alert--${tone}`, className),
|
|
83
|
+
...rest,
|
|
84
|
+
children: [
|
|
85
|
+
resolvedIcon != null && /* @__PURE__ */ jsx2("div", { className: "nuri-alert__icon", "aria-hidden": "true", children: resolvedIcon }),
|
|
86
|
+
children
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
var Header = forwardRef(
|
|
94
|
+
function AlertDialogHeader({ className, ...rest }, ref) {
|
|
95
|
+
return /* @__PURE__ */ jsx2("div", { ref, className: cx("nuri-alert__header", className), ...rest });
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
var Title2 = forwardRef(function AlertDialogTitle({ className, ...rest }, ref) {
|
|
99
|
+
return /* @__PURE__ */ jsx2(Alert.Title, { ref, className: cx("nuri-alert__title", className), ...rest });
|
|
100
|
+
});
|
|
101
|
+
var Description2 = forwardRef(function AlertDialogDescription({ className, ...rest }, ref) {
|
|
102
|
+
return /* @__PURE__ */ jsx2(Alert.Description, { ref, className: cx("nuri-alert__description", className), ...rest });
|
|
103
|
+
});
|
|
104
|
+
var Body = forwardRef(function AlertDialogBody({ className, ...rest }, ref) {
|
|
105
|
+
return /* @__PURE__ */ jsx2("div", { ref, className: cx("nuri-alert__body", className), ...rest });
|
|
106
|
+
});
|
|
107
|
+
var Footer = forwardRef(function AlertDialogFooter({ align = "full", className, ...rest }, ref) {
|
|
108
|
+
return /* @__PURE__ */ jsx2(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
ref,
|
|
112
|
+
className: cx("nuri-alert__footer", `nuri-alert__footer--${align}`, className),
|
|
113
|
+
...rest
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
var Action2 = Alert.Action;
|
|
118
|
+
var Cancel2 = Alert.Cancel;
|
|
119
|
+
var CloseIcon = () => /* @__PURE__ */ jsx2("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M5 5l10 10M15 5L5 15", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
|
|
120
|
+
var CloseButton = forwardRef(function AlertDialogCloseButton({ className, "aria-label": ariaLabel = "\uB2EB\uAE30", children, ...rest }, ref) {
|
|
121
|
+
return /* @__PURE__ */ jsx2(Alert.Cancel, { asChild: true, children: /* @__PURE__ */ jsx2(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
type: "button",
|
|
126
|
+
"aria-label": ariaLabel,
|
|
127
|
+
className: cx("nuri-alert__close", className),
|
|
128
|
+
...rest,
|
|
129
|
+
children: children ?? /* @__PURE__ */ jsx2(CloseIcon, {})
|
|
130
|
+
}
|
|
131
|
+
) });
|
|
132
|
+
});
|
|
133
|
+
var AlertDialog = Object.assign(Root2, {
|
|
134
|
+
Trigger: Trigger2,
|
|
135
|
+
Content: Content2,
|
|
136
|
+
Header,
|
|
137
|
+
Title: Title2,
|
|
138
|
+
Description: Description2,
|
|
139
|
+
Body,
|
|
140
|
+
Footer,
|
|
141
|
+
Action: Action2,
|
|
142
|
+
Cancel: Cancel2,
|
|
143
|
+
CloseButton
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
AlertDialog
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=chunk-GBMYANHH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/AlertDialog/AlertDialog.tsx","../src/AlertDialog/icons.tsx"],"sourcesContent":["'use client';\n\nimport './styles.css';\nimport * as Alert from '@radix-ui/react-alert-dialog';\nimport { forwardRef } from 'react';\nimport type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { cx } from '../utils/cx.js';\nimport { defaultToneIcon } from './icons.js';\n\ntype Tone = 'info' | 'success' | 'warning';\n\n/**\n * 확인 강제형 다이얼로그 (alertdialog). Radix AlertDialog 기반.\n *\n * 일반 Modal과의 차이:\n * - `role=\"alertdialog\"` — 스크린리더가 더 강하게 안내\n * - **바깥(백드롭) 클릭으로 닫히지 않음** — 실수로 닫히는 것 방지\n * - 포커스가 기본적으로 Cancel(취소)에 위치 — 실수로 위험 액션 방지\n * - **중앙 정렬 + 상단 아이콘** (디자인 시스템 표준 레이아웃)\n *\n * Esc 키는 닫힘(키보드 탈출구 — 접근성). 막으려면 Content에 `onEscapeKeyDown` 전달.\n *\n * @example\n * <AlertDialog>\n * <AlertDialog.Trigger asChild><Button>삭제</Button></AlertDialog.Trigger>\n * <AlertDialog.Content tone=\"warning\">\n * <AlertDialog.Header>\n * <AlertDialog.Title>정말 삭제할까요?</AlertDialog.Title>\n * <AlertDialog.Description>되돌릴 수 없습니다.</AlertDialog.Description>\n * </AlertDialog.Header>\n * <AlertDialog.Footer>\n * <AlertDialog.Cancel asChild><Button variant=\"outline\">취소</Button></AlertDialog.Cancel>\n * <AlertDialog.Action asChild><Button onClick={onDelete}>삭제</Button></AlertDialog.Action>\n * </AlertDialog.Footer>\n * </AlertDialog.Content>\n * </AlertDialog>\n */\nconst Root = (props: ComponentPropsWithoutRef<typeof Alert.Root>) => <Alert.Root {...props} />;\nRoot.displayName = 'AlertDialog';\n\n/** 다이얼로그를 여는 트리거. `asChild`로 임의 엘리먼트에 위임. */\nconst Trigger = Alert.Trigger;\n\nexport interface AlertDialogContentProps extends ComponentPropsWithoutRef<typeof Alert.Content> {\n /**\n * 상태 톤 — 기본 아이콘과 그 색을 결정.\n * @default 'info'\n */\n tone?: Tone;\n /**\n * 상단 아이콘.\n * - 미지정: `tone`에 맞는 **기본 아이콘** 자동 렌더\n * - `ReactNode`: 커스텀 아이콘으로 교체\n * - `null`: 아이콘 제거\n */\n icon?: ReactNode | null;\n /** 백드롭(오버레이) 표시 여부. @default true */\n overlay?: boolean;\n /** 포털 렌더 대상. 기본은 document.body. 다른 요소에 렌더하려면 지정. */\n container?: HTMLElement | null;\n}\n\n/** 오버레이 + 포털 + 패널을 한 번에 렌더. 중앙 정렬 + 상단 아이콘 레이아웃. */\nconst Content = forwardRef<ElementRef<typeof Alert.Content>, AlertDialogContentProps>(\n function AlertDialogContent(\n { tone = 'info', icon, overlay = true, container, className, children, ...rest },\n ref,\n ) {\n // icon 미지정(undefined) → 기본 tone 아이콘 / null → 제거 / ReactNode → 교체\n const resolvedIcon = icon === undefined ? defaultToneIcon[tone] : icon;\n return (\n <Alert.Portal container={container}>\n {overlay && <Alert.Overlay className=\"nuri-alert__overlay\" />}\n <Alert.Content\n ref={ref}\n className={cx('nuri-alert', `nuri-alert--${tone}`, className)}\n {...rest}\n >\n {resolvedIcon != null && (\n <div className=\"nuri-alert__icon\" aria-hidden=\"true\">\n {resolvedIcon}\n </div>\n )}\n {children}\n </Alert.Content>\n </Alert.Portal>\n );\n },\n);\n\n/** 헤더 슬롯 (Title/Description 묶음, 중앙 정렬). */\nconst Header = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(\n function AlertDialogHeader({ className, ...rest }, ref) {\n return <div ref={ref} className={cx('nuri-alert__header', className)} {...rest} />;\n },\n);\n\n/** 제목. 자동으로 `aria-labelledby`로 연결됨. */\nconst Title = forwardRef<\n ElementRef<typeof Alert.Title>,\n ComponentPropsWithoutRef<typeof Alert.Title>\n>(function AlertDialogTitle({ className, ...rest }, ref) {\n return <Alert.Title ref={ref} className={cx('nuri-alert__title', className)} {...rest} />;\n});\n\n/** 설명. 자동으로 `aria-describedby`로 연결됨. */\nconst Description = forwardRef<\n ElementRef<typeof Alert.Description>,\n ComponentPropsWithoutRef<typeof Alert.Description>\n>(function AlertDialogDescription({ className, ...rest }, ref) {\n return (\n <Alert.Description ref={ref} className={cx('nuri-alert__description', className)} {...rest} />\n );\n});\n\n/** 본문 슬롯 (추가 콘텐츠). */\nconst Body = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function AlertDialogBody(\n { className, ...rest },\n ref,\n) {\n return <div ref={ref} className={cx('nuri-alert__body', className)} {...rest} />;\n});\n\nexport interface AlertDialogFooterProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * 버튼 정렬. 디자인 표준은 전체너비 버튼이라 기본값 `full`.\n * @default 'full'\n */\n align?: 'start' | 'center' | 'end' | 'between' | 'full';\n}\n\n/** 푸터 슬롯 (Cancel/Action 배치). 기본 전체너비(`full`). */\nconst Footer = forwardRef<HTMLDivElement, AlertDialogFooterProps>(function AlertDialogFooter(\n { align = 'full', className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx('nuri-alert__footer', `nuri-alert__footer--${align}`, className)}\n {...rest}\n />\n );\n});\n\n/**\n * 확인(주 액션) 버튼. 클릭 시 닫힘. `asChild`로 Button 위임.\n * @example <AlertDialog.Action asChild><Button onClick={onConfirm}>삭제</Button></AlertDialog.Action>\n */\nconst Action = Alert.Action;\n\n/**\n * 취소 버튼. 클릭 시 닫힘. 포커스가 기본적으로 여기 위치.\n * @example <AlertDialog.Cancel asChild><Button variant=\"outline\">취소</Button></AlertDialog.Cancel>\n */\nconst Cancel = Alert.Cancel;\n\nconst CloseIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 5l10 10M15 5L5 15\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n);\n\n/**\n * 우상단 X 닫기 버튼 (옵션). 내부적으로 Cancel과 동일하게 닫힘. 기본 `aria-label=\"닫기\"`.\n * 확인을 강제하려면 사용하지 않는 편이 좋습니다 (Cancel/Action으로 명시적 선택 유도).\n */\nconst CloseButton = forwardRef<\n HTMLButtonElement,\n Omit<ComponentPropsWithoutRef<'button'>, 'children'> & { children?: ReactNode }\n>(function AlertDialogCloseButton(\n { className, 'aria-label': ariaLabel = '닫기', children, ...rest },\n ref,\n) {\n return (\n <Alert.Cancel asChild>\n <button\n ref={ref}\n type=\"button\"\n aria-label={ariaLabel}\n className={cx('nuri-alert__close', className)}\n {...rest}\n >\n {children ?? <CloseIcon />}\n </button>\n </Alert.Cancel>\n );\n});\n\nexport const AlertDialog = Object.assign(Root, {\n Trigger,\n Content,\n Header,\n Title,\n Description,\n Body,\n Footer,\n Action,\n Cancel,\n CloseButton,\n});\n","/**\n * tone별 기본 아이콘 — 디자이너 시스템(Figma) 에셋을 그대로 inline SVG로 재현.\n * 구조: 틴트 원 배경 + tone 색 심볼. 색은 토큰(`--nuri-alert-tone-*`)으로 분리.\n * AlertDialog.Content의 `icon` 미지정 시 tone에 맞춰 자동 렌더.\n * `icon={<Custom/>}`로 교체, `icon={null}`로 제거 가능.\n */\nimport type { ReactNode } from 'react';\n\nconst SuccessIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"var(--nuri-alert-tone-success-bg)\" />\n <path\n d=\"M15.77 9.58L10.65 14.70L8.90 12.95\"\n stroke=\"var(--nuri-alert-tone-success-fg)\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nconst WarningIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"var(--nuri-alert-tone-warning-bg)\" />\n <path\n d=\"M12 6.75V12\"\n stroke=\"var(--nuri-alert-tone-warning-fg)\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n />\n <circle cx=\"12\" cy=\"16.31\" r=\"1.1\" fill=\"var(--nuri-alert-tone-warning-fg)\" />\n </svg>\n);\n\nconst InfoIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"var(--nuri-alert-tone-info-bg)\" />\n <path\n d=\"M12.25 7h0.01\"\n stroke=\"var(--nuri-alert-tone-info-fg)\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M11 12h1.25v5h1.25\"\n stroke=\"var(--nuri-alert-tone-info-fg)\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport const defaultToneIcon: Record<'info' | 'success' | 'warning', ReactNode> = {\n info: <InfoIcon />,\n success: <SuccessIcon />,\n warning: <WarningIcon />,\n};\n"],"mappings":";;;;;;AAEA,OAAO;AACP,YAAY,WAAW;AACvB,SAAS,kBAAkB;;;ACKzB,SACE,KADF;AADF,IAAM,cAAc,MAClB,qBAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE;AAAA,sBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,MAAK,qCAAoC;AAAA,EACxE;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA;AAAA,EACjB;AAAA,GACF;AAGF,IAAM,cAAc,MAClB,qBAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE;AAAA,sBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,MAAK,qCAAoC;AAAA,EACxE;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA;AAAA,EAChB;AAAA,EACA,oBAAC,YAAO,IAAG,MAAK,IAAG,SAAQ,GAAE,OAAM,MAAK,qCAAoC;AAAA,GAC9E;AAGF,IAAM,WAAW,MACf,qBAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE;AAAA,sBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,MAAK,kCAAiC;AAAA,EACrE;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAA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AAG;AAAA,MAEH,sBAAY,gBAAAA,KAAC,aAAU;AAAA;AAAA,EAC1B,GACF;AAEJ,CAAC;AAEM,IAAM,cAAc,OAAO,OAAOE,OAAM;AAAA,EAC7C,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA;AACF,CAAC;","names":["jsx","jsxs","Root","Trigger","Content","Title","Description","Action","Cancel"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkR4E4BIPCcjs = require('./chunk-R4E4BIPC.cjs');
|
|
5
|
+
|
|
6
|
+
// src/AlertDialog/AlertDialog.tsx
|
|
7
|
+
require('./AlertDialog/styles.css');
|
|
8
|
+
var _reactalertdialog = require('@radix-ui/react-alert-dialog'); var Alert = _interopRequireWildcard(_reactalertdialog);
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
|
|
11
|
+
// src/AlertDialog/icons.tsx
|
|
12
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
13
|
+
var SuccessIcon = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
14
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "12", fill: "var(--nuri-alert-tone-success-bg)" }),
|
|
15
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
16
|
+
"path",
|
|
17
|
+
{
|
|
18
|
+
d: "M15.77 9.58L10.65 14.70L8.90 12.95",
|
|
19
|
+
stroke: "var(--nuri-alert-tone-success-fg)",
|
|
20
|
+
strokeWidth: "2.5",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round"
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
] });
|
|
26
|
+
var WarningIcon = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
27
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "12", fill: "var(--nuri-alert-tone-warning-bg)" }),
|
|
28
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
29
|
+
"path",
|
|
30
|
+
{
|
|
31
|
+
d: "M12 6.75V12",
|
|
32
|
+
stroke: "var(--nuri-alert-tone-warning-fg)",
|
|
33
|
+
strokeWidth: "2.5",
|
|
34
|
+
strokeLinecap: "round"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "16.31", r: "1.1", fill: "var(--nuri-alert-tone-warning-fg)" })
|
|
38
|
+
] });
|
|
39
|
+
var InfoIcon = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
40
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "12", fill: "var(--nuri-alert-tone-info-bg)" }),
|
|
41
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
42
|
+
"path",
|
|
43
|
+
{
|
|
44
|
+
d: "M12.25 7h0.01",
|
|
45
|
+
stroke: "var(--nuri-alert-tone-info-fg)",
|
|
46
|
+
strokeWidth: "3",
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round"
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
52
|
+
"path",
|
|
53
|
+
{
|
|
54
|
+
d: "M11 12h1.25v5h1.25",
|
|
55
|
+
stroke: "var(--nuri-alert-tone-info-fg)",
|
|
56
|
+
strokeWidth: "2.5",
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] });
|
|
62
|
+
var defaultToneIcon = {
|
|
63
|
+
info: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {}),
|
|
64
|
+
success: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SuccessIcon, {}),
|
|
65
|
+
warning: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WarningIcon, {})
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/AlertDialog/AlertDialog.tsx
|
|
69
|
+
|
|
70
|
+
var Root2 = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Alert.Root, { ...props });
|
|
71
|
+
Root2.displayName = "AlertDialog";
|
|
72
|
+
var Trigger2 = Alert.Trigger;
|
|
73
|
+
var Content2 = _react.forwardRef.call(void 0,
|
|
74
|
+
function AlertDialogContent({ tone = "info", icon, overlay = true, container, className, children, ...rest }, ref) {
|
|
75
|
+
const resolvedIcon = icon === void 0 ? defaultToneIcon[tone] : icon;
|
|
76
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Alert.Portal, { container, children: [
|
|
77
|
+
overlay && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Alert.Overlay, { className: "nuri-alert__overlay" }),
|
|
78
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
79
|
+
Alert.Content,
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert", `nuri-alert--${tone}`, className),
|
|
83
|
+
...rest,
|
|
84
|
+
children: [
|
|
85
|
+
resolvedIcon != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nuri-alert__icon", "aria-hidden": "true", children: resolvedIcon }),
|
|
86
|
+
children
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
var Header = _react.forwardRef.call(void 0,
|
|
94
|
+
function AlertDialogHeader({ className, ...rest }, ref) {
|
|
95
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref, className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert__header", className), ...rest });
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
var Title2 = _react.forwardRef.call(void 0, function AlertDialogTitle({ className, ...rest }, ref) {
|
|
99
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Alert.Title, { ref, className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert__title", className), ...rest });
|
|
100
|
+
});
|
|
101
|
+
var Description2 = _react.forwardRef.call(void 0, function AlertDialogDescription({ className, ...rest }, ref) {
|
|
102
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Alert.Description, { ref, className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert__description", className), ...rest });
|
|
103
|
+
});
|
|
104
|
+
var Body = _react.forwardRef.call(void 0, function AlertDialogBody({ className, ...rest }, ref) {
|
|
105
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref, className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert__body", className), ...rest });
|
|
106
|
+
});
|
|
107
|
+
var Footer = _react.forwardRef.call(void 0, function AlertDialogFooter({ align = "full", className, ...rest }, ref) {
|
|
108
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
ref,
|
|
112
|
+
className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert__footer", `nuri-alert__footer--${align}`, className),
|
|
113
|
+
...rest
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
var Action2 = Alert.Action;
|
|
118
|
+
var Cancel2 = Alert.Cancel;
|
|
119
|
+
var CloseIcon = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M5 5l10 10M15 5L5 15", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
|
|
120
|
+
var CloseButton = _react.forwardRef.call(void 0, function AlertDialogCloseButton({ className, "aria-label": ariaLabel = "\uB2EB\uAE30", children, ...rest }, ref) {
|
|
121
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Alert.Cancel, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
type: "button",
|
|
126
|
+
"aria-label": ariaLabel,
|
|
127
|
+
className: _chunkR4E4BIPCcjs.cx.call(void 0, "nuri-alert__close", className),
|
|
128
|
+
...rest,
|
|
129
|
+
children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})))
|
|
130
|
+
}
|
|
131
|
+
) });
|
|
132
|
+
});
|
|
133
|
+
var AlertDialog = Object.assign(Root2, {
|
|
134
|
+
Trigger: Trigger2,
|
|
135
|
+
Content: Content2,
|
|
136
|
+
Header,
|
|
137
|
+
Title: Title2,
|
|
138
|
+
Description: Description2,
|
|
139
|
+
Body,
|
|
140
|
+
Footer,
|
|
141
|
+
Action: Action2,
|
|
142
|
+
Cancel: Cancel2,
|
|
143
|
+
CloseButton
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
exports.AlertDialog = AlertDialog;
|
|
149
|
+
//# sourceMappingURL=chunk-I7KJ7WTN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/summerhoony/Desktop/projects/nuri-ui/dist/chunk-I7KJ7WTN.cjs","../src/AlertDialog/AlertDialog.tsx","../src/AlertDialog/icons.tsx"],"names":["Root","jsx","Trigger","Content","jsxs","Title","Description","Action","Cancel"],"mappings":"AAAA,2cAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACHA,oCAAO;AACP,wHAAuB;AACvB,8BAA2B;ADK3B;AACA;AEDE,+CAAA;AADF,IAAM,YAAA,EAAc,CAAA,EAAA,mBAClB,8BAAA,KAAC,EAAA,EAAI,KAAA,EAAM,IAAA,EAAK,MAAA,EAAO,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAY,IAAA,EAAK,MAAA,EAAO,aAAA,EAAY,MAAA,EACtE,QAAA,EAAA;AAAA,kBAAA,6BAAA,QAAC,EAAA,EAAO,EAAA,EAAG,IAAA,EAAK,EAAA,EAAG,IAAA,EAAK,CAAA,EAAE,IAAA,EAAK,IAAA,EAAK,oCAAA,CAAoC,CAAA;AAAA,kBACxE,6BAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,CAAA,EAAE,oCAAA;AAAA,MACF,MAAA,EAAO,mCAAA;AAAA,MACP,WAAA,EAAY,KAAA;AAAA,MACZ,aAAA,EAAc,OAAA;AAAA,MACd,cAAA,EAAe;AAAA,IAAA;AAAA,EACjB;AAAA,EAAA,CACF,CAAA;AAGF,IAAM,YAAA,EAAc,CAAA,EAAA,mBAClB,8BAAA,KAAC,EAAA,EAAI,KAAA,EAAM,IAAA,EAAK,MAAA,EAAO,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAY,IAAA,EAAK,MAAA,EAAO,aAAA,EAAY,MAAA,EACtE,QAAA,EA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,MAAA;AACF,IAAA;AAEJ,EAAA;AACF;AAGe;AAC2C,EAAA;AACrB,IAAA;AACnC,EAAA;AACF;AAM8B;AACE,EAAA;AAC/B;AAMU;AAEsB,EAAA;AAEhC;AAIG;AAGkC,EAAA;AACrC;AAYG;AAIAH,EAAAA;AAAC,IAAA;AAAA,IAAA;AACC,MAAA;AACoC,MAAA;AAChC,MAAA;AAAA,IAAA;AACN,EAAA;AAEH;AAMoB;AAMA;AAGd;AAYI;AAKc,EAAA;AAClB,IAAA;AAAA,IAAA;AACC,MAAA;AACK,MAAA;AACO,MAAA;AACgC,MAAA;AACxC,MAAA;AAEU,MAAA;AAAU,IAAA;AAE5B,EAAA;AAEH;AAE8C;AAC7CC,EAAAA;AACAC,EAAAA;AACA,EAAA;AACAE,EAAAA;AACAC,EAAAA;AACA,EAAA;AACA,EAAA;AACAC,EAAAA;AACAC,EAAAA;AACA,EAAA;AACD;ADxDyD;AACA;AACA;AACA","file":"/Users/summerhoony/Desktop/projects/nuri-ui/dist/chunk-I7KJ7WTN.cjs","sourcesContent":[null,"'use client';\n\nimport './styles.css';\nimport * as Alert from '@radix-ui/react-alert-dialog';\nimport { forwardRef } from 'react';\nimport type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { cx } from '../utils/cx.js';\nimport { defaultToneIcon } from './icons.js';\n\ntype Tone = 'info' | 'success' | 'warning';\n\n/**\n * 확인 강제형 다이얼로그 (alertdialog). Radix AlertDialog 기반.\n *\n * 일반 Modal과의 차이:\n * - `role=\"alertdialog\"` — 스크린리더가 더 강하게 안내\n * - **바깥(백드롭) 클릭으로 닫히지 않음** — 실수로 닫히는 것 방지\n * - 포커스가 기본적으로 Cancel(취소)에 위치 — 실수로 위험 액션 방지\n * - **중앙 정렬 + 상단 아이콘** (디자인 시스템 표준 레이아웃)\n *\n * Esc 키는 닫힘(키보드 탈출구 — 접근성). 막으려면 Content에 `onEscapeKeyDown` 전달.\n *\n * @example\n * <AlertDialog>\n * <AlertDialog.Trigger asChild><Button>삭제</Button></AlertDialog.Trigger>\n * <AlertDialog.Content tone=\"warning\">\n * <AlertDialog.Header>\n * <AlertDialog.Title>정말 삭제할까요?</AlertDialog.Title>\n * <AlertDialog.Description>되돌릴 수 없습니다.</AlertDialog.Description>\n * </AlertDialog.Header>\n * <AlertDialog.Footer>\n * <AlertDialog.Cancel asChild><Button variant=\"outline\">취소</Button></AlertDialog.Cancel>\n * <AlertDialog.Action asChild><Button onClick={onDelete}>삭제</Button></AlertDialog.Action>\n * </AlertDialog.Footer>\n * </AlertDialog.Content>\n * </AlertDialog>\n */\nconst Root = (props: ComponentPropsWithoutRef<typeof Alert.Root>) => <Alert.Root {...props} />;\nRoot.displayName = 'AlertDialog';\n\n/** 다이얼로그를 여는 트리거. `asChild`로 임의 엘리먼트에 위임. */\nconst Trigger = Alert.Trigger;\n\nexport interface AlertDialogContentProps extends ComponentPropsWithoutRef<typeof Alert.Content> {\n /**\n * 상태 톤 — 기본 아이콘과 그 색을 결정.\n * @default 'info'\n */\n tone?: Tone;\n /**\n * 상단 아이콘.\n * - 미지정: `tone`에 맞는 **기본 아이콘** 자동 렌더\n * - `ReactNode`: 커스텀 아이콘으로 교체\n * - `null`: 아이콘 제거\n */\n icon?: ReactNode | null;\n /** 백드롭(오버레이) 표시 여부. @default true */\n overlay?: boolean;\n /** 포털 렌더 대상. 기본은 document.body. 다른 요소에 렌더하려면 지정. */\n container?: HTMLElement | null;\n}\n\n/** 오버레이 + 포털 + 패널을 한 번에 렌더. 중앙 정렬 + 상단 아이콘 레이아웃. */\nconst Content = forwardRef<ElementRef<typeof Alert.Content>, AlertDialogContentProps>(\n function AlertDialogContent(\n { tone = 'info', icon, overlay = true, container, className, children, ...rest },\n ref,\n ) {\n // icon 미지정(undefined) → 기본 tone 아이콘 / null → 제거 / ReactNode → 교체\n const resolvedIcon = icon === undefined ? defaultToneIcon[tone] : icon;\n return (\n <Alert.Portal container={container}>\n {overlay && <Alert.Overlay className=\"nuri-alert__overlay\" />}\n <Alert.Content\n ref={ref}\n className={cx('nuri-alert', `nuri-alert--${tone}`, className)}\n {...rest}\n >\n {resolvedIcon != null && (\n <div className=\"nuri-alert__icon\" aria-hidden=\"true\">\n {resolvedIcon}\n </div>\n )}\n {children}\n </Alert.Content>\n </Alert.Portal>\n );\n },\n);\n\n/** 헤더 슬롯 (Title/Description 묶음, 중앙 정렬). */\nconst Header = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(\n function AlertDialogHeader({ className, ...rest }, ref) {\n return <div ref={ref} className={cx('nuri-alert__header', className)} {...rest} />;\n },\n);\n\n/** 제목. 자동으로 `aria-labelledby`로 연결됨. */\nconst Title = forwardRef<\n ElementRef<typeof Alert.Title>,\n ComponentPropsWithoutRef<typeof Alert.Title>\n>(function AlertDialogTitle({ className, ...rest }, ref) {\n return <Alert.Title ref={ref} className={cx('nuri-alert__title', className)} {...rest} />;\n});\n\n/** 설명. 자동으로 `aria-describedby`로 연결됨. */\nconst Description = forwardRef<\n ElementRef<typeof Alert.Description>,\n ComponentPropsWithoutRef<typeof Alert.Description>\n>(function AlertDialogDescription({ className, ...rest }, ref) {\n return (\n <Alert.Description ref={ref} className={cx('nuri-alert__description', className)} {...rest} />\n );\n});\n\n/** 본문 슬롯 (추가 콘텐츠). */\nconst Body = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function AlertDialogBody(\n { className, ...rest },\n ref,\n) {\n return <div ref={ref} className={cx('nuri-alert__body', className)} {...rest} />;\n});\n\nexport interface AlertDialogFooterProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * 버튼 정렬. 디자인 표준은 전체너비 버튼이라 기본값 `full`.\n * @default 'full'\n */\n align?: 'start' | 'center' | 'end' | 'between' | 'full';\n}\n\n/** 푸터 슬롯 (Cancel/Action 배치). 기본 전체너비(`full`). */\nconst Footer = forwardRef<HTMLDivElement, AlertDialogFooterProps>(function AlertDialogFooter(\n { align = 'full', className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx('nuri-alert__footer', `nuri-alert__footer--${align}`, className)}\n {...rest}\n />\n );\n});\n\n/**\n * 확인(주 액션) 버튼. 클릭 시 닫힘. `asChild`로 Button 위임.\n * @example <AlertDialog.Action asChild><Button onClick={onConfirm}>삭제</Button></AlertDialog.Action>\n */\nconst Action = Alert.Action;\n\n/**\n * 취소 버튼. 클릭 시 닫힘. 포커스가 기본적으로 여기 위치.\n * @example <AlertDialog.Cancel asChild><Button variant=\"outline\">취소</Button></AlertDialog.Cancel>\n */\nconst Cancel = Alert.Cancel;\n\nconst CloseIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 5l10 10M15 5L5 15\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n);\n\n/**\n * 우상단 X 닫기 버튼 (옵션). 내부적으로 Cancel과 동일하게 닫힘. 기본 `aria-label=\"닫기\"`.\n * 확인을 강제하려면 사용하지 않는 편이 좋습니다 (Cancel/Action으로 명시적 선택 유도).\n */\nconst CloseButton = forwardRef<\n HTMLButtonElement,\n Omit<ComponentPropsWithoutRef<'button'>, 'children'> & { children?: ReactNode }\n>(function AlertDialogCloseButton(\n { className, 'aria-label': ariaLabel = '닫기', children, ...rest },\n ref,\n) {\n return (\n <Alert.Cancel asChild>\n <button\n ref={ref}\n type=\"button\"\n aria-label={ariaLabel}\n className={cx('nuri-alert__close', className)}\n {...rest}\n >\n {children ?? <CloseIcon />}\n </button>\n </Alert.Cancel>\n );\n});\n\nexport const AlertDialog = Object.assign(Root, {\n Trigger,\n Content,\n Header,\n Title,\n Description,\n Body,\n Footer,\n Action,\n Cancel,\n CloseButton,\n});\n","/**\n * tone별 기본 아이콘 — 디자이너 시스템(Figma) 에셋을 그대로 inline SVG로 재현.\n * 구조: 틴트 원 배경 + tone 색 심볼. 색은 토큰(`--nuri-alert-tone-*`)으로 분리.\n * AlertDialog.Content의 `icon` 미지정 시 tone에 맞춰 자동 렌더.\n * `icon={<Custom/>}`로 교체, `icon={null}`로 제거 가능.\n */\nimport type { ReactNode } from 'react';\n\nconst SuccessIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"var(--nuri-alert-tone-success-bg)\" />\n <path\n d=\"M15.77 9.58L10.65 14.70L8.90 12.95\"\n stroke=\"var(--nuri-alert-tone-success-fg)\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nconst WarningIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"var(--nuri-alert-tone-warning-bg)\" />\n <path\n d=\"M12 6.75V12\"\n stroke=\"var(--nuri-alert-tone-warning-fg)\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n />\n <circle cx=\"12\" cy=\"16.31\" r=\"1.1\" fill=\"var(--nuri-alert-tone-warning-fg)\" />\n </svg>\n);\n\nconst InfoIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"var(--nuri-alert-tone-info-bg)\" />\n <path\n d=\"M12.25 7h0.01\"\n stroke=\"var(--nuri-alert-tone-info-fg)\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M11 12h1.25v5h1.25\"\n stroke=\"var(--nuri-alert-tone-info-fg)\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport const defaultToneIcon: Record<'info' | 'success' | 'warning', ReactNode> = {\n info: <InfoIcon />,\n success: <SuccessIcon />,\n warning: <WarningIcon />,\n};\n"]}
|