Skip to content

Commit dc80308

Browse files
Update id prop & docs
1 parent b738c7e commit dc80308

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Next
44
- Add `required` prop (@ChromuSx)
5+
- Add `id` prop (@portfolioris)
56

67
## 2.9.0 - 2023 Nov 3
78
- Add `timePrecision` prop for showing a time picker (@nihanmubashshir)

src/lib/DateInput.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
export let min = new Date(defaultDate.getFullYear() - 20, 0, 1)
4343
/** The latest value the user can select */
4444
export let max = new Date(defaultDate.getFullYear(), 11, 31, 23, 59, 59, 999)
45-
/** optional id attribute */
46-
export let id = ''
45+
/** Set the input element's ID attribute */
46+
export let id: string | null = null
4747
/** Placeholder text to show when input field is empty */
4848
export let placeholder = '2020-12-31 23:00:00'
4949
/** Whether the text is valid */
@@ -191,7 +191,7 @@
191191
class:invalid={!valid}
192192
type="text"
193193
value={text}
194-
id={id || null}
194+
{id}
195195
{placeholder}
196196
{disabled}
197197
{required}

src/routes/docs/+page.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ The component will not assign a date value until a specific date is selected in
2929

3030
<h3 id="props">Props</h3>
3131

32-
| Prop | Type | Description |
33-
| :----------------------- | :-------------------------------------------- | :---------------------------------------------------------- |
34-
| `value` | Date \| null | Date value |
35-
| `min` | Date | The earliest value the user can select |
36-
| `max` | Date | The latest value the user can select |
37-
| `placeholder` | string | Placeholder used when date value is null |
38-
| `timePrecision` | "minute" \| "second" \| "millisecond" \| null | Show a time picker with the specified precision |
39-
| `valid` | bool | Whether the text is valid |
40-
| `format` | string | Format string |
41-
| `visible` | bool | Whether the date popup is visible |
42-
| `disabled` | bool | Disable the input |
43-
| `required` | bool | Require a value to submit form |
44-
| `closeOnSelection` | bool | Close the date popup when a date is selected |
45-
| `browseWithoutSelecting` | bool | Wait with updating the date until a value is selected |
46-
| `dynamicPositioning` | bool | Dynamicly postions the date popup to best fit on the screen |
47-
| `locale` | Locale | Locale object for internationalization |
32+
| Prop | Type | Description |
33+
| :----------------------- | :-------------------------------------------- | :------------------------------------------------------------ |
34+
| `value` | Date \| null | Date value |
35+
| `min` | Date | The earliest value the user can select |
36+
| `max` | Date | The latest value the user can select |
37+
| `placeholder` | string | Placeholder used when date value is null |
38+
| `timePrecision` | "minute" \| "second" \| "millisecond" \| null | Show a time picker with the specified precision |
39+
| `id` | string \| null | Set the input element's ID attribute |
40+
| `valid` | bool | Whether the text is valid |
41+
| `format` | string | Format string |
42+
| `visible` | bool | Whether the date popup is visible |
43+
| `disabled` | bool | Disable the input |
44+
| `required` | bool | Require a value to submit form |
45+
| `closeOnSelection` | bool | Close the date popup when a date is selected |
46+
| `browseWithoutSelecting` | bool | Wait with updating the date until a value is selected |
47+
| `dynamicPositioning` | bool | Dynamically postions the date popup to best fit on the screen |
48+
| `locale` | Locale | Locale object for internationalization |
4849

4950
<h4 id="format-string">Format string</h4>
5051

0 commit comments

Comments
 (0)