Skip to content

Commit

Permalink
feat(DateField): Add support for class and classes props, add `Da…
Browse files Browse the repository at this point in the history
…teField` class, pass `$$restProps`
  • Loading branch information
brandonmcconnell committed Feb 9, 2024
1 parent 57d46d5 commit 3c9835d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-penguins-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-ux': minor
---

Add support for passing `class` and `classes` props to the DateField component
13 changes: 13 additions & 0 deletions packages/svelte-ux/src/lib/components/DateField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { parse as parseDate } from 'date-fns';
import { PeriodType } from '../utils';
import { getComponentSettings, getSettings } from './settings';
import { cls } from '../utils/styles';
import Field from './Field.svelte';
Expand Down Expand Up @@ -32,6 +33,15 @@
export let rounded = false;
export let dense = false;
export let icon: string | null = null;
export let classes: {
root?: string;
container?: string;
label?: string;
input?: string;
error?: string;
prepend?: string;
append?: string;
} = {};
let inputValue: string | undefined = '';
Expand All @@ -49,6 +59,7 @@
</script>

<Field
{...$$restProps}
{label}
{value}
{icon}
Expand All @@ -65,6 +76,8 @@
inputValue = undefined;
dispatch('change', { value });
}}
{classes}
class={cls('DateField', $$props.class)}
let:id
>
<Input
Expand Down

0 comments on commit 3c9835d

Please sign in to comment.