@sonamu-kit/react-components 0.1.8 → 0.2.0
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/components/index.d.ts +14 -6
- package/dist/components/ui/command.d.ts +5 -1
- package/dist/components/ui/range-number-input.d.ts +14 -0
- package/dist/components/ui/select/enum-select.d.ts +15 -0
- package/dist/components/ui/select/id-async-select.d.ts +33 -0
- package/dist/components/ui/select/select.d.ts +66 -0
- package/dist/components/ui/sonamu-filter/constants.d.ts +9 -0
- package/dist/components/ui/sonamu-filter/rule-row-input.d.ts +5 -0
- package/dist/components/ui/sonamu-filter/sonamu-filter-modal.d.ts +7 -0
- package/dist/components/ui/sonamu-filter/sonamu-filter-popover.d.ts +8 -0
- package/dist/components/ui/sonamu-filter/types.d.ts +85 -0
- package/dist/components/ui/sonamu-filter/utils.d.ts +24 -0
- package/dist/components/ui/sonamu-filter/value-input.d.ts +6 -0
- package/dist/components/ui/tag-input.d.ts +15 -0
- package/dist/i18n/rc-keys.d.ts +28 -0
- package/dist/lib/form-helpers.d.ts +12 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/types.d.ts +25 -0
- package/dist/react-components.es.js +20494 -21095
- package/dist/react-components.es.js.map +1 -1
- package/package.json +4 -2
- package/dist/components/ui/async-select.d.ts +0 -36
- package/dist/components/ui/multi-select.d.ts +0 -225
- package/dist/components/ui/select.d.ts +0 -32
|
@@ -4,8 +4,6 @@ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from '.
|
|
|
4
4
|
export { Alert, AlertDescription, AlertTitle } from './ui/alert';
|
|
5
5
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, } from './ui/alert-dialog';
|
|
6
6
|
export { AspectRatio } from './ui/aspect-ratio';
|
|
7
|
-
export type { AsyncSelectOption, AsyncSelectProps } from './ui/async-select';
|
|
8
|
-
export { AsyncSelect } from './ui/async-select';
|
|
9
7
|
export { Avatar, AvatarFallback, AvatarImage } from './ui/avatar';
|
|
10
8
|
export { Badge, badgeVariants } from './ui/badge';
|
|
11
9
|
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from './ui/breadcrumb';
|
|
@@ -37,25 +35,35 @@ export { Label } from './ui/label';
|
|
|
37
35
|
export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, } from './ui/menubar';
|
|
38
36
|
export type { MonthPickerValue } from './ui/month-picker-multiple';
|
|
39
37
|
export { MonthPickerMultiple } from './ui/month-picker-multiple';
|
|
40
|
-
export type { MultiSelectOption, MultiSelectProps, MultiSelectRef, } from './ui/multi-select';
|
|
41
|
-
export { MultiSelect } from './ui/multi-select';
|
|
42
38
|
export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, navigationMenuTriggerStyle, } from './ui/navigation-menu';
|
|
43
39
|
export { Pagination } from './ui/pagination';
|
|
44
40
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger, } from './ui/popover';
|
|
45
41
|
export { Progress } from './ui/progress';
|
|
46
42
|
export { RadioGroup, RadioGroupItem } from './ui/radio-group';
|
|
43
|
+
export type { RangeNumberInputProps } from './ui/range-number-input';
|
|
44
|
+
export { RangeNumberInput } from './ui/range-number-input';
|
|
47
45
|
export { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from './ui/resizable';
|
|
48
46
|
export { ScrollArea, ScrollBar } from './ui/scroll-area';
|
|
49
|
-
export type {
|
|
50
|
-
export {
|
|
47
|
+
export type { EnumSelectProps } from './ui/select/enum-select';
|
|
48
|
+
export { EnumSelect } from './ui/select/enum-select';
|
|
49
|
+
export type { AsyncIdConfig, IdAsyncSelectProps } from './ui/select/id-async-select';
|
|
50
|
+
export { IdAsyncSelect } from './ui/select/id-async-select';
|
|
51
|
+
export type { ExtractValue, SelectItemDef, SelectProps } from './ui/select/select';
|
|
52
|
+
export { Select } from './ui/select/select';
|
|
51
53
|
export { Separator } from './ui/separator';
|
|
52
54
|
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, } from './ui/sheet';
|
|
53
55
|
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, } from './ui/sidebar';
|
|
54
56
|
export { Skeleton } from './ui/skeleton';
|
|
55
57
|
export { Slider } from './ui/slider';
|
|
58
|
+
export { SonamuFilterModal } from './ui/sonamu-filter/sonamu-filter-modal';
|
|
59
|
+
export { SonamuFilterPopover, SonamuFilterPopover as SonamuFilterTooltip, } from './ui/sonamu-filter/sonamu-filter-popover';
|
|
60
|
+
export type { FieldMeta, Rule, SonamuFilterBadgeProps, SonamuFilterModalProps, SonamuFilterPopoverProps, SonamuFilterTooltipProps, } from './ui/sonamu-filter/types';
|
|
61
|
+
export { extractFieldMetaFromSchema } from './ui/sonamu-filter/utils';
|
|
56
62
|
export { Switch } from './ui/switch';
|
|
57
63
|
export { Table, TableBody, TableCaption, TableCell, type TableCol, TableFooter, TableHead, TableHeader, TableRow, } from './ui/table';
|
|
58
64
|
export { Tabs, TabsContent, TabsList, TabsTrigger } from './ui/tabs';
|
|
65
|
+
export type { TagInputProps } from './ui/tag-input';
|
|
66
|
+
export { TagInput } from './ui/tag-input';
|
|
59
67
|
export { Textarea } from './ui/textarea';
|
|
60
68
|
export { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from './ui/toast';
|
|
61
69
|
export { Toaster } from './ui/toaster';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DialogProps } from '@radix-ui/react-dialog';
|
|
2
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
4
5
|
children?: React.ReactNode;
|
|
@@ -17,7 +18,10 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
|
17
18
|
disablePointerSelection?: boolean;
|
|
18
19
|
vimBindings?: boolean;
|
|
19
20
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
|
|
21
|
+
type CommandDialogProps = DialogProps & {
|
|
22
|
+
commandProps?: React.ComponentPropsWithoutRef<typeof CommandPrimitive>;
|
|
23
|
+
};
|
|
24
|
+
declare const CommandDialog: ({ children, commandProps, ...props }: CommandDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
22
26
|
ref?: React.Ref<HTMLInputElement>;
|
|
23
27
|
} & {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type RangeNumberInputProps = {
|
|
2
|
+
value?: [number | undefined, number | undefined];
|
|
3
|
+
onChange?: (value: [number | undefined, number | undefined]) => void;
|
|
4
|
+
placeholder?: [string, string];
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Range Number Input 컴포넌트
|
|
10
|
+
*
|
|
11
|
+
* between 연산자에서 사용
|
|
12
|
+
* [min, max] 두 개의 숫자 입력
|
|
13
|
+
*/
|
|
14
|
+
export declare function RangeNumberInput({ value, onChange, placeholder, disabled, className, }: RangeNumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type EnumSelectProps<TValue extends string = string> = {
|
|
2
|
+
enum: {
|
|
3
|
+
options: readonly TValue[];
|
|
4
|
+
};
|
|
5
|
+
labels: Record<TValue, string>;
|
|
6
|
+
value?: TValue | TValue[] | "";
|
|
7
|
+
onValueChange?: (value: TValue | TValue[] | "" | null | undefined) => void;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
textPrefix?: string;
|
|
10
|
+
clearable?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function EnumSelect<TValue extends string = string>({ enum: zodEnum, labels, value, onValueChange, placeholder, textPrefix, clearable, disabled, className, multiple, }: EnumSelectProps<TValue>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
export type AsyncIdConfig<TSubsetKey extends string = string, _TSubsetMapping = Record<string, unknown>, _TListParams extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
|
+
placeholderKey: string;
|
|
4
|
+
useList: <T extends TSubsetKey>(subset: T, params?: any, options?: {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}) => UseQueryResult<Record<string, unknown>, Error>;
|
|
7
|
+
};
|
|
8
|
+
type SubsetFieldKeys<TSubsetKey extends string, TSubsetMapping> = TSubsetKey extends keyof TSubsetMapping ? TSubsetMapping[TSubsetKey] extends Record<string, unknown> ? string & keyof TSubsetMapping[TSubsetKey] : string : string;
|
|
9
|
+
type SubsetRow<TSubsetKey extends string, TSubsetMapping> = TSubsetKey extends keyof TSubsetMapping ? TSubsetMapping[TSubsetKey] : Record<string, unknown>;
|
|
10
|
+
type DisplayFieldAsString<TSubsetKey extends string, TSubsetMapping> = {
|
|
11
|
+
displayField?: SubsetFieldKeys<TSubsetKey, TSubsetMapping>;
|
|
12
|
+
};
|
|
13
|
+
type DisplayFieldAsCallback<TSubsetKey extends string, TSubsetMapping> = {
|
|
14
|
+
displayField: (row: SubsetRow<TSubsetKey, TSubsetMapping>) => string;
|
|
15
|
+
};
|
|
16
|
+
type OnRowChangeType<TSubsetKey extends string, TSubsetMapping> = TSubsetKey extends keyof TSubsetMapping ? TSubsetMapping[TSubsetKey] | TSubsetMapping[TSubsetKey][] | undefined : unknown;
|
|
17
|
+
type IdAsyncSelectBaseProps<TSubsetKey extends string = string, TSubsetMapping = Record<string, unknown>, TValue extends string | number = string, TListParams extends Record<string, unknown> = Record<string, unknown>, TSubset extends TSubsetKey = TSubsetKey> = {
|
|
18
|
+
config: AsyncIdConfig<TSubsetKey, TSubsetMapping, TListParams>;
|
|
19
|
+
subset: TSubset;
|
|
20
|
+
baseListParams?: Partial<Omit<TListParams, "keyword" | "page">>;
|
|
21
|
+
valueField?: SubsetFieldKeys<TSubset, TSubsetMapping>;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
clearable?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
multiple?: boolean;
|
|
27
|
+
value?: TValue | TValue[] | null;
|
|
28
|
+
onValueChange?: (value: TValue | TValue[] | undefined) => void;
|
|
29
|
+
onRowChange?: (row: OnRowChangeType<TSubset, TSubsetMapping>) => void;
|
|
30
|
+
};
|
|
31
|
+
export type IdAsyncSelectProps<TSubsetKey extends string = string, TSubsetMapping = Record<string, unknown>, TValue extends string | number = string, TListParams extends Record<string, unknown> = Record<string, unknown>, TSubset extends TSubsetKey = TSubsetKey> = IdAsyncSelectBaseProps<TSubsetKey, TSubsetMapping, TValue, TListParams, TSubset> & (DisplayFieldAsString<TSubset, TSubsetMapping> | DisplayFieldAsCallback<TSubset, TSubsetMapping>);
|
|
32
|
+
export declare function IdAsyncSelect<TSubsetKey extends string = string, TSubsetMapping = Record<string, unknown>, TValue extends string | number = string, TListParams extends Record<string, unknown> = Record<string, unknown>, TSubset extends TSubsetKey = TSubsetKey>({ config, subset, baseListParams, displayField, valueField, placeholder, clearable, disabled, className, multiple, value, onValueChange, onRowChange, }: IdAsyncSelectProps<TSubsetKey, TSubsetMapping, TValue, TListParams, TSubset>): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type ExtractValue<Item> = Item extends {
|
|
3
|
+
value: infer V;
|
|
4
|
+
} ? V : Item;
|
|
5
|
+
type SelectItemDef<V> = V | {
|
|
6
|
+
value: V;
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
interface SelectPropsBase<Item> {
|
|
11
|
+
items: Item[];
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
contentClassName?: string;
|
|
17
|
+
renderItem?: (value: ExtractValue<Item>) => React.ReactNode;
|
|
18
|
+
name?: string;
|
|
19
|
+
onBlur?: React.FocusEventHandler<HTMLSelectElement>;
|
|
20
|
+
}
|
|
21
|
+
type SelectPropsWithValueKey<Item> = ExtractValue<Item> extends string | number ? {
|
|
22
|
+
valueKey?: (value: ExtractValue<Item>) => string;
|
|
23
|
+
} : {
|
|
24
|
+
valueKey: (value: ExtractValue<Item>) => string;
|
|
25
|
+
};
|
|
26
|
+
interface SingleSyncProps<Item> {
|
|
27
|
+
multiple?: false;
|
|
28
|
+
async?: false;
|
|
29
|
+
value?: ExtractValue<Item>;
|
|
30
|
+
onValueChange?: (value: ExtractValue<Item> | undefined) => void;
|
|
31
|
+
searchable?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface SingleAsyncProps<Item> {
|
|
34
|
+
multiple?: false;
|
|
35
|
+
async: true;
|
|
36
|
+
value?: ExtractValue<Item>;
|
|
37
|
+
onValueChange?: (value: ExtractValue<Item> | undefined) => void;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
error?: Error;
|
|
40
|
+
onSearch: (keyword: string) => void;
|
|
41
|
+
searchDebounce?: number;
|
|
42
|
+
}
|
|
43
|
+
interface MultiSyncProps<Item> {
|
|
44
|
+
multiple: true;
|
|
45
|
+
async?: false;
|
|
46
|
+
value: ExtractValue<Item>[];
|
|
47
|
+
onValueChange: (value: ExtractValue<Item>[]) => void;
|
|
48
|
+
maxCount?: number;
|
|
49
|
+
hideSelectAll?: boolean;
|
|
50
|
+
searchable?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface MultiAsyncProps<Item> {
|
|
53
|
+
multiple: true;
|
|
54
|
+
async: true;
|
|
55
|
+
value: ExtractValue<Item>[];
|
|
56
|
+
onValueChange: (value: ExtractValue<Item>[]) => void;
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
error?: Error;
|
|
59
|
+
onSearch: (keyword: string) => void;
|
|
60
|
+
searchDebounce?: number;
|
|
61
|
+
maxCount?: number;
|
|
62
|
+
hideSelectAll?: boolean;
|
|
63
|
+
}
|
|
64
|
+
type SelectProps<Item> = SelectPropsBase<Item> & SelectPropsWithValueKey<Item> & (SingleSyncProps<Item> | SingleAsyncProps<Item> | MultiSyncProps<Item> | MultiAsyncProps<Item>);
|
|
65
|
+
export declare const Select: <Item>(props: SelectProps<Item> & React.RefAttributes<HTMLSelectElement>) => React.ReactElement;
|
|
66
|
+
export type { SelectProps, SelectItemDef, ExtractValue };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterOperator, FilterPropType } from '../../../lib/types';
|
|
2
|
+
/**
|
|
3
|
+
* Operator UI 라벨
|
|
4
|
+
*/
|
|
5
|
+
export declare const operatorLabels: Record<FilterOperator, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Zod 타입 이름 정의
|
|
8
|
+
*/
|
|
9
|
+
export declare const zodTypeToFilterPropTypeMap: Record<string, FilterPropType>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SonamuFilterModalProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SonamuFilterModal
|
|
4
|
+
*
|
|
5
|
+
* Zod 스키마 기반 필터 UI 생성
|
|
6
|
+
*/
|
|
7
|
+
export declare function SonamuFilterModal({ baseSchema, open, onOpenChange, initialRules, onApply, }: SonamuFilterModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SonamuFilterPopoverProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SonamuFilterPopover
|
|
4
|
+
*
|
|
5
|
+
* 필터 버튼에 적용된 필터를 Popover로 표시하는 컴포넌트
|
|
6
|
+
* 필터가 적용되어 있으면 hover 없이도 항상 보임
|
|
7
|
+
*/
|
|
8
|
+
export declare function SonamuFilterPopover({ rules, fieldMeta, children, side, align, }: SonamuFilterPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FilterOperator, FilterPropType } from '../../../lib/types';
|
|
3
|
+
/**
|
|
4
|
+
* 필드 메타 정보
|
|
5
|
+
*/
|
|
6
|
+
export type FieldMeta = {
|
|
7
|
+
propType: FilterPropType;
|
|
8
|
+
nullable: boolean;
|
|
9
|
+
enumData?: {
|
|
10
|
+
options: string[];
|
|
11
|
+
labels: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Rule 타입 정의
|
|
16
|
+
*/
|
|
17
|
+
export type Rule = {
|
|
18
|
+
id: string;
|
|
19
|
+
field: string | null;
|
|
20
|
+
operator: FilterOperator | null;
|
|
21
|
+
value: unknown;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Zod 내부 API 접근을 위한 타입 정의
|
|
25
|
+
*/
|
|
26
|
+
export type ZodDef = {
|
|
27
|
+
type: string;
|
|
28
|
+
innerType?: z.ZodTypeAny;
|
|
29
|
+
meta?: Record<string, unknown>;
|
|
30
|
+
};
|
|
31
|
+
export type ZodWithDef = z.ZodTypeAny & {
|
|
32
|
+
_def: ZodDef;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* SonamuFilterModal Props
|
|
36
|
+
*/
|
|
37
|
+
export type SonamuFilterModalProps = {
|
|
38
|
+
baseSchema: z.ZodObject<z.ZodRawShape>;
|
|
39
|
+
open: boolean;
|
|
40
|
+
onOpenChange: (open: boolean) => void;
|
|
41
|
+
initialRules?: Rule[];
|
|
42
|
+
onApply?: (filters: Record<string, unknown>, rules: Rule[]) => void;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* ValueInput Props
|
|
46
|
+
*/
|
|
47
|
+
export type ValueInputProps = {
|
|
48
|
+
propType: FilterPropType;
|
|
49
|
+
operator: FilterOperator;
|
|
50
|
+
value: unknown;
|
|
51
|
+
onChange: (value: unknown) => void;
|
|
52
|
+
fieldMeta?: FieldMeta;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* RuleRow Props
|
|
56
|
+
*/
|
|
57
|
+
export type RuleRowProps = {
|
|
58
|
+
rule: Rule;
|
|
59
|
+
fieldMeta: Record<string, FieldMeta>;
|
|
60
|
+
onUpdate: (updates: Partial<Rule>) => void;
|
|
61
|
+
onRemove: () => void;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* SonamuFilterBadge Props
|
|
65
|
+
*/
|
|
66
|
+
export type SonamuFilterBadgeProps = {
|
|
67
|
+
rules: Rule[];
|
|
68
|
+
fieldMeta: Record<string, FieldMeta>;
|
|
69
|
+
onRemove: (ruleId: string) => void;
|
|
70
|
+
onClearAll: () => void;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* SonamuFilterTooltip Props (deprecated - use SonamuFilterPopoverProps)
|
|
74
|
+
*/
|
|
75
|
+
export type SonamuFilterTooltipProps = SonamuFilterPopoverProps;
|
|
76
|
+
/**
|
|
77
|
+
* SonamuFilterPopover Props
|
|
78
|
+
*/
|
|
79
|
+
export type SonamuFilterPopoverProps = {
|
|
80
|
+
rules: Rule[];
|
|
81
|
+
fieldMeta: Record<string, FieldMeta>;
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
84
|
+
align?: "start" | "center" | "end";
|
|
85
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FilterPropType } from '../../../lib/types';
|
|
3
|
+
import { FieldMeta } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* ZodNullable, ZodOptional 등의 래퍼를 벗겨내고 내부 타입을 반환
|
|
6
|
+
* nullable/optional 여부도 함께 반환
|
|
7
|
+
*/
|
|
8
|
+
export declare function unwrapZodType(zodType: z.ZodTypeAny): {
|
|
9
|
+
innerType: z.ZodTypeAny;
|
|
10
|
+
nullable: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Zod 타입 이름을 FilterPropType으로 변환
|
|
14
|
+
*/
|
|
15
|
+
export declare function zodTypeNameToPropType(typeName: string): FilterPropType;
|
|
16
|
+
/**
|
|
17
|
+
* Zod enum에서 options와 labels를 추출
|
|
18
|
+
* SD 함수를 사용하여 enum.{EnumName}.{value} 형태로 라벨 조회
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractEnumData(zodEnum: z.ZodTypeAny, SD: (key: string) => string): FieldMeta["enumData"];
|
|
21
|
+
/**
|
|
22
|
+
* Zod 스키마에서 각 필드의 타입 정보를 추출하여 FieldMeta 형태로 변환
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractFieldMetaFromSchema(schema: z.ZodObject<z.ZodRawShape>, SD: (key: string) => string): Record<string, FieldMeta>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TagInputProps = {
|
|
2
|
+
value?: string[];
|
|
3
|
+
onChange?: (value: string[]) => void;
|
|
4
|
+
type?: "text" | "number";
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Tag Input 컴포넌트
|
|
11
|
+
*
|
|
12
|
+
* 콤마 또는 Enter로 태그 추가
|
|
13
|
+
* X 버튼으로 태그 제거
|
|
14
|
+
*/
|
|
15
|
+
export declare function TagInput({ value, onChange, type, placeholder, disabled, className, }: TagInputProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/i18n/rc-keys.d.ts
CHANGED
|
@@ -57,6 +57,20 @@ export declare const rcKeysKo: {
|
|
|
57
57
|
"rc.calendar.month.9": string;
|
|
58
58
|
"rc.calendar.month.10": string;
|
|
59
59
|
"rc.calendar.month.11": string;
|
|
60
|
+
"rc.sonamuFilter.title": string;
|
|
61
|
+
"rc.sonamuFilter.apply": string;
|
|
62
|
+
"rc.sonamuFilter.reset": string;
|
|
63
|
+
"rc.sonamuFilter.addRule": string;
|
|
64
|
+
"rc.sonamuFilter.noRulesYet": string;
|
|
65
|
+
"rc.sonamuFilter.selectField": string;
|
|
66
|
+
"rc.sonamuFilter.selectOperator": string;
|
|
67
|
+
"rc.sonamuFilter.selectOperatorFirst": string;
|
|
68
|
+
"rc.sonamuFilter.enterValue": string;
|
|
69
|
+
"rc.sonamuFilter.enterNumber": string;
|
|
70
|
+
"rc.sonamuFilter.notSupported": string;
|
|
71
|
+
"rc.sonamuFilter.startDate": string;
|
|
72
|
+
"rc.sonamuFilter.endDate": string;
|
|
73
|
+
"rc.sonamuFilter.appliedFilters": string;
|
|
60
74
|
"rc.common.cancel": string;
|
|
61
75
|
"rc.common.save": string;
|
|
62
76
|
};
|
|
@@ -115,6 +129,20 @@ export declare const rcKeysEn: {
|
|
|
115
129
|
"rc.calendar.month.9": string;
|
|
116
130
|
"rc.calendar.month.10": string;
|
|
117
131
|
"rc.calendar.month.11": string;
|
|
132
|
+
"rc.sonamuFilter.title": string;
|
|
133
|
+
"rc.sonamuFilter.apply": string;
|
|
134
|
+
"rc.sonamuFilter.reset": string;
|
|
135
|
+
"rc.sonamuFilter.addRule": string;
|
|
136
|
+
"rc.sonamuFilter.noRulesYet": string;
|
|
137
|
+
"rc.sonamuFilter.selectField": string;
|
|
138
|
+
"rc.sonamuFilter.selectOperator": string;
|
|
139
|
+
"rc.sonamuFilter.selectOperatorFirst": string;
|
|
140
|
+
"rc.sonamuFilter.enterValue": string;
|
|
141
|
+
"rc.sonamuFilter.enterNumber": string;
|
|
142
|
+
"rc.sonamuFilter.notSupported": string;
|
|
143
|
+
"rc.sonamuFilter.startDate": string;
|
|
144
|
+
"rc.sonamuFilter.endDate": string;
|
|
145
|
+
"rc.sonamuFilter.appliedFilters": string;
|
|
118
146
|
"rc.common.cancel": string;
|
|
119
147
|
"rc.common.save": string;
|
|
120
148
|
};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ErrorObj } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* FormRegisterReturn
|
|
5
|
+
*
|
|
6
|
+
* register 함수의 반환 타입입니다.
|
|
7
|
+
*/
|
|
8
|
+
export type FormRegisterReturn = {
|
|
9
|
+
value: any;
|
|
10
|
+
onValueChange: (value: any) => void;
|
|
11
|
+
onRowChange?: (row: any) => void;
|
|
12
|
+
error?: ErrorObj;
|
|
13
|
+
};
|
|
3
14
|
export declare function useTypeForm<T extends z.ZodObject<any> | z.ZodArray<any>, U extends z.infer<T>>(zType: T, defaultValue: U): {
|
|
4
15
|
form: z.core.output<T>;
|
|
5
16
|
setForm: import('react').Dispatch<import('react').SetStateAction<z.core.output<T>>>;
|
|
6
|
-
register: (objPath: string, _emptyStringTo?: "normal" | "nullable" | "optional") =>
|
|
17
|
+
register: (objPath: string, _emptyStringTo?: "normal" | "nullable" | "optional") => FormRegisterReturn;
|
|
7
18
|
submit: <R>(callback: (formData: z.infer<T>) => Promise<R>) => () => Promise<R>;
|
|
8
19
|
addError: (objPath: string, errorMessage: string | ErrorObj) => void;
|
|
9
20
|
removeError: (objPath: string) => void;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { caster, fastifyCaster } from './caster';
|
|
|
3
3
|
export { useTypeForm } from './form-helpers';
|
|
4
4
|
export { useListParams, useSelection } from './list-helpers';
|
|
5
5
|
export { useModal } from './modal-helpers';
|
|
6
|
-
export type { ControlledModalProps, DistributiveOmit, ErrorObj, Override, PaginationProps, SonamuCol, TableColumnWidth, } from './types';
|
|
6
|
+
export type { ControlledModalProps, DistributiveOmit, ErrorObj, FilterOperator, FilterPropType, Override, PaginationProps, SonamuCol, TableColumnWidth, } from './types';
|
|
7
|
+
export { defaultOperatorByPropType, operatorsByPropType } from './types';
|
|
7
8
|
export { useIsMobile } from './use-mobile';
|
|
8
9
|
export { cn } from './utils';
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -24,3 +24,28 @@ export type SonamuCol<T> = {
|
|
|
24
24
|
};
|
|
25
25
|
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
26
26
|
export type Override<T, U> = Omit<T, keyof U> & U;
|
|
27
|
+
/**
|
|
28
|
+
* Sonamu Filter 관련 타입 정의
|
|
29
|
+
*/
|
|
30
|
+
export declare const operatorsByPropType: {
|
|
31
|
+
readonly string: readonly ["eq", "ne", "contains", "startsWith", "endsWith", "in", "notIn", "isNull", "isNotNull"];
|
|
32
|
+
readonly integer: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "notIn", "between", "isNull", "isNotNull"];
|
|
33
|
+
readonly numeric: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "notIn", "between", "isNull", "isNotNull"];
|
|
34
|
+
readonly boolean: readonly ["eq", "ne", "isNull", "isNotNull"];
|
|
35
|
+
readonly date: readonly ["eq", "ne", "before", "after", "between", "isNull", "isNotNull"];
|
|
36
|
+
readonly datetime: readonly ["eq", "ne", "before", "after", "between", "isNull", "isNotNull"];
|
|
37
|
+
readonly enum: readonly ["eq", "ne", "in", "notIn", "isNull", "isNotNull"];
|
|
38
|
+
readonly json: readonly ["isNull", "isNotNull"];
|
|
39
|
+
};
|
|
40
|
+
export declare const defaultOperatorByPropType: {
|
|
41
|
+
readonly string: "contains";
|
|
42
|
+
readonly integer: "eq";
|
|
43
|
+
readonly numeric: "eq";
|
|
44
|
+
readonly boolean: "eq";
|
|
45
|
+
readonly date: "eq";
|
|
46
|
+
readonly datetime: "eq";
|
|
47
|
+
readonly enum: "eq";
|
|
48
|
+
readonly json: "isNull";
|
|
49
|
+
};
|
|
50
|
+
export type FilterPropType = keyof typeof operatorsByPropType;
|
|
51
|
+
export type FilterOperator = (typeof operatorsByPropType)[keyof typeof operatorsByPropType][number];
|