@bigtablet/design-system 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -409,145 +409,6 @@
409
409
  border-color: #000000;
410
410
  }
411
411
 
412
- /* src/ui/form/markdown/style.scss */
413
- .md {
414
- display: grid;
415
- gap: 0.5rem;
416
- }
417
- .md__label {
418
- font-size: 0.875rem;
419
- font-weight: 400;
420
- line-height: 1.5;
421
- color: #6B7280;
422
- }
423
- .md__grid {
424
- display: grid;
425
- grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
426
- align-items: stretch;
427
- column-gap: 1.5rem;
428
- row-gap: 0.75rem;
429
- }
430
- @media (max-width: 960px) {
431
- .md__grid {
432
- grid-template-columns: 1fr;
433
- }
434
- }
435
- .md__input,
436
- .md__preview {
437
- min-width: 0;
438
- box-sizing: border-box;
439
- max-width: 100%;
440
- overflow: auto;
441
- }
442
- .md__input {
443
- width: 100%;
444
- min-height: 300px;
445
- border: 1px solid #e5e5e5;
446
- border-radius: 8px;
447
- padding: 0.75rem;
448
- background: #ffffff;
449
- font-size: 0.9375rem;
450
- font-weight: 400;
451
- line-height: 1.5;
452
- color: #3B3B3B;
453
- line-height: 1.75;
454
- resize: vertical;
455
- transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
456
- }
457
- .md__input:hover {
458
- border-color: rgba(0, 0, 0, 0.08);
459
- }
460
- .md__input:focus {
461
- border-color: #000000;
462
- box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
463
- outline: none;
464
- }
465
- .md__preview {
466
- min-height: 300px;
467
- border: 1px solid #e5e5e5;
468
- border-radius: 8px;
469
- background: #ffffff;
470
- padding: 0.75rem;
471
- }
472
- .markdown-body {
473
- font-size: 0.9375rem;
474
- font-weight: 400;
475
- line-height: 1.5;
476
- color: #3B3B3B;
477
- line-height: 1.7;
478
- word-break: break-word;
479
- overflow-wrap: anywhere;
480
- }
481
- .markdown-body img,
482
- .markdown-body video {
483
- max-width: 100%;
484
- height: auto;
485
- display: block;
486
- }
487
- .markdown-body h1,
488
- .markdown-body h2,
489
- .markdown-body h3,
490
- .markdown-body h4,
491
- .markdown-body h5,
492
- .markdown-body h6 {
493
- font-size: 1.25rem;
494
- font-weight: 600;
495
- line-height: 1.3;
496
- color: #1F2937;
497
- margin: 1rem 0 0.5rem;
498
- }
499
- .markdown-body p {
500
- margin: 0.5rem 0;
501
- }
502
- .markdown-body a {
503
- color: #000000;
504
- text-decoration: underline;
505
- }
506
- .markdown-body ul,
507
- .markdown-body ol {
508
- margin: 0.5rem 0 0.5rem 1rem;
509
- }
510
- .markdown-body blockquote {
511
- border-left: 4px solid #e5e5e5;
512
- padding-left: 0.75rem;
513
- color: #6B7280;
514
- margin: 0.5rem 0;
515
- }
516
- .markdown-body table {
517
- width: 100%;
518
- border-collapse: collapse;
519
- margin: 0.75rem 0;
520
- }
521
- .markdown-body table th,
522
- .markdown-body table td {
523
- border: 1px solid #e5e5e5;
524
- padding: 0.5rem 0.75rem;
525
- text-align: left;
526
- }
527
- .markdown-body table th {
528
- background: #fafafa;
529
- }
530
- .markdown-body code {
531
- background: #fafafa;
532
- padding: 2px 6px;
533
- border-radius: 6px;
534
- font-family:
535
- ui-monospace,
536
- SFMono-Regular,
537
- Menlo,
538
- monospace;
539
- }
540
- .markdown-body pre {
541
- background: #fafafa;
542
- padding: 0.75rem;
543
- border-radius: 8px;
544
- overflow: auto;
545
- }
546
- .markdown-body pre code {
547
- background: transparent;
548
- padding: 0;
549
- }
550
-
551
412
  /* src/ui/form/radio/style.scss */
552
413
  .radio {
553
414
  display: inline-flex;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,24 @@ declare const Card: ({ shadow, padding, bordered, className, ...props }: CardPro
11
11
 
12
12
  type AlertVariant = "info" | "success" | "warning" | "error";
13
13
  type AlertActionsAlign = "left" | "center" | "right";
14
+ interface AlertOptions {
15
+ variant?: AlertVariant;
16
+ title?: React.ReactNode;
17
+ message?: React.ReactNode;
18
+ confirmText?: string;
19
+ cancelText?: string;
20
+ showCancel?: boolean;
21
+ actionsAlign?: AlertActionsAlign;
22
+ onConfirm?: () => void;
23
+ onCancel?: () => void;
24
+ }
25
+ interface AlertContextValue {
26
+ showAlert: (options: AlertOptions) => void;
27
+ }
28
+ declare const useAlert: () => AlertContextValue;
29
+ declare const AlertProvider: React.FC<{
30
+ children: React.ReactNode;
31
+ }>;
14
32
  interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
15
33
  variant?: AlertVariant;
16
34
  title?: React.ReactNode;
@@ -63,15 +81,6 @@ interface FileInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
63
81
  }
64
82
  declare const FileInput: ({ label, onFiles, className, ...props }: FileInputProps) => react_jsx_runtime.JSX.Element;
65
83
 
66
- type MarkdownEditorProps = {
67
- label?: string;
68
- placeholder?: string;
69
- value: string;
70
- onChangeAction: (val: string) => void;
71
- rows?: number;
72
- };
73
- declare const MarkdownEditor: ({ label, placeholder, value, onChangeAction, rows, }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
74
-
75
84
  interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
76
85
  label?: React.ReactNode;
77
86
  size?: "sm" | "md" | "lg";
@@ -147,4 +156,4 @@ declare const SkeletonCard: () => react_jsx_runtime.JSX.Element;
147
156
 
148
157
  declare const SkeletonList: () => react_jsx_runtime.JSX.Element;
149
158
 
150
- export { Alert, Button, Card, Checkbox, FileInput, Loading, MarkdownEditor, Modal, Pagination, Radio, Select, SkeletonCard, SkeletonList, Switch, TextField, ToastProvider, useToast };
159
+ export { Alert, AlertProvider, Button, Card, Checkbox, FileInput, Loading, Modal, Pagination, Radio, Select, SkeletonCard, SkeletonList, Switch, TextField, ToastProvider, useAlert, useToast };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
+ "use client";
2
+ import './index.css';
1
3
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import * as React4 from 'react';
3
- import { createContext } from 'react';
4
- import 'react-dom';
4
+ import * as React3 from 'react';
5
+ import { createContext, useContext, useState, useCallback } from 'react';
6
+ import { createPortal } from 'react-dom';
5
7
  import { ToastContainer, Slide, toast } from 'react-toastify';
6
8
  import 'react-toastify/dist/ReactToastify.css';
7
- import ReactMarkdown from 'react-markdown';
8
- import remarkGfm from 'remark-gfm';
9
9
  import { ChevronDown, Check } from 'lucide-react';
10
10
 
11
11
  // src/ui/display/card/index.tsx
@@ -25,7 +25,101 @@ var Card = ({
25
25
  ].filter(Boolean).join(" ");
26
26
  return /* @__PURE__ */ jsx("div", { className: cls, ...props });
27
27
  };
28
- createContext(null);
28
+ var AlertContext = createContext(null);
29
+ var useAlert = () => {
30
+ const context = useContext(AlertContext);
31
+ if (!context) {
32
+ throw new Error("useAlert must be used within AlertProvider");
33
+ }
34
+ return context;
35
+ };
36
+ var AlertProvider = ({
37
+ children
38
+ }) => {
39
+ const [alertState, setAlertState] = useState({
40
+ isOpen: false
41
+ });
42
+ const showAlert = useCallback((options) => {
43
+ setAlertState({
44
+ ...options,
45
+ isOpen: true
46
+ });
47
+ }, []);
48
+ const handleClose = useCallback(() => {
49
+ setAlertState((prev) => ({ ...prev, isOpen: false }));
50
+ }, []);
51
+ const handleConfirm = useCallback(() => {
52
+ alertState.onConfirm?.();
53
+ handleClose();
54
+ }, [alertState.onConfirm, handleClose]);
55
+ const handleCancel = useCallback(() => {
56
+ alertState.onCancel?.();
57
+ handleClose();
58
+ }, [alertState.onCancel, handleClose]);
59
+ return /* @__PURE__ */ jsxs(AlertContext.Provider, { value: { showAlert }, children: [
60
+ children,
61
+ alertState.isOpen && createPortal(
62
+ /* @__PURE__ */ jsx(
63
+ AlertModal,
64
+ {
65
+ ...alertState,
66
+ onConfirm: handleConfirm,
67
+ onCancel: handleCancel,
68
+ onClose: handleClose
69
+ }
70
+ ),
71
+ document.body
72
+ )
73
+ ] });
74
+ };
75
+ var AlertModal = ({
76
+ variant = "info",
77
+ title,
78
+ message,
79
+ confirmText = "\uD655\uC778",
80
+ cancelText = "\uCDE8\uC18C",
81
+ showCancel = false,
82
+ actionsAlign = "right",
83
+ onConfirm,
84
+ onCancel,
85
+ onClose
86
+ }) => {
87
+ return /* @__PURE__ */ jsx("div", { className: "alert-overlay", onClick: onClose, children: /* @__PURE__ */ jsxs(
88
+ "div",
89
+ {
90
+ className: `alert-modal alert-modal--${variant}`,
91
+ onClick: (e) => e.stopPropagation(),
92
+ role: "alertdialog",
93
+ "aria-modal": "true",
94
+ "aria-labelledby": "alert-title",
95
+ "aria-describedby": "alert-message",
96
+ children: [
97
+ title && /* @__PURE__ */ jsx("div", { className: "alert-modal__title", id: "alert-title", children: title }),
98
+ message && /* @__PURE__ */ jsx("div", { className: "alert-modal__message", id: "alert-message", children: message }),
99
+ /* @__PURE__ */ jsxs("div", { className: `alert-modal__actions alert-modal__actions--${actionsAlign}`, children: [
100
+ showCancel && /* @__PURE__ */ jsx(
101
+ "button",
102
+ {
103
+ type: "button",
104
+ className: "alert-modal__button alert-modal__button--cancel",
105
+ onClick: onCancel,
106
+ children: cancelText
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsx(
110
+ "button",
111
+ {
112
+ type: "button",
113
+ className: "alert-modal__button alert-modal__button--confirm",
114
+ onClick: onConfirm,
115
+ children: confirmText
116
+ }
117
+ )
118
+ ] })
119
+ ]
120
+ }
121
+ ) });
122
+ };
29
123
  var Alert = ({
30
124
  variant = "info",
31
125
  title,
@@ -157,8 +251,8 @@ var Checkbox = ({
157
251
  className,
158
252
  ...props
159
253
  }) => {
160
- const ref = React4.useRef(null);
161
- React4.useEffect(() => {
254
+ const ref = React3.useRef(null);
255
+ React3.useEffect(() => {
162
256
  if (ref.current) ref.current.indeterminate = !!indeterminate;
163
257
  }, [indeterminate]);
164
258
  return /* @__PURE__ */ jsxs(
@@ -179,7 +273,7 @@ var FileInput = ({
179
273
  className,
180
274
  ...props
181
275
  }) => {
182
- const id = React4.useId();
276
+ const id = React3.useId();
183
277
  return /* @__PURE__ */ jsxs("div", { className: ["file", className].filter(Boolean).join(" "), children: [
184
278
  /* @__PURE__ */ jsx(
185
279
  "input",
@@ -194,32 +288,6 @@ var FileInput = ({
194
288
  /* @__PURE__ */ jsx("label", { htmlFor: id, className: "file__label", children: label })
195
289
  ] });
196
290
  };
197
- var MarkdownEditor = ({
198
- label,
199
- placeholder,
200
- value,
201
- onChangeAction,
202
- rows = 14
203
- }) => {
204
- const id = React4.useId();
205
- return /* @__PURE__ */ jsxs("div", { className: "md", children: [
206
- label && /* @__PURE__ */ jsx("label", { className: "md__label", htmlFor: id, children: label }),
207
- /* @__PURE__ */ jsxs("div", { className: "md__grid", children: [
208
- /* @__PURE__ */ jsx(
209
- "textarea",
210
- {
211
- id,
212
- className: "md__input",
213
- rows,
214
- value,
215
- placeholder,
216
- onChange: (e) => onChangeAction(e.target.value)
217
- }
218
- ),
219
- /* @__PURE__ */ jsx("div", { className: "md__preview markdown-body", children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: value || "\uBBF8\uB9AC\uBCF4\uAE30 \uC601\uC5ED\uC785\uB2C8\uB2E4. \uB9C8\uD06C\uB2E4\uC6B4\uC744 \uC785\uB825\uD558\uC138\uC694." }) })
220
- ] })
221
- ] });
222
- };
223
291
  var Radio = ({
224
292
  label,
225
293
  size = "md",
@@ -252,20 +320,20 @@ function Select({
252
320
  fullWidth,
253
321
  className
254
322
  }) {
255
- const internalId = React4.useId();
323
+ const internalId = React3.useId();
256
324
  const selectId = id ?? internalId;
257
325
  const isControlled = value !== void 0;
258
- const [internal, setInternal] = React4.useState(defaultValue);
326
+ const [internal, setInternal] = React3.useState(defaultValue);
259
327
  const currentValue = isControlled ? value ?? null : internal;
260
- const [open, setOpen] = React4.useState(false);
261
- const [activeIndex, setActiveIndex] = React4.useState(-1);
262
- const wrapperRef = React4.useRef(null);
263
- const listRef = React4.useRef(null);
264
- const currentOption = React4.useMemo(
328
+ const [open, setOpen] = React3.useState(false);
329
+ const [activeIndex, setActiveIndex] = React3.useState(-1);
330
+ const wrapperRef = React3.useRef(null);
331
+ const listRef = React3.useRef(null);
332
+ const currentOption = React3.useMemo(
265
333
  () => options.find((o) => o.value === currentValue) ?? null,
266
334
  [options, currentValue]
267
335
  );
268
- const setValue = React4.useCallback(
336
+ const setValue = React3.useCallback(
269
337
  (next) => {
270
338
  const opt = options.find((o) => o.value === next) ?? null;
271
339
  if (!isControlled) setInternal(next);
@@ -273,7 +341,7 @@ function Select({
273
341
  },
274
342
  [isControlled, onChange, options]
275
343
  );
276
- React4.useEffect(() => {
344
+ React3.useEffect(() => {
277
345
  const onDocClick = (e) => {
278
346
  if (!wrapperRef.current) return;
279
347
  if (!wrapperRef.current.contains(e.target)) setOpen(false);
@@ -342,7 +410,7 @@ function Select({
342
410
  break;
343
411
  }
344
412
  };
345
- React4.useEffect(() => {
413
+ React3.useEffect(() => {
346
414
  if (open) {
347
415
  const idx = Math.max(
348
416
  0,
@@ -440,7 +508,7 @@ var Switch = ({
440
508
  ...props
441
509
  }) => {
442
510
  const controlled = checked !== void 0;
443
- const [inner, setInner] = React4.useState(!!defaultChecked);
511
+ const [inner, setInner] = React3.useState(!!defaultChecked);
444
512
  const on = controlled ? !!checked : inner;
445
513
  const toggle = () => {
446
514
  if (disabled) return;
@@ -468,7 +536,7 @@ var Switch = ({
468
536
  }
469
537
  );
470
538
  };
471
- var TextField = React4.forwardRef(
539
+ var TextField = React3.forwardRef(
472
540
  ({
473
541
  id,
474
542
  label,
@@ -484,7 +552,7 @@ var TextField = React4.forwardRef(
484
552
  onChangeAction,
485
553
  ...props
486
554
  }, ref) => {
487
- const inputId = id ?? React4.useId();
555
+ const inputId = id ?? React3.useId();
488
556
  const helperId = helperText ? `${inputId}-help` : void 0;
489
557
  const classNames = [
490
558
  "tf__input",
@@ -560,7 +628,7 @@ var Modal = ({
560
628
  children,
561
629
  ...props
562
630
  }) => {
563
- React4.useEffect(() => {
631
+ React3.useEffect(() => {
564
632
  const onKey = (e) => e.key === "Escape" && onClose?.();
565
633
  if (open) document.addEventListener("keydown", onKey);
566
634
  return () => document.removeEventListener("keydown", onKey);
@@ -609,4 +677,4 @@ var SkeletonList = () => /* @__PURE__ */ jsxs("div", { className: "request-item
609
677
  /* @__PURE__ */ jsx("div", { className: "request-item__dday", children: /* @__PURE__ */ jsx("span", { className: "skeleton__dday" }) })
610
678
  ] });
611
679
 
612
- export { Alert, Button, Card, Checkbox, FileInput, Loading, MarkdownEditor, Modal, Pagination, Radio, Select, card_default as SkeletonCard, SkeletonList, Switch, TextField, ToastProvider, useToast };
680
+ export { Alert, AlertProvider, Button, Card, Checkbox, FileInput, Loading, Modal, Pagination, Radio, Select, card_default as SkeletonCard, SkeletonList, Switch, TextField, ToastProvider, useAlert, useToast };
package/dist/next.js CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+ import './next.css';
1
3
  import * as React from 'react';
2
4
  import Link from 'next/link';
3
5
  import Image from 'next/image';
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@bigtablet/design-system",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Bigtablet Design System UI Components",
5
5
  "type": "module",
6
- "types": "dist/next.d.ts",
7
- "style": "dist/next.css",
6
+ "types": "dist/index.d.ts",
7
+ "style": "dist/index.css",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/next.d.ts",
11
- "import": "./dist/next.js"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
12
  },
13
13
  "./next": {
14
14
  "types": "./dist/next.d.ts",
15
15
  "import": "./dist/next.js"
16
16
  },
17
- "./style.css": "./dist/next.css"
17
+ "./style.css": "./dist/index.css"
18
18
  },
19
19
  "files": [
20
20
  "dist",
@@ -67,14 +67,13 @@
67
67
  "@types/react": "^19",
68
68
  "@types/react-dom": "^19",
69
69
  "chromatic": "^13.3.3",
70
+ "conventional-changelog-conventionalcommits": "^9.1.0",
70
71
  "esbuild-sass-plugin": "^3",
71
72
  "lucide-react": "^0.552.0",
72
73
  "next": "16.0.1",
73
74
  "react": "19.2.0",
74
75
  "react-dom": "19.2.0",
75
- "react-markdown": "^10.1.0",
76
76
  "react-toastify": "^11.0.5",
77
- "remark-gfm": "^4.0.1",
78
77
  "sass-embedded": "^1.93.3",
79
78
  "semantic-release": "^25.0.1",
80
79
  "storybook": "8.6.14",