From e5445e5b95771576648fb5e26705d421a2edb3a5 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Sun, 15 Sep 2024 18:46:03 -0400 Subject: [PATCH] fix(TextField/Field): Expose `id` prop --- .changeset/grumpy-suns-watch.md | 5 +++++ packages/svelte-ux/src/lib/components/Field.svelte | 2 +- packages/svelte-ux/src/lib/components/TextField.svelte | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/grumpy-suns-watch.md diff --git a/.changeset/grumpy-suns-watch.md b/.changeset/grumpy-suns-watch.md new file mode 100644 index 000000000..8bf999c2e --- /dev/null +++ b/.changeset/grumpy-suns-watch.md @@ -0,0 +1,5 @@ +--- +'svelte-ux': patch +--- + +fix(TextField/Field): Expose `id` prop diff --git a/packages/svelte-ux/src/lib/components/Field.svelte b/packages/svelte-ux/src/lib/components/Field.svelte index 64a3d8148..fcf3ea257 100644 --- a/packages/svelte-ux/src/lib/components/Field.svelte +++ b/packages/svelte-ux/src/lib/components/Field.svelte @@ -53,7 +53,7 @@ $: hasPrepend = $$slots.prepend || icon != null; $: hasAppend = $$slots.append || iconRight != null || clearable || error; - const id = uniqueId('field-'); + export let id = uniqueId('field-'); let labelEl: HTMLLabelElement | null = null; diff --git a/packages/svelte-ux/src/lib/components/TextField.svelte b/packages/svelte-ux/src/lib/components/TextField.svelte index 31bd99b8e..bca893a38 100644 --- a/packages/svelte-ux/src/lib/components/TextField.svelte +++ b/packages/svelte-ux/src/lib/components/TextField.svelte @@ -208,7 +208,7 @@ $: hasPrefix = $$slots.prefix || type === 'currency'; $: hasSuffix = $$slots.suffix || type === 'percent'; - const id = uniqueId('textfield-'); + export let id = uniqueId('textfield-'); let labelEl: HTMLLabelElement | null = null;