Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
feat: textfield - support 'search' type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaeho Lee committed Dec 21, 2022
1 parent 62f4087 commit 3bb00fa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/tall-cups-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@greenlabs/formula-components": patch
"@greenlabs/rescript-formula-components": patch
---

feat: textfield - support 'search' type
2 changes: 1 addition & 1 deletion packages/components-rescript/src/Formula__TextField.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ external make: (
~className: string=?,
~variant: [#boxOutline | #boxFill | #line]=?,
~size: [#xsmall | #small | #medium | #large]=?,
~_type: [#text | #password]=?,
~_type: [#text | #password | #search]=?,
~placeholder: string=?,
~prefix: React.element=?,
~prefixIcon: React.componentLike<{..}, React.element>=?, // FIXME: Icon component type
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/TextField/TextField.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export const Textarea_and_Ref_Etc: ComponentStory<typeof TextField> = (
}}
titleText="onChange: see console"
/>
<TextField {...args} type="search" titleText="type=search" />
</form>
)}
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ type inputProps = {
onBlur?: React.FocusEventHandler<InputElement>
onChange?: React.ChangeEventHandler<InputElement>
onFocus?: React.FocusEventHandler<InputElement>
type?: "text" | "password"
type?: "text" | "password" | "search"
}

// FIXME: make input/textarea compatible
export type renderInputProps = inputProps & {
id: string
className: string
type: "text" | "password" // FIXME: fix case for <textarea />
type: "text" | "password" | "search" // FIXME: fix case for <textarea />
inputRef: InputRefType
}
type TextFieldProps = PropsWithChildren<
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/TextField/styles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ export const inputStyle = style({
borderTopRightRadius: 4,
borderBottomRightRadius: 4,
selectors: {
[`&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-ms-clear`]:
{
WebkitAppearance: "none",
},
[`${textFieldVariants["line.large"]} &`]: {
vars: {
[vars.inputHeight]: "33px",
Expand Down

0 comments on commit 3bb00fa

Please sign in to comment.