@nurimedia/react-ui 0.1.1 → 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 -181
- package/dist/AlertDialog/index.cjs.map +1 -1
- package/dist/AlertDialog/index.js +4 -145
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/Button/index.cjs +4 -132
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.js +4 -106
- package/dist/Button/index.js.map +1 -1
- package/dist/Checkbox/index.cjs +4 -79
- package/dist/Checkbox/index.cjs.map +1 -1
- package/dist/Checkbox/index.js +4 -43
- package/dist/Checkbox/index.js.map +1 -1
- package/dist/Input/index.cjs +4 -99
- package/dist/Input/index.cjs.map +1 -1
- package/dist/Input/index.js +4 -73
- package/dist/Input/index.js.map +1 -1
- package/dist/Modal/index.cjs +4 -116
- package/dist/Modal/index.cjs.map +1 -1
- package/dist/Modal/index.js +4 -80
- package/dist/Modal/index.js.map +1 -1
- package/dist/Radio/index.cjs +6 -82
- package/dist/Radio/index.cjs.map +1 -1
- package/dist/Radio/index.js +5 -44
- package/dist/Radio/index.js.map +1 -1
- package/dist/Select/index.cjs +4 -112
- package/dist/Select/index.cjs.map +1 -1
- package/dist/Select/index.js +4 -76
- package/dist/Select/index.js.map +1 -1
- package/dist/Switch/index.cjs +4 -67
- package/dist/Switch/index.cjs.map +1 -1
- package/dist/Switch/index.js +4 -31
- package/dist/Switch/index.js.map +1 -1
- package/dist/Textarea/index.cjs +4 -123
- package/dist/Textarea/index.cjs.map +1 -1
- package/dist/Textarea/index.js +4 -97
- package/dist/Textarea/index.js.map +1 -1
- package/dist/Toast/index.cjs +4 -178
- package/dist/Toast/index.cjs.map +1 -1
- package/dist/Toast/index.js +5 -142
- package/dist/Toast/index.js.map +1 -1
- package/dist/Tooltip/index.cjs +6 -101
- package/dist/Tooltip/index.cjs.map +1 -1
- package/dist/Tooltip/index.js +5 -63
- 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 -900
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -834
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/Toast/index.cjs
CHANGED
|
@@ -1,185 +1,11 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});'use client';
|
|
30
2
|
|
|
31
|
-
// src/Toast/index.ts
|
|
32
|
-
var Toast_exports = {};
|
|
33
|
-
__export(Toast_exports, {
|
|
34
|
-
Toaster: () => Toaster,
|
|
35
|
-
toast: () => toast
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(Toast_exports);
|
|
38
3
|
|
|
39
|
-
// src/Toast/Toaster.tsx
|
|
40
|
-
var import_styles = require("./styles.css");
|
|
41
|
-
var RadixToast = __toESM(require("@radix-ui/react-toast"), 1);
|
|
42
4
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return classes.filter(Boolean).join(" ");
|
|
46
|
-
}
|
|
5
|
+
var _chunk323VGYMKcjs = require('../chunk-323VGYMK.cjs');
|
|
6
|
+
require('../chunk-R4E4BIPC.cjs');
|
|
47
7
|
|
|
48
|
-
// src/Toast/store.ts
|
|
49
|
-
var import_react = require("react");
|
|
50
|
-
var toasts = [];
|
|
51
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
52
|
-
var EMPTY = [];
|
|
53
|
-
var counter = 0;
|
|
54
|
-
var emit = () => {
|
|
55
|
-
for (const l of listeners) l();
|
|
56
|
-
};
|
|
57
|
-
function add(message, options = {}) {
|
|
58
|
-
const id = options.id ?? `nuri-toast-${++counter}`;
|
|
59
|
-
const record = {
|
|
60
|
-
id,
|
|
61
|
-
message,
|
|
62
|
-
tone: options.tone ?? "default",
|
|
63
|
-
duration: options.duration ?? 3e3
|
|
64
|
-
};
|
|
65
|
-
const idx = toasts.findIndex((t) => t.id === id);
|
|
66
|
-
toasts = idx >= 0 ? toasts.map((t) => t.id === id ? record : t) : [...toasts, record];
|
|
67
|
-
emit();
|
|
68
|
-
return id;
|
|
69
|
-
}
|
|
70
|
-
function remove(id) {
|
|
71
|
-
toasts = toasts.filter((t) => t.id !== id);
|
|
72
|
-
emit();
|
|
73
|
-
}
|
|
74
|
-
function clear() {
|
|
75
|
-
toasts = [];
|
|
76
|
-
emit();
|
|
77
|
-
}
|
|
78
|
-
var toastStore = {
|
|
79
|
-
add,
|
|
80
|
-
remove,
|
|
81
|
-
clear,
|
|
82
|
-
subscribe(listener) {
|
|
83
|
-
listeners.add(listener);
|
|
84
|
-
return () => {
|
|
85
|
-
listeners.delete(listener);
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
getSnapshot: () => toasts,
|
|
89
|
-
getServerSnapshot: () => EMPTY
|
|
90
|
-
};
|
|
91
|
-
function useToasts() {
|
|
92
|
-
return (0, import_react.useSyncExternalStore)(
|
|
93
|
-
toastStore.subscribe,
|
|
94
|
-
toastStore.getSnapshot,
|
|
95
|
-
toastStore.getServerSnapshot
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
8
|
|
|
99
|
-
// src/Toast/icons.tsx
|
|
100
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
101
|
-
var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
-
"path",
|
|
103
|
-
{
|
|
104
|
-
d: "M3.5 8.5l3 3 6-6.5",
|
|
105
|
-
stroke: "currentColor",
|
|
106
|
-
strokeWidth: "1.6",
|
|
107
|
-
strokeLinecap: "round",
|
|
108
|
-
strokeLinejoin: "round"
|
|
109
|
-
}
|
|
110
|
-
) });
|
|
111
|
-
var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
112
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 4v4.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "11.3", r: "0.95", fill: "currentColor" })
|
|
114
|
-
] });
|
|
115
|
-
var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
116
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 7.5v4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
117
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "4.7", r: "0.95", fill: "currentColor" })
|
|
118
|
-
] });
|
|
119
|
-
var toneIcon = {
|
|
120
|
-
success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckIcon, {}),
|
|
121
|
-
error: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorIcon, {}),
|
|
122
|
-
info: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InfoIcon, {})
|
|
123
|
-
};
|
|
124
9
|
|
|
125
|
-
|
|
126
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
127
|
-
function Toaster({
|
|
128
|
-
swipeDirection = "down",
|
|
129
|
-
swipeThreshold = 50,
|
|
130
|
-
className,
|
|
131
|
-
label = "\uC54C\uB9BC"
|
|
132
|
-
}) {
|
|
133
|
-
const toasts2 = useToasts();
|
|
134
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
135
|
-
RadixToast.Provider,
|
|
136
|
-
{
|
|
137
|
-
swipeDirection,
|
|
138
|
-
swipeThreshold,
|
|
139
|
-
label,
|
|
140
|
-
children: [
|
|
141
|
-
toasts2.map((t) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
142
|
-
RadixToast.Root,
|
|
143
|
-
{
|
|
144
|
-
duration: t.duration,
|
|
145
|
-
onOpenChange: (open) => {
|
|
146
|
-
if (!open) toastStore.remove(t.id);
|
|
147
|
-
},
|
|
148
|
-
type: t.tone === "error" ? "foreground" : "background",
|
|
149
|
-
className: cx("nuri-toast", t.tone !== "default" && `nuri-toast--${t.tone}`),
|
|
150
|
-
children: [
|
|
151
|
-
t.tone !== "default" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "nuri-toast__icon", "aria-hidden": "true", children: toneIcon[t.tone] }),
|
|
152
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RadixToast.Title, { className: "nuri-toast__message", children: t.message })
|
|
153
|
-
]
|
|
154
|
-
},
|
|
155
|
-
t.id
|
|
156
|
-
)),
|
|
157
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
158
|
-
RadixToast.Viewport,
|
|
159
|
-
{
|
|
160
|
-
className: cx("nuri-toast__viewport", className),
|
|
161
|
-
label: `${label} ({hotkey})`
|
|
162
|
-
}
|
|
163
|
-
)
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/Toast/toast.ts
|
|
170
|
-
function toastFn(message, options) {
|
|
171
|
-
return toastStore.add(message, options);
|
|
172
|
-
}
|
|
173
|
-
var toast = Object.assign(toastFn, {
|
|
174
|
-
success: (message, options) => toastStore.add(message, { ...options, tone: "success" }),
|
|
175
|
-
error: (message, options) => toastStore.add(message, { ...options, tone: "error" }),
|
|
176
|
-
info: (message, options) => toastStore.add(message, { ...options, tone: "info" }),
|
|
177
|
-
/** id 지정 시 해당 토스트만, 없으면 전체 제거. */
|
|
178
|
-
dismiss: (id) => id ? toastStore.remove(id) : toastStore.clear()
|
|
179
|
-
});
|
|
180
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
-
0 && (module.exports = {
|
|
182
|
-
Toaster,
|
|
183
|
-
toast
|
|
184
|
-
});
|
|
10
|
+
exports.Toaster = _chunk323VGYMKcjs.Toaster; exports.toast = _chunk323VGYMKcjs.toast;
|
|
185
11
|
//# sourceMappingURL=index.cjs.map
|
package/dist/Toast/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Toast/index.ts","../../src/Toast/Toaster.tsx","../../src/utils/cx.ts","../../src/Toast/store.ts","../../src/Toast/icons.tsx","../../src/Toast/toast.ts"],"sourcesContent":["export { Toaster } from './Toaster.js';\nexport type { ToasterProps } from './Toaster.js';\nexport { toast } from './toast.js';\nexport type { ToastTone, ToastOptions, ToastRecord } from './store.js';\n","'use client';\n\nimport './styles.css';\nimport * as RadixToast from '@radix-ui/react-toast';\nimport { cx } from '../utils/cx.js';\nimport { toastStore, useToasts } from './store.js';\nimport { toneIcon } from './icons.js';\n\nexport interface ToasterProps {\n /**\n * 스와이프로 닫는 방향. 하단 표시라 기본 `down`(아래로 밀어 닫기 — 터치·드래그 모두).\n * @default 'down'\n */\n swipeDirection?: RadixToast.ToastProviderProps['swipeDirection'];\n /** 스와이프 임계 거리(px). @default 50 */\n swipeThreshold?: number;\n /** 뷰포트에 추가할 className (위치 커스터마이즈 등). */\n className?: string;\n /** 스크린리더용 지역 라벨. @default '알림' */\n label?: string;\n}\n\n/**\n * 토스트 렌더러. **앱 루트에 1회만** 마운트하면 되고, 표시는 `toast()` 호출로 트리거한다.\n * (사용처마다 렌더할 필요 없음 — 모듈 store를 구독해 이 컴포넌트만 렌더)\n *\n * Radix Toast 기반이라 자동 닫힘 타이머·hover 시 일시정지·스와이프 닫기·\n * 스크린리더 announce(aria-live)를 표준으로 제공한다.\n *\n * @example\n * // app/layout.tsx\n * <body>{children}<Toaster /></body>\n */\nexport function Toaster({\n swipeDirection = 'down',\n swipeThreshold = 50,\n className,\n label = '알림',\n}: ToasterProps) {\n const toasts = useToasts();\n\n return (\n <RadixToast.Provider\n swipeDirection={swipeDirection}\n swipeThreshold={swipeThreshold}\n label={label}\n >\n {toasts.map((t) => (\n <RadixToast.Root\n key={t.id}\n duration={t.duration}\n onOpenChange={(open) => {\n if (!open) toastStore.remove(t.id);\n }}\n // error는 foreground(assertive)로 즉시 안내, 그 외는 background(polite)\n type={t.tone === 'error' ? 'foreground' : 'background'}\n className={cx('nuri-toast', t.tone !== 'default' && `nuri-toast--${t.tone}`)}\n >\n {t.tone !== 'default' && (\n <span className=\"nuri-toast__icon\" aria-hidden=\"true\">\n {toneIcon[t.tone]}\n </span>\n )}\n <RadixToast.Title className=\"nuri-toast__message\">{t.message}</RadixToast.Title>\n </RadixToast.Root>\n ))}\n {/* 랜드마크 이름 — 스크린리더 영역 탐색용. {hotkey}는 Radix가 실제 키(F8)로 치환 */}\n <RadixToast.Viewport\n className={cx('nuri-toast__viewport', className)}\n label={`${label} ({hotkey})`}\n />\n </RadixToast.Provider>\n );\n}\n","/**\n * 조건부 className 합성 유틸. falsy 값(undefined/false/null/'')은 제거.\n * @example cx('btn', isActive && 'btn--active', className)\n */\nexport function cx(...classes: Array<string | false | null | undefined>): string {\n return classes.filter(Boolean).join(' ');\n}\n","'use client';\n\nimport { useSyncExternalStore } from 'react';\nimport type { ReactNode } from 'react';\n\nexport type ToastTone = 'default' | 'success' | 'error' | 'info';\n\nexport interface ToastOptions {\n /** 톤 — 아이콘·색 결정. @default 'default' (아이콘 없음) */\n tone?: ToastTone;\n /** 자동 닫힘까지 ms. @default 3000 */\n duration?: number;\n /** id 직접 지정 (같은 id면 교체 — 중복 방지·수동 dismiss용). */\n id?: string;\n}\n\nexport interface ToastRecord {\n id: string;\n message: ReactNode;\n tone: ToastTone;\n duration: number;\n}\n\n// ── React 밖 모듈 싱글톤 store (아무 데서나 toast() 호출 가능한 이유) ──\nlet toasts: ToastRecord[] = [];\nconst listeners = new Set<() => void>();\nconst EMPTY: ToastRecord[] = []; // 서버 스냅샷용 안정 참조\nlet counter = 0;\n\nconst emit = () => {\n for (const l of listeners) l();\n};\n\nfunction add(message: ReactNode, options: ToastOptions = {}): string {\n const id = options.id ?? `nuri-toast-${++counter}`;\n const record: ToastRecord = {\n id,\n message,\n tone: options.tone ?? 'default',\n duration: options.duration ?? 3000,\n };\n const idx = toasts.findIndex((t) => t.id === id);\n toasts = idx >= 0 ? toasts.map((t) => (t.id === id ? record : t)) : [...toasts, record];\n emit();\n return id;\n}\n\nfunction remove(id: string) {\n toasts = toasts.filter((t) => t.id !== id);\n emit();\n}\n\nfunction clear() {\n toasts = [];\n emit();\n}\n\nexport const toastStore = {\n add,\n remove,\n clear,\n subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n getSnapshot: () => toasts,\n getServerSnapshot: () => EMPTY,\n};\n\n/** 현재 토스트 목록을 구독 (Toaster 내부 전용). */\nexport function useToasts(): ToastRecord[] {\n return useSyncExternalStore(\n toastStore.subscribe,\n toastStore.getSnapshot,\n toastStore.getServerSnapshot,\n );\n}\n","import type { ReactNode } from 'react';\nimport type { ToastTone } from './store.js';\n\n// 16px, currentColor — 색은 .nuri-toast--{tone}이 톤 토큰으로 지정.\nconst CheckIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M3.5 8.5l3 3 6-6.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nconst ErrorIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M8 4v4.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n <circle cx=\"8\" cy=\"11.3\" r=\"0.95\" fill=\"currentColor\" />\n </svg>\n);\n\nconst InfoIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M8 7.5v4\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n <circle cx=\"8\" cy=\"4.7\" r=\"0.95\" fill=\"currentColor\" />\n </svg>\n);\n\n/** default 톤은 아이콘 없음. */\nexport const toneIcon: Record<Exclude<ToastTone, 'default'>, ReactNode> = {\n success: <CheckIcon />,\n error: <ErrorIcon />,\n info: <InfoIcon />,\n};\n","import type { ReactNode } from 'react';\nimport { toastStore } from './store.js';\nimport type { ToastOptions } from './store.js';\n\ntype ToneOptions = Omit<ToastOptions, 'tone'>;\n\n/**\n * 토스트를 띄운다. React 밖 모듈 함수라 컴포넌트·이벤트 핸들러·API 레이어 등\n * **어디서나** 호출 가능. 화면 렌더는 앱 루트에 1회 마운트한 `<Toaster/>`가 담당한다.\n *\n * @returns 토스트 id (수동 dismiss에 사용)\n * @example\n * toast.success('저장됐습니다');\n * const id = toast.error('오류', { duration: 5000 });\n * toast.dismiss(id);\n */\nfunction toastFn(message: ReactNode, options?: ToastOptions): string {\n return toastStore.add(message, options);\n}\n\nexport const toast = Object.assign(toastFn, {\n success: (message: ReactNode, options?: ToneOptions) =>\n toastStore.add(message, { ...options, tone: 'success' }),\n error: (message: ReactNode, options?: ToneOptions) =>\n toastStore.add(message, { ...options, tone: 'error' }),\n info: (message: ReactNode, options?: ToneOptions) =>\n toastStore.add(message, { ...options, tone: 'info' }),\n /** id 지정 시 해당 토스트만, 없으면 전체 제거. */\n dismiss: (id?: string) => (id ? toastStore.remove(id) : toastStore.clear()),\n});\n"],"mappings":"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","names":["import_jsx_runtime","toasts"]}
|
|
1
|
+
{"version":3,"sources":["/Users/summerhoony/Desktop/projects/nuri-ui/dist/Toast/index.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACF,qFAAC","file":"/Users/summerhoony/Desktop/projects/nuri-ui/dist/Toast/index.cjs"}
|
package/dist/Toast/index.js
CHANGED
|
@@ -1,146 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// src/utils/cx.ts
|
|
8
|
-
function cx(...classes) {
|
|
9
|
-
return classes.filter(Boolean).join(" ");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// src/Toast/store.ts
|
|
13
|
-
import { useSyncExternalStore } from "react";
|
|
14
|
-
var toasts = [];
|
|
15
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
16
|
-
var EMPTY = [];
|
|
17
|
-
var counter = 0;
|
|
18
|
-
var emit = () => {
|
|
19
|
-
for (const l of listeners) l();
|
|
20
|
-
};
|
|
21
|
-
function add(message, options = {}) {
|
|
22
|
-
const id = options.id ?? `nuri-toast-${++counter}`;
|
|
23
|
-
const record = {
|
|
24
|
-
id,
|
|
25
|
-
message,
|
|
26
|
-
tone: options.tone ?? "default",
|
|
27
|
-
duration: options.duration ?? 3e3
|
|
28
|
-
};
|
|
29
|
-
const idx = toasts.findIndex((t) => t.id === id);
|
|
30
|
-
toasts = idx >= 0 ? toasts.map((t) => t.id === id ? record : t) : [...toasts, record];
|
|
31
|
-
emit();
|
|
32
|
-
return id;
|
|
33
|
-
}
|
|
34
|
-
function remove(id) {
|
|
35
|
-
toasts = toasts.filter((t) => t.id !== id);
|
|
36
|
-
emit();
|
|
37
|
-
}
|
|
38
|
-
function clear() {
|
|
39
|
-
toasts = [];
|
|
40
|
-
emit();
|
|
41
|
-
}
|
|
42
|
-
var toastStore = {
|
|
43
|
-
add,
|
|
44
|
-
remove,
|
|
45
|
-
clear,
|
|
46
|
-
subscribe(listener) {
|
|
47
|
-
listeners.add(listener);
|
|
48
|
-
return () => {
|
|
49
|
-
listeners.delete(listener);
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
getSnapshot: () => toasts,
|
|
53
|
-
getServerSnapshot: () => EMPTY
|
|
54
|
-
};
|
|
55
|
-
function useToasts() {
|
|
56
|
-
return useSyncExternalStore(
|
|
57
|
-
toastStore.subscribe,
|
|
58
|
-
toastStore.getSnapshot,
|
|
59
|
-
toastStore.getServerSnapshot
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/Toast/icons.tsx
|
|
64
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
65
|
-
var CheckIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
66
|
-
"path",
|
|
67
|
-
{
|
|
68
|
-
d: "M3.5 8.5l3 3 6-6.5",
|
|
69
|
-
stroke: "currentColor",
|
|
70
|
-
strokeWidth: "1.6",
|
|
71
|
-
strokeLinecap: "round",
|
|
72
|
-
strokeLinejoin: "round"
|
|
73
|
-
}
|
|
74
|
-
) });
|
|
75
|
-
var ErrorIcon = () => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
76
|
-
/* @__PURE__ */ jsx("path", { d: "M8 4v4.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
77
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "11.3", r: "0.95", fill: "currentColor" })
|
|
78
|
-
] });
|
|
79
|
-
var InfoIcon = () => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
80
|
-
/* @__PURE__ */ jsx("path", { d: "M8 7.5v4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
81
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "4.7", r: "0.95", fill: "currentColor" })
|
|
82
|
-
] });
|
|
83
|
-
var toneIcon = {
|
|
84
|
-
success: /* @__PURE__ */ jsx(CheckIcon, {}),
|
|
85
|
-
error: /* @__PURE__ */ jsx(ErrorIcon, {}),
|
|
86
|
-
info: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// src/Toast/Toaster.tsx
|
|
90
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
91
|
-
function Toaster({
|
|
92
|
-
swipeDirection = "down",
|
|
93
|
-
swipeThreshold = 50,
|
|
94
|
-
className,
|
|
95
|
-
label = "\uC54C\uB9BC"
|
|
96
|
-
}) {
|
|
97
|
-
const toasts2 = useToasts();
|
|
98
|
-
return /* @__PURE__ */ jsxs2(
|
|
99
|
-
RadixToast.Provider,
|
|
100
|
-
{
|
|
101
|
-
swipeDirection,
|
|
102
|
-
swipeThreshold,
|
|
103
|
-
label,
|
|
104
|
-
children: [
|
|
105
|
-
toasts2.map((t) => /* @__PURE__ */ jsxs2(
|
|
106
|
-
RadixToast.Root,
|
|
107
|
-
{
|
|
108
|
-
duration: t.duration,
|
|
109
|
-
onOpenChange: (open) => {
|
|
110
|
-
if (!open) toastStore.remove(t.id);
|
|
111
|
-
},
|
|
112
|
-
type: t.tone === "error" ? "foreground" : "background",
|
|
113
|
-
className: cx("nuri-toast", t.tone !== "default" && `nuri-toast--${t.tone}`),
|
|
114
|
-
children: [
|
|
115
|
-
t.tone !== "default" && /* @__PURE__ */ jsx2("span", { className: "nuri-toast__icon", "aria-hidden": "true", children: toneIcon[t.tone] }),
|
|
116
|
-
/* @__PURE__ */ jsx2(RadixToast.Title, { className: "nuri-toast__message", children: t.message })
|
|
117
|
-
]
|
|
118
|
-
},
|
|
119
|
-
t.id
|
|
120
|
-
)),
|
|
121
|
-
/* @__PURE__ */ jsx2(
|
|
122
|
-
RadixToast.Viewport,
|
|
123
|
-
{
|
|
124
|
-
className: cx("nuri-toast__viewport", className),
|
|
125
|
-
label: `${label} ({hotkey})`
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// src/Toast/toast.ts
|
|
134
|
-
function toastFn(message, options) {
|
|
135
|
-
return toastStore.add(message, options);
|
|
136
|
-
}
|
|
137
|
-
var toast = Object.assign(toastFn, {
|
|
138
|
-
success: (message, options) => toastStore.add(message, { ...options, tone: "success" }),
|
|
139
|
-
error: (message, options) => toastStore.add(message, { ...options, tone: "error" }),
|
|
140
|
-
info: (message, options) => toastStore.add(message, { ...options, tone: "info" }),
|
|
141
|
-
/** id 지정 시 해당 토스트만, 없으면 전체 제거. */
|
|
142
|
-
dismiss: (id) => id ? toastStore.remove(id) : toastStore.clear()
|
|
143
|
-
});
|
|
2
|
+
import {
|
|
3
|
+
Toaster,
|
|
4
|
+
toast
|
|
5
|
+
} from "../chunk-RC773ZEY.js";
|
|
6
|
+
import "../chunk-PS6QXS5Z.js";
|
|
144
7
|
export {
|
|
145
8
|
Toaster,
|
|
146
9
|
toast
|
package/dist/Toast/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Tooltip/index.cjs
CHANGED
|
@@ -1,106 +1,11 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});'use client';
|
|
30
2
|
|
|
31
|
-
// src/Tooltip/index.ts
|
|
32
|
-
var Tooltip_exports = {};
|
|
33
|
-
__export(Tooltip_exports, {
|
|
34
|
-
Tooltip: () => Tooltip,
|
|
35
|
-
TooltipProvider: () => TooltipProvider
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(Tooltip_exports);
|
|
38
3
|
|
|
39
|
-
// src/Tooltip/Tooltip.tsx
|
|
40
|
-
var import_styles = require("./styles.css");
|
|
41
|
-
var RadixTooltip = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
42
|
-
var import_react = require("react");
|
|
43
4
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return classes.filter(Boolean).join(" ");
|
|
47
|
-
}
|
|
5
|
+
var _chunkLRATCHCBcjs = require('../chunk-LRATCHCB.cjs');
|
|
6
|
+
require('../chunk-R4E4BIPC.cjs');
|
|
48
7
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function TooltipProvider({ children, ...props }) {
|
|
53
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HasProviderContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadixTooltip.Provider, { ...props, children }) });
|
|
54
|
-
}
|
|
55
|
-
function Tooltip({
|
|
56
|
-
content,
|
|
57
|
-
children,
|
|
58
|
-
side = "top",
|
|
59
|
-
align = "center",
|
|
60
|
-
arrow = true,
|
|
61
|
-
delayDuration,
|
|
62
|
-
open,
|
|
63
|
-
defaultOpen,
|
|
64
|
-
onOpenChange,
|
|
65
|
-
disabled = false,
|
|
66
|
-
container,
|
|
67
|
-
className
|
|
68
|
-
}) {
|
|
69
|
-
const hasProvider = (0, import_react.useContext)(HasProviderContext);
|
|
70
|
-
if (disabled) return children;
|
|
71
|
-
const root = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
72
|
-
RadixTooltip.Root,
|
|
73
|
-
{
|
|
74
|
-
open,
|
|
75
|
-
defaultOpen,
|
|
76
|
-
onOpenChange,
|
|
77
|
-
delayDuration,
|
|
78
|
-
children: [
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadixTooltip.Trigger, { asChild: true, children }),
|
|
80
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadixTooltip.Portal, { container, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
81
|
-
RadixTooltip.Content,
|
|
82
|
-
{
|
|
83
|
-
className: cx("nuri-tooltip", className),
|
|
84
|
-
side,
|
|
85
|
-
align,
|
|
86
|
-
sideOffset: 4,
|
|
87
|
-
collisionPadding: 8,
|
|
88
|
-
arrowPadding: 6,
|
|
89
|
-
hideWhenDetached: true,
|
|
90
|
-
children: [
|
|
91
|
-
content,
|
|
92
|
-
arrow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadixTooltip.Arrow, { className: "nuri-tooltip__arrow", width: 14, height: 7 })
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
) })
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
return hasProvider ? root : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadixTooltip.Provider, { delayDuration: 100, children: root });
|
|
100
|
-
}
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
Tooltip,
|
|
104
|
-
TooltipProvider
|
|
105
|
-
});
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.Tooltip = _chunkLRATCHCBcjs.Tooltip; exports.TooltipProvider = _chunkLRATCHCBcjs.TooltipProvider;
|
|
106
11
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/summerhoony/Desktop/projects/nuri-ui/dist/Tooltip/index.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACF,yGAAC","file":"/Users/summerhoony/Desktop/projects/nuri-ui/dist/Tooltip/index.cjs"}
|
package/dist/Tooltip/index.js
CHANGED
|
@@ -1,67 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
// src/utils/cx.ts
|
|
9
|
-
function cx(...classes) {
|
|
10
|
-
return classes.filter(Boolean).join(" ");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// src/Tooltip/Tooltip.tsx
|
|
14
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
var HasProviderContext = createContext(false);
|
|
16
|
-
function TooltipProvider({ children, ...props }) {
|
|
17
|
-
return /* @__PURE__ */ jsx(HasProviderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(RadixTooltip.Provider, { ...props, children }) });
|
|
18
|
-
}
|
|
19
|
-
function Tooltip({
|
|
20
|
-
content,
|
|
21
|
-
children,
|
|
22
|
-
side = "top",
|
|
23
|
-
align = "center",
|
|
24
|
-
arrow = true,
|
|
25
|
-
delayDuration,
|
|
26
|
-
open,
|
|
27
|
-
defaultOpen,
|
|
28
|
-
onOpenChange,
|
|
29
|
-
disabled = false,
|
|
30
|
-
container,
|
|
31
|
-
className
|
|
32
|
-
}) {
|
|
33
|
-
const hasProvider = useContext(HasProviderContext);
|
|
34
|
-
if (disabled) return children;
|
|
35
|
-
const root = /* @__PURE__ */ jsxs(
|
|
36
|
-
RadixTooltip.Root,
|
|
37
|
-
{
|
|
38
|
-
open,
|
|
39
|
-
defaultOpen,
|
|
40
|
-
onOpenChange,
|
|
41
|
-
delayDuration,
|
|
42
|
-
children: [
|
|
43
|
-
/* @__PURE__ */ jsx(RadixTooltip.Trigger, { asChild: true, children }),
|
|
44
|
-
/* @__PURE__ */ jsx(RadixTooltip.Portal, { container, children: /* @__PURE__ */ jsxs(
|
|
45
|
-
RadixTooltip.Content,
|
|
46
|
-
{
|
|
47
|
-
className: cx("nuri-tooltip", className),
|
|
48
|
-
side,
|
|
49
|
-
align,
|
|
50
|
-
sideOffset: 4,
|
|
51
|
-
collisionPadding: 8,
|
|
52
|
-
arrowPadding: 6,
|
|
53
|
-
hideWhenDetached: true,
|
|
54
|
-
children: [
|
|
55
|
-
content,
|
|
56
|
-
arrow && /* @__PURE__ */ jsx(RadixTooltip.Arrow, { className: "nuri-tooltip__arrow", width: 14, height: 7 })
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
) })
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
return hasProvider ? root : /* @__PURE__ */ jsx(RadixTooltip.Provider, { delayDuration: 100, children: root });
|
|
64
|
-
}
|
|
2
|
+
import {
|
|
3
|
+
Tooltip,
|
|
4
|
+
TooltipProvider
|
|
5
|
+
} from "../chunk-2YGYLCCA.js";
|
|
6
|
+
import "../chunk-PS6QXS5Z.js";
|
|
65
7
|
export {
|
|
66
8
|
Tooltip,
|
|
67
9
|
TooltipProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|