@getmicdrop/svelte-components 5.15.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/calendar/Calendar/MiniMonthCalendar.svelte +4 -4
- package/dist/calendar/PublicCard/PublicCard.svelte +3 -3
- 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/patterns/chat/ChatContainer.svelte +1 -1
- package/dist/patterns/navigation/BottomNav.svelte +1 -1
- package/dist/patterns/navigation/Header.svelte +1 -1
- package/dist/primitives/BottomSheet/BottomSheet.svelte +18 -3
- package/dist/primitives/BottomSheet/BottomSheet.svelte.d.ts +2 -0
- package/dist/primitives/BottomSheet/BottomSheet.svelte.d.ts.map +1 -1
- package/dist/primitives/Button/Button.svelte +1 -1
- package/dist/primitives/Drawer/Drawer.svelte +1 -9
- package/dist/primitives/Drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/primitives/Input/Select.svelte +1 -1
- package/dist/primitives/Modal/Modal.svelte +2 -2
- package/dist/recipes/SuperLogin/SuperLogin.svelte +7 -7
- 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/dist/services/ShowService.js +1 -1
- package/dist/utils/greetings.js +3 -3
- package/dist/utils/imageValidation.js +1 -1
- package/package.json +1 -1
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
let nextPressed = $state(false);
|
|
41
41
|
let todayPressed = $state(false);
|
|
42
42
|
|
|
43
|
-
let
|
|
44
|
-
const
|
|
45
|
-
const
|
|
43
|
+
let _momentumAnimationId = null;
|
|
44
|
+
const _MOMENTUM_FRICTION = 0.92;
|
|
45
|
+
const _MOMENTUM_MIN_VELOCITY = 0.05;
|
|
46
46
|
|
|
47
47
|
const SWIPE_THRESHOLD = 0.15;
|
|
48
48
|
const VELOCITY_THRESHOLD = 0.3;
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
return checkDate < todayLocal;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
function
|
|
102
|
+
function _isSelectedDate(dateStr) {
|
|
103
103
|
return selectedDates.includes(dateStr);
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
onEventClick,
|
|
9
9
|
} = $props();
|
|
10
10
|
|
|
11
|
-
let
|
|
11
|
+
let _isSmallScreen = $state(false);
|
|
12
12
|
|
|
13
13
|
const DEFAULT_PLACEHOLDER = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect fill='%23e5e7eb' width='100' height='100'/%3E%3Cpath d='M50 25c-8.3 0-15 6.7-15 15v5c0 8.3 6.7 15 15 15s15-6.7 15-15v-5c0-8.3-6.7-15-15-15zm0 45c-13.8 0-25 5.6-25 12.5V90h50v-7.5c0-6.9-11.2-12.5-25-12.5z' fill='%239ca3af'/%3E%3C/svg%3E";
|
|
14
14
|
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
function handleResize() {
|
|
24
|
-
|
|
24
|
+
_isSmallScreen = window.innerWidth < 768;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
$effect(() => {
|
|
28
|
-
|
|
28
|
+
_isSmallScreen = window.innerWidth < 768;
|
|
29
29
|
window.addEventListener("resize", handleResize);
|
|
30
30
|
return () => {
|
|
31
31
|
if (typeof window !== 'undefined') {
|
|
@@ -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
|
// ============================================================================
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
41
|
{#if footer}
|
|
42
|
-
<div class="px-4 py-3 border-t border-gray-200 dark:border-gray-700 bg-
|
|
42
|
+
<div class="px-4 py-3 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shrink-0">
|
|
43
43
|
{@render footer()}
|
|
44
44
|
</div>
|
|
45
45
|
{/if}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import Logo from "../../assets/images/Logo.png";
|
|
6
6
|
import Avatar from "../../primitives/Avatar/Avatar.svelte";
|
|
7
7
|
import DarkModeToggle from "../../primitives/DarkModeToggle.svelte";
|
|
8
|
-
import
|
|
8
|
+
import IconComponent from "../../primitives/Icons/Icon.svelte";
|
|
9
9
|
import ChevronLeft from "../../primitives/Icons/ChevronLeft.svelte";
|
|
10
10
|
import Button from "../../primitives/Button/Button.svelte";
|
|
11
11
|
import MenuItem from "../../primitives/MenuItem/MenuItem.svelte";
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
open?: boolean;
|
|
11
11
|
/** Title displayed in the header */
|
|
12
12
|
title?: string;
|
|
13
|
+
/** Keep as bottom sheet at all screen sizes (never convert to centered modal) */
|
|
14
|
+
alwaysSheet?: boolean;
|
|
13
15
|
/** Callback when the sheet should close */
|
|
14
16
|
onclose?: () => void;
|
|
15
17
|
/** Main content */
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
let {
|
|
22
24
|
open = $bindable(false),
|
|
23
25
|
title = '',
|
|
26
|
+
alwaysSheet = false,
|
|
24
27
|
onclose,
|
|
25
28
|
children,
|
|
26
29
|
actions
|
|
@@ -57,6 +60,18 @@
|
|
|
57
60
|
document.body.style.overflow = "";
|
|
58
61
|
}
|
|
59
62
|
});
|
|
63
|
+
|
|
64
|
+
let backdropClass = $derived(
|
|
65
|
+
alwaysSheet
|
|
66
|
+
? "fixed inset-0 z-50 flex items-end bg-gray-900/50 dark:bg-gray-900/80"
|
|
67
|
+
: "fixed inset-0 z-50 flex items-end md:items-center md:justify-center bg-gray-900/50 dark:bg-gray-900/80"
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
let sheetClass = $derived(
|
|
71
|
+
alwaysSheet
|
|
72
|
+
? "w-full max-h-[90dvh] bg-white dark:bg-gray-800 rounded-t-xl shadow-xl flex flex-col overflow-hidden"
|
|
73
|
+
: "w-full max-h-[90dvh] md:max-w-lg md:max-h-[80vh] md:m-4 bg-white dark:bg-gray-800 rounded-t-xl md:rounded-lg shadow-xl flex flex-col overflow-hidden"
|
|
74
|
+
);
|
|
60
75
|
</script>
|
|
61
76
|
|
|
62
77
|
<svelte:window onkeydown={handleKeydown} />
|
|
@@ -65,18 +80,18 @@
|
|
|
65
80
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
66
81
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
67
82
|
<div
|
|
68
|
-
class=
|
|
83
|
+
class={backdropClass}
|
|
69
84
|
onclick={handleBackdropClick}
|
|
70
85
|
transition:fade={{ duration: 200 }}
|
|
71
86
|
>
|
|
72
87
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
73
88
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
74
89
|
<div
|
|
75
|
-
class=
|
|
90
|
+
class={sheetClass}
|
|
76
91
|
onclick={(e) => e.stopPropagation()}
|
|
77
92
|
transition:fly={{ y: 300, duration: 300, easing: cubicOut }}
|
|
78
93
|
>
|
|
79
|
-
<div class="flex justify-center pt-3 pb-2 shrink-0 md:hidden">
|
|
94
|
+
<div class="flex justify-center pt-3 pb-2 shrink-0 {alwaysSheet ? '' : 'md:hidden'}" >
|
|
80
95
|
<div class="w-10 h-1 bg-gray-300 dark:bg-gray-600 rounded-full"></div>
|
|
81
96
|
</div>
|
|
82
97
|
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
open?: boolean;
|
|
5
5
|
/** Title displayed in the header */
|
|
6
6
|
title?: string;
|
|
7
|
+
/** Keep as bottom sheet at all screen sizes (never convert to centered modal) */
|
|
8
|
+
alwaysSheet?: boolean;
|
|
7
9
|
/** Callback when the sheet should close */
|
|
8
10
|
onclose?: () => void;
|
|
9
11
|
/** Main content */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/BottomSheet/BottomSheet.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIpC,UAAU,KAAK;IACb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"BottomSheet.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/BottomSheet/BottomSheet.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIpC,UAAU,KAAK;IACb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAiGH,QAAA,MAAM,WAAW,+CAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
link: "text-blue-700 bg-transparent border-transparent hover:underline dark:text-blue-500",
|
|
119
119
|
icon: "text-gray-500 bg-transparent border-transparent hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700",
|
|
120
120
|
toggle: "text-gray-900 bg-gray-100 border border-gray-200 hover:bg-gray-200 dark:bg-gray-700 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600",
|
|
121
|
-
success: "text-white bg-green-600 border border-green-600",
|
|
121
|
+
success: "text-white bg-green-600 border border-green-600 hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
// Active state classes for ghost and toggle
|
|
@@ -130,17 +130,15 @@
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
//
|
|
133
|
+
// Focus management when drawer is open (no body scroll lock — allow background scrolling)
|
|
134
134
|
$effect(() => {
|
|
135
135
|
if (typeof document !== "undefined") {
|
|
136
136
|
if (isVisible) {
|
|
137
|
-
document.body.style.overflow = "hidden";
|
|
138
137
|
// Store previously focused element and focus drawer
|
|
139
138
|
previouslyFocusedElement = document.activeElement;
|
|
140
139
|
// Use setTimeout to ensure drawer is rendered before focusing
|
|
141
140
|
setTimeout(() => drawerElement?.focus(), 0);
|
|
142
141
|
} else {
|
|
143
|
-
document.body.style.overflow = "";
|
|
144
142
|
// Restore focus when closing
|
|
145
143
|
if (previouslyFocusedElement && previouslyFocusedElement instanceof HTMLElement) {
|
|
146
144
|
previouslyFocusedElement.focus();
|
|
@@ -148,12 +146,6 @@
|
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
});
|
|
151
|
-
|
|
152
|
-
onDestroy(() => {
|
|
153
|
-
if (typeof document !== "undefined") {
|
|
154
|
-
document.body.style.overflow = "";
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
149
|
</script>
|
|
158
150
|
|
|
159
151
|
<svelte:window onkeydown={handleKeydown} />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGpC,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGpC,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA2LH,QAAA,MAAM,MAAM,+CAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
let
|
|
115
|
+
let _authError = $state("");
|
|
116
116
|
let email = $state((() => userEmail)());
|
|
117
117
|
let password = $state("");
|
|
118
118
|
let errors = $state({});
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
email = rememberedUser.email;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
} catch (
|
|
184
|
+
} catch (_e) {
|
|
185
185
|
// Ignore parse errors
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
|
|
206
206
|
// Handle browser back/forward buttons
|
|
207
207
|
const handlePopState = () => {
|
|
208
|
-
const
|
|
208
|
+
const _path = window.location.pathname;
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
window.addEventListener("popstate", handlePopState);
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
async function handleSubmit(event) {
|
|
276
276
|
event.preventDefault();
|
|
277
277
|
isLoading = true;
|
|
278
|
-
|
|
278
|
+
_authError = "";
|
|
279
279
|
// Try to get values from DOM first (for testing frameworks), fall back to Svelte state
|
|
280
280
|
const emailInput = /** @type {HTMLInputElement|null} */ (document.querySelector('#email'));
|
|
281
281
|
const passwordInput = /** @type {HTMLInputElement|null} */ (document.querySelector('#password'));
|
|
@@ -436,7 +436,7 @@
|
|
|
436
436
|
});
|
|
437
437
|
|
|
438
438
|
try {
|
|
439
|
-
const [
|
|
439
|
+
const [_delay, _response] = await Promise.all([minDelay, apiCall]);
|
|
440
440
|
isLoading = false;
|
|
441
441
|
|
|
442
442
|
// Always show success to prevent email enumeration
|
|
@@ -483,7 +483,7 @@
|
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
try {
|
|
486
|
-
const [
|
|
486
|
+
const [_delay2, _response2] = await Promise.all([minDelay, apiCall]);
|
|
487
487
|
|
|
488
488
|
isLoading = false;
|
|
489
489
|
|
|
@@ -549,7 +549,7 @@
|
|
|
549
549
|
'rememberedUser',
|
|
550
550
|
JSON.stringify({ email: emailVal, firstName: firstNameVal })
|
|
551
551
|
);
|
|
552
|
-
} catch (
|
|
552
|
+
} catch (_e) {
|
|
553
553
|
// Ignore storage errors
|
|
554
554
|
}
|
|
555
555
|
}
|
|
@@ -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":["../../../../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;AAiTH,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
package/dist/utils/greetings.js
CHANGED
|
@@ -142,7 +142,7 @@ export function getGreeting(name) {
|
|
|
142
142
|
return greeting;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
} catch (
|
|
145
|
+
} catch (_e) {
|
|
146
146
|
// localStorage unavailable or parse error - continue to generate
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -157,7 +157,7 @@ export function getGreeting(name) {
|
|
|
157
157
|
day: currentDay,
|
|
158
158
|
cachedName: name
|
|
159
159
|
}));
|
|
160
|
-
} catch (
|
|
160
|
+
} catch (_e2) {
|
|
161
161
|
// localStorage unavailable - greeting still works, just won't persist
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -181,7 +181,7 @@ export function clearGreetingCache() {
|
|
|
181
181
|
if (typeof window === 'undefined') return;
|
|
182
182
|
try {
|
|
183
183
|
localStorage.removeItem(STORAGE_KEY);
|
|
184
|
-
} catch (
|
|
184
|
+
} catch (_e) {
|
|
185
185
|
// localStorage unavailable
|
|
186
186
|
}
|
|
187
187
|
}
|