-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TextArea): added floating action buttons, inset action items, ti…
…tle, and description
- Loading branch information
Showing
7 changed files
with
347 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
const defaultClass = | ||
'flex items-center justify-between space-x-3 border-t border-border px-2 py-2 sm:px-3'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<div | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])} | ||
> | ||
<slot /> | ||
</div> |
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,21 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
const defaultClass = 'flex flex-nowrap justify-end space-x-2 px-2 py-2 sm:px-3'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<div | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])} | ||
> | ||
<slot /> | ||
</div> |
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,44 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
export let name: string; | ||
export let placeholder: string | undefined = undefined; | ||
export let value: string | undefined = undefined; | ||
export let autocomplete: 'on' | 'off' | undefined = undefined; | ||
export let autocapitalize: 'off' | 'none' | 'sentences' | 'words' | 'characters' = 'off'; | ||
export let readonly: true | undefined = undefined; | ||
export let tabindex: string | undefined = undefined; | ||
export let disabled = false; | ||
const defaultClass = | ||
'block w-full bg-surface border-0 pt-2.5 text-lg font-medium placeholder-secondary-content placeholder-opacity-80 focus:ring-0'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<div> | ||
<slot /> | ||
</div> | ||
|
||
<label for={name} class="sr-only">Title</label> | ||
<input | ||
type="text" | ||
{name} | ||
id={name} | ||
{placeholder} | ||
{autocapitalize} | ||
{autocomplete} | ||
{readonly} | ||
{tabindex} | ||
{disabled} | ||
bind:value | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])} | ||
/> |
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,12 +1,21 @@ | ||
import OriginalTextArea from './TextArea.svelte'; | ||
import Label from './Label.svelte'; | ||
import Title from './Title.svelte'; | ||
import Pills from './Pills.svelte'; | ||
import Actions from './Actions.svelte'; | ||
|
||
const TextArea = OriginalTextArea as TextAreaStatic; | ||
TextArea.Label = Label; | ||
TextArea.Title = Title; | ||
TextArea.Pills = Pills; | ||
TextArea.Actions = Actions; | ||
|
||
export default TextArea; | ||
|
||
export interface TextAreaStatic { | ||
new (...args: ConstructorParameters<typeof OriginalTextArea>): OriginalTextArea; | ||
Label: typeof Label; | ||
Title: typeof Title; | ||
Pills: typeof Pills; | ||
Actions: typeof Actions; | ||
} |
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
Oops, something went wrong.