From f14379a1c8f79cbbfb54095434f16153f7f183c5 Mon Sep 17 00:00:00 2001
From: miloschwartz
Date: Sat, 12 Apr 2025 12:40:52 -0400
Subject: [PATCH] remove forward ref
---
src/components/tags/tag-input.tsx | 1370 ++++++++++++++-------------
src/components/ui/alert.tsx | 76 +-
src/components/ui/avatar.tsx | 81 +-
src/components/ui/breadcrumb.tsx | 105 +-
src/components/ui/button.tsx | 50 +-
src/components/ui/card.tsx | 142 +--
src/components/ui/checkbox.tsx | 49 +-
src/components/ui/command.tsx | 196 ++--
src/components/ui/dialog.tsx | 123 +--
src/components/ui/drawer.tsx | 117 ++-
src/components/ui/dropdown-menu.tsx | 268 +++---
src/components/ui/form.tsx | 75 +-
src/components/ui/input-otp.tsx | 79 +-
src/components/ui/input.tsx | 75 +-
src/components/ui/label.tsx | 22 +-
src/components/ui/popover.tsx | 62 +-
src/components/ui/radio-group.tsx | 30 +-
src/components/ui/select.tsx | 258 ++---
src/components/ui/separator.tsx | 42 +-
src/components/ui/sheet.tsx | 118 ++-
src/components/ui/switch.tsx | 37 +-
src/components/ui/table.tsx | 198 ++--
src/components/ui/tabs.tsx | 87 +-
src/components/ui/textarea.tsx | 32 +-
src/components/ui/toast.tsx | 154 +--
25 files changed, 2067 insertions(+), 1779 deletions(-)
diff --git a/src/components/tags/tag-input.tsx b/src/components/tags/tag-input.tsx
index 46fabd78..500c31f0 100644
--- a/src/components/tags/tag-input.tsx
+++ b/src/components/tags/tag-input.tsx
@@ -105,193 +105,93 @@ export interface TagInputProps
generateTagId?: () => string;
}
-const TagInput = React.forwardRef(
- (props, ref) => {
- const {
- id,
- placeholder,
- tags,
- setTags,
- variant,
- size,
- shape,
- enableAutocomplete,
- autocompleteOptions,
- maxTags,
- delimiter = Delimiter.Comma,
- onTagAdd,
- onTagRemove,
- allowDuplicates,
- showCount,
- validateTag,
- placeholderWhenFull = "Max tags reached",
- sortTags,
- delimiterList,
- truncate,
- autocompleteFilter,
- borderStyle,
- textCase,
- interaction,
- animation,
- textStyle,
- minLength,
- maxLength,
- direction = "row",
- onInputChange,
- customTagRenderer,
- onFocus,
- onBlur,
- onTagClick,
- draggable = false,
- inputFieldPosition = "bottom",
- clearAll = false,
- onClearAll,
- usePopoverForTags = false,
- inputProps = {},
- restrictTagsToAutocompleteOptions,
- inlineTags = true,
- addTagsOnBlur = false,
- activeTagIndex,
- setActiveTagIndex,
- styleClasses = {},
- disabled = false,
- usePortal = false,
- addOnPaste = false,
- generateTagId = uuid
- } = props;
+const TagInput = (
+ {
+ ref,
+ ...props
+ }: TagInputProps & {
+ ref: React.RefObject;
+ }
+) => {
+ const {
+ id,
+ placeholder,
+ tags,
+ setTags,
+ variant,
+ size,
+ shape,
+ enableAutocomplete,
+ autocompleteOptions,
+ maxTags,
+ delimiter = Delimiter.Comma,
+ onTagAdd,
+ onTagRemove,
+ allowDuplicates,
+ showCount,
+ validateTag,
+ placeholderWhenFull = "Max tags reached",
+ sortTags,
+ delimiterList,
+ truncate,
+ autocompleteFilter,
+ borderStyle,
+ textCase,
+ interaction,
+ animation,
+ textStyle,
+ minLength,
+ maxLength,
+ direction = "row",
+ onInputChange,
+ customTagRenderer,
+ onFocus,
+ onBlur,
+ onTagClick,
+ draggable = false,
+ inputFieldPosition = "bottom",
+ clearAll = false,
+ onClearAll,
+ usePopoverForTags = false,
+ inputProps = {},
+ restrictTagsToAutocompleteOptions,
+ inlineTags = true,
+ addTagsOnBlur = false,
+ activeTagIndex,
+ setActiveTagIndex,
+ styleClasses = {},
+ disabled = false,
+ usePortal = false,
+ addOnPaste = false,
+ generateTagId = uuid
+ } = props;
- const [inputValue, setInputValue] = React.useState("");
- const [tagCount, setTagCount] = React.useState(
- Math.max(0, tags.length)
- );
- const inputRef = React.useRef(null);
+ const [inputValue, setInputValue] = React.useState("");
+ const [tagCount, setTagCount] = React.useState(
+ Math.max(0, tags.length)
+ );
+ const inputRef = React.useRef(null);
- if (
- (maxTags !== undefined && maxTags < 0) ||
- (props.minTags !== undefined && props.minTags < 0)
- ) {
- console.warn("maxTags and minTags cannot be less than 0");
- // error
- return null;
- }
+ if (
+ (maxTags !== undefined && maxTags < 0) ||
+ (props.minTags !== undefined && props.minTags < 0)
+ ) {
+ console.warn("maxTags and minTags cannot be less than 0");
+ // error
+ return null;
+ }
- const handleInputChange = (e: React.ChangeEvent) => {
- const newValue = e.target.value;
- if (addOnPaste && newValue.includes(delimiter)) {
- const splitValues = newValue
- .split(delimiter)
- .map((v) => v.trim())
- .filter((v) => v);
- splitValues.forEach((value) => {
- if (!value) return; // Skip empty strings from split
+ const handleInputChange = (e: React.ChangeEvent) => {
+ const newValue = e.target.value;
+ if (addOnPaste && newValue.includes(delimiter)) {
+ const splitValues = newValue
+ .split(delimiter)
+ .map((v) => v.trim())
+ .filter((v) => v);
+ splitValues.forEach((value) => {
+ if (!value) return; // Skip empty strings from split
- const newTagText = value.trim();
-
- // Check if the tag is in the autocomplete options if restrictTagsToAutocomplete is true
- if (
- restrictTagsToAutocompleteOptions &&
- !autocompleteOptions?.some(
- (option) => option.text === newTagText
- )
- ) {
- console.warn(
- "Tag not allowed as per autocomplete options"
- );
- return;
- }
-
- if (validateTag && !validateTag(newTagText)) {
- console.warn("Invalid tag as per validateTag");
- return;
- }
-
- if (minLength && newTagText.length < minLength) {
- console.warn(`Tag "${newTagText}" is too short`);
- return;
- }
-
- if (maxLength && newTagText.length > maxLength) {
- console.warn(`Tag "${newTagText}" is too long`);
- return;
- }
-
- const newTagId = generateTagId();
-
- // Add tag if duplicates are allowed or tag does not already exist
- if (
- allowDuplicates ||
- !tags.some((tag) => tag.text === newTagText)
- ) {
- if (maxTags === undefined || tags.length < maxTags) {
- // Check for maxTags limit
- const newTag = { id: newTagId, text: newTagText };
- setTags((prevTags) => [...prevTags, newTag]);
- onTagAdd?.(newTagText);
- } else {
- console.warn(
- "Reached the maximum number of tags allowed"
- );
- }
- } else {
- console.warn(`Duplicate tag "${newTagText}" not added`);
- }
- });
- setInputValue("");
- } else {
- setInputValue(newValue);
- }
- onInputChange?.(newValue);
- };
-
- const handleInputFocus = (
- event: React.FocusEvent
- ) => {
- setActiveTagIndex(null); // Reset active tag index when the input field gains focus
- onFocus?.(event);
- };
-
- const handleInputBlur = (event: React.FocusEvent) => {
- if (addTagsOnBlur && inputValue.trim()) {
- const newTagText = inputValue.trim();
-
- if (validateTag && !validateTag(newTagText)) {
- return;
- }
-
- if (minLength && newTagText.length < minLength) {
- console.warn("Tag is too short");
- return;
- }
-
- if (maxLength && newTagText.length > maxLength) {
- console.warn("Tag is too long");
- return;
- }
-
- if (
- (allowDuplicates ||
- !tags.some((tag) => tag.text === newTagText)) &&
- (maxTags === undefined || tags.length < maxTags)
- ) {
- const newTagId = generateTagId();
- setTags([...tags, { id: newTagId, text: newTagText }]);
- onTagAdd?.(newTagText);
- setTagCount((prevTagCount) => prevTagCount + 1);
- setInputValue("");
- }
- }
-
- onBlur?.(event);
- };
-
- const handleKeyDown = (e: React.KeyboardEvent) => {
- if (
- delimiterList
- ? delimiterList.includes(e.key)
- : e.key === delimiter || e.key === Delimiter.Enter
- ) {
- e.preventDefault();
- const newTagText = inputValue.trim();
+ const newTagText = value.trim();
// Check if the tag is in the autocomplete options if restrictTagsToAutocomplete is true
if (
@@ -300,441 +200,307 @@ const TagInput = React.forwardRef(
(option) => option.text === newTagText
)
) {
- // error
+ console.warn(
+ "Tag not allowed as per autocomplete options"
+ );
return;
}
if (validateTag && !validateTag(newTagText)) {
+ console.warn("Invalid tag as per validateTag");
return;
}
if (minLength && newTagText.length < minLength) {
- console.warn("Tag is too short");
- // error
+ console.warn(`Tag "${newTagText}" is too short`);
return;
}
- // Validate maxLength
if (maxLength && newTagText.length > maxLength) {
- // error
- console.warn("Tag is too long");
+ console.warn(`Tag "${newTagText}" is too long`);
return;
}
const newTagId = generateTagId();
+ // Add tag if duplicates are allowed or tag does not already exist
if (
- newTagText &&
- (allowDuplicates ||
- !tags.some((tag) => tag.text === newTagText)) &&
- (maxTags === undefined || tags.length < maxTags)
+ allowDuplicates ||
+ !tags.some((tag) => tag.text === newTagText)
) {
- setTags([...tags, { id: newTagId, text: newTagText }]);
- onTagAdd?.(newTagText);
- setTagCount((prevTagCount) => prevTagCount + 1);
+ if (maxTags === undefined || tags.length < maxTags) {
+ // Check for maxTags limit
+ const newTag = { id: newTagId, text: newTagText };
+ setTags((prevTags) => [...prevTags, newTag]);
+ onTagAdd?.(newTagText);
+ } else {
+ console.warn(
+ "Reached the maximum number of tags allowed"
+ );
+ }
+ } else {
+ console.warn(`Duplicate tag "${newTagText}" not added`);
}
- setInputValue("");
- } else {
- switch (e.key) {
- case "Delete":
- if (activeTagIndex !== null) {
- e.preventDefault();
- const newTags = [...tags];
- newTags.splice(activeTagIndex, 1);
- setTags(newTags);
- setActiveTagIndex((prev) =>
- newTags.length === 0
- ? null
- : prev! >= newTags.length
- ? newTags.length - 1
- : prev
- );
- setTagCount((prevTagCount) => prevTagCount - 1);
- onTagRemove?.(tags[activeTagIndex].text);
- }
- break;
- case "Backspace":
- if (activeTagIndex !== null) {
- e.preventDefault();
- const newTags = [...tags];
- newTags.splice(activeTagIndex, 1);
- setTags(newTags);
- setActiveTagIndex((prev) =>
- prev! === 0 ? null : prev! - 1
- );
- setTagCount((prevTagCount) => prevTagCount - 1);
- onTagRemove?.(tags[activeTagIndex].text);
- }
- break;
- case "ArrowRight":
- e.preventDefault();
- if (activeTagIndex === null) {
- setActiveTagIndex(0);
- } else {
- setActiveTagIndex((prev) =>
- prev! + 1 >= tags.length ? 0 : prev! + 1
- );
- }
- break;
- case "ArrowLeft":
- e.preventDefault();
- if (activeTagIndex === null) {
- setActiveTagIndex(tags.length - 1);
- } else {
- setActiveTagIndex((prev) =>
- prev! === 0 ? tags.length - 1 : prev! - 1
- );
- }
- break;
- case "Home":
- e.preventDefault();
- setActiveTagIndex(0);
- break;
- case "End":
- e.preventDefault();
- setActiveTagIndex(tags.length - 1);
- break;
- }
- }
- };
-
- const removeTag = (idToRemove: string) => {
- setTags(tags.filter((tag) => tag.id !== idToRemove));
- onTagRemove?.(
- tags.find((tag) => tag.id === idToRemove)?.text || ""
- );
- setTagCount((prevTagCount) => prevTagCount - 1);
- };
-
- const onSortEnd = (oldIndex: number, newIndex: number) => {
- setTags((currentTags) => {
- const newTags = [...currentTags];
- const [removedTag] = newTags.splice(oldIndex, 1);
- newTags.splice(newIndex, 0, removedTag);
-
- return newTags;
});
- };
+ setInputValue("");
+ } else {
+ setInputValue(newValue);
+ }
+ onInputChange?.(newValue);
+ };
- const handleClearAll = () => {
- if (!onClearAll) {
- setActiveTagIndex(-1);
- setTags([]);
+ const handleInputFocus = (
+ event: React.FocusEvent
+ ) => {
+ setActiveTagIndex(null); // Reset active tag index when the input field gains focus
+ onFocus?.(event);
+ };
+
+ const handleInputBlur = (event: React.FocusEvent) => {
+ if (addTagsOnBlur && inputValue.trim()) {
+ const newTagText = inputValue.trim();
+
+ if (validateTag && !validateTag(newTagText)) {
return;
}
- onClearAll?.();
- };
- // const filteredAutocompleteOptions = autocompleteFilter
- // ? autocompleteOptions?.filter((option) => autocompleteFilter(option.text))
- // : autocompleteOptions;
- const filteredAutocompleteOptions = useMemo(() => {
- return (autocompleteOptions || []).filter((option) =>
- option.text
- .toLowerCase()
- .includes(inputValue ? inputValue.toLowerCase() : "")
- );
- }, [inputValue, autocompleteOptions]);
+ if (minLength && newTagText.length < minLength) {
+ console.warn("Tag is too short");
+ return;
+ }
- const displayedTags = sortTags ? [...tags].sort() : tags;
+ if (maxLength && newTagText.length > maxLength) {
+ console.warn("Tag is too long");
+ return;
+ }
- const truncatedTags = truncate
- ? tags.map((tag) => ({
- id: tag.id,
- text:
- tag.text?.length > truncate
- ? `${tag.text.substring(0, truncate)}...`
- : tag.text
- }))
- : displayedTags;
+ if (
+ (allowDuplicates ||
+ !tags.some((tag) => tag.text === newTagText)) &&
+ (maxTags === undefined || tags.length < maxTags)
+ ) {
+ const newTagId = generateTagId();
+ setTags([...tags, { id: newTagId, text: newTagText }]);
+ onTagAdd?.(newTagText);
+ setTagCount((prevTagCount) => prevTagCount + 1);
+ setInputValue("");
+ }
+ }
- return (
- 0 ? "gap-3" : ""} ${
- inputFieldPosition === "bottom"
- ? "flex-col"
- : inputFieldPosition === "top"
- ? "flex-col-reverse"
- : "flex-row"
- }`}
- >
- {!usePopoverForTags &&
- (!inlineTags ? (
-
- ) : (
- !enableAutocomplete && (
-
-
-
- = maxTags
- ? placeholderWhenFull
- : placeholder
- }
- value={inputValue}
- onChange={handleInputChange}
- onKeyDown={handleKeyDown}
- onFocus={handleInputFocus}
- onBlur={handleInputBlur}
- {...inputProps}
- className={cn(
- "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
- // className,
- styleClasses?.input
- )}
- autoComplete={
- enableAutocomplete ? "on" : "off"
- }
- list={
- enableAutocomplete
- ? "autocomplete-options"
- : undefined
- }
- disabled={
- disabled ||
- (maxTags !== undefined &&
- tags.length >= maxTags)
- }
- />
-
-
- )
- ))}
- {enableAutocomplete ? (
-
-
- {!usePopoverForTags ? (
- !inlineTags ? (
- // = maxTags ? placeholderWhenFull : placeholder}
- // ref={inputRef}
- // value={inputValue}
- // disabled={disabled || (maxTags !== undefined && tags.length >= maxTags)}
- // onChangeCapture={handleInputChange}
- // onKeyDown={handleKeyDown}
- // onFocus={handleInputFocus}
- // onBlur={handleInputBlur}
- // className={cn(
- // 'w-full',
- // // className,
- // styleClasses?.input,
- // )}
- // />
- = maxTags
- ? placeholderWhenFull
- : placeholder
- }
- value={inputValue}
- onChange={handleInputChange}
- onKeyDown={handleKeyDown}
- onFocus={handleInputFocus}
- onBlur={handleInputBlur}
- {...inputProps}
- className={cn(
- "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
- // className,
- styleClasses?.input
- )}
- autoComplete={
- enableAutocomplete ? "on" : "off"
- }
- list={
- enableAutocomplete
- ? "autocomplete-options"
- : undefined
- }
- disabled={
- disabled ||
- (maxTags !== undefined &&
- tags.length >= maxTags)
- }
- />
- ) : (
-
-
- {/* = maxTags ? placeholderWhenFull : placeholder}
- ref={inputRef}
- value={inputValue}
- disabled={disabled || (maxTags !== undefined && tags.length >= maxTags)}
- onChangeCapture={handleInputChange}
- onKeyDown={handleKeyDown}
- onFocus={handleInputFocus}
- onBlur={handleInputBlur}
- inlineTags={inlineTags}
- className={cn(
- 'border-0 flex-1 w-fit h-5',
- // className,
- styleClasses?.input,
- )}
- /> */}
- = maxTags
- ? placeholderWhenFull
- : placeholder
- }
- value={inputValue}
- onChange={handleInputChange}
- onKeyDown={handleKeyDown}
- onFocus={handleInputFocus}
- onBlur={handleInputBlur}
- {...inputProps}
- className={cn(
- "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
- // className,
- styleClasses?.input
- )}
- autoComplete={
- enableAutocomplete
- ? "on"
- : "off"
- }
- list={
- enableAutocomplete
- ? "autocomplete-options"
- : undefined
- }
- disabled={
- disabled ||
- (maxTags !== undefined &&
- tags.length >= maxTags)
- }
- />
-
- )
- ) : (
- ) => {
+ if (
+ delimiterList
+ ? delimiterList.includes(e.key)
+ : e.key === delimiter || e.key === Delimiter.Enter
+ ) {
+ e.preventDefault();
+ const newTagText = inputValue.trim();
+
+ // Check if the tag is in the autocomplete options if restrictTagsToAutocomplete is true
+ if (
+ restrictTagsToAutocompleteOptions &&
+ !autocompleteOptions?.some(
+ (option) => option.text === newTagText
+ )
+ ) {
+ // error
+ return;
+ }
+
+ if (validateTag && !validateTag(newTagText)) {
+ return;
+ }
+
+ if (minLength && newTagText.length < minLength) {
+ console.warn("Tag is too short");
+ // error
+ return;
+ }
+
+ // Validate maxLength
+ if (maxLength && newTagText.length > maxLength) {
+ // error
+ console.warn("Tag is too long");
+ return;
+ }
+
+ const newTagId = generateTagId();
+
+ if (
+ newTagText &&
+ (allowDuplicates ||
+ !tags.some((tag) => tag.text === newTagText)) &&
+ (maxTags === undefined || tags.length < maxTags)
+ ) {
+ setTags([...tags, { id: newTagId, text: newTagText }]);
+ onTagAdd?.(newTagText);
+ setTagCount((prevTagCount) => prevTagCount + 1);
+ }
+ setInputValue("");
+ } else {
+ switch (e.key) {
+ case "Delete":
+ if (activeTagIndex !== null) {
+ e.preventDefault();
+ const newTags = [...tags];
+ newTags.splice(activeTagIndex, 1);
+ setTags(newTags);
+ setActiveTagIndex((prev) =>
+ newTags.length === 0
+ ? null
+ : prev! >= newTags.length
+ ? newTags.length - 1
+ : prev
+ );
+ setTagCount((prevTagCount) => prevTagCount - 1);
+ onTagRemove?.(tags[activeTagIndex].text);
+ }
+ break;
+ case "Backspace":
+ if (activeTagIndex !== null) {
+ e.preventDefault();
+ const newTags = [...tags];
+ newTags.splice(activeTagIndex, 1);
+ setTags(newTags);
+ setActiveTagIndex((prev) =>
+ prev! === 0 ? null : prev! - 1
+ );
+ setTagCount((prevTagCount) => prevTagCount - 1);
+ onTagRemove?.(tags[activeTagIndex].text);
+ }
+ break;
+ case "ArrowRight":
+ e.preventDefault();
+ if (activeTagIndex === null) {
+ setActiveTagIndex(0);
+ } else {
+ setActiveTagIndex((prev) =>
+ prev! + 1 >= tags.length ? 0 : prev! + 1
+ );
+ }
+ break;
+ case "ArrowLeft":
+ e.preventDefault();
+ if (activeTagIndex === null) {
+ setActiveTagIndex(tags.length - 1);
+ } else {
+ setActiveTagIndex((prev) =>
+ prev! === 0 ? tags.length - 1 : prev! - 1
+ );
+ }
+ break;
+ case "Home":
+ e.preventDefault();
+ setActiveTagIndex(0);
+ break;
+ case "End":
+ e.preventDefault();
+ setActiveTagIndex(tags.length - 1);
+ break;
+ }
+ }
+ };
+
+ const removeTag = (idToRemove: string) => {
+ setTags(tags.filter((tag) => tag.id !== idToRemove));
+ onTagRemove?.(
+ tags.find((tag) => tag.id === idToRemove)?.text || ""
+ );
+ setTagCount((prevTagCount) => prevTagCount - 1);
+ };
+
+ const onSortEnd = (oldIndex: number, newIndex: number) => {
+ setTags((currentTags) => {
+ const newTags = [...currentTags];
+ const [removedTag] = newTags.splice(oldIndex, 1);
+ newTags.splice(newIndex, 0, removedTag);
+
+ return newTags;
+ });
+ };
+
+ const handleClearAll = () => {
+ if (!onClearAll) {
+ setActiveTagIndex(-1);
+ setTags([]);
+ return;
+ }
+ onClearAll?.();
+ };
+
+ // const filteredAutocompleteOptions = autocompleteFilter
+ // ? autocompleteOptions?.filter((option) => autocompleteFilter(option.text))
+ // : autocompleteOptions;
+ const filteredAutocompleteOptions = useMemo(() => {
+ return (autocompleteOptions || []).filter((option) =>
+ option.text
+ .toLowerCase()
+ .includes(inputValue ? inputValue.toLowerCase() : "")
+ );
+ }, [inputValue, autocompleteOptions]);
+
+ const displayedTags = sortTags ? [...tags].sort() : tags;
+
+ const truncatedTags = truncate
+ ? tags.map((tag) => ({
+ id: tag.id,
+ text:
+ tag.text?.length > truncate
+ ? `${tag.text.substring(0, truncate)}...`
+ : tag.text
+ }))
+ : displayedTags;
+
+ return (
+ ( 0 ? "gap-3" : ""} ${
+ inputFieldPosition === "bottom"
+ ? "flex-col"
+ : inputFieldPosition === "top"
+ ? "flex-col-reverse"
+ : "flex-row"
+ }`}
+ >
+ {!usePopoverForTags &&
+ (!inlineTags ? (
+
+ ) : (
+ !enableAutocomplete && (
+
+
+ (
onSortEnd={onSortEnd}
onRemoveTag={removeTag}
direction={direction}
+ inlineTags={inlineTags}
activeTagIndex={activeTagIndex}
setActiveTagIndex={setActiveTagIndex}
classStyleProps={{
- popoverClasses:
- styleClasses?.tagPopover,
- tagListClasses: styleClasses?.tagList,
+ tagListClasses:
+ styleClasses?.tagList,
tagClasses: styleClasses?.tag
}}
disabled={disabled}
- >
- {/* = maxTags ? placeholderWhenFull : placeholder}
- ref={inputRef}
- value={inputValue}
- disabled={disabled || (maxTags !== undefined && tags.length >= maxTags)}
- onChangeCapture={handleInputChange}
- onKeyDown={handleKeyDown}
- onFocus={handleInputFocus}
- onBlur={handleInputBlur}
- className={cn(
- 'w-full',
- // className,
- styleClasses?.input,
- )}
- /> */}
- = maxTags
- ? placeholderWhenFull
- : placeholder
- }
- value={inputValue}
- onChange={handleInputChange}
- onKeyDown={handleKeyDown}
- onFocus={handleInputFocus}
- onBlur={handleInputBlur}
- {...inputProps}
- className={cn(
- "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
- // className,
- styleClasses?.input
- )}
- autoComplete={
- enableAutocomplete ? "on" : "off"
- }
- list={
- enableAutocomplete
- ? "autocomplete-options"
- : undefined
- }
- disabled={
- disabled ||
- (maxTags !== undefined &&
- tags.length >= maxTags)
- }
- />
-
- )}
-
-
- ) : (
-
- {!usePopoverForTags ? (
- !inlineTags ? (
+ />
(
onBlur={handleInputBlur}
{...inputProps}
className={cn(
+ "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
+ // className,
styleClasses?.input
- // className
)}
autoComplete={
enableAutocomplete ? "on" : "off"
@@ -852,7 +561,184 @@ const TagInput = React.forwardRef(
tags.length >= maxTags)
}
/>
- ) : null
+
+
+ )
+ ))}
+ {enableAutocomplete ? (
+
+
+ {!usePopoverForTags ? (
+ !inlineTags ? (
+ // = maxTags ? placeholderWhenFull : placeholder}
+ // ref={inputRef}
+ // value={inputValue}
+ // disabled={disabled || (maxTags !== undefined && tags.length >= maxTags)}
+ // onChangeCapture={handleInputChange}
+ // onKeyDown={handleKeyDown}
+ // onFocus={handleInputFocus}
+ // onBlur={handleInputBlur}
+ // className={cn(
+ // 'w-full',
+ // // className,
+ // styleClasses?.input,
+ // )}
+ // />
+ (= maxTags
+ ? placeholderWhenFull
+ : placeholder
+ }
+ value={inputValue}
+ onChange={handleInputChange}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
+ onBlur={handleInputBlur}
+ {...inputProps}
+ className={cn(
+ "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
+ // className,
+ styleClasses?.input
+ )}
+ autoComplete={
+ enableAutocomplete ? "on" : "off"
+ }
+ list={
+ enableAutocomplete
+ ? "autocomplete-options"
+ : undefined
+ }
+ disabled={
+ disabled ||
+ (maxTags !== undefined &&
+ tags.length >= maxTags)
+ }
+ />)
+ ) : (
+
+
+ {/* = maxTags ? placeholderWhenFull : placeholder}
+ ref={inputRef}
+ value={inputValue}
+ disabled={disabled || (maxTags !== undefined && tags.length >= maxTags)}
+ onChangeCapture={handleInputChange}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
+ onBlur={handleInputBlur}
+ inlineTags={inlineTags}
+ className={cn(
+ 'border-0 flex-1 w-fit h-5',
+ // className,
+ styleClasses?.input,
+ )}
+ /> */}
+ = maxTags
+ ? placeholderWhenFull
+ : placeholder
+ }
+ value={inputValue}
+ onChange={handleInputChange}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
+ onBlur={handleInputBlur}
+ {...inputProps}
+ className={cn(
+ "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
+ // className,
+ styleClasses?.input
+ )}
+ autoComplete={
+ enableAutocomplete
+ ? "on"
+ : "off"
+ }
+ list={
+ enableAutocomplete
+ ? "autocomplete-options"
+ : undefined
+ }
+ disabled={
+ disabled ||
+ (maxTags !== undefined &&
+ tags.length >= maxTags)
+ }
+ />
+
+ )
) : (
(
activeTagIndex={activeTagIndex}
setActiveTagIndex={setActiveTagIndex}
classStyleProps={{
- popoverClasses: styleClasses?.tagPopover,
+ popoverClasses:
+ styleClasses?.tagPopover,
tagListClasses: styleClasses?.tagList,
tagClasses: styleClasses?.tag
}}
disabled={disabled}
>
+ {/* = maxTags ? placeholderWhenFull : placeholder}
+ ref={inputRef}
+ value={inputValue}
+ disabled={disabled || (maxTags !== undefined && tags.length >= maxTags)}
+ onChangeCapture={handleInputChange}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
+ onBlur={handleInputBlur}
+ className={cn(
+ 'w-full',
+ // className,
+ styleClasses?.input,
+ )}
+ /> */}
(
onFocus={handleInputFocus}
onBlur={handleInputBlur}
{...inputProps}
+ className={cn(
+ "border-0 h-5 bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 flex-1 w-fit",
+ // className,
+ styleClasses?.input
+ )}
autoComplete={
enableAutocomplete ? "on" : "off"
}
@@ -908,37 +815,134 @@ const TagInput = React.forwardRef(
(maxTags !== undefined &&
tags.length >= maxTags)
}
- className={cn(
- "border-0 w-full",
- styleClasses?.input
- // className
- )}
/>
)}
-
- )}
-
- {showCount && maxTags && (
-
-
- {`${tagCount}`}/{`${maxTags}`}
-
-
- )}
- {clearAll && (
-
- )}
-
- );
- }
-);
+
+
+ ) : (
+
+ {!usePopoverForTags ? (
+ !inlineTags ? (
+ = maxTags
+ ? placeholderWhenFull
+ : placeholder
+ }
+ value={inputValue}
+ onChange={handleInputChange}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
+ onBlur={handleInputBlur}
+ {...inputProps}
+ className={cn(
+ styleClasses?.input
+ // className
+ )}
+ autoComplete={
+ enableAutocomplete ? "on" : "off"
+ }
+ list={
+ enableAutocomplete
+ ? "autocomplete-options"
+ : undefined
+ }
+ disabled={
+ disabled ||
+ (maxTags !== undefined &&
+ tags.length >= maxTags)
+ }
+ />
+ ) : null
+ ) : (
+
+ = maxTags
+ ? placeholderWhenFull
+ : placeholder
+ }
+ value={inputValue}
+ onChange={handleInputChange}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
+ onBlur={handleInputBlur}
+ {...inputProps}
+ autoComplete={
+ enableAutocomplete ? "on" : "off"
+ }
+ list={
+ enableAutocomplete
+ ? "autocomplete-options"
+ : undefined
+ }
+ disabled={
+ disabled ||
+ (maxTags !== undefined &&
+ tags.length >= maxTags)
+ }
+ className={cn(
+ "border-0 w-full",
+ styleClasses?.input
+ // className
+ )}
+ />
+
+ )}
+
+ )}
+ {showCount && maxTags && (
+
+
+ {`${tagCount}`}/{`${maxTags}`}
+
+
+ )}
+ {clearAll && (
+
+ )}
+
)
+ );
+};
TagInput.displayName = "TagInput";
diff --git a/src/components/ui/alert.tsx b/src/components/ui/alert.tsx
index 8d07ca3e..2e167650 100644
--- a/src/components/ui/alert.tsx
+++ b/src/components/ui/alert.tsx
@@ -22,44 +22,52 @@ const alertVariants = cva(
},
);
-const Alert = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes & VariantProps
->(({ className, variant, ...props }, ref) => (
-
-));
+const Alert = (
+ {
+ ref,
+ className,
+ variant,
+ ...props
+ }
+) => ();
Alert.displayName = "Alert";
-const AlertTitle = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const AlertTitle = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
AlertTitle.displayName = "AlertTitle";
-const AlertDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const AlertDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
AlertDescription.displayName = "AlertDescription";
export { Alert, AlertTitle, AlertDescription };
diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx
index ef6e4355..b02832a5 100644
--- a/src/components/ui/avatar.tsx
+++ b/src/components/ui/avatar.tsx
@@ -5,46 +5,55 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar"
import { cn } from "@app/lib/cn"
-const Avatar = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const Avatar = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
Avatar.displayName = AvatarPrimitive.Root.displayName
-const AvatarImage = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const AvatarImage = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
AvatarImage.displayName = AvatarPrimitive.Image.displayName
-const AvatarFallback = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const AvatarFallback = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
export { Avatar, AvatarImage, AvatarFallback }
diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx
index dd40aa55..464475f8 100644
--- a/src/components/ui/breadcrumb.tsx
+++ b/src/components/ui/breadcrumb.tsx
@@ -4,47 +4,55 @@ import { ChevronRight, MoreHorizontal } from "lucide-react"
import { cn } from "@app/lib/cn"
-const Breadcrumb = React.forwardRef<
- HTMLElement,
- React.ComponentPropsWithoutRef<"nav"> & {
- separator?: React.ReactNode
+const Breadcrumb = (
+ {
+ ref,
+ ...props
}
->(({ ...props }, ref) => )
+) =>
Breadcrumb.displayName = "Breadcrumb"
-const BreadcrumbList = React.forwardRef<
- HTMLOListElement,
- React.ComponentPropsWithoutRef<"ol">
->(({ className, ...props }, ref) => (
-
-))
+const BreadcrumbList = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef<"ol"> & {
+ ref: React.RefObject;
+ }
+) => (
)
BreadcrumbList.displayName = "BreadcrumbList"
-const BreadcrumbItem = React.forwardRef<
- HTMLLIElement,
- React.ComponentPropsWithoutRef<"li">
->(({ className, ...props }, ref) => (
-
-))
+const BreadcrumbItem = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef<"li"> & {
+ ref: React.RefObject;
+ }
+) => ()
BreadcrumbItem.displayName = "BreadcrumbItem"
-const BreadcrumbLink = React.forwardRef<
- HTMLAnchorElement,
- React.ComponentPropsWithoutRef<"a"> & {
- asChild?: boolean
+const BreadcrumbLink = (
+ {
+ ref,
+ asChild,
+ className,
+ ...props
}
->(({ asChild, className, ...props }, ref) => {
+) => {
const Comp = asChild ? Slot : "a"
return (
@@ -54,22 +62,25 @@ const BreadcrumbLink = React.forwardRef<
{...props}
/>
)
-})
+}
BreadcrumbLink.displayName = "BreadcrumbLink"
-const BreadcrumbPage = React.forwardRef<
- HTMLSpanElement,
- React.ComponentPropsWithoutRef<"span">
->(({ className, ...props }, ref) => (
-
-))
+const BreadcrumbPage = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef<"span"> & {
+ ref: React.RefObject;
+ }
+) => ()
BreadcrumbPage.displayName = "BreadcrumbPage"
const BreadcrumbSeparator = ({
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index 5698c53a..a96b7c83 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -51,32 +51,32 @@ export interface ButtonProps
loading?: boolean; // Add loading prop
}
-const Button = React.forwardRef(
- (
- {
- className,
- variant,
- size,
- asChild = false,
- loading = false,
- ...props
- },
- ref
- ) => {
- const Comp = asChild ? Slot : "button";
- return (
-
- {loading && }
- {props.children}
-
- );
+const Button = (
+ {
+ ref,
+ className,
+ variant,
+ size,
+ asChild = false,
+ loading = false,
+ ...props
+ }: ButtonProps & {
+ ref: React.RefObject;
}
-);
+) => {
+ const Comp = asChild ? Slot : "button";
+ return (
+
+ {loading && }
+ {props.children}
+
+ );
+};
Button.displayName = "Button";
export { Button, buttonVariants };
diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx
index e5f16047..0ac7d134 100644
--- a/src/components/ui/card.tsx
+++ b/src/components/ui/card.tsx
@@ -2,78 +2,96 @@ import * as React from "react";
import { cn } from "@app/lib/cn";
-const Card = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const Card = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
Card.displayName = "Card";
-const CardHeader = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const CardHeader = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
CardHeader.displayName = "CardHeader";
-const CardTitle = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const CardTitle = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
CardTitle.displayName = "CardTitle";
-const CardDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const CardDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
CardDescription.displayName = "CardDescription";
-const CardContent = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const CardContent = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
CardContent.displayName = "CardContent";
-const CardFooter = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-));
+const CardFooter = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ();
CardFooter.displayName = "CardFooter";
export {
diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx
index 0343250c..083c19d7 100644
--- a/src/components/ui/checkbox.tsx
+++ b/src/components/ui/checkbox.tsx
@@ -33,20 +33,24 @@ interface CheckboxProps
extends React.ComponentPropsWithoutRef,
VariantProps {}
-const Checkbox = React.forwardRef<
- React.ElementRef,
- CheckboxProps
->(({ className, variant, ...props }, ref) => (
-
-
-
-
-
-));
+const Checkbox = (
+ {
+ ref,
+ className,
+ variant,
+ ...props
+ }: CheckboxProps & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
+
+);
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
interface CheckboxWithLabelProps
@@ -54,10 +58,17 @@ interface CheckboxWithLabelProps
label: string;
}
-const CheckboxWithLabel = React.forwardRef<
- React.ElementRef,
- CheckboxWithLabelProps
->(({ className, label, id, ...props }, ref) => {
+const CheckboxWithLabel = (
+ {
+ ref,
+ className,
+ label,
+ id,
+ ...props
+ }: CheckboxWithLabelProps & {
+ ref: React.RefObject>;
+ }
+) => {
return (
@@ -69,7 +80,7 @@ const CheckboxWithLabel = React.forwardRef<
);
-});
+};
CheckboxWithLabel.displayName = "CheckboxWithLabel";
export { Checkbox, CheckboxWithLabel };
diff --git a/src/components/ui/command.tsx b/src/components/ui/command.tsx
index 105ff32f..99c90409 100644
--- a/src/components/ui/command.tsx
+++ b/src/components/ui/command.tsx
@@ -8,19 +8,22 @@ import { Search } from "lucide-react"
import { cn } from "@app/lib/cn"
import { Dialog, DialogContent } from "@/components/ui/dialog"
-const Command = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const Command = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
Command.displayName = CommandPrimitive.displayName
interface CommandDialogProps extends DialogProps {}
@@ -37,92 +40,109 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
)
}
-const CommandInput = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-
-
-
-))
-
-CommandInput.displayName = CommandPrimitive.Input.displayName
-
-const CommandList = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
-
-CommandList.displayName = CommandPrimitive.List.displayName
-
-const CommandEmpty = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->((props, ref) => (
-
-))
-
-CommandEmpty.displayName = CommandPrimitive.Empty.displayName
-
-const CommandGroup = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
- & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
-))
+
)
+
+CommandInput.displayName = CommandPrimitive.Input.displayName
+
+const CommandList = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
+
+CommandList.displayName = CommandPrimitive.List.displayName
+
+const CommandEmpty = (
+ {
+ ref,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
+
+CommandEmpty.displayName = CommandPrimitive.Empty.displayName
+
+const CommandGroup = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
CommandGroup.displayName = CommandPrimitive.Group.displayName
-const CommandSeparator = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const CommandSeparator = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
-const CommandItem = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const CommandItem = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
CommandItem.displayName = CommandPrimitive.Item.displayName
diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx
index 75443e18..2bfbd320 100644
--- a/src/components/ui/dialog.tsx
+++ b/src/components/ui/dialog.tsx
@@ -14,43 +14,50 @@ const DialogPortal = DialogPrimitive.Portal;
const DialogClose = DialogPrimitive.Close;
-const DialogOverlay = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
- & {
+ ref: React.RefObject>;
+ }
+) => ();
+DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
+
+const DialogContent = (
+ {
+ ref,
+ className,
+ children,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
-));
-DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
-
-const DialogContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, ...props }, ref) => (
-
-
-
- {children}
-
-
- Close
-
-
-
-));
+ >
+ {children}
+
+
+ Close
+
+
+);
DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({
@@ -81,31 +88,37 @@ const DialogFooter = ({
);
DialogFooter.displayName = "DialogFooter";
-const DialogTitle = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-));
+const DialogTitle = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ();
DialogTitle.displayName = DialogPrimitive.Title.displayName;
-const DialogDescription = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-));
+const DialogDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ();
DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
diff --git a/src/components/ui/drawer.tsx b/src/components/ui/drawer.tsx
index d0500060..f05d0fb7 100644
--- a/src/components/ui/drawer.tsx
+++ b/src/components/ui/drawer.tsx
@@ -22,37 +22,44 @@ const DrawerPortal = DrawerPrimitive.Portal;
const DrawerClose = DrawerPrimitive.Close;
-const DrawerOverlay = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-));
+const DrawerOverlay = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ();
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
-const DrawerContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, ...props }, ref) => (
-
-
-
-
- {children}
-
-
-));
+const DrawerContent = (
+ {
+ ref,
+ className,
+ children,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
+
+ {children}
+
+);
DrawerContent.displayName = "DrawerContent";
const DrawerHeader = ({
@@ -77,31 +84,37 @@ const DrawerFooter = ({
);
DrawerFooter.displayName = "DrawerFooter";
-const DrawerTitle = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-));
+const DrawerTitle = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ();
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
-const DrawerDescription = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-));
+const DrawerDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ();
DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
export {
diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx
index 50e8dba7..c8fc081d 100644
--- a/src/components/ui/dropdown-menu.tsx
+++ b/src/components/ui/dropdown-menu.tsx
@@ -18,154 +18,174 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
-const DropdownMenuSubTrigger = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef & {
- inset?: boolean
+const DropdownMenuSubTrigger = (
+ {
+ ref,
+ className,
+ inset,
+ children,
+ ...props
}
->(({ className, inset, children, ...props }, ref) => (
-
- {children}
-
-
-))
+) => (
+ {children}
+
+)
DropdownMenuSubTrigger.displayName =
DropdownMenuPrimitive.SubTrigger.displayName
-const DropdownMenuSubContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const DropdownMenuSubContent = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
DropdownMenuSubContent.displayName =
DropdownMenuPrimitive.SubContent.displayName
-const DropdownMenuContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, sideOffset = 4, ...props }, ref) => (
-
-
-
-))
-DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
-
-const DropdownMenuItem = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef & {
- inset?: boolean
+const DropdownMenuContent = (
+ {
+ ref,
+ className,
+ sideOffset = 4,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
}
->(({ className, inset, ...props }, ref) => (
- (
+
-))
+)
+DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
+
+const DropdownMenuItem = (
+ {
+ ref,
+ className,
+ inset,
+ ...props
+ }
+) => ()
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
-const DropdownMenuCheckboxItem = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, checked, ...props }, ref) => (
-
-
-
-
-
-
- {children}
-
-))
+const DropdownMenuCheckboxItem = (
+ {
+ ref,
+ className,
+ children,
+ checked,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
+
+
+
+ {children}
+)
DropdownMenuCheckboxItem.displayName =
DropdownMenuPrimitive.CheckboxItem.displayName
-const DropdownMenuRadioItem = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, ...props }, ref) => (
-
-
-
-
-
-
- {children}
-
-))
+const DropdownMenuRadioItem = (
+ {
+ ref,
+ className,
+ children,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
+
+
+
+ {children}
+)
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
-const DropdownMenuLabel = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef & {
- inset?: boolean
+const DropdownMenuLabel = (
+ {
+ ref,
+ className,
+ inset,
+ ...props
}
->(({ className, inset, ...props }, ref) => (
-
-))
+) => ()
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
-const DropdownMenuSeparator = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const DropdownMenuSeparator = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
const DropdownMenuShortcut = ({
diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx
index 61796efd..ba754e49 100644
--- a/src/components/ui/form.tsx
+++ b/src/components/ui/form.tsx
@@ -72,10 +72,15 @@ const FormItemContext = React.createContext(
{} as FormItemContextValue
)
-const FormItem = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => {
+const FormItem = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => {
const id = React.useId()
return (
@@ -83,13 +88,18 @@ const FormItem = React.forwardRef<
)
-})
+}
FormItem.displayName = "FormItem"
-const FormLabel = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => {
+const FormLabel = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => {
const { error, formItemId } = useFormField()
return (
@@ -100,13 +110,17 @@ const FormLabel = React.forwardRef<
{...props}
/>
)
-})
+}
FormLabel.displayName = "FormLabel"
-const FormControl = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ ...props }, ref) => {
+const FormControl = (
+ {
+ ref,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
return (
@@ -122,13 +136,18 @@ const FormControl = React.forwardRef<
{...props}
/>
)
-})
+}
FormControl.displayName = "FormControl"
-const FormDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => {
+const FormDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => {
const { formDescriptionId } = useFormField()
return (
@@ -139,13 +158,19 @@ const FormDescription = React.forwardRef<
{...props}
/>
)
-})
+}
FormDescription.displayName = "FormDescription"
-const FormMessage = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, children, ...props }, ref) => {
+const FormMessage = (
+ {
+ ref,
+ className,
+ children,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => {
const { error, formMessageId } = useFormField()
const body = error ? String(error?.message) : children
@@ -163,7 +188,7 @@ const FormMessage = React.forwardRef<
{body}
)
-})
+}
FormMessage.displayName = "FormMessage"
export {
diff --git a/src/components/ui/input-otp.tsx b/src/components/ui/input-otp.tsx
index 79e763b1..6fe57b94 100644
--- a/src/components/ui/input-otp.tsx
+++ b/src/components/ui/input-otp.tsx
@@ -6,34 +6,45 @@ import { Dot } from "lucide-react"
import { cn } from "@app/lib/cn"
-const InputOTP = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, containerClassName, ...props }, ref) => (
-
-))
+const InputOTP = (
+ {
+ ref,
+ className,
+ containerClassName,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
InputOTP.displayName = "InputOTP"
-const InputOTPGroup = React.forwardRef<
- React.ElementRef<"div">,
- React.ComponentPropsWithoutRef<"div">
->(({ className, ...props }, ref) => (
-
-))
+const InputOTPGroup = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef<"div"> & {
+ ref: React.RefObject>;
+ }
+) => ()
InputOTPGroup.displayName = "InputOTPGroup"
-const InputOTPSlot = React.forwardRef<
- React.ElementRef<"div">,
- React.ComponentPropsWithoutRef<"div"> & { index: number }
->(({ index, className, ...props }, ref) => {
+const InputOTPSlot = (
+ {
+ ref,
+ index,
+ className,
+ ...props
+ }
+) => {
const inputOTPContext = React.useContext(OTPInputContext)
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
@@ -55,17 +66,19 @@ const InputOTPSlot = React.forwardRef<
)}
)
-})
+}
InputOTPSlot.displayName = "InputOTPSlot"
-const InputOTPSeparator = React.forwardRef<
- React.ElementRef<"div">,
- React.ComponentPropsWithoutRef<"div">
->(({ ...props }, ref) => (
-
-
-
-))
+const InputOTPSeparator = (
+ {
+ ref,
+ ...props
+ }: React.ComponentPropsWithoutRef<"div"> & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
)
InputOTPSeparator.displayName = "InputOTPSeparator"
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx
index 036c9f68..30e22e07 100644
--- a/src/components/ui/input.tsx
+++ b/src/components/ui/input.tsx
@@ -5,39 +5,23 @@ import { EyeOff, Eye } from "lucide-react";
export type InputProps = React.InputHTMLAttributes;
-const Input = React.forwardRef(
- ({ className, type, ...props }, ref) => {
- const [showPassword, setShowPassword] = React.useState(false);
- const togglePasswordVisibility = () => setShowPassword(!showPassword);
+const Input = (
+ {
+ ref,
+ className,
+ type,
+ ...props
+ }: InputProps & {
+ ref: React.RefObject;
+ }
+) => {
+ const [showPassword, setShowPassword] = React.useState(false);
+ const togglePasswordVisibility = () => setShowPassword(!showPassword);
- return type === "password" ? (
-
-
-
- {showPassword ? (
-
- ) : (
-
- )}
-
-
- ) : (
+ return type === "password" ? (
+
(
ref={ref}
{...props}
/>
- );
- }
-);
+
+ {showPassword ? (
+
+ ) : (
+
+ )}
+
+
+ ) : (
+
+ );
+};
Input.displayName = "Input";
export { Input };
diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsx
index 0c85b64d..a306d06c 100644
--- a/src/components/ui/label.tsx
+++ b/src/components/ui/label.tsx
@@ -10,17 +10,17 @@ const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
)
-const Label = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef &
- VariantProps
->(({ className, ...props }, ref) => (
-
-))
+const Label = (
+ {
+ ref,
+ className,
+ ...props
+ }
+) => ()
Label.displayName = LabelPrimitive.Root.displayName
export { Label }
diff --git a/src/components/ui/popover.tsx b/src/components/ui/popover.tsx
index 82cd9fd9..7fd84c3f 100644
--- a/src/components/ui/popover.tsx
+++ b/src/components/ui/popover.tsx
@@ -7,34 +7,42 @@ import { cn } from "@app/lib/cn"
const Popover = PopoverPrimitive.Root
-const PopoverTrigger = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const PopoverTrigger = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
-const PopoverContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
-
-
-
-))
+const PopoverContent = (
+ {
+ ref,
+ className,
+ align = "center",
+ sideOffset = 4,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+)
PopoverContent.displayName = PopoverPrimitive.Content.displayName
export { Popover, PopoverTrigger, PopoverContent }
diff --git a/src/components/ui/radio-group.tsx b/src/components/ui/radio-group.tsx
index c70aa7cc..e3a8de7a 100644
--- a/src/components/ui/radio-group.tsx
+++ b/src/components/ui/radio-group.tsx
@@ -6,10 +6,15 @@ import { Circle } from "lucide-react"
import { cn } from "@app/lib/cn"
-const RadioGroup = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => {
+const RadioGroup = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => {
return (
)
-})
+}
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
-const RadioGroupItem = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => {
+const RadioGroupItem = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => {
return (
)
-})
+}
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
export { RadioGroup, RadioGroupItem }
diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx
index 2edc4102..23b98153 100644
--- a/src/components/ui/select.tsx
+++ b/src/components/ui/select.tsx
@@ -12,139 +12,163 @@ const SelectGroup = SelectPrimitive.Group
const SelectValue = SelectPrimitive.Value
-const SelectTrigger = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, ...props }, ref) => (
- span]:line-clamp-1",
- "rounded-md",
- className
- )}
- {...props}
- >
- {children}
-
-
-
-
-))
+const SelectTrigger = (
+ {
+ ref,
+ className,
+ children,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (span]:line-clamp-1",
+ "rounded-md",
+ className
+ )}
+ {...props}
+>
+ {children}
+
+
+
+)
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
-const SelectScrollUpButton = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-
-
-))
+const SelectScrollUpButton = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+)
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
-const SelectScrollDownButton = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-
-
-))
+const SelectScrollDownButton = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+)
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName
-const SelectContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, position = "popper", ...props }, ref) => (
-
-
-
-
- {children}
-
-
-
-
-))
-SelectContent.displayName = SelectPrimitive.Content.displayName
-
-const SelectLabel = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
-SelectLabel.displayName = SelectPrimitive.Label.displayName
-
-const SelectItem = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, ...props }, ref) => (
- & {
+ ref: React.RefObject>;
+ }
+) => (
+
-
-
-
-
-
+
+
+ {children}
+
+
+
+)
+SelectContent.displayName = SelectPrimitive.Content.displayName
- {children}
-
-))
+const SelectLabel = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
+SelectLabel.displayName = SelectPrimitive.Label.displayName
+
+const SelectItem = (
+ {
+ ref,
+ className,
+ children,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
+
+
+
+ {children}
+)
SelectItem.displayName = SelectPrimitive.Item.displayName
-const SelectSeparator = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const SelectSeparator = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
export {
diff --git a/src/components/ui/separator.tsx b/src/components/ui/separator.tsx
index c59cac0d..bd8183ee 100644
--- a/src/components/ui/separator.tsx
+++ b/src/components/ui/separator.tsx
@@ -5,27 +5,27 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator"
import { cn } from "@app/lib/cn"
-const Separator = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(
- (
- { className, orientation = "horizontal", decorative = true, ...props },
- ref
- ) => (
-
- )
-)
+const Separator = (
+ {
+ ref,
+ className,
+ orientation = "horizontal",
+ decorative = true,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
Separator.displayName = SeparatorPrimitive.Root.displayName
export { Separator }
diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx
index f93f45db..b87baec6 100644
--- a/src/components/ui/sheet.tsx
+++ b/src/components/ui/sheet.tsx
@@ -15,19 +15,22 @@ const SheetClose = SheetPrimitive.Close
const SheetPortal = SheetPrimitive.Portal
-const SheetOverlay = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const SheetOverlay = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
const sheetVariants = cva(
@@ -53,25 +56,30 @@ interface SheetContentProps
extends React.ComponentPropsWithoutRef,
VariantProps {}
-const SheetContent = React.forwardRef<
- React.ElementRef,
- SheetContentProps
->(({ side = "right", className, children, ...props }, ref) => (
-
-
-
- {children}
- {/* */}
- {/* */}
- {/* Close */}
- {/* */}
-
-
-))
+const SheetContent = (
+ {
+ ref,
+ side = "right",
+ className,
+ children,
+ ...props
+ }: SheetContentProps & {
+ ref: React.RefObject>;
+ }
+) => (
+
+
+ {children}
+ {/* */}
+ {/* */}
+ {/* Close */}
+ {/* */}
+
+)
SheetContent.displayName = SheetPrimitive.Content.displayName
const SheetHeader = ({
@@ -102,28 +110,34 @@ const SheetFooter = ({
)
SheetFooter.displayName = "SheetFooter"
-const SheetTitle = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const SheetTitle = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
SheetTitle.displayName = SheetPrimitive.Title.displayName
-const SheetDescription = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const SheetDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
SheetDescription.displayName = SheetPrimitive.Description.displayName
export {
diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx
index 0817d46e..5dfd6548 100644
--- a/src/components/ui/switch.tsx
+++ b/src/components/ui/switch.tsx
@@ -5,25 +5,28 @@ import * as SwitchPrimitives from "@radix-ui/react-switch"
import { cn } from "@app/lib/cn"
-const Switch = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
- & {
+ ref: React.RefObject>;
+ }
+) => (
+
-
-
-))
+ />
+)
Switch.displayName = SwitchPrimitives.Root.displayName
export { Switch }
diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx
index 6bf7e785..fad6b864 100644
--- a/src/components/ui/table.tsx
+++ b/src/components/ui/table.tsx
@@ -6,107 +6,131 @@ export function TableContainer({ children }: { children: React.ReactNode }) {
return {children}
}
-const Table = React.forwardRef<
- HTMLTableElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
+const Table = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ()
Table.displayName = "Table"
-const TableHeader = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
+const TableHeader = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ()
TableHeader.displayName = "TableHeader"
-const TableBody = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
+const TableBody = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ()
TableBody.displayName = "TableBody"
-const TableFooter = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
- tr]:border-b-0",
- className
- )}
- {...props}
- />
-))
+const TableFooter = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => (tr]:border-b-0",
+ className
+ )}
+ {...props}
+/>)
TableFooter.displayName = "TableFooter"
-const TableRow = React.forwardRef<
- HTMLTableRowElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
+const TableRow = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => (
)
TableRow.displayName = "TableRow"
-const TableHead = React.forwardRef<
- HTMLTableCellElement,
- React.ThHTMLAttributes
->(({ className, ...props }, ref) => (
- |
-))
+const TableHead = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ThHTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ( | )
TableHead.displayName = "TableHead"
-const TableCell = React.forwardRef<
- HTMLTableCellElement,
- React.TdHTMLAttributes
->(({ className, ...props }, ref) => (
- |
-))
+const TableCell = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.TdHTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ( | )
TableCell.displayName = "TableCell"
-const TableCaption = React.forwardRef<
- HTMLTableCaptionElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
+const TableCaption = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.HTMLAttributes & {
+ ref: React.RefObject;
+ }
+) => ()
TableCaption.displayName = "TableCaption"
export {
diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx
index 1febecdd..891e10f6 100644
--- a/src/components/ui/tabs.tsx
+++ b/src/components/ui/tabs.tsx
@@ -7,49 +7,58 @@ import { cn } from "@app/lib/cn"
const Tabs = TabsPrimitive.Root
-const TabsList = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const TabsList = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
TabsList.displayName = TabsPrimitive.List.displayName
-const TabsTrigger = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const TabsTrigger = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
-const TabsContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const TabsContent = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
TabsContent.displayName = TabsPrimitive.Content.displayName
export { Tabs, TabsList, TabsTrigger, TabsContent }
diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsx
index c6c0b47c..de57ad87 100644
--- a/src/components/ui/textarea.tsx
+++ b/src/components/ui/textarea.tsx
@@ -5,20 +5,26 @@ import { cn } from "@app/lib/cn"
export interface TextareaProps
extends React.TextareaHTMLAttributes {}
-const Textarea = React.forwardRef(
- ({ className, ...props }, ref) => {
- return (
-
- )
+const Textarea = (
+ {
+ ref,
+ className,
+ ...props
+ }: TextareaProps & {
+ ref: React.RefObject;
}
-)
+) => {
+ return (
+
+ )
+}
Textarea.displayName = "Textarea"
export { Textarea }
diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsx
index f41ae275..d9f9afc9 100644
--- a/src/components/ui/toast.tsx
+++ b/src/components/ui/toast.tsx
@@ -9,19 +9,22 @@ import { cn } from "@app/lib/cn"
const ToastProvider = ToastPrimitives.Provider
-const ToastViewport = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const ToastViewport = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
ToastViewport.displayName = ToastPrimitives.Viewport.displayName
const toastVariants = cva(
@@ -40,11 +43,14 @@ const toastVariants = cva(
}
)
-const Toast = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef &
- VariantProps
->(({ className, variant, ...props }, ref) => {
+const Toast = (
+ {
+ ref,
+ className,
+ variant,
+ ...props
+ }
+) => {
return (
)
-})
+}
Toast.displayName = ToastPrimitives.Root.displayName
-const ToastAction = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const ToastAction = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
ToastAction.displayName = ToastPrimitives.Action.displayName
-const ToastClose = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-
-
-))
+const ToastClose = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => (
+
+)
ToastClose.displayName = ToastPrimitives.Close.displayName
-const ToastTitle = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const ToastTitle = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
ToastTitle.displayName = ToastPrimitives.Title.displayName
-const ToastDescription = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
+const ToastDescription = (
+ {
+ ref,
+ className,
+ ...props
+ }: React.ComponentPropsWithoutRef & {
+ ref: React.RefObject>;
+ }
+) => ()
ToastDescription.displayName = ToastPrimitives.Description.displayName
type ToastProps = React.ComponentPropsWithoutRef