@getmicdrop/svelte-components 5.16.0 → 5.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Layout/Stack.spec.js +1 -1
- package/dist/datetime/__tests__/format.test.js +1 -1
- package/dist/datetime/__tests__/parse.test.js +1 -1
- package/dist/datetime/__tests__/timezone.test.js +1 -1
- package/dist/datetime/parse.js +1 -1
- package/dist/forms/createFormStore.svelte.js +1 -0
- package/dist/primitives/Input/Select.svelte +1 -1
- package/dist/recipes/fields/SelectField.spec.js +8 -5
- package/dist/recipes/fields/SelectField.svelte +1 -1
- package/dist/recipes/inputs/MultiSelect.spec.js +3 -0
- package/dist/recipes/inputs/MultiSelect.svelte +1 -1
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.spec.js +6 -6
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +1 -6
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import { formatCleanTimeRange, formatDateRange, formatDayOfWeek, formatEventDate, formatEventDateTime, formatEventTime, formatHour, formatMonth, formatNotificationTime, formatRelativeTime, formatTimeRange, getDateInTimezone, getDateParts, getHourInTimezone, isToday, } from '../format';
|
|
3
|
-
import { DateTimeError } from '../types';
|
|
3
|
+
import { DateTimeError, DateTimeErrorCode } from '../types';
|
|
4
4
|
describe('format utilities', () => {
|
|
5
5
|
describe('formatEventTime', () => {
|
|
6
6
|
it('formats time in specified timezone', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { combineDateAndTime, formatDateTimeForAPI, isNextDayTime, minutesToTimeString, parseDateTimeFromAPI, parseEndOfDay, parseLocalToUTC, parseStartOfDay, parseTimeToMinutes, parseUTCToLocal, stripNextDayPrefix, } from '../parse';
|
|
3
|
-
import { DateTimeError } from '../types';
|
|
3
|
+
import { DateTimeError, DateTimeErrorCode } from '../types';
|
|
4
4
|
describe('parse utilities', () => {
|
|
5
5
|
describe('parseLocalToUTC', () => {
|
|
6
6
|
it('converts local datetime to UTC', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import { getTimezoneDisplayName, getTimezoneOffset, getUserTimezone, getVenueTimezone, isDST, isValidTimezone, normalizeTimezone, getIANATimezone, isValidIANATimezone, getAllTimezones, formatTimezoneForDisplay, getTimezoneOptions, getCommonUSTimezoneOptions, } from '../timezone';
|
|
3
3
|
import { DateTimeError, DateTimeErrorCode } from '../types';
|
|
4
4
|
describe('timezone utilities', () => {
|
package/dist/datetime/parse.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module datetime/parse
|
|
8
8
|
*/
|
|
9
|
-
import { format } from 'date-fns';
|
|
9
|
+
import { format, parse } from 'date-fns';
|
|
10
10
|
import { fromZonedTime, toZonedTime } from 'date-fns-tz';
|
|
11
11
|
import { DATE_FORMATS } from './constants';
|
|
12
12
|
import { isValidTimezone } from './timezone';
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* - UI states (loading, saving, saved)
|
|
8
8
|
* - Section-level validation for progressive forms
|
|
9
9
|
*/
|
|
10
|
+
import { z } from 'zod';
|
|
10
11
|
// ============================================================================
|
|
11
12
|
// Implementation
|
|
12
13
|
// ============================================================================
|
|
@@ -45,9 +45,11 @@ describe('SelectField Label', () => {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
describe('SelectField Placeholder', () => {
|
|
48
|
-
test('default placeholder is
|
|
49
|
-
render(SelectField);
|
|
50
|
-
|
|
48
|
+
test('default placeholder is empty', () => {
|
|
49
|
+
const { container } = render(SelectField);
|
|
50
|
+
const button = container.querySelector('button[aria-haspopup="listbox"]');
|
|
51
|
+
// With empty placeholder, the button text content should be minimal
|
|
52
|
+
expect(button).toBeInTheDocument();
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
test('custom placeholder is displayed', () => {
|
|
@@ -64,9 +66,10 @@ describe('SelectField Items', () => {
|
|
|
64
66
|
expect(container.querySelector('button[aria-haspopup="listbox"]')).toBeInTheDocument();
|
|
65
67
|
});
|
|
66
68
|
|
|
67
|
-
test('empty items renders select with
|
|
69
|
+
test('empty items renders select with button', () => {
|
|
68
70
|
const { container } = render(SelectField, { props: { items: [] } });
|
|
69
|
-
|
|
71
|
+
const button = container.querySelector('button[aria-haspopup="listbox"]');
|
|
72
|
+
expect(button).toBeInTheDocument();
|
|
70
73
|
});
|
|
71
74
|
});
|
|
72
75
|
|
|
@@ -105,6 +105,7 @@ describe("MultiSelect Component Tests", () => {
|
|
|
105
105
|
test("Clears all selections when clicking clear button", async () => {
|
|
106
106
|
const { user } = setupTest({
|
|
107
107
|
value: ["opt1", "opt2", "opt3"],
|
|
108
|
+
placeholder: "Select options",
|
|
108
109
|
});
|
|
109
110
|
|
|
110
111
|
const clearButton = screen.getByRole("button", { name: /clear all/i });
|
|
@@ -188,6 +189,7 @@ describe("MultiSelect Component Tests", () => {
|
|
|
188
189
|
test("Toggles item off when clicking selected item", async () => {
|
|
189
190
|
const { user } = setupTest({
|
|
190
191
|
value: ["opt1"],
|
|
192
|
+
placeholder: "Select options",
|
|
191
193
|
});
|
|
192
194
|
const trigger = screen.getByRole("combobox");
|
|
193
195
|
|
|
@@ -253,6 +255,7 @@ describe("MultiSelect Component Tests", () => {
|
|
|
253
255
|
test("Initializes empty value as array", () => {
|
|
254
256
|
setupTest({
|
|
255
257
|
value: null,
|
|
258
|
+
placeholder: "Select options",
|
|
256
259
|
});
|
|
257
260
|
// Should not crash and show placeholder
|
|
258
261
|
expect(screen.getByText("Select options")).toBeInTheDocument();
|
|
@@ -63,11 +63,11 @@ describe('PlaceAutocomplete Component', () => {
|
|
|
63
63
|
expect(input).toBeInTheDocument();
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
test('renders with
|
|
66
|
+
test('renders with empty placeholder by default', async () => {
|
|
67
67
|
setupTest();
|
|
68
68
|
await waitFor(() => {
|
|
69
69
|
const input = screen.getByRole('textbox');
|
|
70
|
-
expect(input).toHaveAttribute('placeholder', '
|
|
70
|
+
expect(input).toHaveAttribute('placeholder', '');
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
|
|
@@ -154,17 +154,17 @@ describe('PlaceAutocomplete Component', () => {
|
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
describe('Mode Variants', () => {
|
|
157
|
-
test('default mode
|
|
157
|
+
test('default mode has empty placeholder', () => {
|
|
158
158
|
setupTest();
|
|
159
159
|
const input = screen.getByRole('textbox');
|
|
160
|
-
expect(input).toHaveAttribute('placeholder', '
|
|
160
|
+
expect(input).toHaveAttribute('placeholder', '');
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
test('cityState mode
|
|
163
|
+
test('cityState mode has empty placeholder by default', async () => {
|
|
164
164
|
setupTest({ mode: 'cityState' });
|
|
165
165
|
await waitFor(() => {
|
|
166
166
|
const input = screen.getByRole('textbox');
|
|
167
|
-
expect(input).toHaveAttribute('placeholder', '
|
|
167
|
+
expect(input).toHaveAttribute('placeholder', '');
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
170
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
let {
|
|
25
25
|
fetchFields = ['formattedAddress', 'addressComponents'],
|
|
26
|
-
placeholder = $bindable('
|
|
26
|
+
placeholder = $bindable(''),
|
|
27
27
|
language = 'en-US',
|
|
28
28
|
region = 'US',
|
|
29
29
|
autocomplete = 'off',
|
|
@@ -68,11 +68,6 @@
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
$effect(() => {
|
|
72
|
-
if (mode === 'cityState' && placeholder === 'Search for location...') {
|
|
73
|
-
placeholder = 'Search for city, state...';
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
71
|
|
|
77
72
|
const reset = () => {
|
|
78
73
|
currentSuggestion = -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceAutocomplete.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.ts"],"names":[],"mappings":"AASA,0CAA0C,CAAE,UAAU,gBAAgB;IAAM,QAAQ,EAAE,MAAM,CAAC;IAAI,SAAS,EAAE,MAAM,CAAC;IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;CAAG;AACzI,sCAAsC,CAAE,UAAU,SAAS;IAAM,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAI,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAAI,IAAI,CAAC,EAAE,MAAM,CAAC;IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAAG;AAMrL,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"PlaceAutocomplete.svelte.d.ts","sourceRoot":"","sources":["../../../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