@getmicdrop/svelte-components 5.16.0 → 5.16.2

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.
@@ -1,4 +1,4 @@
1
- import { render } from '@testing-library/svelte';
1
+ import { render, screen } from '@testing-library/svelte';
2
2
  import { expect, describe, test } from 'vitest';
3
3
  import Stack from './Stack.svelte';
4
4
  describe('Stack Component', () => {
@@ -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', () => {
@@ -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
  // ============================================================================
@@ -30,7 +30,7 @@
30
30
  let {
31
31
  value = $bindable(""),
32
32
  items = [],
33
- placeholder = "Select an option",
33
+ placeholder = "",
34
34
  label = "",
35
35
  required = false,
36
36
  disabled = false,
@@ -593,7 +593,7 @@
593
593
  <img
594
594
  src={imageArray[0]}
595
595
  alt="Uploaded"
596
- class="w-full h-full object-cover"
596
+ class="w-full h-full object-contain"
597
597
  />
598
598
  {#if !disabled}
599
599
  <div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-3">
@@ -684,7 +684,7 @@
684
684
  <img
685
685
  src={slot.image}
686
686
  alt="Uploaded"
687
- class="w-full h-full object-cover pointer-events-none"
687
+ class="w-full h-full object-contain pointer-events-none"
688
688
  draggable="false"
689
689
  />
690
690
  {#if showMainBadge && index === 0}
@@ -45,9 +45,11 @@ describe('SelectField Label', () => {
45
45
  });
46
46
 
47
47
  describe('SelectField Placeholder', () => {
48
- test('default placeholder is "Select an option"', () => {
49
- render(SelectField);
50
- expect(screen.getByText('Select an option')).toBeInTheDocument();
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 placeholder only', () => {
69
+ test('empty items renders select with button', () => {
68
70
  const { container } = render(SelectField, { props: { items: [] } });
69
- expect(screen.getByText('Select an option')).toBeInTheDocument();
71
+ const button = container.querySelector('button[aria-haspopup="listbox"]');
72
+ expect(button).toBeInTheDocument();
70
73
  });
71
74
  });
72
75
 
@@ -42,7 +42,7 @@
42
42
  let {
43
43
  value = $bindable(''),
44
44
  items = [],
45
- placeholder = 'Select an option',
45
+ placeholder = '',
46
46
  label = '',
47
47
  required = false,
48
48
  disabled = false,
@@ -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();
@@ -30,7 +30,7 @@
30
30
  let {
31
31
  value = $bindable([]),
32
32
  items = [],
33
- placeholder = "Select options",
33
+ placeholder = "",
34
34
  label = "",
35
35
  required = false,
36
36
  disabled = false,
@@ -63,11 +63,11 @@ describe('PlaceAutocomplete Component', () => {
63
63
  expect(input).toBeInTheDocument();
64
64
  });
65
65
 
66
- test('renders with default placeholder', async () => {
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', 'Search for location...');
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 is full', () => {
157
+ test('default mode has empty placeholder', () => {
158
158
  setupTest();
159
159
  const input = screen.getByRole('textbox');
160
- expect(input).toHaveAttribute('placeholder', 'Search for location...');
160
+ expect(input).toHaveAttribute('placeholder', '');
161
161
  });
162
162
 
163
- test('cityState mode updates placeholder', async () => {
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', 'Search for city, state...');
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('Search for location...'),
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,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,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;AAiTH,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmicdrop/svelte-components",
3
- "version": "5.16.0",
3
+ "version": "5.16.2",
4
4
  "description": "Shared component library for Micdrop applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",