sharpcodes-heroui 1.0.0 → 1.0.1
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/fields/autocomplete.d.ts +43 -0
- package/dist/components/fields/breadcrumbs.d.ts +7 -0
- package/dist/components/fields/button.d.ts +15 -0
- package/dist/components/fields/date-range.d.ts +44 -0
- package/dist/components/fields/index.d.ts +10 -0
- package/dist/components/fields/modal.d.ts +25 -0
- package/dist/components/fields/number.d.ts +13 -0
- package/dist/components/fields/scroll.d.ts +2 -0
- package/dist/components/fields/search.d.ts +15 -0
- package/dist/components/fields/table/base.d.ts +35 -0
- package/dist/components/fields/table/empty.d.ts +2 -0
- package/dist/components/fields/table/index.d.ts +17 -0
- package/dist/components/fields/table/pagination.d.ts +35 -0
- package/dist/components/fields/tabs.d.ts +22 -0
- package/dist/components/form-fields/autocomplete.d.ts +42 -0
- package/dist/components/form-fields/date-range.d.ts +42 -0
- package/dist/components/form-fields/date.d.ts +39 -0
- package/dist/components/form-fields/error.d.ts +9 -0
- package/dist/components/form-fields/field.d.ts +10 -0
- package/dist/components/form-fields/index.d.ts +6 -0
- package/dist/components/form-fields/input.d.ts +34 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/libs/index.d.ts +2 -0
- package/dist/libs/next/axios-client.d.ts +2 -0
- package/dist/libs/next/axios-server.d.ts +2 -0
- package/dist/libs/next/index.d.ts +2 -0
- package/dist/libs/utils/date.d.ts +2 -0
- package/dist/libs/utils/form.d.ts +17 -0
- package/dist/libs/utils/index.d.ts +3 -0
- package/dist/libs/utils/response.d.ts +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FieldValues, Path } from "react-hook-form";
|
|
2
|
+
import { AutocompleteFilterProps, AutocompletePopoverProps, AutocompleteProps, AutocompleteTriggerProps, AutocompleteValueProps, EmptyStateProps, FieldErrorProps, LabelProps, ListBoxItemIndicatorProps, ListBoxItemProps, ListBoxRootProps, SearchFieldClearButtonProps, SearchFieldGroupProps, SearchFieldInputProps, SearchFieldProps, SearchFieldSearchIconProps, TagGroupListProps, TagGroupProps, TagRootProps } from "@heroui/react";
|
|
3
|
+
type TAutoComplete<T extends FieldValues, K extends Path<T>> = {
|
|
4
|
+
items: Array<T>;
|
|
5
|
+
idKey: K;
|
|
6
|
+
nameKey: Path<T>;
|
|
7
|
+
label?: string;
|
|
8
|
+
emptyMessage?: string;
|
|
9
|
+
onChange: (keys: Array<T[K]>) => void;
|
|
10
|
+
value: Array<T[K]>;
|
|
11
|
+
} & WithProperties<{
|
|
12
|
+
base?: {
|
|
13
|
+
autoComplete?: Omit<AutocompleteProps<T>, "onChange" | "value">;
|
|
14
|
+
trigger?: AutocompleteTriggerProps;
|
|
15
|
+
value?: AutocompleteValueProps;
|
|
16
|
+
};
|
|
17
|
+
tag?: {
|
|
18
|
+
group?: Omit<TagGroupProps, "onRemove">;
|
|
19
|
+
list?: TagGroupListProps<T>;
|
|
20
|
+
item?: TagRootProps;
|
|
21
|
+
};
|
|
22
|
+
popover?: {
|
|
23
|
+
popover?: AutocompletePopoverProps;
|
|
24
|
+
filter?: Omit<AutocompleteFilterProps, "filter">;
|
|
25
|
+
};
|
|
26
|
+
search?: {
|
|
27
|
+
field?: SearchFieldProps;
|
|
28
|
+
group?: SearchFieldGroupProps;
|
|
29
|
+
icon?: SearchFieldSearchIconProps;
|
|
30
|
+
input?: SearchFieldInputProps;
|
|
31
|
+
clear?: SearchFieldClearButtonProps;
|
|
32
|
+
};
|
|
33
|
+
list?: {
|
|
34
|
+
listbox?: Omit<ListBoxRootProps<T>, "items" | "renderEmptyState">;
|
|
35
|
+
empty?: EmptyStateProps;
|
|
36
|
+
item?: Omit<ListBoxItemProps, "id" | "textValue">;
|
|
37
|
+
check?: ListBoxItemIndicatorProps;
|
|
38
|
+
};
|
|
39
|
+
label?: LabelProps;
|
|
40
|
+
error?: FieldErrorProps;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const AutoComplete: <T extends FieldValues, K extends Path<T>>({ emptyMessage, items, idKey, nameKey, properties, label, onChange, value }: TAutoComplete<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Breadcrumbs } from "@heroui/react";
|
|
2
|
+
export type TBreadCrumb = Omit<Parameters<(typeof Breadcrumbs)["Item"]>[0], "children">;
|
|
3
|
+
type TBreadCrumbs = {
|
|
4
|
+
data: Record<string, TBreadCrumb> | undefined;
|
|
5
|
+
};
|
|
6
|
+
export declare const BreadCrumbs: ({ data }: TBreadCrumbs) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtonProps, SpinnerProps, TooltipContentProps, TooltipProps } from "@heroui/react";
|
|
2
|
+
import { RippleProps } from "m3-ripple";
|
|
3
|
+
import { PropsWithChildren, ReactNode } from "react";
|
|
4
|
+
type TRippledButton = {
|
|
5
|
+
tooltipContent?: ReactNode;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
} & Pick<ButtonProps, "onPress" | "type"> & WithProperties<{
|
|
8
|
+
ripple?: RippleProps;
|
|
9
|
+
button?: Omit<ButtonProps, "type" | "onPress">;
|
|
10
|
+
tooltip?: Partial<Omit<TooltipProps, "isDisabled">>;
|
|
11
|
+
tooltipContent?: TooltipContentProps;
|
|
12
|
+
spinner?: SpinnerProps;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const RippledButton: ({ onPress, isLoading, type, tooltipContent, children, properties }: PropsWithChildren<TRippledButton>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CalendarYearPickerTriggerHeadingProps, CalendarYearPickerTriggerIndicatorProps, CalendarYearPickerTriggerProps, DateRangePickerPopoverProps, DateRangePickerProps, DateRangePickerRangeSeparatorProps, DateRangePickerTriggerIndicatorProps, DateRangePickerTriggerProps, FieldErrorProps, LabelProps, RangeCalendar, RangeCalendarGridHeaderProps, RangeCalendarHeaderCellProps, RangeCalendarHeaderProps, RangeCalendarNavButtonProps } from "@heroui/react";
|
|
2
|
+
import { ZonedDateTime } from "@internationalized/date";
|
|
3
|
+
import { DateInputGroupInputProps, DateInputGroupRootProps, DateInputGroupSegmentProps, DateInputGroupSuffixProps } from "@heroui/react/date-input-group";
|
|
4
|
+
export type DateRangeItem = {
|
|
5
|
+
from: Date;
|
|
6
|
+
to: Date;
|
|
7
|
+
};
|
|
8
|
+
type TDateRange = {
|
|
9
|
+
label: string;
|
|
10
|
+
onChange: (consume: DateRangeItem | null) => void;
|
|
11
|
+
value: DateRangeItem | null;
|
|
12
|
+
} & WithProperties<{
|
|
13
|
+
picker: Omit<DateRangePickerProps<ZonedDateTime>, "value" | "onChange">;
|
|
14
|
+
label?: LabelProps;
|
|
15
|
+
error?: FieldErrorProps;
|
|
16
|
+
input?: {
|
|
17
|
+
group?: DateInputGroupRootProps;
|
|
18
|
+
input?: Omit<DateInputGroupInputProps, "slot">;
|
|
19
|
+
segment?: DateInputGroupSegmentProps;
|
|
20
|
+
separator?: DateRangePickerRangeSeparatorProps;
|
|
21
|
+
trigger?: {
|
|
22
|
+
trigger?: DateRangePickerTriggerProps;
|
|
23
|
+
heading?: CalendarYearPickerTriggerHeadingProps;
|
|
24
|
+
indicator?: DateRangePickerTriggerIndicatorProps;
|
|
25
|
+
suffix?: DateInputGroupSuffixProps;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
calendar?: {
|
|
29
|
+
next?: Omit<RangeCalendarNavButtonProps, "slot">;
|
|
30
|
+
previous?: Omit<RangeCalendarNavButtonProps, "slot">;
|
|
31
|
+
popover?: Partial<DateRangePickerPopoverProps>;
|
|
32
|
+
calendar?: RangeCalendar;
|
|
33
|
+
header?: RangeCalendarHeaderProps;
|
|
34
|
+
yearPicker?: {
|
|
35
|
+
tigger?: CalendarYearPickerTriggerProps;
|
|
36
|
+
heading?: CalendarYearPickerTriggerHeadingProps;
|
|
37
|
+
indicator?: CalendarYearPickerTriggerIndicatorProps;
|
|
38
|
+
};
|
|
39
|
+
headerCell?: RangeCalendarHeaderCellProps;
|
|
40
|
+
gridHeader?: RangeCalendarGridHeaderProps;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
export declare const DateRange: ({ onChange, value, properties, label }: TDateRange) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./autocomplete";
|
|
2
|
+
export * from "./breadcrumbs";
|
|
3
|
+
export * from "./button";
|
|
4
|
+
export * from "./date-range";
|
|
5
|
+
export * from "./modal";
|
|
6
|
+
export * from "./number";
|
|
7
|
+
export * from "./scroll";
|
|
8
|
+
export * from "./search";
|
|
9
|
+
export * from "./table";
|
|
10
|
+
export * from "./tabs";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DescriptionProps, ModalBackdropProps, ModalBodyProps, ModalCloseTriggerProps, ModalContainerProps, ModalDialogProps, ModalFooterProps, ModalHeaderProps, ModalHeadingProps, ModalIconProps, ModalProps, SeparatorProps } from "@heroui/react";
|
|
2
|
+
import { LucideIcon } from "lucide-react";
|
|
3
|
+
import { PropsWithChildren, ReactNode } from "react";
|
|
4
|
+
type TModal = {
|
|
5
|
+
showCloseButton?: boolean;
|
|
6
|
+
icon?: LucideIcon;
|
|
7
|
+
heading?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
} & Pick<ModalProps, "isOpen" | "onOpenChange"> & WithProperties<{
|
|
11
|
+
modal?: Omit<ModalProps, "isOpen" | "onOpenChange">;
|
|
12
|
+
backdrop?: ModalBackdropProps;
|
|
13
|
+
container?: ModalContainerProps;
|
|
14
|
+
dialog?: ModalDialogProps;
|
|
15
|
+
header?: ModalHeaderProps;
|
|
16
|
+
heading?: ModalHeadingProps;
|
|
17
|
+
close?: ModalCloseTriggerProps;
|
|
18
|
+
icon?: ModalIconProps;
|
|
19
|
+
description?: DescriptionProps;
|
|
20
|
+
separator?: SeparatorProps;
|
|
21
|
+
body?: ModalBodyProps;
|
|
22
|
+
footer: ModalFooterProps;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const Modal: ({ isOpen, icon, footer, onOpenChange, properties, showCloseButton, description, heading, children }: PropsWithChildren<TModal>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LabelProps, NumberFieldDecrementButtonProps, NumberFieldGroupProps, NumberFieldIncrementButtonProps, NumberFieldInputProps, NumberFieldProps } from "@heroui/react";
|
|
2
|
+
type TNumericInput = {
|
|
3
|
+
label?: string;
|
|
4
|
+
} & Pick<NumberFieldProps, "value" | "onChange"> & WithProperties<{
|
|
5
|
+
field?: Omit<NumberFieldProps, "onChange" | "value">;
|
|
6
|
+
label?: LabelProps;
|
|
7
|
+
group?: NumberFieldGroupProps;
|
|
8
|
+
decrement?: NumberFieldDecrementButtonProps;
|
|
9
|
+
increment?: NumberFieldIncrementButtonProps;
|
|
10
|
+
input?: NumberFieldInputProps;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const NumericInput: ({ label, onChange, properties, value }: TNumericInput) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LabelProps, SearchFieldClearButtonProps, SearchFieldGroupProps, SearchFieldInputProps, SearchFieldProps, SearchFieldSearchIconProps } from "@heroui/react";
|
|
2
|
+
type SearchInputField = {
|
|
3
|
+
delay?: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
onDebounce?: (value: string) => void;
|
|
6
|
+
} & WithProperties<{
|
|
7
|
+
field?: Omit<SearchFieldProps, "value" | "onChange">;
|
|
8
|
+
group?: SearchFieldGroupProps;
|
|
9
|
+
icon?: SearchFieldSearchIconProps;
|
|
10
|
+
input?: SearchFieldInputProps;
|
|
11
|
+
clear?: SearchFieldClearButtonProps;
|
|
12
|
+
label?: LabelProps;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const SearchInputField: ({ label, delay, onDebounce, properties }: SearchInputField) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TDataTablePagination } from "./pagination";
|
|
2
|
+
import { TableBodyProps, TableCellProps, TableColumnProps, TableColumnResizerProps, TableContentProps, TableFooterProps, TableHeaderProps, TableProps, TableResizableContainerProps, TableRowProps, TableScrollContainerProps } from "@heroui/react";
|
|
3
|
+
import { TableLayoutProps } from "@react-stately/layout";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import { FieldValues, Path } from "react-hook-form";
|
|
6
|
+
export type TDataTable<T extends FieldValues, K extends Path<T>> = {
|
|
7
|
+
storageBaseName?: string;
|
|
8
|
+
name: string;
|
|
9
|
+
onSelectRows?: (selectedKeys: Array<T[K]>) => void;
|
|
10
|
+
rowIdKey: K;
|
|
11
|
+
columns: Array<{
|
|
12
|
+
key: Path<T>;
|
|
13
|
+
title: string;
|
|
14
|
+
hide?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
renderCell?: (consume: {
|
|
17
|
+
row: T;
|
|
18
|
+
rowIndex: number;
|
|
19
|
+
}) => Partial<Record<Path<T>, ReactNode>>;
|
|
20
|
+
items: Array<T>;
|
|
21
|
+
} & TDataTablePagination & WithProperties<{
|
|
22
|
+
table?: TableProps;
|
|
23
|
+
tableContent?: TableContentProps;
|
|
24
|
+
scrollContainer?: TableScrollContainerProps;
|
|
25
|
+
tableRow?: TableRowProps<T>;
|
|
26
|
+
tableColumn?: TableColumnProps;
|
|
27
|
+
tableHeader?: TableHeaderProps<T>;
|
|
28
|
+
tableFooter?: TableFooterProps;
|
|
29
|
+
tableBody?: Omit<TableBodyProps<T>, "items">;
|
|
30
|
+
tableCell?: TableCellProps;
|
|
31
|
+
tableColumnResizer?: TableColumnResizerProps;
|
|
32
|
+
tableReizeableContainer?: TableResizableContainerProps;
|
|
33
|
+
virtualization?: TableLayoutProps;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const DataTable: <T extends FieldValues, K extends Path<T>>({ name, onSelectRows, columns, items, properties, rowIdKey, renderCell, storageBaseName, ...pagination }: TDataTable<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { DataTable, type TDataTable } from "./base";
|
|
2
|
+
export { RenderEmptyDataTable } from "./empty";
|
|
3
|
+
export { DataTablePagination, type TDataTablePagination } from "./pagination";
|
|
4
|
+
export declare const RenderDateRangeDataTableValue: ({ dates: [from, to] }: {
|
|
5
|
+
dates: [Date, Date];
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const RenderDateTimeDataTableValue: ({ date }: {
|
|
8
|
+
date: Date;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const RenderCurrencyDataTableValue: ({ isNegativeDanger, value }: {
|
|
11
|
+
isNegativeDanger?: boolean;
|
|
12
|
+
value: string | number | null | undefined;
|
|
13
|
+
}) => string | number | import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
export declare const RenderActionDataTableValue: <T extends Partial<Record<DataTableActionKeys, {
|
|
15
|
+
onPress: VoidFunction;
|
|
16
|
+
tooltip?: string;
|
|
17
|
+
}>>>(props: T) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PaginationContentProps, PaginationItemProps, PaginationNextIconProps, PaginationNextProps, PaginationPreviousIconProps, PaginationPreviousProps, PaginationProps, PaginationSummaryProps } from "@heroui/react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export type TDataTablePagination = {
|
|
4
|
+
page: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
hidePageNumbers?: boolean;
|
|
7
|
+
renderPaginationSummary?: (take: number) => ReactNode;
|
|
8
|
+
gotoPage?: (value: number) => void;
|
|
9
|
+
next?: {
|
|
10
|
+
text?: string;
|
|
11
|
+
canNext?: boolean;
|
|
12
|
+
onPress?: VoidFunction;
|
|
13
|
+
};
|
|
14
|
+
prev?: {
|
|
15
|
+
text?: string;
|
|
16
|
+
canPrev?: boolean;
|
|
17
|
+
onPress?: VoidFunction;
|
|
18
|
+
};
|
|
19
|
+
count: {
|
|
20
|
+
max?: number;
|
|
21
|
+
value: number;
|
|
22
|
+
onChange?: (value: number) => void;
|
|
23
|
+
};
|
|
24
|
+
locale?: string;
|
|
25
|
+
} & WithProperties<{
|
|
26
|
+
pagination?: PaginationProps;
|
|
27
|
+
paginationSummary?: PaginationSummaryProps;
|
|
28
|
+
paginationItem?: PaginationItemProps;
|
|
29
|
+
paginationContent?: PaginationContentProps;
|
|
30
|
+
paginationPrevButton?: Omit<PaginationPreviousProps, "isDisabled" | "onPress">;
|
|
31
|
+
paginationPrevIcon?: PaginationPreviousIconProps;
|
|
32
|
+
paginationNextButton?: Omit<PaginationNextProps, "isDisabled" | "onPress">;
|
|
33
|
+
paginationNextIcon?: PaginationNextIconProps;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const DataTablePagination: ({ renderPaginationSummary, gotoPage, locale, count, page, totalPages, properties, next, prev, hidePageNumbers }: TDataTablePagination) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LinkProps, TabIndicatorProps, TabListContainerProps, TabListProps, TabPanelProps, TabProps, TabsProps } from "@heroui/react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
type TTabs<T extends string, K extends T = T> = {
|
|
4
|
+
pathname: string;
|
|
5
|
+
renderTab?: {
|
|
6
|
+
[P in K]: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
[P in K]: Partial<Pick<LinkProps, "href"> & {
|
|
10
|
+
component?: ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
} & WithProperties<{
|
|
14
|
+
tab?: Omit<TabProps, "id" | "href" | "render">;
|
|
15
|
+
panel?: Omit<TabPanelProps, "id">;
|
|
16
|
+
tabs?: TabsProps;
|
|
17
|
+
list?: TabListProps;
|
|
18
|
+
indicator?: TabIndicatorProps;
|
|
19
|
+
listContainer?: TabListContainerProps;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const Tabs: <T extends string, K extends T = T>({ pathname, renderTab, data, properties }: TTabs<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FieldValues, Path } from "react-hook-form";
|
|
2
|
+
import { AutocompleteFilterProps, AutocompletePopoverProps, AutocompleteProps, AutocompleteTriggerProps, AutocompleteValueProps, EmptyStateProps, FieldErrorProps, LabelProps, ListBoxItemIndicatorProps, ListBoxItemProps, ListBoxRootProps, SearchFieldClearButtonProps, SearchFieldGroupProps, SearchFieldInputProps, SearchFieldProps, SearchFieldSearchIconProps, TagGroupListProps, TagGroupProps, TagRootProps } from "@heroui/react";
|
|
3
|
+
import { TFormField } from "./field";
|
|
4
|
+
type TAutoCompleteFormField<D extends FieldValues, T extends FieldValues, K extends Path<T>> = {
|
|
5
|
+
items: Array<D>;
|
|
6
|
+
idKey: Path<D>;
|
|
7
|
+
nameKey: Path<D>;
|
|
8
|
+
label?: string;
|
|
9
|
+
emptyMessage?: string;
|
|
10
|
+
} & TFormField<T, K> & WithProperties<{
|
|
11
|
+
base?: {
|
|
12
|
+
autoComplete?: AutocompleteProps<D>;
|
|
13
|
+
trigger?: AutocompleteTriggerProps;
|
|
14
|
+
value?: AutocompleteValueProps;
|
|
15
|
+
};
|
|
16
|
+
tag?: {
|
|
17
|
+
group?: Omit<TagGroupProps, "onRemove">;
|
|
18
|
+
list?: TagGroupListProps<D>;
|
|
19
|
+
item?: TagRootProps;
|
|
20
|
+
};
|
|
21
|
+
popover?: {
|
|
22
|
+
popover?: Partial<AutocompletePopoverProps>;
|
|
23
|
+
filter?: Omit<AutocompleteFilterProps, "filter">;
|
|
24
|
+
};
|
|
25
|
+
search?: {
|
|
26
|
+
field?: SearchFieldProps;
|
|
27
|
+
group?: SearchFieldGroupProps;
|
|
28
|
+
icon?: SearchFieldSearchIconProps;
|
|
29
|
+
input?: SearchFieldInputProps;
|
|
30
|
+
clear?: SearchFieldClearButtonProps;
|
|
31
|
+
};
|
|
32
|
+
list?: {
|
|
33
|
+
listbox?: Omit<ListBoxRootProps<D>, "items" | "renderEmptyState">;
|
|
34
|
+
empty?: EmptyStateProps;
|
|
35
|
+
item?: Omit<ListBoxItemProps, "id" | "textValue">;
|
|
36
|
+
check?: ListBoxItemIndicatorProps;
|
|
37
|
+
};
|
|
38
|
+
label?: LabelProps;
|
|
39
|
+
error?: FieldErrorProps;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const AutoCompleteFormField: <D extends FieldValues, T extends FieldValues, K extends Path<T>>({ emptyMessage, items, idKey, nameKey, properties, label, ...form }: TAutoCompleteFormField<D, T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FieldValues, Path } from "react-hook-form";
|
|
2
|
+
import { TFormField } from "./field";
|
|
3
|
+
import { CalendarYearPickerTriggerHeadingProps, CalendarYearPickerTriggerIndicatorProps, CalendarYearPickerTriggerProps, DateRangePickerPopoverProps, DateRangePickerProps, DateRangePickerRangeSeparatorProps, DateRangePickerTriggerIndicatorProps, DateRangePickerTriggerProps, FieldErrorProps, LabelProps, RangeCalendar, RangeCalendarGridHeaderProps, RangeCalendarHeaderCellProps, RangeCalendarHeaderProps, RangeCalendarNavButtonProps } from "@heroui/react";
|
|
4
|
+
import { ZonedDateTime } from "@internationalized/date";
|
|
5
|
+
import { DateInputGroupInputProps, DateInputGroupRootProps, DateInputGroupSegmentProps, DateInputGroupSuffixProps } from "@heroui/react/date-input-group";
|
|
6
|
+
type TDateRangeFormField<T extends FieldValues, K extends Path<T>> = {
|
|
7
|
+
label: string;
|
|
8
|
+
startName: SubPath<T, K>;
|
|
9
|
+
endName: SubPath<T, K>;
|
|
10
|
+
} & TFormField<T, K> & WithProperties<{
|
|
11
|
+
picker: Omit<DateRangePickerProps<ZonedDateTime>, "startName" | "endName">;
|
|
12
|
+
label?: LabelProps;
|
|
13
|
+
error?: FieldErrorProps;
|
|
14
|
+
input?: {
|
|
15
|
+
group?: DateInputGroupRootProps;
|
|
16
|
+
input?: Omit<DateInputGroupInputProps, "slot">;
|
|
17
|
+
segment?: DateInputGroupSegmentProps;
|
|
18
|
+
separator?: DateRangePickerRangeSeparatorProps;
|
|
19
|
+
trigger?: {
|
|
20
|
+
trigger?: DateRangePickerTriggerProps;
|
|
21
|
+
heading?: CalendarYearPickerTriggerHeadingProps;
|
|
22
|
+
indicator?: DateRangePickerTriggerIndicatorProps;
|
|
23
|
+
suffix?: DateInputGroupSuffixProps;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
calendar?: {
|
|
27
|
+
next?: Omit<RangeCalendarNavButtonProps, "slot">;
|
|
28
|
+
previous?: Omit<RangeCalendarNavButtonProps, "slot">;
|
|
29
|
+
popover?: DateRangePickerPopoverProps;
|
|
30
|
+
calendar?: RangeCalendar;
|
|
31
|
+
header?: RangeCalendarHeaderProps;
|
|
32
|
+
yearPicker?: {
|
|
33
|
+
tigger?: CalendarYearPickerTriggerProps;
|
|
34
|
+
heading?: CalendarYearPickerTriggerHeadingProps;
|
|
35
|
+
indicator?: CalendarYearPickerTriggerIndicatorProps;
|
|
36
|
+
};
|
|
37
|
+
headerCell?: RangeCalendarHeaderCellProps;
|
|
38
|
+
gridHeader?: RangeCalendarGridHeaderProps;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
export declare const DateRangeFormField: <T extends FieldValues, K extends Path<T>>({ startName, endName, properties, label, ...form }: TDateRangeFormField<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FieldValues, Path } from "react-hook-form";
|
|
2
|
+
import { TFormField } from "./field";
|
|
3
|
+
import { CalendarYearPickerTriggerHeadingProps, CalendarYearPickerTriggerIndicatorProps, CalendarYearPickerTriggerProps, DatePickerPopoverProps, DatePickerProps, DatePickerTriggerProps, Calendar, CalendarGridHeaderProps, CalendarHeaderCellProps, CalendarHeaderProps, LabelProps, FieldErrorProps, CalendarNavButtonProps, DatePickerTriggerIndicatorProps } from "@heroui/react";
|
|
4
|
+
import { ZonedDateTime } from "@internationalized/date";
|
|
5
|
+
import { DateInputGroupInputProps, DateInputGroupRootProps, DateInputGroupSegmentProps, DateInputGroupSuffixProps } from "@heroui/react/date-input-group";
|
|
6
|
+
type TDateFormField<T extends FieldValues, K extends Path<T>> = {
|
|
7
|
+
label?: string;
|
|
8
|
+
} & TFormField<T, K> & WithProperties<{
|
|
9
|
+
picker: Omit<DatePickerProps<ZonedDateTime>, "startName" | "endName">;
|
|
10
|
+
label?: LabelProps;
|
|
11
|
+
error?: FieldErrorProps;
|
|
12
|
+
input?: {
|
|
13
|
+
group?: DateInputGroupRootProps;
|
|
14
|
+
input?: Omit<DateInputGroupInputProps, "slot">;
|
|
15
|
+
segment?: DateInputGroupSegmentProps;
|
|
16
|
+
trigger?: {
|
|
17
|
+
trigger?: DatePickerTriggerProps;
|
|
18
|
+
heading?: CalendarYearPickerTriggerHeadingProps;
|
|
19
|
+
indicator?: DatePickerTriggerIndicatorProps;
|
|
20
|
+
suffix?: DateInputGroupSuffixProps;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
calendar?: {
|
|
24
|
+
popover?: Partial<DatePickerPopoverProps>;
|
|
25
|
+
calendar?: Calendar;
|
|
26
|
+
header?: CalendarHeaderProps;
|
|
27
|
+
next?: Omit<CalendarNavButtonProps, "slot">;
|
|
28
|
+
previous?: Omit<CalendarNavButtonProps, "slot">;
|
|
29
|
+
yearPicker?: {
|
|
30
|
+
tigger?: CalendarYearPickerTriggerProps;
|
|
31
|
+
heading?: CalendarYearPickerTriggerHeadingProps;
|
|
32
|
+
indicator?: CalendarYearPickerTriggerIndicatorProps;
|
|
33
|
+
};
|
|
34
|
+
headerCell?: CalendarHeaderCellProps;
|
|
35
|
+
gridHeader?: CalendarGridHeaderProps;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
export declare const DateFormField: <T extends FieldValues, K extends Path<T>>({ label, properties, ...form }: TDateFormField<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FieldErrorProps } from "@heroui/react";
|
|
2
|
+
import { ControllerFieldState } from "react-hook-form";
|
|
3
|
+
type TFormFieldErrorMessage = {
|
|
4
|
+
fieldState: ControllerFieldState;
|
|
5
|
+
} & WithProperties<{
|
|
6
|
+
error?: FieldErrorProps;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const FormFieldErrorMessage: ({ fieldState, properties }: TFormFieldErrorMessage) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Control, FieldValues, Path, ControllerProps } from "react-hook-form";
|
|
3
|
+
export type TFormField<T extends FieldValues, K extends Path<T>> = {
|
|
4
|
+
name: K;
|
|
5
|
+
control: Control<T>;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const FormField: <T extends FieldValues, K extends Path<T>>({ className, children, control, name }: TFormField<T, K> & {
|
|
9
|
+
children: (props: Parameters<ControllerProps<T>["render"]>[0]) => ReactNode;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FieldValues, Path } from "react-hook-form";
|
|
2
|
+
import { DescriptionProps, FieldErrorProps, InputGroupInputProps, InputGroupPrefixProps, InputGroupSuffixProps, LabelProps, NumberFieldDecrementButtonProps, NumberFieldGroupProps, NumberFieldIncrementButtonProps, NumberFieldInputProps, NumberFieldProps, TextFieldProps } from "@heroui/react";
|
|
3
|
+
import { TFormField } from "./field";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
type TInputFormField<T extends FieldValues, K extends Path<T>> = {
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
startComponent?: ReactNode;
|
|
9
|
+
endComponent?: ReactNode;
|
|
10
|
+
} & TFormField<T, K> & WithProperties<{
|
|
11
|
+
input?: InputGroupInputProps;
|
|
12
|
+
field?: TextFieldProps;
|
|
13
|
+
label?: LabelProps;
|
|
14
|
+
error?: FieldErrorProps;
|
|
15
|
+
description?: DescriptionProps;
|
|
16
|
+
prefix?: InputGroupPrefixProps;
|
|
17
|
+
suffix?: InputGroupSuffixProps;
|
|
18
|
+
}>;
|
|
19
|
+
type TNumberInputFormField<T extends FieldValues, K extends Path<T>> = {
|
|
20
|
+
label?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
} & TFormField<T, K> & WithProperties<{
|
|
23
|
+
field?: Omit<NumberFieldProps, "value" | "onChange">;
|
|
24
|
+
label?: LabelProps;
|
|
25
|
+
error?: FieldErrorProps;
|
|
26
|
+
description?: DescriptionProps;
|
|
27
|
+
group?: NumberFieldGroupProps;
|
|
28
|
+
decrement?: NumberFieldDecrementButtonProps;
|
|
29
|
+
input?: NumberFieldInputProps;
|
|
30
|
+
increment?: NumberFieldIncrementButtonProps;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const InputFormField: <T extends FieldValues, K extends Path<T>>({ endComponent, startComponent, description, properties, label, ...form }: TInputFormField<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const NumberInputFormField: <T extends FieldValues, K extends Path<T>>({ label, description, properties, ...form }: TNumberInputFormField<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./libs";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { FieldValues } from "react-hook-form";
|
|
3
|
+
export declare const toDefaultValue: <T extends FieldValues>(schema: z.ZodType<T>) => T;
|
|
4
|
+
export declare const acceptFiles: {
|
|
5
|
+
excel: {
|
|
6
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": string[];
|
|
7
|
+
"application/vnd.ms-excel": string[];
|
|
8
|
+
};
|
|
9
|
+
pdf: {
|
|
10
|
+
"application/pdf": string[];
|
|
11
|
+
};
|
|
12
|
+
images: {
|
|
13
|
+
"image/jpeg": string[];
|
|
14
|
+
"image/png": string[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const getMimeByFileName: (fileName: string) => string | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { FieldValues } from "react-hook-form";
|
|
3
|
+
import { Key } from "@heroui/react";
|
|
4
|
+
export declare const toFailedZodResponse: <T extends FieldValues>(error: z.ZodError<T>) => Res<null>;
|
|
5
|
+
export declare const toSuccessAxiosResponse: <T>(response: T) => Res<T>;
|
|
6
|
+
export declare const toFailedAxiosResponse: <T>(error: unknown) => Res<T>;
|
|
7
|
+
export declare const getErrorMessage: (response: ReturnType<typeof toFailedAxiosResponse>) => string | null;
|
|
8
|
+
export declare const toastException: (error: unknown) => void;
|
|
9
|
+
export declare const toastSuccess: <T extends FieldValues | Key>(response: Res<T>) => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sharpcodes-heroui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=22"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "vite build"
|
|
17
|
+
"build": "vite build && tsc --project tsconfig.build.json"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "^19.0.0",
|