-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Search): new Search component (#2064)
- Loading branch information
1 parent
c694d7d
commit 489a374
Showing
34 changed files
with
868 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,49 @@ | ||
import { AriaRole, InputHTMLAttributes, ReactNode } from "react"; | ||
import { VibeComponentProps } from "../../types"; | ||
import { BASE_SIZES } from "../../constants"; | ||
import VibeComponent from "../../types/VibeComponent"; | ||
|
||
export type InputSize = (typeof BASE_SIZES)[keyof typeof BASE_SIZES]; | ||
type BaseInputNativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "role">; | ||
type Renderer = ReactNode | ReactNode[]; | ||
|
||
export interface BaseInputProps extends BaseInputNativeInputProps, VibeComponentProps { | ||
/** | ||
* Size of the input element. Will influence also padding and font size. | ||
*/ | ||
size?: InputSize; | ||
leftRender?: Renderer; | ||
rightRender?: Renderer; | ||
/** | ||
* A render prop function for adding a component or element to the left side of the input. | ||
* This could be an icon, text, or any custom element that fits within the input's design. | ||
*/ | ||
renderLeft?: Renderer; | ||
/** | ||
* Similar to renderLeft, but for adding an element to the right side of the input. | ||
* Useful for clear buttons, password visibility toggles, or custom validation icons. | ||
*/ | ||
renderRight?: Renderer; | ||
/** | ||
* When true, indicates that the input has successfully passed validation or meets some criteria. | ||
* This control the visual styling of the input to convey success to the user. | ||
*/ | ||
success?: boolean; | ||
/** | ||
* When true, indicates that there is an error with the input's current value. | ||
* This control the visual styling of the input to convey error to the user. | ||
*/ | ||
error?: boolean; | ||
/** | ||
* ARIA role for the input wrapper. This can be used to improve accessibility by | ||
* giving screen readers more context about the input's purpose. | ||
*/ | ||
wrapperRole?: AriaRole; | ||
/** | ||
* ARIA role for the input. Setting this helps in making the input more | ||
* accessible by providing additional semantic information to assistive technologies. | ||
*/ | ||
inputRole?: AriaRole; | ||
wrapperClassName?: string; | ||
/** | ||
* Additional CSS class names to be applied to the input element. This allows for custom | ||
* styling on top of the default styles provided by the component. | ||
*/ | ||
inputClassName?: string; | ||
} | ||
|
||
export type BaseInputComponent = VibeComponent<BaseInputProps, HTMLInputElement>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/core/src/components/LegacySearch/LegacySearch.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.searchWrapper input[type="search"] { | ||
-webkit-appearance: textfield; | ||
} | ||
|
||
.searchWrapper input[type="search"]::-webkit-search-decoration, | ||
.searchWrapper input[type="search"]::-webkit-search-cancel-button, | ||
.searchWrapper input[type="search"]::-webkit-search-results-button, | ||
.searchWrapper input[type="search"]::-webkit-search-results-decoration { | ||
-webkit-appearance: none; | ||
} | ||
|
||
.searchWrapper:focus-within .searchFocusElementFirst { | ||
animation: dashForward 5s linear forwards; | ||
} | ||
|
||
.searchWrapper:focus-within .searchFocusElementSecond { | ||
animation: dashBackwards 5s linear forwards; | ||
} | ||
|
||
.search.round { | ||
border-radius: 50px !important; | ||
} | ||
|
||
@keyframes dashForward { | ||
to { | ||
stroke-dashoffset: 0; | ||
} | ||
} | ||
|
||
@keyframes dashBackwards { | ||
to { | ||
stroke-dashoffset: 2000; | ||
} | ||
} |
Oops, something went wrong.