Skip to content

Commit

Permalink
Fix lack of reactivity of data-fs-error (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Haak <[email protected]>
Co-authored-by: Hunter Johnston <[email protected]>
  • Loading branch information
3 people authored Oct 30, 2023
1 parent 2f4d1d4 commit c0573e3
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-mayflies-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"formsnap": patch
---

Fix lack of reactivity of `data-fs-error`
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:content-cachebust": "contentlayer build --clearCache",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"prepare": "pnpm package",
"prepublishOnly": "pnpm run package",
"test": "pnpm run test:integration && pnpm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type $$Props = CheckboxProps;
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-checkbox": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-description.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
type $$Props = DescriptionProps;
export let tag = "p";
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-description": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type $$Props = InputProps;
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-input": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-label.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type $$Props = LabelProps;
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-label": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-radio.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type $$Props = RadioProps;
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-radio": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type $$Props = SelectProps;
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-select": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-textarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type $$Props = TextareaProps;
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-textarea": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form-validation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
type $$Props = ValidationProps;
export let tag = "p";
const { actions, errors } = getFormField();
const attrs = {
$: attrs = {
"data-fs-validation": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
form: superFrm,
schema
};
const attrs = {
$: attrs = {
"data-fs-form": "",
"data-fs-error": $errors ? "" : undefined
};
Expand Down
4 changes: 2 additions & 2 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type DescriptionProps = {
*
* @default "p"
*/
tag?: "string";
tag?: string;
} & HTMLAttributes<HTMLElement>;

export type ValidationProps = {
Expand All @@ -56,7 +56,7 @@ export type ValidationProps = {
*
* @default "p"
*/
tag?: "string";
tag?: string;
} & HTMLAttributes<HTMLElement>;

export type RadioProps = HTMLInputAttributes;
Expand Down

0 comments on commit c0573e3

Please sign in to comment.