Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
d6ba872
feat: spreadsheet component [WIP]
ItzNotABug Apr 3, 2025
57d4183
add: drag <> swap column behaviour.
ItzNotABug Apr 3, 2025
a71b1ca
Merge branch 'next' into 'feat-spreadsheet'.
ItzNotABug Jun 2, 2025
c68e7f1
Merge branch 'next' into feat-spreadsheet
ItzNotABug Jun 4, 2025
211263f
rewrite: spreadsheet.
ItzNotABug Jun 6, 2025
70051f6
add: missing ref for tests.
ItzNotABug Jun 6, 2025
659b428
revert: local changes.
ItzNotABug Jun 6, 2025
c1c5978
revert: local changes.
ItzNotABug Jun 6, 2025
6b4e0b8
remove: redundant comments.
ItzNotABug Jun 6, 2025
16f27f9
remove: redundant css.
ItzNotABug Jun 6, 2025
d750282
fix: lint 😮‍💨
ItzNotABug Jun 6, 2025
bb99022
Merge branch 'next' into feat-spreadsheet
ItzNotABug Jun 6, 2025
48fc640
ci: empty commit
ItzNotABug Jun 6, 2025
594b51a
fix: imports.
ItzNotABug Jun 6, 2025
1a8d505
fix: footer.
ItzNotABug Jun 6, 2025
f40a6e1
change: conflicting name.
ItzNotABug Jun 6, 2025
b2e9b87
Improve column drag and drop visual feedback and UX
TorstenDittmann Jun 24, 2025
742f8b2
Merge branch 'next' into feat-spreadsheet
ItzNotABug Jul 8, 2025
8df8c98
feat: empty cells support.
ItzNotABug Jul 9, 2025
bc94ff8
update: allow custom elements for edits.
ItzNotABug Jul 9, 2025
813ff24
update: shut the lint up.
ItzNotABug Jul 9, 2025
78fdff7
address comments from design.
ItzNotABug Jul 9, 2025
1a03ce8
fix: auto-height.
ItzNotABug Jul 9, 2025
5ba20ca
update: allow passing height.
ItzNotABug Jul 9, 2025
ad1b5c4
fix: hide right border on the last column before action.
ItzNotABug Jul 10, 2025
79a6929
fix: row and header colors for checkboxes.
ItzNotABug Jul 10, 2025
44e5eb1
update: remove unnecessary style; fix: action icon alignment.
ItzNotABug Jul 10, 2025
94df3da
attempt: fix the presentation view on last column.
ItzNotABug Jul 10, 2025
3b35c69
footer: full width.
ItzNotABug Jul 10, 2025
c8081ce
remove: overflow hidden from cell for tooltips.
ItzNotABug Jul 10, 2025
f00b8c5
update: mint things 😉.
ItzNotABug Jul 10, 2025
9e1c50a
update: swap animation
ItzNotABug Jul 10, 2025
7254e0d
add: nice indicator.
ItzNotABug Jul 10, 2025
a75c2d5
update: story.
ItzNotABug Jul 11, 2025
f0ff26b
fix: story for local tests.
ItzNotABug Jul 11, 2025
95ce490
Merge branch 'next' into feat-spreadsheet
ItzNotABug Jul 11, 2025
543ebea
fix: alpha.
ItzNotABug Jul 11, 2025
255fab5
fix: preview image border color.
ItzNotABug Jul 11, 2025
373d6a6
update: cursor logic and cleanup.
ItzNotABug Jul 11, 2025
a6874bc
update: optimize logic for lesser elements in dom for tooltips.
ItzNotABug Jul 12, 2025
2f1e67d
fix: lint.
ItzNotABug Jul 12, 2025
e91326e
add: loading state.
ItzNotABug Jul 12, 2025
f351106
update: sizes.
ItzNotABug Jul 12, 2025
ffd1c00
update: forward context menu events.
ItzNotABug Jul 12, 2025
244d5db
update: start keyboard key management; fix: textarea.
ItzNotABug Jul 14, 2025
6aed15d
add: preliminary keyboard nav support.
ItzNotABug Jul 14, 2025
edccb3a
remove: focus logic.
ItzNotABug Jul 14, 2025
e2eb987
update: use contextual logic.
ItzNotABug Jul 14, 2025
3bfe2c7
Merge branch 'feat-spreadsheet' into keyboard-nav-sheet
ItzNotABug Jul 14, 2025
7e2deae
fix: zIndex.
ItzNotABug Jul 14, 2025
d6705b9
update: use action directives.
ItzNotABug Jul 14, 2025
7f8f433
update: misc changes to dimensions.
ItzNotABug Jul 15, 2025
3d145d4
ci: empty commit
ItzNotABug Jul 16, 2025
2acaff9
Merge branch 'feat-spreadsheet' into keyboard-nav-sheet
ItzNotABug Jul 16, 2025
ac94143
update: cell focus navigation.
ItzNotABug Jul 19, 2025
d7034e5
fix: first item not working on nav.
ItzNotABug Jul 19, 2025
f36ef60
Merge branch 'next' into keyboard-nav-sheet
ItzNotABug Jul 20, 2025
dc53e79
add: input.
ItzNotABug Jul 22, 2025
c071257
update: resizing bg border.
ItzNotABug Jul 22, 2025
8057bf6
Merge branch 'optimize-dom' into feat-spreadsheet
ItzNotABug Jul 22, 2025
c5b4d80
revert: borders on resize.
ItzNotABug Jul 23, 2025
b12ef1f
fix: cursor and state on non-resizable columns; update: borders for d…
ItzNotABug Jul 23, 2025
7025bb6
Merge branch 'next' into feat-spreadsheet
ItzNotABug Jul 23, 2025
9132446
patch: border diffs.
ItzNotABug Jul 23, 2025
7ac7261
Merge remote-tracking branch 'origin/feat-spreadsheet' into feat-spre…
ItzNotABug Jul 23, 2025
19f15c8
add: select state options.
ItzNotABug Jul 24, 2025
c88c338
add: simple column swap tracker.
ItzNotABug Jul 24, 2025
5ee0b63
add: simple column resize tracker.
ItzNotABug Jul 25, 2025
e0df9cb
add: `minimumWidth` for resizing.
ItzNotABug Jul 25, 2025
99ee9f5
fix: overlay color on resize and format.
ItzNotABug Jul 26, 2025
96e10aa
fix: cell text overflows and wrappings.
ItzNotABug Jul 28, 2025
8892b0f
Merge branch 'feat-spreadsheet' into keyboard-nav-sheet
ItzNotABug Jul 28, 2025
7daf439
add: whitespace handling.
ItzNotABug Jul 28, 2025
54f2e83
fix: display.
ItzNotABug Jul 28, 2025
b5bb595
fix: display for loading and normal mode.
ItzNotABug Jul 28, 2025
ebaa13e
Merge branch 'feat-spreadsheet' into 'keyboard-nav-sheet'.
ItzNotABug Jul 29, 2025
3ea76a5
Merge remote-tracking branch 'origin/keyboard-nav-sheet' into keyboar…
ItzNotABug Jul 29, 2025
5913d0c
fix: add `portal` on tooltip; border/outline width for focused state.
ItzNotABug Jul 29, 2025
963d0b9
fix: random overflow and borders.
ItzNotABug Jul 29, 2025
cc69c76
fix: random overflow and borders.
ItzNotABug Jul 29, 2025
0a9015e
fix: misc.
ItzNotABug Jul 29, 2025
3d31cea
attempt: fix.
ItzNotABug Jul 29, 2025
0cc4af0
fix: overflown value text content.
ItzNotABug Jul 31, 2025
a7a43d6
Merge branch 'next' into 'keyboard-nav-sheet'.
ItzNotABug Aug 1, 2025
95dc1c9
fix: inconsistent border on non-resizable column.
ItzNotABug Aug 1, 2025
97e114e
fix: focused state.
ItzNotABug Aug 1, 2025
142a846
fix: keyboard nav & focus.
ItzNotABug Aug 4, 2025
18ed891
fix: values updates.
ItzNotABug Aug 4, 2025
a64ab34
fix:
ItzNotABug Aug 4, 2025
51326d1
fix: editor
ItzNotABug Aug 4, 2025
f4bae29
Merge remote-tracking branch 'origin/keyboard-nav-sheet' into keyboar…
ItzNotABug Aug 4, 2025
bfa834d
fix: outlines.
ItzNotABug Aug 4, 2025
1bc7cf7
fix: alignment.
ItzNotABug Aug 4, 2025
da8cd99
add: disabled row state.
ItzNotABug Aug 4, 2025
3b4734f
feat: virtual spreadsheet
TorstenDittmann Aug 4, 2025
a53ff9c
Merge branch 'keyboard-nav-sheet' into 'feat-virtual-spreadsheet'.
ItzNotABug Aug 5, 2025
4ac7e2f
update: full height.
ItzNotABug Aug 5, 2025
31a9048
address comments.
ItzNotABug Aug 5, 2025
fce7eac
update: misc cleanup.
ItzNotABug Aug 5, 2025
9da8171
fix: editing mode and focus issues.
ItzNotABug Aug 5, 2025
7ab8acd
fix: selector count.
ItzNotABug Aug 5, 2025
25a3ab9
update: empty cells.
ItzNotABug Aug 5, 2025
cf90d64
update: empty cells <> virtual lists.
ItzNotABug Aug 5, 2025
5f582f9
fix: cell navs, backwards compat.
ItzNotABug Aug 5, 2025
bc41d0c
update: rows.
ItzNotABug Aug 5, 2025
d303221
fix: revert size change.
ItzNotABug Aug 5, 2025
23c182d
fix: count.
ItzNotABug Aug 5, 2025
7f47803
lint.
ItzNotABug Aug 5, 2025
24930a2
revert: architect's fix
ItzNotABug Aug 5, 2025
c880f34
update: selected rows destruction fix.
ItzNotABug Aug 5, 2025
0468c93
hotfix.
ItzNotABug Aug 5, 2025
753f9c0
another hotfix.
ItzNotABug Aug 5, 2025
950fa5e
fixes:
ItzNotABug Aug 7, 2025
0c51a94
fixes.
ItzNotABug Aug 8, 2025
b00fb9c
update: conditional paddings.
ItzNotABug Aug 8, 2025
0c30e2f
feat: delay to tooltips.
ItzNotABug Aug 8, 2025
363dcac
update: increase touch target for resize, misc.
ItzNotABug Aug 9, 2025
c0cdd91
feat: infinite scrolling.
ItzNotABug Aug 10, 2025
b4e47f3
feat: bidirectional scrolling.
ItzNotABug Aug 10, 2025
cad4411
update: loading time on demos, lint.
ItzNotABug Aug 10, 2025
da2ca90
fix: condition.
ItzNotABug Aug 11, 2025
206f46f
fix: scroll listener conditions.
ItzNotABug Aug 11, 2025
c1b4460
update: add scroll listener effectively.
ItzNotABug Aug 11, 2025
19eed0b
fix: add scroll listener logic not firing on console.
ItzNotABug Aug 11, 2025
182bbaa
update: comment.
ItzNotABug Aug 11, 2025
fd15f6e
update: reorder [no specific reason, just ocd things].
ItzNotABug Aug 11, 2025
b023951
fix: non-full pages issue, binding var support.
ItzNotABug Aug 11, 2025
3f2602a
comments.
ItzNotABug Aug 11, 2025
8675026
updates, fixes.
ItzNotABug Aug 12, 2025
c467db8
add: update method.
ItzNotABug Aug 12, 2025
10eee24
fix: target index scroll.
ItzNotABug Aug 13, 2025
698efda
update: hover state for resize.
ItzNotABug Aug 13, 2025
0fed23b
fix: colors.
ItzNotABug Aug 13, 2025
8076873
fix: drag and reordering the columns. my sanity has been restored 😮‍💨
ItzNotABug Aug 15, 2025
fe36900
fix: last column calculation.
ItzNotABug Aug 15, 2025
202a180
fix: column width calculations.
ItzNotABug Aug 16, 2025
8672d4d
update: improved edge case handling with only non action item.
ItzNotABug Aug 16, 2025
fcd953f
lint.
ItzNotABug Aug 16, 2025
558e460
optimize: sparse paging.
ItzNotABug Aug 16, 2025
85acd09
fix: remove debounce and load page on visibility.
ItzNotABug Aug 16, 2025
c165ec2
fix: width logic, again.
ItzNotABug Aug 16, 2025
e10aaa8
add: hover logic for sequence and checkbox.
ItzNotABug Aug 16, 2025
45189ad
update: only remove focus if hover mode is true.
ItzNotABug Aug 16, 2025
247af49
update: keyboard events, navigation, and bug fix with select showing …
ItzNotABug Aug 16, 2025
7a52c75
update: improved keyboard nav and enter trigger on action.
ItzNotABug Aug 16, 2025
9081fa8
fix: an edge case when Table is used inside a Dialog component.
ItzNotABug Aug 17, 2025
535121c
update: simplify fix for the width issue on dialogs.
ItzNotABug Aug 17, 2025
db071ac
add: end slot to textarea for console.
ItzNotABug Aug 17, 2025
34671e4
update: add `close` support to editor;
ItzNotABug Aug 18, 2025
7e90824
update: border color on hover.
ItzNotABug Aug 18, 2025
65f97c8
fix: hover on non-draggable columns and missing borders on select.
ItzNotABug Aug 18, 2025
6bf3dd0
add: tooltip support to bottom action.
ItzNotABug Aug 19, 2025
9f28c76
fix: border for select cells.
ItzNotABug Aug 19, 2025
09eb531
Merge branch 'next' into 'feat-virtual-spreadsheet'.
ItzNotABug Aug 19, 2025
0478e12
Merge pull request #350 from appwrite/feat-virtual-spreadsheet
ItzNotABug Aug 19, 2025
0c4d6e1
Merge pull request #346 from appwrite/keyboard-nav-sheet
ItzNotABug Aug 19, 2025
185ee47
fix: lint.
ItzNotABug Aug 19, 2025
44385d1
fix: onMount invalid call, leftover from merge.
ItzNotABug Aug 19, 2025
36dc3f2
fix: close triggering `on:blur`.
ItzNotABug Aug 19, 2025
59e81f6
fix: toast action buttons to extra-compact.
ItzNotABug Aug 20, 2025
c993493
Merge branch 'next' into feat-spreadsheet
ItzNotABug Aug 25, 2025
23b0b61
fix: limit on pagination [lol].
ItzNotABug Aug 25, 2025
4d9e4bf
Merge remote-tracking branch 'origin/feat-spreadsheet' into feat-spre…
ItzNotABug Aug 25, 2025
dffcf86
attempt fix: better next loading.
ItzNotABug Aug 27, 2025
98d8dd0
attempt fix: measure again on content update.
ItzNotABug Aug 27, 2025
0f90bf1
Merge pull request #357 from appwrite/smoother-autoload
ItzNotABug Aug 27, 2025
18188b7
fix: number component not firing on:change and values being string on…
ItzNotABug Aug 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions v2/pink-sb/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { dirname, join } from 'path';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);

/** @type { import('@storybook/sveltekit').StorybookConfig } */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion v2/pink-sb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"dev": "storybook dev -p 6006",
"dev:package": "svelte-kit sync && svelte-package --watch",
"build": "vite build && pnpm run package && pnpm run sb:build",
"build": "vite build && pnpm run package",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"prepublishOnly": "pnpm run package",
Expand Down
12 changes: 9 additions & 3 deletions v2/pink-sb/src/lib/Dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
<Icon icon={IconX} />
</Button>
</Stack>
<Text variant="m-400" color="--fgcolor-neutral-secondary">
<slot />
</Text>
<div class="dialog-content">
<Text variant="m-400" color="--fgcolor-neutral-secondary">
<slot />
</Text>
</div>
</header>
<footer>
<slot name="footer">
Expand Down Expand Up @@ -107,6 +109,10 @@
border-bottom: var(--border-width-s) solid var(--border-neutral);
background: var(--bgcolor-neutral-primary);
padding-block-start: var(--space-7);

& .dialog-content {
width: 100%;
}
}
}

Expand Down
48 changes: 34 additions & 14 deletions v2/pink-sb/src/lib/Popover.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { fade } from 'svelte/transition';
import { activePopover } from './context.js';
import type { Placement } from '@floating-ui/dom';
import { onMount, hasContext, setContext } from 'svelte';
import { onMount, hasContext, setContext, tick } from 'svelte';
import { computePosition, autoUpdate, shift, offset, flip } from '@floating-ui/dom';

export let portal: boolean = false;
Expand All @@ -17,6 +18,8 @@

$: showTooltip = $activeInstance === id;

setContext('popover-group', true);

function toggle(e?: Event) {
return tooltipAction(e, 'toggle');
}
Expand Down Expand Up @@ -60,10 +63,12 @@

async function update() {
if (!referenceElement || !tooltipElement) return;

const firstChild = referenceElement.firstElementChild;
if (!(firstChild instanceof HTMLElement)) {
return;
}

const { x, y } = await computePosition(firstChild, tooltipElement, {
placement,
middleware: [offset(2), flip(), shift()]
Expand Down Expand Up @@ -96,27 +101,42 @@
};
}

setContext('popover-group', true);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function autoUpdateAction(_: HTMLDivElement) {
let cleanup: (() => void) | undefined;

onMount(() => autoUpdate(referenceElement, tooltipElement, update));
tick().then(() => {
if (!referenceElement || !tooltipElement) return;
cleanup = autoUpdate(referenceElement, tooltipElement, update);
});

return {
destroy: () => cleanup?.()
};
}
</script>

<svelte:window on:click={onBlur} on:keydown={onKeyDown} on:resize={update} />

<span aria-describedby={id} bind:this={referenceElement}>
<slot showing={showTooltip} {toggle} {update} {show} {hide} />
</span>
<div
{id}
role="tooltip"
aria-hidden={!showTooltip}
bind:this={tooltipElement}
class:padding-m={padding === 'm'}
class:padding-none={padding === 'none'}
use:portalPopover
>
<slot showing={showTooltip} {toggle} {update} {show} {hide} name="tooltip" />
</div>

{#if showTooltip}
<div
{id}
role="tooltip"
aria-hidden="false"
bind:this={tooltipElement}
class:padding-m={padding === 'm'}
class:padding-none={padding === 'none'}
use:portalPopover
use:autoUpdateAction
transition:fade={{ duration: 150 }}
>
<slot showing={showTooltip} {toggle} {update} {show} {hide} name="tooltip" />
</div>
{/if}

<style lang="scss">
span {
Expand Down
142 changes: 93 additions & 49 deletions v2/pink-sb/src/lib/Tooltip.svelte
Original file line number Diff line number Diff line change
@@ -1,34 +1,59 @@
<script lang="ts">
import { tick, hasContext } from 'svelte';
import type { Placement } from '@floating-ui/dom';
import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
import { onMount } from 'svelte';

export let portal: boolean = false;
export let placement: Placement | undefined = undefined;
export let padding: 'none' | 'm' = 'm';
export let offsetAmount: number = 6;
export let disabled = false;
export let maxWidth = '11.25rem';
export let delay: number = 0;

let show = false;
let showing = false;
const id = 'tooltip-' + Math.random().toString(36).substring(2, 9);
let referenceElement: HTMLSpanElement;
let delayTimeout: ReturnType<typeof setTimeout>;

let tooltipElement: HTMLDivElement;
let referenceElement: HTMLSpanElement;
const id = 'tooltip-' + Math.random().toString(36).substring(2, 9);

const inDialogGroup = hasContext('dialog-group');

async function showTooltip() {
await update();
showing = show = !disabled;
if (disabled) return;

if (delayTimeout) {
clearTimeout(delayTimeout);
}

if (delay > 0) {
delayTimeout = setTimeout(async () => {
await update();
showing = show = true;
}, delay);
} else {
await update();
showing = show = true;
}
}

function hideTooltip() {
if (delayTimeout) {
clearTimeout(delayTimeout);
}
show = false;
}

async function update() {
if (!referenceElement || !tooltipElement) return;

const firstChild = referenceElement.firstElementChild;
if (!(firstChild instanceof HTMLElement)) {
return;
}

const { x, y } = await computePosition(firstChild, tooltipElement, {
placement,
middleware: [offset(offsetAmount), flip(), shift()]
Expand All @@ -40,7 +65,50 @@
});
}

onMount(() => autoUpdate(referenceElement, tooltipElement, update));
function portalPopover(node: HTMLElement) {
if (!portal && !inDialogGroup) return;

const target = !inDialogGroup
? document.body
: // can be inside a modal/dialog
document.body.querySelector<HTMLDialogElement>('dialog[open]');

if (target) {
target.appendChild(node);
}

return {
destroy() {
if (target && node.parentNode === target) {
target.removeChild(node);
}
}
};
}

function fadeSlide(_: Node, { y = 8, duration = 200 } = {}) {
return {
duration,
css: (time: number) => `
opacity: ${time};
transform: translateY(${(1 - time) * y}px);
`
};
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function autoUpdateAction(_: HTMLDivElement) {
let cleanup: (() => void) | undefined;

tick().then(() => {
if (!referenceElement || !tooltipElement) return;
cleanup = autoUpdate(referenceElement, tooltipElement, update);
});

return {
destroy: () => cleanup?.()
};
}
</script>

<svelte:window on:resize={update} />
Expand All @@ -57,19 +125,25 @@
>
<slot {showing} {update} />
</span>
<div
{id}
on:transitionend={() => (showing = false)}
bind:this={tooltipElement}
aria-hidden={!show}
class:padding-none={padding === 'none'}
class:padding-m={padding === 'm'}
role="tooltip"
style:max-inline-size={maxWidth}
data-state={!show ? 'closed' : 'open'}
>
<slot {showing} {update} name="tooltip" />
</div>

{#if show}
<div
{id}
transition:fadeSlide
use:autoUpdateAction
use:portalPopover
on:transitionend={() => (showing = false)}
bind:this={tooltipElement}
aria-hidden={!show}
class:padding-none={padding === 'none'}
class:padding-m={padding === 'm'}
role="tooltip"
style:max-inline-size={maxWidth}
data-state={!show ? 'closed' : 'open'}
>
<slot {showing} {update} name="tooltip" />
</div>
{/if}

<style lang="scss">
[role='note'] {
Expand All @@ -88,7 +162,6 @@
color: var(--fgcolor-on-invert);
visibility: hidden;
opacity: 0;
transition: visibility 0s linear 0.2s;
z-index: 9002;

&[aria-hidden='false'] {
Expand All @@ -104,34 +177,5 @@
padding: var(--space-2) var(--space-4);
}
}

&[data-state='open'] {
animation: pink-tooltip-enter 0.2s ease-out;
}

&[data-state='closed'] {
animation: pink-tooltip-exit 0.2s ease-out;
}
}
@keyframes pink-tooltip-enter {
from {
opacity: 0;
transform: translateY(0.5rem);
}
to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes pink-tooltip-exit {
from {
opacity: 1;
transform: translateY(0);
}
to {
opacity: 0;
transform: translateY(0.5rem);
}
}
</style>
63 changes: 63 additions & 0 deletions v2/pink-sb/src/lib/action-menu/Input.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script lang="ts">
import { Divider } from '../index.js';
import { autofocusInput } from '$lib/input/autofocus.js';
import type { HTMLInputAttributes } from 'svelte/elements';

type $$Props = HTMLInputAttributes & {
autofocus?: boolean;
};

export let value: $$Props['value'] = '';
export let type: $$Props['type'] = 'text';
export let disabled: $$Props['disabled'] = false;
export let readonly: $$Props['readonly'] = false;
export let required: $$Props['required'] = false;
export let maxlength: $$Props['maxlength'] = undefined;
export let id: $$Props['id'] = undefined;
export let autofocus: $$Props['autofocus'] = false;
</script>

<div class="input-text-wrapper">
<input
bind:value
{...{ type }}
{disabled}
{readonly}
{required}
{maxlength}
{id}
{...$$restProps}
use:autofocusInput={autofocus}
/>

<Divider />
</div>

<style lang="scss">
.input-text-wrapper {
padding-block-end: 0.5rem;

& input {
padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);

inline-size: 100%;
line-height: 140%;

&:disabled {
color: var(--fgcolor-neutral-tertiary);
}

&::placeholder {
color: var(--fgcolor-neutral-tertiary);
}

&:is(:-webkit-autofill, :autofill) {
-webkit-background-clip: text;
}

&::-webkit-calendar-picker-indicator {
filter: invert(0.5);
}
}
}
</style>
Loading
Loading