@mci-ui/mci-ui 0.0.78 → 0.0.80

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.
Files changed (62) hide show
  1. package/README.md +261 -2
  2. package/dist/index.css +1 -1
  3. package/dist/index.es.js +1880 -1808
  4. package/dist/index.umd.js +2 -2
  5. package/dist/types/index.d.ts +1 -0
  6. package/dist/types/shared/types/mci-ui.types.d.ts +1 -0
  7. package/dist/types/shared/types/ui/breadcrumb.types.d.ts +13 -0
  8. package/dist/types/shared/types/ui/button.types.d.ts +15 -0
  9. package/dist/types/shared/types/ui/check.types.d.ts +15 -0
  10. package/dist/types/shared/types/ui/collapse.types.d.ts +9 -0
  11. package/dist/types/shared/types/ui/drawer.types.d.ts +16 -0
  12. package/dist/types/shared/types/ui/identity-input.types.d.ts +6 -0
  13. package/dist/types/shared/types/ui/index.d.ts +21 -0
  14. package/dist/types/shared/types/ui/input.types.d.ts +25 -0
  15. package/dist/types/shared/types/ui/loader.types.d.ts +8 -0
  16. package/dist/types/shared/types/ui/modal.types.d.ts +17 -0
  17. package/dist/types/shared/types/ui/pagination.types.d.ts +13 -0
  18. package/dist/types/shared/types/ui/phone.types.d.ts +15 -0
  19. package/dist/types/shared/types/ui/picker.types.d.ts +24 -0
  20. package/dist/types/shared/types/ui/select.types.d.ts +25 -0
  21. package/dist/types/shared/types/ui/skeleton.types.d.ts +6 -0
  22. package/dist/types/shared/types/ui/tabs.types.d.ts +18 -0
  23. package/dist/types/shared/types/ui/tag.types.d.ts +10 -0
  24. package/dist/types/shared/types/ui/textarea.types.d.ts +12 -0
  25. package/dist/types/shared/types/ui/toast.types.d.ts +10 -0
  26. package/dist/types/shared/types/ui/toggle.types.d.ts +9 -0
  27. package/dist/types/shared/types/ui/tooltip.types.d.ts +8 -0
  28. package/dist/types/shared/types/ui/upload.types.d.ts +27 -0
  29. package/dist/types/shared/ui/MciModal/MciModal.d.ts +1 -18
  30. package/dist/types/shared/ui/mciBreadcrumb/MciBreadcrumb.d.ts +1 -14
  31. package/dist/types/shared/ui/mciButton/MciButton.d.ts +1 -16
  32. package/dist/types/shared/ui/mciCheck/MciCheck.d.ts +1 -14
  33. package/dist/types/shared/ui/mciCollapse/MciCollapse.d.ts +1 -10
  34. package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -17
  35. package/dist/types/shared/ui/mciIdentityInput/MciIdentityInput.d.ts +3 -8
  36. package/dist/types/shared/ui/mciIdentityInput/mci-identity-input.utils.d.ts +9 -0
  37. package/dist/types/shared/ui/mciInput/MciInput.d.ts +1 -24
  38. package/dist/types/shared/ui/mciInput/mci-input.utils.d.ts +19 -0
  39. package/dist/types/shared/ui/mciLoader/MciLoader.d.ts +1 -9
  40. package/dist/types/shared/ui/mciPagination/MciPagination.d.ts +1 -14
  41. package/dist/types/shared/ui/mciPagination/mci-pagination.utils.d.ts +1 -0
  42. package/dist/types/shared/ui/mciPhone/MciPhone.d.ts +1 -15
  43. package/dist/types/shared/ui/mciPhone/mci-phone.utils.d.ts +32 -0
  44. package/dist/types/shared/ui/mciPicker/MciPicker.d.ts +1 -23
  45. package/dist/types/shared/ui/mciPicker/mci-picker.utils.d.ts +14 -0
  46. package/dist/types/shared/ui/mciSelect/MciSelect.d.ts +1 -24
  47. package/dist/types/shared/ui/mciSelect/mci-select.utils.d.ts +39 -0
  48. package/dist/types/shared/ui/mciSkeleton/MciSkeleton.d.ts +1 -7
  49. package/dist/types/shared/ui/mciTable/MciTableClamp2.d.ts +7 -0
  50. package/dist/types/shared/ui/mciTable/mci-table.utils.d.ts +3 -0
  51. package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +1 -19
  52. package/dist/types/shared/ui/mciTag/MciTag.d.ts +1 -11
  53. package/dist/types/shared/ui/mciTextarea/MciTextarea.d.ts +1 -12
  54. package/dist/types/shared/ui/mciToast/MciToast.d.ts +1 -9
  55. package/dist/types/shared/ui/mciToast/mci-toast.utils.d.ts +34 -0
  56. package/dist/types/shared/ui/mciToggle/MciToggle.d.ts +1 -10
  57. package/dist/types/shared/ui/mciTooltip/MciTooltip.d.ts +1 -9
  58. package/dist/types/shared/ui/mciUpload/MciUpload.d.ts +1 -27
  59. package/dist/types/shared/ui/mciUpload/mci-upload.utils.d.ts +5 -0
  60. package/package.json +1 -1
  61. package/dist/types/App.d.ts +0 -2
  62. package/dist/types/main.d.ts +0 -0
@@ -1,25 +1,3 @@
1
- import { Locale } from '../../lib/locales';
2
- type DateValue = Date | string | null;
3
- type RangeValue = [DateValue, DateValue];
4
- export interface MciPickerProps {
5
- type?: 'date' | 'range';
6
- value?: DateValue | RangeValue;
7
- onChange?: (value: any) => void;
8
- placeholder?: string | [string, string];
9
- label?: string;
10
- disabled?: boolean;
11
- required?: boolean;
12
- className?: string;
13
- format?: string;
14
- minDate?: Date;
15
- maxDate?: Date;
16
- error?: string;
17
- showClear?: boolean;
18
- allowManualInput?: boolean;
19
- locale?: Locale;
20
- startView?: 'day' | 'month' | 'year';
21
- iconPosition?: 'left' | 'right';
22
- align?: 'left' | 'right' | 'center' | 'auto';
23
- }
1
+ import { MciPickerProps } from '../../types/ui/picker.types';
24
2
  declare const MciPicker: import('react').ForwardRefExoticComponent<MciPickerProps & import('react').RefAttributes<HTMLDivElement>>;
25
3
  export default MciPicker;
@@ -0,0 +1,14 @@
1
+ import { DateValue } from '../../types/ui/picker.types';
2
+ export declare function toSafeDate(value: DateValue | undefined): Date | null;
3
+ export declare function normalizeDate(date: Date): Date;
4
+ export declare function formatDateByPattern(date: Date | null, pattern: string): string;
5
+ export declare function parseDateFromInput(value: string): Date | null;
6
+ export declare function formatManualDateInput(value: string): string;
7
+ export declare function isDateOutsideBounds(date: Date, minDate?: Date, maxDate?: Date): boolean;
8
+ export declare function shiftMonth(date: Date, offset: number): Date;
9
+ export declare function shiftYear(date: Date, offset: number): Date;
10
+ export declare function getCalendarDays(monthDate: Date): {
11
+ date: Date;
12
+ isCurrentMonth: boolean;
13
+ }[];
14
+ export declare function isSameCalendarDay(a: Date, b: Date): boolean;
@@ -1,27 +1,4 @@
1
1
  import { default as React } from 'react';
2
- type Option = {
3
- value: string | number;
4
- label: string;
5
- };
6
- type SelectProps = {
7
- label?: string;
8
- placeholder?: string;
9
- options: Option[];
10
- icon?: React.ReactNode;
11
- iconPosition?: 'left' | 'right';
12
- size?: 'sm' | 'md' | 'base';
13
- error?: string;
14
- disabled?: boolean;
15
- required?: boolean;
16
- value?: string | number;
17
- onChange?: (value: string | number) => void;
18
- onFocus?: () => void;
19
- onBlur?: () => void;
20
- className?: string;
21
- clearable?: boolean;
22
- searchable?: boolean;
23
- onSearch?: (searchTerm: string) => void;
24
- name?: string;
25
- };
2
+ import { SelectProps } from '../../types/ui/select.types';
26
3
  declare const MciSelect: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
27
4
  export default MciSelect;
@@ -0,0 +1,39 @@
1
+ import { Option } from '../../types/ui/select.types';
2
+ export declare const SELECT_SIZES: {
3
+ readonly sm: {
4
+ readonly container: "h-9 text-sm";
5
+ readonly padding: "px-2";
6
+ readonly iconPaddingLeft: "pl-7";
7
+ readonly iconPaddingRight: "pr-7";
8
+ readonly iconSize: "w-4 h-4";
9
+ readonly iconWrapper: "left-2";
10
+ readonly rightIconWrapper: "right-2";
11
+ readonly label: "text-sm";
12
+ readonly dropdown: "text-sm";
13
+ };
14
+ readonly md: {
15
+ readonly container: "h-10 text-sm";
16
+ readonly padding: "px-4";
17
+ readonly iconPaddingLeft: "pl-8";
18
+ readonly iconPaddingRight: "pr-8";
19
+ readonly iconSize: "w-5 h-5";
20
+ readonly iconWrapper: "left-3";
21
+ readonly rightIconWrapper: "right-3";
22
+ readonly label: "text-sm";
23
+ readonly dropdown: "text-sm";
24
+ };
25
+ readonly base: {
26
+ readonly container: "h-12 text-base";
27
+ readonly padding: "px-4";
28
+ readonly iconPaddingLeft: "pl-10";
29
+ readonly iconPaddingRight: "pl-3";
30
+ readonly iconSize: "w-5 h-5";
31
+ readonly iconWrapper: "left-4";
32
+ readonly rightIconWrapper: "right-16";
33
+ readonly label: "text-base";
34
+ readonly dropdown: "text-base";
35
+ };
36
+ };
37
+ export declare function getFilteredOptions(options: Option[], searchTerm: string, searchable: boolean, hasExternalSearch: boolean): Option[];
38
+ export declare function getSelectStateStyles(disabled: boolean, error?: string): "border-slate-200 bg-slate-100 text-slate-400 cursor-not-allowed" | "border-red-600 focus:border-red-600 shadow-red bg-white" | "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600 bg-white";
39
+ export declare function getSelectIconColor(disabled: boolean, error: string | undefined, isOpen: boolean, isFocused: boolean): "text-slate-400" | "text-red-600" | "text-black";
@@ -1,8 +1,2 @@
1
- type SkeletonProps = {
2
- className?: string;
3
- variant?: 'default' | 'rounded' | 'circle';
4
- width?: string | number;
5
- height?: string | number;
6
- };
1
+ import { SkeletonProps } from '../../types/ui/skeleton.types';
7
2
  export default function MciSkeleton({ className, variant, width, height, }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ type Clamp2Props = {
3
+ children: ReactNode;
4
+ title?: string;
5
+ };
6
+ export default function MciTableClamp2({ children, title }: Clamp2Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { MciTableSort } from '../../types/mci-table.types';
2
+ export declare function normalizeColWidth(width?: string | number): string | undefined;
3
+ export declare function sortRows<T extends Record<string, unknown>>(rows: T[], activeSort: MciTableSort<T> | null, isExternalSort: boolean): T[];
@@ -1,20 +1,2 @@
1
- import { default as React } from 'react';
2
- type Tab = {
3
- id: string;
4
- label: string;
5
- icon?: React.ReactNode;
6
- content: React.ReactNode;
7
- disabled?: boolean;
8
- };
9
- type TabsProps = {
10
- tabs: Tab[];
11
- defaultTab?: string;
12
- position?: 'top' | 'bottom' | 'left' | 'right';
13
- className?: string;
14
- tabListClassName?: string;
15
- contentClassName?: string;
16
- extra?: React.ReactNode;
17
- onChange?: (tabId: string | number) => void;
18
- };
1
+ import { TabsProps } from '../../types/ui/tabs.types';
19
2
  export default function MciTabs({ tabs, defaultTab, position, className, tabListClassName, contentClassName, extra, onChange, }: TabsProps): import("react/jsx-runtime").JSX.Element;
20
- export {};
@@ -1,12 +1,2 @@
1
- import { default as React } from 'react';
2
- type TagProps = {
3
- children: React.ReactNode;
4
- variant?: 'success' | 'warning' | 'error' | 'gray' | 'blue';
5
- size?: 'sm' | 'md' | 'lg';
6
- icon?: React.ReactNode;
7
- iconPosition?: 'left' | 'right';
8
- rounded?: boolean;
9
- className?: string;
10
- };
1
+ import { TagProps } from '../../types/ui/tag.types';
11
2
  export default function MciTag({ children, variant, size, icon, iconPosition, className, }: TagProps): import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,14 +1,3 @@
1
- type TextareaProps = {
2
- label?: string;
3
- placeholder?: string;
4
- value?: string;
5
- onChange?: (value: string) => void;
6
- required?: boolean;
7
- disabled?: boolean;
8
- error?: string;
9
- className?: string;
10
- rows?: number;
11
- name?: string;
12
- };
1
+ import { TextareaProps } from '../../types/ui/textarea.types';
13
2
  declare const MciTextarea: import('react').ForwardRefExoticComponent<TextareaProps & import('react').RefAttributes<HTMLTextAreaElement>>;
14
3
  export default MciTextarea;
@@ -1,13 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
3
- interface ToastProps {
4
- title: string;
5
- description?: string;
6
- type?: ToastType;
7
- duration?: number;
8
- action?: ReactNode;
9
- onClose?: () => void;
10
- }
2
+ import { ToastProps } from '../../types/ui/toast.types';
11
3
  declare const MciToast: {
12
4
  success: (title: string | Omit<ToastProps, "type">, desc?: string, action?: ReactNode) => {
13
5
  close: () => void;
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ import { ToastType } from '../../types/ui/toast.types';
3
+ export declare const TOAST_ICONS: Record<ToastType, ReactNode>;
4
+ export declare const TOAST_STYLES: {
5
+ readonly bg: {
6
+ readonly success: "bg-green-50";
7
+ readonly error: "bg-red-50";
8
+ readonly warning: "bg-orange-50";
9
+ readonly info: "bg-blue-50";
10
+ readonly loading: "bg-slate-50";
11
+ };
12
+ readonly line: {
13
+ readonly success: "bg-green-600";
14
+ readonly error: "bg-red-600";
15
+ readonly warning: "bg-orange-600";
16
+ readonly info: "bg-blue-600";
17
+ readonly loading: "bg-slate-600";
18
+ };
19
+ readonly text: {
20
+ readonly success: "text-green-600";
21
+ readonly error: "text-red-600";
22
+ readonly warning: "text-orange-600";
23
+ readonly info: "text-blue-600";
24
+ readonly loading: "text-slate-600";
25
+ };
26
+ readonly action: {
27
+ readonly success: "text-green-600";
28
+ readonly error: "text-red-600";
29
+ readonly warning: "text-orange-600";
30
+ readonly info: "text-blue-600";
31
+ readonly loading: "text-slate-600";
32
+ };
33
+ };
34
+ export declare function getOrCreateToastContainer(): HTMLElement;
@@ -1,11 +1,2 @@
1
- type ToggleProps = {
2
- checked?: boolean;
3
- onChange?: (checked: boolean) => void;
4
- disabled?: boolean;
5
- variant?: 'blue' | 'yellow';
6
- label?: string;
7
- supportText?: string;
8
- className?: string;
9
- };
1
+ import { ToggleProps } from '../../types/ui/toggle.types';
10
2
  export default function MciToggle({ checked, onChange, disabled, variant, label, supportText, className, }: ToggleProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,10 +1,2 @@
1
- import { default as React } from 'react';
2
- type TooltipProps = {
3
- content: React.ReactNode;
4
- children: React.ReactNode;
5
- position?: 'top' | 'bottom' | 'left' | 'right';
6
- delay?: number;
7
- className?: string;
8
- };
1
+ import { TooltipProps } from '../../types/ui/tooltip.types';
9
2
  export default function MciTooltip({ content, children, position, delay, className, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,30 +1,4 @@
1
1
  import { default as React } from 'react';
2
- import { UploadLocale } from '../../lib/uploadLanguage';
3
- interface FileInfo {
4
- id: string;
5
- file: File;
6
- preview?: string;
7
- progress: number;
8
- status: 'uploading' | 'success' | 'error';
9
- error?: string;
10
- }
11
- interface MciUploadProps {
12
- multiple?: boolean;
13
- accept?: string;
14
- maxSize?: number;
15
- maxFiles?: number;
16
- disabled?: boolean;
17
- label?: string;
18
- required?: boolean;
19
- error?: string;
20
- className?: string;
21
- onFilesChange?: (files: File[]) => void;
22
- onUpload?: (files: FileInfo[]) => Promise<void>;
23
- showPreview?: boolean;
24
- locale?: UploadLocale;
25
- showFileTypeIcon?: boolean;
26
- customValidator?: (file: File) => string | null;
27
- variant?: 'yellow' | 'blue';
28
- }
2
+ import { MciUploadProps } from '../../types/ui/upload.types';
29
3
  declare const MciUpload: React.FC<MciUploadProps>;
30
4
  export default MciUpload;
@@ -0,0 +1,5 @@
1
+ export declare function getFileIcon(file: File): import("react/jsx-runtime").JSX.Element;
2
+ export declare function formatFileSize(bytes: number): string;
3
+ export declare function validateFileSize(file: File, maxSizeMb: number): boolean;
4
+ export declare function validateFileType(file: File, accept: string): boolean;
5
+ export declare function createPreview(file: File): Promise<string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mci-ui/mci-ui",
3
3
  "private": false,
4
- "version": "0.0.78",
4
+ "version": "0.0.80",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",
@@ -1,2 +0,0 @@
1
- declare function App(): import("react/jsx-runtime").JSX.Element;
2
- export default App;
File without changes