@xfilecom/front-core 0.2.43 → 0.2.44

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/base.css CHANGED
@@ -1392,13 +1392,16 @@ button.xfc-badge[aria-disabled='true'] {
1392
1392
  z-index: 9998;
1393
1393
  display: flex;
1394
1394
  flex-direction: column;
1395
+ align-items: flex-end;
1395
1396
  gap: var(--xfc-space-sm);
1396
- max-width: 360px;
1397
+ width: max-content;
1398
+ max-width: min(100vw - 2 * var(--xfc-space-md), 28rem);
1397
1399
  }
1398
1400
 
1399
1401
  .xfc-toast {
1400
1402
  display: inline-flex;
1401
- width: 100%;
1403
+ width: max-content;
1404
+ max-width: min(100vw - 2 * var(--xfc-space-md), 28rem);
1402
1405
  box-sizing: border-box;
1403
1406
  align-items: flex-start;
1404
1407
  justify-content: flex-start;
@@ -1451,7 +1454,7 @@ button.xfc-badge[aria-disabled='true'] {
1451
1454
  }
1452
1455
 
1453
1456
  .xfc-toast__message {
1454
- flex: 1 1 0;
1457
+ flex: 0 1 auto;
1455
1458
  min-width: 0;
1456
1459
  overflow-wrap: break-word;
1457
1460
  word-wrap: break-word;
@@ -1,5 +1,7 @@
1
- import type { ReactNode, SVGAttributes } from 'react';
1
+ import { type ReactNode, type SVGAttributes } from 'react';
2
2
  export type ToastSeverity = 'info' | 'success' | 'warn' | 'error';
3
+ /** `ToastList` 기본 자동 닫기 간격(ms) */
4
+ export declare const DEFAULT_TOAST_AUTO_DISMISS_MS = 2000;
3
5
  export type ToastSeverityIconProps = {
4
6
  severity: ToastSeverity;
5
7
  } & Pick<SVGAttributes<SVGSVGElement>, 'className' | 'style'>;
@@ -24,6 +26,11 @@ export type ToastEntry = {
24
26
  icon?: ReactNode | null;
25
27
  /** 행별 닫기 버튼. 생략 시 `ToastList`의 `dismissible`(기본 true)을 따름. */
26
28
  dismissible?: boolean;
29
+ /**
30
+ * 자동 닫기 지연(ms). `false`면 이 행만 끔.
31
+ * 생략 시 `ToastList`의 `defaultAutoDismissMs`(기본 `DEFAULT_TOAST_AUTO_DISMISS_MS`)를 따름.
32
+ */
33
+ autoDismissMs?: number | false;
27
34
  };
28
35
  export type ToastListProps = {
29
36
  toasts: ToastEntry[];
@@ -32,6 +39,11 @@ export type ToastListProps = {
32
39
  dismissAriaLabel?: string;
33
40
  /** 행에 `dismissible`이 없을 때 쓰는 기본값. 생략 시 각 토스트는 `dismissible` 기본 true. */
34
41
  dismissible?: boolean;
42
+ /**
43
+ * 목록 기본 자동 닫기(ms). `false`면 목록 전체에서 끔(행별 `autoDismissMs`로 개별 켤 수 있음).
44
+ * @default DEFAULT_TOAST_AUTO_DISMISS_MS
45
+ */
46
+ defaultAutoDismissMs?: number | false;
35
47
  };
36
48
  /** 하단 고정 토스트 스택 (business-promotion `ToastList` UI, 상태는 부모에서 주입). */
37
- export declare function ToastList({ toasts, onDismiss, className, dismissAriaLabel, dismissible: listDismissible, }: ToastListProps): import("react/jsx-runtime").JSX.Element | null;
49
+ export declare function ToastList({ toasts, onDismiss, className, dismissAriaLabel, dismissible: listDismissible, defaultAutoDismissMs, }: ToastListProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_TOAST_AUTO_DISMISS_MS = void 0;
3
4
  exports.ToastSeverityIcon = ToastSeverityIcon;
4
5
  exports.Toast = Toast;
5
6
  exports.ToastList = ToastList;
6
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ /** `ToastList` 기본 자동 닫기 간격(ms) */
10
+ exports.DEFAULT_TOAST_AUTO_DISMISS_MS = 2000;
11
+ function ToastDismissTimer({ id, ms, onDismiss, }) {
12
+ const onDismissRef = (0, react_1.useRef)(onDismiss);
13
+ onDismissRef.current = onDismiss;
14
+ (0, react_1.useEffect)(() => {
15
+ if (ms <= 0)
16
+ return;
17
+ const t = setTimeout(() => {
18
+ onDismissRef.current(id);
19
+ }, ms);
20
+ return () => clearTimeout(t);
21
+ }, [id, ms]);
22
+ return null;
23
+ }
24
+ function resolveAutoDismissMs(entry, listDefault) {
25
+ if (entry.autoDismissMs === false)
26
+ return 0;
27
+ if (typeof entry.autoDismissMs === 'number') {
28
+ return entry.autoDismissMs > 0 ? entry.autoDismissMs : 0;
29
+ }
30
+ const d = listDefault === undefined ? exports.DEFAULT_TOAST_AUTO_DISMISS_MS : listDefault;
31
+ if (d === false)
32
+ return 0;
33
+ return d > 0 ? d : 0;
34
+ }
7
35
  const iconSvgProps = {
8
36
  width: 20,
9
37
  height: 20,
@@ -40,12 +68,13 @@ function Toast({ severity, message, onDismiss, className = '', icon, dismissAria
40
68
  return ((0, jsx_runtime_1.jsxs)("div", { className: root, role: liveRole, children: [iconContent != null ? (0, jsx_runtime_1.jsx)("span", { className: "xfc-toast__icon", children: iconContent }) : null, (0, jsx_runtime_1.jsx)("div", { className: "xfc-toast__message", children: message }), showDismiss ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "xfc-toast-dismiss", onClick: onDismiss, "aria-label": dismissAriaLabel, children: (0, jsx_runtime_1.jsx)(ToastCloseIcon, {}) })) : null] }));
41
69
  }
42
70
  /** 하단 고정 토스트 스택 (business-promotion `ToastList` UI, 상태는 부모에서 주입). */
43
- function ToastList({ toasts, onDismiss, className = '', dismissAriaLabel, dismissible: listDismissible, }) {
71
+ function ToastList({ toasts, onDismiss, className = '', dismissAriaLabel, dismissible: listDismissible, defaultAutoDismissMs, }) {
44
72
  if (!toasts.length)
45
73
  return null;
46
74
  const listCls = ['xfc-toast-list', className].filter(Boolean).join(' ');
47
75
  return ((0, jsx_runtime_1.jsx)("div", { className: listCls, "aria-live": "polite", "aria-relevant": "additions text", children: toasts.map((t) => {
48
76
  const rowDismissible = t.dismissible ?? listDismissible ?? true;
49
- return ((0, jsx_runtime_1.jsx)(Toast, { severity: t.severity, message: t.message, icon: t.icon, dismissAriaLabel: dismissAriaLabel, dismissible: rowDismissible, onDismiss: () => onDismiss(t.id) }, t.id));
77
+ const dismissMs = resolveAutoDismissMs(t, defaultAutoDismissMs);
78
+ return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [dismissMs > 0 ? ((0, jsx_runtime_1.jsx)(ToastDismissTimer, { id: t.id, ms: dismissMs, onDismiss: onDismiss })) : null, (0, jsx_runtime_1.jsx)(Toast, { severity: t.severity, message: t.message, icon: t.icon, dismissAriaLabel: dismissAriaLabel, dismissible: rowDismissible, onDismiss: () => onDismiss(t.id) })] }, t.id));
50
79
  }) }));
51
80
  }
@@ -32,7 +32,7 @@ export { Switch, type SwitchProps } from './Switch';
32
32
  export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, type TableBodyProps, type TableCaptionProps, type TableCellProps, type TableFooterProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, } from './Table';
33
33
  export { Tabs, TabsContent, TabsList, TabsTrigger, type TabsContentProps, type TabsListProps, type TabsProps, type TabsTriggerProps, } from './Tabs';
34
34
  export { Textarea, type TextareaProps, } from './Textarea';
35
- export { Toast, ToastList, ToastSeverityIcon, type ToastEntry, type ToastListProps, type ToastProps, type ToastSeverity, type ToastSeverityIconProps, } from './Toast';
35
+ export { Toast, ToastList, ToastSeverityIcon, DEFAULT_TOAST_AUTO_DISMISS_MS, type ToastEntry, type ToastListProps, type ToastProps, type ToastSeverity, type ToastSeverityIconProps, } from './Toast';
36
36
  export { Text, type TextProps, type TextVariant } from './Text';
37
37
  export { Toggle, type ToggleProps } from './Toggle';
38
38
  export { Tooltip, type TooltipProps } from './Tooltip';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TableCaption = exports.TableBody = exports.Table = exports.Switch = exports.Stack = exports.Slider = exports.Skeleton = exports.Separator = exports.Select = exports.ScrollArea = exports.RadioGroupItem = exports.RadioGroup = exports.Progress = exports.PaginationLink = exports.PaginationItem = exports.PaginationEllipsis = exports.PaginationContent = exports.Pagination = exports.Paper = exports.LoadingOverlay = exports.Label = exports.Input = exports.InlineErrorList = exports.Field = exports.CollapsibleTrigger = exports.CollapsibleContent = exports.Collapsible = exports.Checkbox = exports.Card = exports.Button = exports.Box = exports.BreadcrumbSeparator = exports.BreadcrumbPage = exports.BreadcrumbList = exports.BreadcrumbLink = exports.BreadcrumbItem = exports.Breadcrumb = exports.Badge = exports.AvatarImage = exports.AvatarFallback = exports.AvatarAuto = exports.Avatar = exports.AspectRatio = exports.AlertTitle = exports.AlertDescription = exports.Alert = exports.AccordionTrigger = exports.AccordionItem = exports.AccordionContent = exports.Accordion = void 0;
4
- exports.Tooltip = exports.Toggle = exports.Text = exports.ToastSeverityIcon = exports.ToastList = exports.Toast = exports.Textarea = exports.TabsTrigger = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableFooter = exports.TableCell = void 0;
4
+ exports.Tooltip = exports.Toggle = exports.Text = exports.DEFAULT_TOAST_AUTO_DISMISS_MS = exports.ToastSeverityIcon = exports.ToastList = exports.Toast = exports.Textarea = exports.TabsTrigger = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableFooter = exports.TableCell = void 0;
5
5
  /**
6
6
  * Atomic UI — design tokens + base.css 의 `.xfc-*` 와 1:1.
7
7
  * 패키지 루트는 `components/index.ts` → 여기서 동일 심볼을 재export.
@@ -100,6 +100,7 @@ var Toast_1 = require("./Toast");
100
100
  Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return Toast_1.Toast; } });
101
101
  Object.defineProperty(exports, "ToastList", { enumerable: true, get: function () { return Toast_1.ToastList; } });
102
102
  Object.defineProperty(exports, "ToastSeverityIcon", { enumerable: true, get: function () { return Toast_1.ToastSeverityIcon; } });
103
+ Object.defineProperty(exports, "DEFAULT_TOAST_AUTO_DISMISS_MS", { enumerable: true, get: function () { return Toast_1.DEFAULT_TOAST_AUTO_DISMISS_MS; } });
103
104
  var Text_1 = require("./Text");
104
105
  Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
105
106
  var Toggle_1 = require("./Toggle");
@@ -1,2 +1,2 @@
1
1
  /** Auto-generated by scripts/write-version.js — do not edit by hand */
2
- export declare const XFRAME_FRONT_CORE_VERSION: "0.2.43";
2
+ export declare const XFRAME_FRONT_CORE_VERSION: "0.2.44";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.XFRAME_FRONT_CORE_VERSION = void 0;
4
4
  /** Auto-generated by scripts/write-version.js — do not edit by hand */
5
- exports.XFRAME_FRONT_CORE_VERSION = "0.2.43";
5
+ exports.XFRAME_FRONT_CORE_VERSION = "0.2.44";
package/dist/index.d.ts CHANGED
@@ -51,6 +51,6 @@ export declare const tokenVars: {
51
51
  readonly toastWarnBg: "--xfc-toast-warn-bg";
52
52
  readonly toastErrorBg: "--xfc-toast-error-bg";
53
53
  };
54
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AspectRatio, Avatar, AvatarAuto, AvatarFallback, AvatarImage, Badge, BottomSheet, Box, Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ConfirmDialog, Dialog, Field, InlineErrorList, Input, Label, LoadingOverlay, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, Paper, Progress, RadioGroup, RadioGroupItem, ScrollArea, Select, Separator, Skeleton, Slider, Stack, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, Textarea, Toast, ToastList, ToastSeverityIcon, Toggle, Tooltip, type AccordionContentProps, type AccordionItemProps, type AccordionProps, type AccordionTriggerProps, type AlertDescriptionProps, type AlertProps, type AlertTitleProps, type AspectRatioProps, type AvatarAutoProps, type AvatarFallbackProps, type AvatarImageProps, type AvatarProps, type BadgeProps, type BottomSheetProps, type BoxProps, type BreadcrumbItemProps, type BreadcrumbLinkProps, type BreadcrumbListProps, type BreadcrumbPageProps, type BreadcrumbProps, type BreadcrumbSeparatorProps, type ButtonProps, type CardProps, type CheckboxProps, type CollapsibleContentProps, type CollapsibleProps, type CollapsibleTriggerProps, type ConfirmDialogProps, type DialogProps, type FieldProps, type InlineErrorEntry, type InlineErrorListProps, type InputProps, type LabelProps, type LoadingOverlayProps, type PaginationContentProps, type PaginationEllipsisProps, type PaginationItemProps, type PaginationLinkProps, type PaginationProps, type PaperProps, type ProgressProps, type RadioGroupItemProps, type RadioGroupProps, type ScrollAreaProps, type SelectProps, type SeparatorProps, type SkeletonProps, type SliderProps, type StackProps, type SwitchProps, type TableBodyProps, type TableCaptionProps, type TableCellProps, type TableFooterProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, type TabsContentProps, type TabsListProps, type TabsProps, type TabsTriggerProps, type TextProps, type TextVariant, type TextareaProps, type ToastEntry, type ToastListProps, type ToastProps, type ToastSeverity, type ToastSeverityIconProps, type ToggleProps, type TooltipProps, } from './components';
54
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AspectRatio, Avatar, AvatarAuto, AvatarFallback, AvatarImage, Badge, BottomSheet, Box, Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ConfirmDialog, Dialog, Field, InlineErrorList, Input, Label, LoadingOverlay, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, Paper, Progress, RadioGroup, RadioGroupItem, ScrollArea, Select, Separator, Skeleton, Slider, Stack, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, Textarea, Toast, ToastList, ToastSeverityIcon, DEFAULT_TOAST_AUTO_DISMISS_MS, Toggle, Tooltip, type AccordionContentProps, type AccordionItemProps, type AccordionProps, type AccordionTriggerProps, type AlertDescriptionProps, type AlertProps, type AlertTitleProps, type AspectRatioProps, type AvatarAutoProps, type AvatarFallbackProps, type AvatarImageProps, type AvatarProps, type BadgeProps, type BottomSheetProps, type BoxProps, type BreadcrumbItemProps, type BreadcrumbLinkProps, type BreadcrumbListProps, type BreadcrumbPageProps, type BreadcrumbProps, type BreadcrumbSeparatorProps, type ButtonProps, type CardProps, type CheckboxProps, type CollapsibleContentProps, type CollapsibleProps, type CollapsibleTriggerProps, type ConfirmDialogProps, type DialogProps, type FieldProps, type InlineErrorEntry, type InlineErrorListProps, type InputProps, type LabelProps, type LoadingOverlayProps, type PaginationContentProps, type PaginationEllipsisProps, type PaginationItemProps, type PaginationLinkProps, type PaginationProps, type PaperProps, type ProgressProps, type RadioGroupItemProps, type RadioGroupProps, type ScrollAreaProps, type SelectProps, type SeparatorProps, type SkeletonProps, type SliderProps, type StackProps, type SwitchProps, type TableBodyProps, type TableCaptionProps, type TableCellProps, type TableFooterProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, type TabsContentProps, type TabsListProps, type TabsProps, type TabsTriggerProps, type TextProps, type TextVariant, type TextareaProps, type ToastEntry, type ToastListProps, type ToastProps, type ToastSeverity, type ToastSeverityIconProps, type ToggleProps, type TooltipProps, } from './components';
55
55
  /** 커스텀 오버레이용 — `Dialog`/`BottomSheet`와 동일한 훅 */
56
56
  export { useBodyScrollLock, useEscapeKey, useFocusTrap } from './components';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Slider = exports.Skeleton = exports.Separator = exports.Select = exports.ScrollArea = exports.RadioGroupItem = exports.RadioGroup = exports.Progress = exports.Paper = exports.PaginationLink = exports.PaginationItem = exports.PaginationEllipsis = exports.PaginationContent = exports.Pagination = exports.LoadingOverlay = exports.Label = exports.Input = exports.InlineErrorList = exports.Field = exports.Dialog = exports.ConfirmDialog = exports.CollapsibleTrigger = exports.CollapsibleContent = exports.Collapsible = exports.Checkbox = exports.Card = exports.Button = exports.BreadcrumbSeparator = exports.BreadcrumbPage = exports.BreadcrumbList = exports.BreadcrumbLink = exports.BreadcrumbItem = exports.Breadcrumb = exports.Box = exports.BottomSheet = exports.Badge = exports.AvatarImage = exports.AvatarFallback = exports.AvatarAuto = exports.Avatar = exports.AspectRatio = exports.AlertTitle = exports.AlertDescription = exports.Alert = exports.AccordionTrigger = exports.AccordionItem = exports.AccordionContent = exports.Accordion = exports.tokenVars = exports.XFRAME_FRONT_CORE_VERSION = void 0;
4
- exports.useFocusTrap = exports.useEscapeKey = exports.useBodyScrollLock = exports.Tooltip = exports.Toggle = exports.ToastSeverityIcon = exports.ToastList = exports.Toast = exports.Textarea = exports.Text = exports.TabsTrigger = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableFooter = exports.TableCell = exports.TableCaption = exports.TableBody = exports.Table = exports.Switch = exports.Stack = void 0;
4
+ exports.useFocusTrap = exports.useEscapeKey = exports.useBodyScrollLock = exports.Tooltip = exports.Toggle = exports.DEFAULT_TOAST_AUTO_DISMISS_MS = exports.ToastSeverityIcon = exports.ToastList = exports.Toast = exports.Textarea = exports.Text = exports.TabsTrigger = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableFooter = exports.TableCell = exports.TableCaption = exports.TableBody = exports.Table = exports.Switch = exports.Stack = void 0;
5
5
  /**
6
6
  * @xfilecom/front-core — design tokens + atomic React components (browser-only).
7
7
  *
@@ -124,6 +124,7 @@ Object.defineProperty(exports, "Textarea", { enumerable: true, get: function ()
124
124
  Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return components_1.Toast; } });
125
125
  Object.defineProperty(exports, "ToastList", { enumerable: true, get: function () { return components_1.ToastList; } });
126
126
  Object.defineProperty(exports, "ToastSeverityIcon", { enumerable: true, get: function () { return components_1.ToastSeverityIcon; } });
127
+ Object.defineProperty(exports, "DEFAULT_TOAST_AUTO_DISMISS_MS", { enumerable: true, get: function () { return components_1.DEFAULT_TOAST_AUTO_DISMISS_MS; } });
127
128
  Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return components_1.Toggle; } });
128
129
  Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return components_1.Tooltip; } });
129
130
  /** 커스텀 오버레이용 — `Dialog`/`BottomSheet`와 동일한 훅 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfilecom/front-core",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "description": "Shared design tokens, base CSS, and atomic React components (browser-only; no Nest dependency)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",