prom-pal-ui 1.0.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.
@@ -0,0 +1,7 @@
1
+ export * from "./ui/button";
2
+ export * from "./ui/select";
3
+ export * from "./ui/fields";
4
+ export * from "./ui/skeleton";
5
+ export * from "./lib/index";
6
+ import "./styles/tailwind.css";
7
+ export * from "./ui/test";
@@ -0,0 +1,2 @@
1
+ export * from "./schema";
2
+ export * from "./schema-msg";
@@ -0,0 +1,5 @@
1
+ declare const PROM_MSG_ERROR: {
2
+ EMPTY: string;
3
+ INVALID_VALUES: string;
4
+ };
5
+ export { PROM_MSG_ERROR };
@@ -0,0 +1,3 @@
1
+ import z from "zod";
2
+ declare const promSchemaPhone: z.ZodString;
3
+ export { promSchemaPhone };
@@ -0,0 +1,2 @@
1
+ export { cn } from "./utils";
2
+ export * from "./form/rules";
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,17 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import * as React from "react";
3
+ import { CommonPromComponentProps } from "./types";
4
+ declare const buttonVariants: (props?: {
5
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
6
+ size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg";
7
+ } & import("class-variance-authority/dist/types").ClassProp) => string;
8
+ declare const skeletonVariants: (props?: {
9
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
10
+ size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg";
11
+ } & import("class-variance-authority/dist/types").ClassProp) => string;
12
+ interface PromButtonProps extends React.ComponentProps<"button">, VariantProps<typeof buttonVariants>, CommonPromComponentProps {
13
+ asChild?: boolean;
14
+ loadingText?: string;
15
+ }
16
+ declare function PromButton({ size, variant, children, disabled, className, loadingText, isLoad, asChild, skeleton, ...props }: PromButtonProps): import("react/jsx-runtime").JSX.Element;
17
+ export { PromButton, buttonVariants, skeletonVariants };
@@ -0,0 +1,42 @@
1
+ import { ReactNode } from "react";
2
+ import { type ControllerProps, type FieldPath, type FieldValues, UseFormReturn } from "react-hook-form";
3
+ import { z } from "zod";
4
+ import { CommonPromComponentProps } from "../types";
5
+ type PromFormRenderProps = {
6
+ isValid: boolean;
7
+ isSubmitting: boolean;
8
+ errors: Record<string, any>;
9
+ form: UseFormReturn<z.infer<any>>;
10
+ };
11
+ interface PromFromProps extends CommonPromComponentProps {
12
+ children?: ReactNode;
13
+ schema?: z.ZodObject<any>;
14
+ defaultValues?: z.infer<any>;
15
+ onSubmit?: (data: z.infer<any>) => void;
16
+ render?: (props: PromFormRenderProps) => ReactNode;
17
+ form?: UseFormReturn<z.infer<any>>;
18
+ errorDisplay?: ReactNode;
19
+ }
20
+ declare const PromFrom: ({ schema, render, children, onSubmit, defaultValues, form: externalForm, }: PromFromProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const usePromForm: <T extends FieldValues>() => {
22
+ form: UseFormReturn<T, any, T>;
23
+ errors: import("react-hook-form").FieldErrors<T>;
24
+ isValid: boolean;
25
+ isSubmitting: boolean;
26
+ reset: import("react-hook-form").UseFormReset<T>;
27
+ watch: import("react-hook-form").UseFormWatch<T>;
28
+ control: import("react-hook-form").Control<T, any, T>;
29
+ setValue: import("react-hook-form").UseFormSetValue<T>;
30
+ register: import("react-hook-form").UseFormRegister<T>;
31
+ handleSubmit: import("react-hook-form").UseFormHandleSubmit<T, T>;
32
+ getValues: import("react-hook-form").UseFormGetValues<T>;
33
+ trigger: import("react-hook-form").UseFormTrigger<T>;
34
+ };
35
+ type PromFormFiledProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ControllerProps<TFieldValues, TName>;
36
+ declare const PromFormFiled: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: PromFormFiledProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
37
+ declare const PromMessage: () => import("react/jsx-runtime").JSX.Element;
38
+ declare const useCreatePromForm: ({ schema, defaultValues, }: {
39
+ schema: z.ZodObject<any>;
40
+ defaultValues?: z.infer<any>;
41
+ }) => UseFormReturn<any, unknown, Record<string, unknown>>;
42
+ export { PromFrom, usePromForm, PromMessage, PromFormFiled, useCreatePromForm, type PromFromProps, type PromFormRenderProps, };
@@ -0,0 +1,6 @@
1
+ export * from "./form";
2
+ export * from "./input";
3
+ export * from "./label";
4
+ export * from "./textarea";
5
+ export * from "./switch-field";
6
+ export * from "./select-field";
@@ -0,0 +1,8 @@
1
+ import React, { FC } from "react";
2
+ import { CommonPromComponentProps, CommonPromStyle } from "../types";
3
+ interface PromInputProps extends CommonPromComponentProps, CommonPromStyle, Omit<React.ComponentProps<"input">, "name"> {
4
+ name: string;
5
+ label?: string;
6
+ }
7
+ declare const PromInput: FC<PromInputProps>;
8
+ export { PromInput };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ declare function PromLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { PromLabel };
@@ -0,0 +1,18 @@
1
+ import { FC } from "react";
2
+ import { CommonPromComponentProps, CommonPromStyle } from "../types";
3
+ interface PromSelectType {
4
+ key: string | number;
5
+ value: string;
6
+ }
7
+ type PromSelectFieldProps = CommonPromStyle & CommonPromComponentProps & {
8
+ name: string;
9
+ label?: string;
10
+ placeholder?: string;
11
+ options: PromSelectType[];
12
+ };
13
+ declare const PromSelectField: FC<PromSelectFieldProps>;
14
+ declare function promSelectFilterOptions<T extends Record<string, any>, K extends keyof T>(obj: T, allowedKeys: K[]): Array<{
15
+ key: K;
16
+ value: T[K];
17
+ }>;
18
+ export { PromSelectField, promSelectFilterOptions };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
3
+ interface PromSwitchFieldProps extends React.ComponentProps<typeof SwitchPrimitive.Root> {
4
+ name: string;
5
+ label?: string;
6
+ isLoad?: boolean;
7
+ isDisable?: boolean;
8
+ }
9
+ declare const PromSwitchField: React.FC<PromSwitchFieldProps>;
10
+ export { PromSwitchField };
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
3
+ interface PromSwitchProps extends React.ComponentProps<typeof SwitchPrimitive.Root> {
4
+ name: string;
5
+ isLoad?: boolean;
6
+ isDisable?: boolean;
7
+ }
8
+ declare const PromSwitch: React.FC<PromSwitchProps>;
9
+ export { PromSwitch };
@@ -0,0 +1,8 @@
1
+ import React, { FC } from "react";
2
+ import { CommonPromComponentProps, CommonPromStyle } from "../types";
3
+ interface PromTextareaProps extends CommonPromComponentProps, CommonPromStyle, Omit<React.ComponentProps<"textarea">, "name"> {
4
+ name: string;
5
+ label?: string;
6
+ }
7
+ declare const PromTextarea: FC<PromTextareaProps>;
8
+ export { PromTextarea };
@@ -0,0 +1,35 @@
1
+ import { ReactNode } from "react";
2
+ import { type ControllerProps, type FieldPath, type FieldValues, UseFormReturn } from "react-hook-form";
3
+ import { z } from "zod";
4
+ import { CommonPromComponentProps } from "./types";
5
+ type PromFormRenderProps = {
6
+ isValid: boolean;
7
+ isSubmitting: boolean;
8
+ errors: Record<string, any>;
9
+ form: UseFormReturn<z.infer<any>>;
10
+ };
11
+ interface PromFromProps extends CommonPromComponentProps {
12
+ children?: ReactNode;
13
+ schema: z.ZodObject<any>;
14
+ defaultValues?: z.infer<any>;
15
+ onSubmit: (data: z.infer<any>) => void;
16
+ render?: (props: PromFormRenderProps) => ReactNode;
17
+ errorDisplay?: ReactNode;
18
+ }
19
+ declare const PromFrom: ({ schema, render, children, onSubmit, defaultValues, }: PromFromProps) => import("react/jsx-runtime").JSX.Element;
20
+ declare const usePromForm: <T extends FieldValues>() => {
21
+ form: UseFormReturn<T, any, T>;
22
+ errors: import("react-hook-form").FieldErrors<T>;
23
+ isValid: boolean;
24
+ isSubmitting: boolean;
25
+ reset: import("react-hook-form").UseFormReset<T>;
26
+ watch: import("react-hook-form").UseFormWatch<T>;
27
+ control: import("react-hook-form").Control<T, any, T>;
28
+ setValue: import("react-hook-form").UseFormSetValue<T>;
29
+ register: import("react-hook-form").UseFormRegister<T>;
30
+ handleSubmit: import("react-hook-form").UseFormHandleSubmit<T, T>;
31
+ };
32
+ type PromFormFiledProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ControllerProps<TFieldValues, TName>;
33
+ declare const PromFormFiled: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: PromFormFiledProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
34
+ declare const PromMessage: () => import("react/jsx-runtime").JSX.Element;
35
+ export { PromFrom, usePromForm, PromMessage, PromFormFiled, type PromFromProps, type PromFormRenderProps, };
@@ -0,0 +1,8 @@
1
+ import React, { FC } from "react";
2
+ import { CommonPromComponentProps, CommonPromStyle } from "./types";
3
+ interface PromInputProps extends CommonPromComponentProps, CommonPromStyle, Omit<React.ComponentProps<"input">, "name"> {
4
+ name: string;
5
+ label?: string;
6
+ }
7
+ declare const PromInput: FC<PromInputProps>;
8
+ export { PromInput };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Label };
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import * as SelectPrimitive from "@radix-ui/react-select";
3
+ declare function PromSelect({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function PromSelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
5
+ declare function PromSelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
6
+ declare function PromSelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
7
+ size?: "sm" | "default";
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ declare function PromSelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
10
+ declare function PromSelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): import("react/jsx-runtime").JSX.Element;
11
+ declare function PromSelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
12
+ declare function PromSelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
13
+ declare function PromSelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): import("react/jsx-runtime").JSX.Element;
14
+ declare function PromSelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): import("react/jsx-runtime").JSX.Element;
15
+ export { PromSelect, PromSelectContent, PromSelectGroup, PromSelectItem, PromSelectLabel, PromSelectScrollDownButton, PromSelectScrollUpButton, PromSelectSeparator, PromSelectTrigger, PromSelectValue, };
@@ -0,0 +1,2 @@
1
+ declare function PromSkeleton({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
2
+ export { PromSkeleton };
@@ -0,0 +1,4 @@
1
+ import * as SwitchPrimitives from "@radix-ui/react-switch";
2
+ import * as React from "react";
3
+ declare const PromSwitch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ export { PromSwitch };
@@ -0,0 +1 @@
1
+ export declare function PromTest(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React, { FC } from "react";
2
+ import { CommonPromComponentProps, CommonPromStyle } from "./types";
3
+ interface PromTextareaProps extends CommonPromComponentProps, CommonPromStyle, Omit<React.ComponentProps<"textarea">, "name"> {
4
+ name: string;
5
+ label?: string;
6
+ }
7
+ declare const PromTextarea: FC<PromTextareaProps>;
8
+ export { PromTextarea };
@@ -0,0 +1,8 @@
1
+ export interface CommonPromStyle {
2
+ styleTitle?: string;
3
+ styleWrapper?: string;
4
+ }
5
+ export interface CommonPromComponentProps {
6
+ isLoad?: boolean;
7
+ skeleton?: boolean;
8
+ }
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "prom-pal-ui",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "build/cjs/index.js",
6
+ "module": "build/esm/index.js",
7
+ "types": "build/types/index.d.ts",
8
+ "files": [
9
+ "build"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "keywords": [],
15
+ "author": "promotion-pal",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "@hookform/resolvers": "^5.2.2",
19
+ "@radix-ui/react-label": "^2.1.8",
20
+ "@radix-ui/react-select": "^2.2.6",
21
+ "@radix-ui/react-slot": "^1.2.4",
22
+ "@radix-ui/react-switch": "^1.2.6",
23
+ "@rollup/plugin-commonjs": "^29.0.0",
24
+ "@rollup/plugin-node-resolve": "^16.0.3",
25
+ "@rollup/plugin-typescript": "^12.3.0",
26
+ "@tailwindcss/postcss": "^4.1.18",
27
+ "@tailwindcss/vite": "^4.1.18",
28
+ "@types/react": "^18.3.27",
29
+ "@types/react-dom": "^19.2.3",
30
+ "autoprefixer": "^10.4.23",
31
+ "class-variance-authority": "^0.7.1",
32
+ "clsx": "^2.1.1",
33
+ "lucide-react": "^0.562.0",
34
+ "postcss": "^8.5.6",
35
+ "react-hook-form": "^7.69.0",
36
+ "rollup": "^4.54.0",
37
+ "rollup-plugin-postcss": "^4.0.2",
38
+ "rollup-plugin-terser": "^7.0.2",
39
+ "rollup-plugin-typescript2": "^0.36.0",
40
+ "tailwind-merge": "^3.4.0",
41
+ "tailwindcss": "^4.1.18",
42
+ "tslib": "^2.8.1",
43
+ "typescript": "^5.9.3",
44
+ "zod": "^4.3.4"
45
+ },
46
+ "peerDependencies": {
47
+ "@hookform/resolvers": "^5.2.2",
48
+ "@radix-ui/react-label": "^2.1.8",
49
+ "@radix-ui/react-slot": "^1.2.4",
50
+ "@radix-ui/react-switch": "^1.2.6",
51
+ "@types/react": "^18.3.27",
52
+ "@types/react-dom": "^19.2.3",
53
+ "class-variance-authority": "^0.7.1",
54
+ "react": ">=16",
55
+ "react-dom": ">=16",
56
+ "react-hook-form": "^7.69.0",
57
+ "zod": "^4.3.4"
58
+ },
59
+ "dependencies": {
60
+ "postcss-selector-parser": "^7.1.1",
61
+ "react-jss": "^10.10.0"
62
+ },
63
+ "scripts": {
64
+ "build": "rollup --config",
65
+ "dev": "rollup --config --watch",
66
+ "clean": "rm -rf build"
67
+ }
68
+ }