-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from josemarluedke/feat/input-clear-button
feat: add option to clear content of input & (start/end)ContentPointerEvents arg
- Loading branch information
Showing
12 changed files
with
330 additions
and
67 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { buildWaiter } from '@ember/test-waiters'; | ||
const waiter = buildWaiter('@frontile/forms:triggerFormInputEvent)'); | ||
|
||
function triggerFormInputEvent(element?: HTMLElement | null): void { | ||
if (!element) return; | ||
const waiterToken = waiter.beginAsync(); | ||
|
||
requestAnimationFrame(() => { | ||
let parent = element.parentElement; | ||
while (parent) { | ||
if (parent.tagName === 'FORM') { | ||
(parent as HTMLFormElement).dispatchEvent( | ||
new Event('input', { bubbles: true }) | ||
); | ||
break; | ||
} | ||
parent = parent.parentElement; | ||
} | ||
|
||
waiter.endAsync(waiterToken); | ||
}); | ||
} | ||
|
||
export { triggerFormInputEvent }; |
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,23 +1,36 @@ | ||
import { tv } from '../tw'; | ||
import { tv, type VariantProps } from '../tw'; | ||
|
||
const closeButton = tv({ | ||
slots: { | ||
base: 'rounded-full hover:bg-default-100 transition transition-200 focus-visable:ring text-inherit', | ||
base: 'rounded-full transition transition-200 focus-visable:ring text-inherit', | ||
icon: 'size-[1em]' | ||
}, | ||
|
||
variants: { | ||
size: { | ||
xs: 'text-sm p-1', | ||
sm: 'text-base p-2', | ||
md: 'text-xl p-2', | ||
lg: 'text-2xl p-3', | ||
xl: 'text-4xl p-3' | ||
xs: { base: 'text-sm p-1' }, | ||
sm: { base: 'text-base p-2' }, | ||
md: { base: 'text-xl p-2' }, | ||
lg: { base: 'text-2xl p-3' }, | ||
xl: { base: 'text-4xl p-3' } | ||
}, | ||
variant: { | ||
transparent: { base: ['bg-transparent', 'hover:bg-default-100'] }, | ||
subtle: { | ||
base: [ | ||
'bg-default-100', | ||
'text-default-foreground dark:text-default-background', | ||
'dark:bg-default-200', | ||
'hover:bg-default-200/60 dark:hover:bg-default-800/60' | ||
] | ||
} | ||
} | ||
}, | ||
defaultVariants: { | ||
size: 'md' | ||
size: 'md', | ||
variant: 'transparent' | ||
} | ||
}); | ||
|
||
export type CloseButtonVariants = VariantProps<typeof closeButton>; | ||
export { closeButton }; |
Oops, something went wrong.