diff --git a/apps/www/components/selectLargeData.tsx b/apps/www/components/selectLargeData.tsx index 3272e73..f0106b3 100644 --- a/apps/www/components/selectLargeData.tsx +++ b/apps/www/components/selectLargeData.tsx @@ -6,8 +6,6 @@ import { SelectGroup, SelectItem, SelectLabel, - SelectScrollDownButton, - SelectScrollUpButton, SelectSeparator, } from "ruru-ui/components/select"; @@ -22,13 +20,11 @@ const SelectCountries = () => { Fruits - {Array.from({ length: 50 }, (_, index) => ( Ruru-UI-V{index} ))} - diff --git a/apps/www/content/docs/components/select.mdx b/apps/www/content/docs/components/select.mdx index 94d31d7..b6ebc25 100644 --- a/apps/www/content/docs/components/select.mdx +++ b/apps/www/content/docs/components/select.mdx @@ -257,9 +257,9 @@ export function DefaultValueSelect() { -### ScrollDownButton and ScrollUpButton +### Scrollable -You can add scroll buttons to the `Select` component by using the `SelectScrollDownButton` and `SelectScrollUpButton` components. +When the content in the Select component exceeds the maximum height, it becomes scrollable, adding `ScrollUpButton` and `ScrollDownButton` to help users easily navigate through the options. @@ -267,8 +267,6 @@ You can add scroll buttons to the `Select` component by using the `SelectScrollD ```tsx -// [!code word:SelectScrollDownButton] -// [!code word:SelectScrollUpButton] import { Select, SelectContent, @@ -277,8 +275,6 @@ import { SelectGroup, SelectItem, SelectLabel, - SelectScrollDownButton, - SelectScrollUpButton, SelectSeparator, } from "ruru-ui/components/select"; @@ -293,13 +289,11 @@ const SelectCountries = () => { Fruits - {Array.from({ length: 50 }, (_, index) => ( Ruru-UI-V{index} ))} - diff --git a/apps/www/public/registry/components/input.json b/apps/www/public/registry/components/input.json index 9f7bdc9..ebc5a13 100644 --- a/apps/www/public/registry/components/input.json +++ b/apps/www/public/registry/components/input.json @@ -3,7 +3,7 @@ "files": [ { "name": "input.tsx", - "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { EyeClosedIcon, EyeOpenIcon } from \"@radix-ui/react-icons\";\n\nexport interface InputProps\n extends Omit<\n React.InputHTMLAttributes,\n \"children\" | \"prefix\" | \"suffix\"\n > {\n \n className?: string;\n \n iclassName?: string;\n \n prefix?: React.ReactNode | string;\n \n suffix?: React.ReactNode | string;\n \n prefixStyling?: boolean;\n \n label?: string;\n \n suffixStyling?: boolean;\n \n error?: string;\n}\n\nconst Input = React.forwardRef(\n (\n {\n className,\n iclassName,\n prefix,\n suffix,\n prefixStyling = true,\n suffixStyling = true,\n label,\n type,\n error,\n ...props\n },\n ref,\n ) => {\n \n const prefixRef = React.useRef(null);\n const suffixRef = React.useRef(null);\n \n const [prefixWidth, setPrefixWidth] = React.useState(0);\n const [suffixWidth, setSuffixWidth] = React.useState(0);\n \n React.useEffect(() => {\n if (prefixRef.current) {\n setPrefixWidth(prefixRef.current.offsetWidth);\n }\n if (suffixRef.current) {\n setSuffixWidth(suffixRef.current.offsetWidth);\n }\n }, [prefix, suffix]);\n\n return (\n
\n {label && (\n \n {label}\n \n )}\n {prefix && (\n \n {prefix}\n {prefixStyling &&
}\n
\n )}\n \n {suffix && (\n \n {suffixStyling && (\n
\n )}\n {suffix}\n
\n )}\n {error && (\n \n \n \n \n \n
\n )}\n \n );\n },\n);\n\nInput.displayName = \"Input\";\n\nexport interface SearchInputProps\n extends Omit, \"children\"> {\n \n enablePrefixStyling?: boolean;\n}\n\nconst SearchInput = React.forwardRef(\n ({ enablePrefixStyling = false, ...props }, ref) => {\n return (\n \n \n \n }\n prefixStyling={enablePrefixStyling}\n className={cn(\"rounded-full\", props.className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\n\nSearchInput.displayName = \"SearchInput\";\n\nconst PasswordInput = React.forwardRef<\n HTMLInputElement,\n Omit\n>(({ className, ...props }, ref) => {\n const [showPassword, setShowPassword] = React.useState(false);\n\n return (\n
\n \n setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n \n ) : (\n \n )}\n \n {showPassword ? \"Hide password\" : \"Show password\"}\n \n \n\n {}\n \n
\n );\n});\nPasswordInput.displayName = \"PasswordInput\";\n\nexport { Input, SearchInput, PasswordInput };\n" + "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { EyeClosedIcon, EyeOpenIcon } from \"@radix-ui/react-icons\";\n\nexport interface InputProps\n extends Omit<\n React.InputHTMLAttributes,\n \"children\" | \"prefix\" | \"suffix\"\n > {\n \n className?: string;\n \n iclassName?: string;\n \n prefix?: React.ReactNode | string;\n \n suffix?: React.ReactNode | string;\n \n prefixStyling?: boolean;\n \n label?: string;\n \n suffixStyling?: boolean;\n \n error?: string;\n}\n\nconst Input = React.forwardRef(\n (\n {\n className,\n iclassName,\n prefix,\n suffix,\n prefixStyling = true,\n suffixStyling = true,\n label,\n type,\n error,\n ...props\n },\n ref,\n ) => {\n \n const prefixRef = React.useRef(null);\n const suffixRef = React.useRef(null);\n \n const [prefixWidth, setPrefixWidth] = React.useState(0);\n const [suffixWidth, setSuffixWidth] = React.useState(0);\n \n React.useEffect(() => {\n if (prefixRef.current) {\n setPrefixWidth(prefixRef.current.offsetWidth);\n }\n if (suffixRef.current) {\n setSuffixWidth(suffixRef.current.offsetWidth);\n }\n }, [prefix, suffix]);\n\n return (\n
\n {label && (\n \n {label}\n \n )}\n {prefix && (\n \n {prefix}\n {prefixStyling &&
}\n
\n )}\n \n {suffix && (\n \n {suffixStyling && (\n
\n )}\n {suffix}\n
\n )}\n {error && (\n \n \n \n \n \n
\n )}\n \n );\n },\n);\n\nInput.displayName = \"Input\";\n\nexport interface SearchInputProps\n extends Omit, \"children\"> {\n \n enablePrefixStyling?: boolean;\n}\n\nconst SearchInput = React.forwardRef(\n ({ enablePrefixStyling = false, ...props }, ref) => {\n return (\n \n \n \n }\n prefixStyling={enablePrefixStyling}\n className={cn(\"rounded-full\", props.className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\n\nSearchInput.displayName = \"SearchInput\";\n\nconst PasswordInput = React.forwardRef<\n HTMLInputElement,\n Omit\n>(({ className, ...props }, ref) => {\n const [showPassword, setShowPassword] = React.useState(false);\n\n return (\n
\n \n setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n \n ) : (\n \n )}\n \n {showPassword ? \"Hide password\" : \"Show password\"}\n \n \n\n {}\n \n
\n );\n});\nPasswordInput.displayName = \"PasswordInput\";\n\nexport { Input, SearchInput, PasswordInput };\n" } ], "type": "components:ui" diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx index 3e32fe2..a8caffc 100644 --- a/packages/ui/src/components/input.tsx +++ b/packages/ui/src/components/input.tsx @@ -301,7 +301,8 @@ const PasswordInput = React.forwardRef<
diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx index 6a1bad4..58aa8dd 100644 --- a/packages/ui/src/components/select.tsx +++ b/packages/ui/src/components/select.tsx @@ -121,7 +121,7 @@ const SelectScrollUpButton = React.forwardRef<