diff --git a/packages/ui/package.json b/packages/ui/package.json index 9198559b..441a59ec 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,77 +1,79 @@ { - "name": "@o2s/ui", - "version": "1.4.0", - "private": true, - "license": "MIT", - "exports": { - "./globals": "./src/globals.css", - "./theme": "./src/theme.css", - "./postcss.config": "./postcss.config.mjs", - "./lib/*": "./src/lib/*.ts", - "./hooks/*": "./src/hooks/*.ts", - "./providers/*": "./src/providers/*/index.ts", - "./elements/*": "./src/elements/*.tsx", - "./components/*": "./src/components/*/index.ts" - }, - "scripts": { - "lint": "tsc --noEmit && eslint . --max-warnings 0", - "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,json}\"", - "generate:component": "turbo gen react-component", - "generate:component:shadcn": "npx shadcn@latest add" - }, - "devDependencies": { - "@o2s/eslint-config": "*", - "@o2s/prettier-config": "*", - "@o2s/typescript-config": "*", - "@tailwindcss/postcss": "^4.1.14", - "@trivago/prettier-plugin-sort-imports": "^5.2.2", - "@turbo/gen": "^2.5.8", - "@types/eslint": "^9.6.1", - "@types/node": "^24.7.2", - "eslint": "^9.37.0", - "prettier": "^3.6.2", - "sass": "^1.93.2", - "tw-animate-css": "^1.4.0", - "typescript": "^5.9.3" - }, - "dependencies": { - "@o2s/framework": "*", - "@radix-ui/react-accordion": "^1.2.12", - "@radix-ui/react-avatar": "^1.1.10", - "@radix-ui/react-checkbox": "^1.3.3", - "@radix-ui/react-collapsible": "^1.1.12", - "@radix-ui/react-dialog": "^1.1.15", - "@radix-ui/react-dropdown-menu": "^2.1.16", - "@radix-ui/react-label": "^2.1.7", - "@radix-ui/react-navigation-menu": "^1.2.14", - "@radix-ui/react-popover": "^1.1.15", - "@radix-ui/react-progress": "^1.1.7", - "@radix-ui/react-radio-group": "^1.3.8", - "@radix-ui/react-select": "^2.2.6", - "@radix-ui/react-separator": "^1.1.7", - "@radix-ui/react-slot": "^1.2.3", - "@radix-ui/react-switch": "^1.2.6", - "@radix-ui/react-toast": "^1.2.15", - "@radix-ui/react-toggle": "^1.1.10", - "@radix-ui/react-toggle-group": "^1.1.11", - "@radix-ui/react-tooltip": "^1.2.8", - "class-variance-authority": "^0.7.1", - "classnames": "^2.5.1", - "clsx": "^2.1.1", - "cmdk": "^1.1.1", - "date-fns": "^4.1.0", - "lucide-react": "^0.545.0", - "react-day-picker": "^9.11.1", - "markdown-to-jsx": "^7.7.15", - "recharts": "^2.15.4", - "tailwind-merge": "^3.3.1", - "tailwindcss-animate": "^1.0.7" - }, - "peerDependencies": { - "@types/react": "^19", - "@types/react-dom": "^19", - "react": "^19", - "react-dom": "^19", - "tailwindcss": "^4" - } + "name": "@o2s/ui", + "version": "1.4.0", + "private": true, + "license": "MIT", + "exports": { + "./globals": "./src/globals.css", + "./theme": "./src/theme.css", + "./postcss.config": "./postcss.config.mjs", + "./lib/*": "./src/lib/*.ts", + "./hooks/*": "./src/hooks/*.ts", + "./providers/*": "./src/providers/*/index.ts", + "./elements/*": "./src/elements/*.tsx", + "./components/*": "./src/components/*/index.ts" + }, + "scripts": { + "lint": "tsc --noEmit && eslint . --max-warnings 0", + "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,json}\"", + "generate:component": "turbo gen react-component", + "generate:component:shadcn": "npx shadcn@latest add" + }, + "devDependencies": { + "@o2s/eslint-config": "*", + "@o2s/prettier-config": "*", + "@o2s/typescript-config": "*", + "@tailwindcss/postcss": "^4.1.14", + "@trivago/prettier-plugin-sort-imports": "^5.2.2", + "@turbo/gen": "^2.5.8", + "@types/eslint": "^9.6.1", + "@types/node": "^24.7.2", + "eslint": "^9.37.0", + "prettier": "^3.6.2", + "sass": "^1.93.2", + "tw-animate-css": "^1.4.0", + "typescript": "^5.9.3" + }, + "dependencies": { + "@o2s/framework": "*", + "@radix-ui/react-accordion": "^1.2.12", + "@radix-ui/react-avatar": "^1.1.10", + "@radix-ui/react-checkbox": "^1.3.3", + "@radix-ui/react-collapsible": "^1.1.12", + "@radix-ui/react-dialog": "^1.1.15", + "@radix-ui/react-dropdown-menu": "^2.1.16", + "@radix-ui/react-label": "^2.1.7", + "@radix-ui/react-navigation-menu": "^1.2.14", + "@radix-ui/react-popover": "^1.1.15", + "@radix-ui/react-progress": "^1.1.7", + "@radix-ui/react-radio-group": "^1.3.8", + "@radix-ui/react-select": "^2.2.6", + "@radix-ui/react-separator": "^1.1.7", + "@radix-ui/react-slot": "^1.2.3", + "@radix-ui/react-switch": "^1.2.6", + "@radix-ui/react-toast": "^1.2.15", + "@radix-ui/react-toggle": "^1.1.10", + "@radix-ui/react-toggle-group": "^1.1.11", + "@radix-ui/react-tooltip": "^1.2.8", + "class-variance-authority": "^0.7.1", + "classnames": "^2.5.1", + "clsx": "^2.1.1", + "cmdk": "^1.1.1", + "date-fns": "^4.1.0", + "lucide-react": "^0.545.0", + "react-day-picker": "^9.11.1", + "markdown-to-jsx": "^7.7.15", + "recharts": "^2.15.4", + "tailwind-merge": "^3.3.1", + "tailwindcss-animate": "^1.0.7", + "libphonenumber-js": "^1.11.18", + "input-format": "^0.3.14" + }, + "peerDependencies": { + "@types/react": "^19", + "@types/react-dom": "^19", + "react": "^19", + "react-dom": "^19", + "tailwindcss": "^4" + } } diff --git a/packages/ui/src/components/PhoneInput/index.ts b/packages/ui/src/components/PhoneInput/index.ts new file mode 100644 index 00000000..5572f79a --- /dev/null +++ b/packages/ui/src/components/PhoneInput/index.ts @@ -0,0 +1,4 @@ +export { default as PhoneInput } from '../../elements/phone-input'; +export type { PhoneInputProps, PhoneInputChangePayload } from '../../elements/phone-input'; + + diff --git a/packages/ui/src/elements/accordion.tsx b/packages/ui/src/elements/accordion.tsx index d06dfdf7..163ca829 100644 --- a/packages/ui/src/elements/accordion.tsx +++ b/packages/ui/src/elements/accordion.tsx @@ -7,20 +7,21 @@ import { cn } from '@o2s/ui/lib/utils'; const Accordion = AccordionPrimitive.Root; -const AccordionItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +type AccordionItemProps = React.ComponentPropsWithoutRef & { + ref?: React.Ref>; +}; +const AccordionItem = ({ className, ref, ...props }: AccordionItemProps) => ( -)); -AccordionItem.displayName = 'AccordionItem'; +); export interface AccordionTriggerProps extends React.ComponentPropsWithoutRef { tag?: keyof JSX.IntrinsicElements; } -const AccordionTrigger = React.forwardRef, AccordionTriggerProps>( - ({ className, tag = 'h3', children, ...props }, ref) => { +type AccordionTriggerOwnProps = AccordionTriggerProps & { + ref?: React.Ref>; +}; +const AccordionTrigger = ({ className, tag = 'h3', children, ref, ...props }: AccordionTriggerOwnProps) => { const Comp = tag; return ( @@ -40,14 +41,12 @@ const AccordionTrigger = React.forwardRef ); - }, -); -AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; + }; -const AccordionContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( +type AccordionContentProps = React.ComponentPropsWithoutRef & { + ref?: React.Ref>; +}; +const AccordionContent = ({ className, children, ref, ...props }: AccordionContentProps) => (
{children}
-)); - -AccordionContent.displayName = AccordionPrimitive.Content.displayName; +); export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }; diff --git a/packages/ui/src/elements/alert.tsx b/packages/ui/src/elements/alert.tsx index ba01f67a..4b470cc7 100644 --- a/packages/ui/src/elements/alert.tsx +++ b/packages/ui/src/elements/alert.tsx @@ -18,26 +18,21 @@ const alertVariants = cva( }, ); -const Alert = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes & VariantProps ->(({ className, variant, ...props }, ref) => ( +type AlertProps = React.HTMLAttributes & VariantProps & { + ref?: React.Ref; +}; +const Alert = ({ className, variant, ref, ...props }: AlertProps) => (
-)); -Alert.displayName = 'Alert'; +); -const AlertTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +type AlertTitleProps = React.HTMLAttributes & { ref?: React.Ref }; +const AlertTitle = ({ className, ref, ...props }: AlertTitleProps) => ( +
); -AlertTitle.displayName = 'AlertTitle'; -const AlertDescription = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +type AlertDescriptionProps = React.HTMLAttributes & { ref?: React.Ref }; +const AlertDescription = ({ className, ref, ...props }: AlertDescriptionProps) => ( +
); -AlertDescription.displayName = 'AlertDescription'; export { Alert, AlertTitle, AlertDescription }; diff --git a/packages/ui/src/elements/avatar.tsx b/packages/ui/src/elements/avatar.tsx index 7ce8881b..96492a9f 100644 --- a/packages/ui/src/elements/avatar.tsx +++ b/packages/ui/src/elements/avatar.tsx @@ -23,27 +23,24 @@ type AvatarProps = { email?: string; } & React.ComponentPropsWithoutRef; -const Avatar = React.forwardRef, AvatarProps>( - ({ name, email, className, ...props }, ref) => ( -
- - {name && } -
- ), +type AvatarOwnProps = AvatarProps & { ref?: React.Ref> }; +const Avatar = ({ name, email, className, ref, ...props }: AvatarOwnProps) => ( +
+ + {name && } +
); -Avatar.displayName = AvatarPrimitive.Root.displayName; -const AvatarImage = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, alt = '', ...props }, ref) => ( +type AvatarImageProps = React.ComponentPropsWithoutRef & { + ref?: React.Ref>; +}; +const AvatarImage = ({ className, alt = '', ref, ...props }: AvatarImageProps) => ( -)); -AvatarImage.displayName = AvatarPrimitive.Image.displayName; +); export interface AvatarFallbackProps extends React.ComponentPropsWithoutRef, @@ -51,8 +48,10 @@ export interface AvatarFallbackProps name: string; } -const AvatarFallback = React.forwardRef, AvatarFallbackProps>( - ({ variant, className, name, ...props }, ref) => { +type AvatarFallbackOwnProps = AvatarFallbackProps & { + ref?: React.Ref>; +}; +const AvatarFallback = ({ variant, className, name, ref, ...props }: AvatarFallbackOwnProps) => { const initials = name .split(' ') .map((name) => name[0]) @@ -64,9 +63,7 @@ const AvatarFallback = React.forwardRef ); - }, -); -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; +}; type AvatarUserProps = { name: string; diff --git a/packages/ui/src/elements/breadcrumb.tsx b/packages/ui/src/elements/breadcrumb.tsx index 7d6d4a31..3426b1ac 100644 --- a/packages/ui/src/elements/breadcrumb.tsx +++ b/packages/ui/src/elements/breadcrumb.tsx @@ -4,60 +4,40 @@ import * as React from 'react'; import { cn } from '@o2s/ui/lib/utils'; -const Breadcrumb = React.forwardRef< - HTMLElement, - React.ComponentPropsWithoutRef<'nav'> & { - separator?: React.ReactNode; - } ->(({ ...props }, ref) =>