@farmzone/fz-react-ui 1.1.11 → 1.1.12

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.d.cts CHANGED
@@ -93,6 +93,12 @@ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
93
93
  showPasswordToggle?: boolean;
94
94
  clearable?: boolean;
95
95
  onClear?: () => void;
96
+ /** 값의 첫 글자로 스페이스를 입력할 수 있는지 (기본 true) */
97
+ allowLeadingSpace?: boolean;
98
+ /** 값 중간(선행/후행 공백을 제외한 부분)에 스페이스가 남아있을 수 있는지 (기본 true) */
99
+ allowMiddleSpace?: boolean;
100
+ /** 포커스를 벗어날 때(blur) 값 끝에 스페이스가 남아있을 수 있는지 (기본 true) */
101
+ allowTrailingSpace?: boolean;
96
102
  }
97
103
  declare function Input(props: InputProps): react.JSX.Element;
98
104
 
@@ -400,10 +406,12 @@ declare function useBreadCrumbItems(params: Omit<BuildBreadCrumbItemsParams, "pa
400
406
  pathname?: string;
401
407
  }): BreadCrumbItem[];
402
408
 
403
- declare function ToastProvider(): react.JSX.Element;
404
-
405
409
  type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
406
410
  type ToastType = "success" | "error" | "warning" | "info" | "loading";
411
+ interface ToastIconTheme {
412
+ primary: string;
413
+ secondary: string;
414
+ }
407
415
  interface ToastProps {
408
416
  toast: string;
409
417
  id?: string;
@@ -412,10 +420,35 @@ interface ToastProps {
412
420
  duration?: number;
413
421
  showCloseButton?: boolean;
414
422
  className?: string;
423
+ style?: CSSProperties;
424
+ iconTheme?: ToastIconTheme;
415
425
  icon?: ReactNode;
416
426
  onClose?: () => void;
417
427
  onClick?: () => void;
418
428
  }
429
+ interface ToastStyleOptions {
430
+ className?: string;
431
+ style?: CSSProperties;
432
+ iconTheme?: ToastIconTheme;
433
+ }
434
+ interface ToastOptions extends ToastStyleOptions {
435
+ duration?: number;
436
+ success?: ToastStyleOptions & {
437
+ duration?: number;
438
+ };
439
+ error?: ToastStyleOptions & {
440
+ duration?: number;
441
+ };
442
+ warning?: ToastStyleOptions & {
443
+ duration?: number;
444
+ };
445
+ info?: ToastStyleOptions & {
446
+ duration?: number;
447
+ };
448
+ loading?: ToastStyleOptions & {
449
+ duration?: number;
450
+ };
451
+ }
419
452
  interface ToastHookReturn {
420
453
  showToast: (props: ToastProps) => string;
421
454
  dismissToast: (toastId: string) => void;
@@ -434,6 +467,11 @@ declare const toast: {
434
467
  dismissAllExcept: (type: ToastType) => void;
435
468
  };
436
469
 
470
+ interface ToastProviderProps {
471
+ toastOptions?: ToastOptions;
472
+ }
473
+ declare function ToastProvider(props: ToastProviderProps): react.JSX.Element;
474
+
437
475
  interface CalendarYearRange {
438
476
  minYear: string;
439
477
  maxYear: string;
@@ -964,6 +1002,9 @@ declare const SubmitForm: typeof SubmitFormRoot & {
964
1002
  Table: typeof FormTable;
965
1003
  };
966
1004
 
1005
+ declare function formatNumberWithCommas(value: string | number): string;
1006
+ declare function parseFormattedNumber(value: string): number | undefined;
1007
+
967
1008
  type SelectableOption = {
968
1009
  label: string;
969
1010
  value: string;
@@ -1648,4 +1689,4 @@ declare const Z_INDEX: {
1648
1689
  };
1649
1690
  type ZIndexKey = keyof typeof Z_INDEX;
1650
1691
 
1651
- export { ArrowIcon, Badge, type BadgeProps, type BaseParams, BaseUploader, type BaseUploaderProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbMenuItem, type BreadCrumbProps, type BreadCrumbRoot, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CalendarYearRange, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type Column, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailField, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, type FilterRow, type FormFieldConfig, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, type MentionItem, type MenuChild, type MenuGrandchild, type MenuItem, type MenuSection, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTabGroupInfo, type MultiTab as MultiTabItem, type MultiTabMenuItem, PageFilter, type PageParams, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, RichEditor, RichEditorContent, type RichEditorContentProps, type RichEditorHeadingLevel, type RichEditorProps, type RichEditorThemeOverride, RichEditorToolbar, type RichEditorToolbarConfig, type RichEditorToolbarProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, type SidebarHeaderRenderProps, type SidebarProps, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type SortOption, type SortOrder, type SortParams, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastPosition, type ToastProps, ToastProvider, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type UseParams, type UseRichEditorOptions, type UseRichEditorReturn, type YmdDateString, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, formatDate, getFileLabel, getPreviewFileType, isCalendarDayAfterMax, isDateInRange, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useParams, useRichEditor, useScrollToTop, useStableImageSrc, useToast, validateAndFormatInput };
1692
+ export { ArrowIcon, Badge, type BadgeProps, type BaseParams, BaseUploader, type BaseUploaderProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbMenuItem, type BreadCrumbProps, type BreadCrumbRoot, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CalendarYearRange, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type Column, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailField, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, type FilterRow, type FormFieldConfig, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, type MentionItem, type MenuChild, type MenuGrandchild, type MenuItem, type MenuSection, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTabGroupInfo, type MultiTab as MultiTabItem, type MultiTabMenuItem, PageFilter, type PageParams, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, RichEditor, RichEditorContent, type RichEditorContentProps, type RichEditorHeadingLevel, type RichEditorProps, type RichEditorThemeOverride, RichEditorToolbar, type RichEditorToolbarConfig, type RichEditorToolbarProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, type SidebarHeaderRenderProps, type SidebarProps, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type SortOption, type SortOrder, type SortParams, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastIconTheme, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastStyleOptions, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type UseParams, type UseRichEditorOptions, type UseRichEditorReturn, type YmdDateString, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, formatDate, formatNumberWithCommas, getFileLabel, getPreviewFileType, isCalendarDayAfterMax, isDateInRange, parseFormattedNumber, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useParams, useRichEditor, useScrollToTop, useStableImageSrc, useToast, validateAndFormatInput };
package/dist/index.d.ts CHANGED
@@ -93,6 +93,12 @@ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
93
93
  showPasswordToggle?: boolean;
94
94
  clearable?: boolean;
95
95
  onClear?: () => void;
96
+ /** 값의 첫 글자로 스페이스를 입력할 수 있는지 (기본 true) */
97
+ allowLeadingSpace?: boolean;
98
+ /** 값 중간(선행/후행 공백을 제외한 부분)에 스페이스가 남아있을 수 있는지 (기본 true) */
99
+ allowMiddleSpace?: boolean;
100
+ /** 포커스를 벗어날 때(blur) 값 끝에 스페이스가 남아있을 수 있는지 (기본 true) */
101
+ allowTrailingSpace?: boolean;
96
102
  }
97
103
  declare function Input(props: InputProps): react.JSX.Element;
98
104
 
@@ -400,10 +406,12 @@ declare function useBreadCrumbItems(params: Omit<BuildBreadCrumbItemsParams, "pa
400
406
  pathname?: string;
401
407
  }): BreadCrumbItem[];
402
408
 
403
- declare function ToastProvider(): react.JSX.Element;
404
-
405
409
  type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
406
410
  type ToastType = "success" | "error" | "warning" | "info" | "loading";
411
+ interface ToastIconTheme {
412
+ primary: string;
413
+ secondary: string;
414
+ }
407
415
  interface ToastProps {
408
416
  toast: string;
409
417
  id?: string;
@@ -412,10 +420,35 @@ interface ToastProps {
412
420
  duration?: number;
413
421
  showCloseButton?: boolean;
414
422
  className?: string;
423
+ style?: CSSProperties;
424
+ iconTheme?: ToastIconTheme;
415
425
  icon?: ReactNode;
416
426
  onClose?: () => void;
417
427
  onClick?: () => void;
418
428
  }
429
+ interface ToastStyleOptions {
430
+ className?: string;
431
+ style?: CSSProperties;
432
+ iconTheme?: ToastIconTheme;
433
+ }
434
+ interface ToastOptions extends ToastStyleOptions {
435
+ duration?: number;
436
+ success?: ToastStyleOptions & {
437
+ duration?: number;
438
+ };
439
+ error?: ToastStyleOptions & {
440
+ duration?: number;
441
+ };
442
+ warning?: ToastStyleOptions & {
443
+ duration?: number;
444
+ };
445
+ info?: ToastStyleOptions & {
446
+ duration?: number;
447
+ };
448
+ loading?: ToastStyleOptions & {
449
+ duration?: number;
450
+ };
451
+ }
419
452
  interface ToastHookReturn {
420
453
  showToast: (props: ToastProps) => string;
421
454
  dismissToast: (toastId: string) => void;
@@ -434,6 +467,11 @@ declare const toast: {
434
467
  dismissAllExcept: (type: ToastType) => void;
435
468
  };
436
469
 
470
+ interface ToastProviderProps {
471
+ toastOptions?: ToastOptions;
472
+ }
473
+ declare function ToastProvider(props: ToastProviderProps): react.JSX.Element;
474
+
437
475
  interface CalendarYearRange {
438
476
  minYear: string;
439
477
  maxYear: string;
@@ -964,6 +1002,9 @@ declare const SubmitForm: typeof SubmitFormRoot & {
964
1002
  Table: typeof FormTable;
965
1003
  };
966
1004
 
1005
+ declare function formatNumberWithCommas(value: string | number): string;
1006
+ declare function parseFormattedNumber(value: string): number | undefined;
1007
+
967
1008
  type SelectableOption = {
968
1009
  label: string;
969
1010
  value: string;
@@ -1648,4 +1689,4 @@ declare const Z_INDEX: {
1648
1689
  };
1649
1690
  type ZIndexKey = keyof typeof Z_INDEX;
1650
1691
 
1651
- export { ArrowIcon, Badge, type BadgeProps, type BaseParams, BaseUploader, type BaseUploaderProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbMenuItem, type BreadCrumbProps, type BreadCrumbRoot, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CalendarYearRange, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type Column, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailField, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, type FilterRow, type FormFieldConfig, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, type MentionItem, type MenuChild, type MenuGrandchild, type MenuItem, type MenuSection, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTabGroupInfo, type MultiTab as MultiTabItem, type MultiTabMenuItem, PageFilter, type PageParams, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, RichEditor, RichEditorContent, type RichEditorContentProps, type RichEditorHeadingLevel, type RichEditorProps, type RichEditorThemeOverride, RichEditorToolbar, type RichEditorToolbarConfig, type RichEditorToolbarProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, type SidebarHeaderRenderProps, type SidebarProps, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type SortOption, type SortOrder, type SortParams, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastPosition, type ToastProps, ToastProvider, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type UseParams, type UseRichEditorOptions, type UseRichEditorReturn, type YmdDateString, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, formatDate, getFileLabel, getPreviewFileType, isCalendarDayAfterMax, isDateInRange, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useParams, useRichEditor, useScrollToTop, useStableImageSrc, useToast, validateAndFormatInput };
1692
+ export { ArrowIcon, Badge, type BadgeProps, type BaseParams, BaseUploader, type BaseUploaderProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbMenuItem, type BreadCrumbProps, type BreadCrumbRoot, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CalendarYearRange, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type Column, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailField, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, type FilterRow, type FormFieldConfig, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, type MentionItem, type MenuChild, type MenuGrandchild, type MenuItem, type MenuSection, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTabGroupInfo, type MultiTab as MultiTabItem, type MultiTabMenuItem, PageFilter, type PageParams, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, RichEditor, RichEditorContent, type RichEditorContentProps, type RichEditorHeadingLevel, type RichEditorProps, type RichEditorThemeOverride, RichEditorToolbar, type RichEditorToolbarConfig, type RichEditorToolbarProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, type SidebarHeaderRenderProps, type SidebarProps, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type SortOption, type SortOrder, type SortParams, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastIconTheme, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastStyleOptions, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type UseParams, type UseRichEditorOptions, type UseRichEditorReturn, type YmdDateString, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, formatDate, formatNumberWithCommas, getFileLabel, getPreviewFileType, isCalendarDayAfterMax, isDateInRange, parseFormattedNumber, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useParams, useRichEditor, useScrollToTop, useStableImageSrc, useToast, validateAndFormatInput };
package/dist/index.js CHANGED
@@ -451,6 +451,12 @@ function Input2(props) {
451
451
  clearable = false,
452
452
  onClear,
453
453
  onChange,
454
+ onKeyDown,
455
+ onBlur,
456
+ maxLength,
457
+ allowLeadingSpace = true,
458
+ allowMiddleSpace = true,
459
+ allowTrailingSpace = true,
454
460
  ...rest
455
461
  } = props;
456
462
  const randomId = useId();
@@ -497,6 +503,15 @@ function Input2(props) {
497
503
  children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" })
498
504
  }
499
505
  ) : null);
506
+ const splitSpaceRuns = (value) => {
507
+ const core = value.trim();
508
+ if (core === "") {
509
+ return { leading: value, core: "", trailing: "" };
510
+ }
511
+ const leading = value.slice(0, value.length - value.trimStart().length);
512
+ const trailing = value.slice(value.trimEnd().length);
513
+ return { leading, core, trailing };
514
+ };
500
515
  const handleChange = (event) => {
501
516
  const { value } = event.target;
502
517
  if (type === "number" || type === "money") {
@@ -506,7 +521,9 @@ function Input2(props) {
506
521
  sanitized = parts[0] + "." + parts.slice(1).join("");
507
522
  }
508
523
  if (type === "money") {
509
- const digitsOnly = sanitized.replace(/\D/g, "");
524
+ let digitsOnly = sanitized.replace(/\D/g, "");
525
+ digitsOnly = digitsOnly.replace(/^0+/, "");
526
+ digitsOnly = digitsOnly.slice(0, maxLength);
510
527
  if (digitsOnly.length === 0) {
511
528
  event.target.value = "";
512
529
  } else {
@@ -516,11 +533,39 @@ function Input2(props) {
516
533
  } else {
517
534
  event.target.value = sanitized;
518
535
  }
536
+ } else if (!allowLeadingSpace || !allowMiddleSpace) {
537
+ const { leading, core, trailing } = splitSpaceRuns(value);
538
+ const nextLeading = allowLeadingSpace ? leading : "";
539
+ const nextCore = allowMiddleSpace ? core : core.replace(/ /g, "");
540
+ const sanitized = nextLeading + nextCore + trailing;
541
+ if (sanitized !== value) {
542
+ event.target.value = sanitized;
543
+ }
519
544
  }
520
545
  if (onChange) {
521
546
  onChange(event);
522
547
  }
523
548
  };
549
+ const handleKeyDown = (event) => {
550
+ if (event.key === " ") {
551
+ if (type === "number" || type === "money") {
552
+ event.preventDefault();
553
+ } else if (!allowLeadingSpace && event.currentTarget.selectionStart === 0) {
554
+ event.preventDefault();
555
+ }
556
+ }
557
+ onKeyDown?.(event);
558
+ };
559
+ const handleBlur = (event) => {
560
+ if (!allowTrailingSpace && type !== "number" && type !== "money") {
561
+ const trimmed = event.currentTarget.value.replace(/ +$/, "");
562
+ if (trimmed !== event.currentTarget.value) {
563
+ event.currentTarget.value = trimmed;
564
+ onChange?.(event);
565
+ }
566
+ }
567
+ onBlur?.(event);
568
+ };
524
569
  const inputBlock = /* @__PURE__ */ jsxs("div", { className: "relative m-0", children: [
525
570
  leftIcon && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground absolute top-1/2 left-3 -translate-y-1/2 transform", children: leftIcon }),
526
571
  /* @__PURE__ */ jsx(
@@ -532,7 +577,10 @@ function Input2(props) {
532
577
  placeholder,
533
578
  disabled,
534
579
  ref,
580
+ maxLength: type === "money" ? void 0 : maxLength,
535
581
  onChange: handleChange,
582
+ onKeyDown: handleKeyDown,
583
+ onBlur: handleBlur,
536
584
  ...rest
537
585
  }
538
586
  ),
@@ -1677,12 +1725,36 @@ var ToastManager = class _ToastManager {
1677
1725
  static instance;
1678
1726
  containers = /* @__PURE__ */ new Map();
1679
1727
  toasts = /* @__PURE__ */ new Map();
1728
+ // ToastProvider가 마운트/prop 변경 시 넣어주는 전역 기본값 — 개별 toast() 호출의 props가 항상 우선한다.
1729
+ defaultOptions = {};
1680
1730
  static getInstance() {
1681
1731
  if (!_ToastManager.instance) {
1682
1732
  _ToastManager.instance = new _ToastManager();
1683
1733
  }
1684
1734
  return _ToastManager.instance;
1685
1735
  }
1736
+ setDefaultOptions(options) {
1737
+ this.defaultOptions = options;
1738
+ }
1739
+ getDefaultOptions() {
1740
+ return this.defaultOptions;
1741
+ }
1742
+ // 호출 시점 props를 전역 기본값(및 상태별 기본값)과 합쳐 최종 props를 만든다. 우선순위는
1743
+ // 호출 props > 상태별 기본값(options[type]) > 공통 기본값(options.*) > 하드코딩 폴백.
1744
+ resolveProps(props) {
1745
+ const type = props.type ?? "info";
1746
+ const base = this.defaultOptions;
1747
+ const perType = base[type] ?? {};
1748
+ const style = { ...base.style, ...perType.style, ...props.style };
1749
+ const className = [base.className, perType.className, props.className].filter((value) => Boolean(value)).join(" ");
1750
+ return {
1751
+ ...props,
1752
+ duration: props.duration ?? perType.duration ?? base.duration ?? 1500,
1753
+ style: Object.keys(style).length > 0 ? style : void 0,
1754
+ className: className || void 0,
1755
+ iconTheme: props.iconTheme ?? perType.iconTheme ?? base.iconTheme
1756
+ };
1757
+ }
1686
1758
  registerContainer(position, setToasts) {
1687
1759
  this.containers.set(position, setToasts);
1688
1760
  const existingToasts = this.toasts.get(position) || [];
@@ -1692,7 +1764,8 @@ var ToastManager = class _ToastManager {
1692
1764
  setToasts([]);
1693
1765
  }
1694
1766
  }
1695
- addToast(props) {
1767
+ addToast(rawProps) {
1768
+ const props = this.resolveProps(rawProps);
1696
1769
  const position = props.position || "top-center";
1697
1770
  const duration = props.duration !== void 0 ? props.duration : 1500;
1698
1771
  if (props.id) {
@@ -1923,8 +1996,9 @@ function ToastItemCard(props) {
1923
1996
  e.stopPropagation();
1924
1997
  handleClose();
1925
1998
  };
1926
- const getTypeStyles = (type) => {
1999
+ const getTypeStyles = (type, hasCustomStyle2) => {
1927
2000
  const baseStyles = "px-4 py-3 rounded-lg shadow-lg border flex items-center gap-3 min-w-[300px] max-w-[500px] pointer-events-auto";
2001
+ if (hasCustomStyle2) return baseStyles;
1928
2002
  const typeStyles = {
1929
2003
  success: "bg-green-50 border-green-200 text-green-800",
1930
2004
  error: "bg-red-50 border-red-200 text-red-800",
@@ -1934,7 +2008,7 @@ function ToastItemCard(props) {
1934
2008
  };
1935
2009
  return `${baseStyles} ${typeStyles[type]}`;
1936
2010
  };
1937
- const getDefaultIcon = (type) => {
2011
+ const getDefaultIcon = (type, iconTheme) => {
1938
2012
  const icons = {
1939
2013
  success: "\u2713",
1940
2014
  error: "\u2715",
@@ -1942,6 +2016,28 @@ function ToastItemCard(props) {
1942
2016
  info: "\u2139",
1943
2017
  loading: "\u27F3"
1944
2018
  };
2019
+ if (iconTheme) {
2020
+ if (type === "loading") {
2021
+ return /* @__PURE__ */ jsx(
2022
+ "span",
2023
+ {
2024
+ className: "h-4 w-4 shrink-0 animate-spin rounded-full",
2025
+ style: {
2026
+ border: `2px solid ${iconTheme.secondary}`,
2027
+ borderRightColor: iconTheme.primary
2028
+ }
2029
+ }
2030
+ );
2031
+ }
2032
+ return /* @__PURE__ */ jsx(
2033
+ "span",
2034
+ {
2035
+ className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-bold",
2036
+ style: { backgroundColor: iconTheme.primary, color: iconTheme.secondary },
2037
+ children: icons[type]
2038
+ }
2039
+ );
2040
+ }
1945
2041
  return /* @__PURE__ */ jsx("span", { className: `text-lg ${type === "loading" ? "animate-spin" : ""}`, children: icons[type] });
1946
2042
  };
1947
2043
  const getCloseButtonStyles = (type) => {
@@ -1955,15 +2051,17 @@ function ToastItemCard(props) {
1955
2051
  };
1956
2052
  return `${baseStyles} ${typeStyles[type]}`;
1957
2053
  };
2054
+ const hasCustomStyle = Boolean(toast2.props.style && Object.keys(toast2.props.style).length > 0);
1958
2055
  return /* @__PURE__ */ jsxs(
1959
2056
  "div",
1960
2057
  {
1961
- className: `${getTypeStyles(toast2.props.type || "info")} transition-all duration-300 ${isVisible ? "animate-in slide-in-from-top-2 fade-in-0 duration-300 opacity-100" : "animate-out slide-out-to-top-2 fade-out-0 duration-300 opacity-0"} mb-2 cursor-pointer`,
2058
+ className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} transition-all duration-300 ${isVisible ? "animate-in slide-in-from-top-2 fade-in-0 duration-300 opacity-100" : "animate-out slide-out-to-top-2 fade-out-0 duration-300 opacity-0"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
2059
+ style: toast2.props.style,
1962
2060
  onClick: handleClick,
1963
2061
  children: [
1964
- toast2.props.icon || getDefaultIcon(toast2.props.type || "info"),
2062
+ toast2.props.icon || getDefaultIcon(toast2.props.type || "info", toast2.props.iconTheme),
1965
2063
  /* @__PURE__ */ jsx("span", { className: "flex-1 text-sm font-medium", children: toast2.props.toast }),
1966
- toast2.props.showCloseButton !== false && /* @__PURE__ */ jsx(
2064
+ toast2.props.showCloseButton === true && /* @__PURE__ */ jsx(
1967
2065
  "button",
1968
2066
  {
1969
2067
  onClick: handleCloseClick,
@@ -1985,7 +2083,12 @@ var TOAST_POSITIONS = [
1985
2083
  "bottom-center",
1986
2084
  "bottom-right"
1987
2085
  ];
1988
- function ToastProvider() {
2086
+ function ToastProvider(props) {
2087
+ const { toastOptions } = props;
2088
+ useEffect(() => {
2089
+ if (!toastOptions) return;
2090
+ ToastManager.getInstance().setDefaultOptions(toastOptions);
2091
+ }, [toastOptions]);
1989
2092
  return /* @__PURE__ */ jsx(Fragment, { children: TOAST_POSITIONS.map((position) => /* @__PURE__ */ jsx(ToastContainer, { position }, position)) });
1990
2093
  }
1991
2094
 
@@ -6363,7 +6466,7 @@ var THREE_DIGIT_AREA_CODES = /* @__PURE__ */ new Set([
6363
6466
  "063"
6364
6467
  ]);
6365
6468
  function formatPhoneNumber(value) {
6366
- let digits = value.replace(/\D/g, "");
6469
+ const digits = value.replace(/\D/g, "");
6367
6470
  if (digits.startsWith("02")) {
6368
6471
  if (digits.length > 2 && digits.length <= 6) {
6369
6472
  return `${digits.slice(0, 2)}-${digits.slice(2)}`;
@@ -6400,6 +6503,12 @@ function formatNumberWithCommas(value) {
6400
6503
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6401
6504
  return parts.join(".");
6402
6505
  }
6506
+ function parseFormattedNumber(value) {
6507
+ const digitsOnly = value.replace(/,/g, "").replace(/[^\d.]/g, "");
6508
+ if (digitsOnly === "" || digitsOnly === ".") return void 0;
6509
+ const num = Number(digitsOnly);
6510
+ return Number.isNaN(num) ? void 0 : num;
6511
+ }
6403
6512
  function removeNonNumeric(value, allowDecimal = false) {
6404
6513
  if (allowDecimal) {
6405
6514
  return value.replace(/[^\d.]/g, "").replace(/(\..*?)\./g, "$1");
@@ -12017,6 +12126,6 @@ function useParams(initialParams) {
12017
12126
  };
12018
12127
  }
12019
12128
 
12020
- export { ArrowIcon, Badge, BaseUploader, BreadCrumb, Button, Carousel_default as Carousel, Checkbox, DatePicker, DebouncedButton, DetailContent, DetailModalFrame, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, Input2 as Input, Loading, LoadingOverlay, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, ModalOverlay, MultiTabBar as MultiTab, PageFilter, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverTitle, PopoverTrigger, Radio, RadioGroup, RichEditor_default as RichEditor, RichEditorContent, RichEditorToolbar, ScrollArea_default as ScrollArea, ScrollBar, SearchAddress, SearchBar, Select2 as Select, Select as SelectBase, SelectContent, SelectGroup2 as SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SimplePopover, Skeleton, Slider, Spinner, SubmitForm, Switch, Tab, Table, Textarea, ToastProvider, ToggleSwitch, Tooltip2 as Tooltip, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, formatDate, getFileLabel, getPreviewFileType, isCalendarDayAfterMax, isDateInRange, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useParams, useRichEditor, useScrollToTop, useStableImageSrc, useToast, validateAndFormatInput };
12129
+ export { ArrowIcon, Badge, BaseUploader, BreadCrumb, Button, Carousel_default as Carousel, Checkbox, DatePicker, DebouncedButton, DetailContent, DetailModalFrame, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, Input2 as Input, Loading, LoadingOverlay, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, ModalOverlay, MultiTabBar as MultiTab, PageFilter, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverTitle, PopoverTrigger, Radio, RadioGroup, RichEditor_default as RichEditor, RichEditorContent, RichEditorToolbar, ScrollArea_default as ScrollArea, ScrollBar, SearchAddress, SearchBar, Select2 as Select, Select as SelectBase, SelectContent, SelectGroup2 as SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SimplePopover, Skeleton, Slider, Spinner, SubmitForm, Switch, Tab, Table, Textarea, ToastProvider, ToggleSwitch, Tooltip2 as Tooltip, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, formatDate, formatNumberWithCommas, getFileLabel, getPreviewFileType, isCalendarDayAfterMax, isDateInRange, parseFormattedNumber, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useParams, useRichEditor, useScrollToTop, useStableImageSrc, useToast, validateAndFormatInput };
12021
12130
  //# sourceMappingURL=index.js.map
12022
12131
  //# sourceMappingURL=index.js.map