@placeholderco/placeholder-ui 2.6.0 → 2.6.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.
|
@@ -33,11 +33,27 @@
|
|
|
33
33
|
// Calculate selected index for background positioning using derived state
|
|
34
34
|
const selectedIndex = $derived(options.findIndex((option) => option.value === value));
|
|
35
35
|
|
|
36
|
+
// Pending timers, cleared on destroy so they never read state after the component is gone
|
|
37
|
+
const pendingTimers = new Set<ReturnType<typeof setTimeout>>();
|
|
38
|
+
|
|
39
|
+
function scheduleRecalculate(delay: number) {
|
|
40
|
+
const id = setTimeout(() => {
|
|
41
|
+
pendingTimers.delete(id);
|
|
42
|
+
recalculateBackground();
|
|
43
|
+
}, delay);
|
|
44
|
+
pendingTimers.add(id);
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
onMount(() => {
|
|
37
48
|
// recalculate 10 times on startup to ensure background is positioned correctly
|
|
38
49
|
for (let i = 0; i < 10; i++) {
|
|
39
|
-
|
|
50
|
+
scheduleRecalculate(100 * i);
|
|
40
51
|
}
|
|
52
|
+
|
|
53
|
+
return () => {
|
|
54
|
+
for (const id of pendingTimers) clearTimeout(id);
|
|
55
|
+
pendingTimers.clear();
|
|
56
|
+
};
|
|
41
57
|
});
|
|
42
58
|
|
|
43
59
|
// Update background position and size based on selected element
|
|
@@ -60,7 +76,7 @@
|
|
|
60
76
|
*/
|
|
61
77
|
export function recalculateBackground(delay?: number) {
|
|
62
78
|
if (delay) {
|
|
63
|
-
|
|
79
|
+
scheduleRecalculate(delay);
|
|
64
80
|
return;
|
|
65
81
|
}
|
|
66
82
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
required?: boolean;
|
|
9
9
|
/** CSS classes for the container element */
|
|
10
10
|
containerClass?: string;
|
|
11
|
-
/** Selected time value in HH:mm format (bindable) */
|
|
11
|
+
/** Selected time value in HH:mm:ss format (bindable). Accepts HH:mm or HH:mm:ss on input; always emits HH:mm:ss. */
|
|
12
12
|
value?: string | undefined;
|
|
13
13
|
/** Use rounded time increments */
|
|
14
14
|
rounded?: boolean;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/** Currently selected date (for date-time combinations) */
|
|
20
20
|
selectedDate?: string | undefined;
|
|
21
21
|
/** Callback when selected time changes */
|
|
22
|
-
onchange?: (
|
|
22
|
+
onchange?: (time: string | undefined) => void;
|
|
23
23
|
}
|
|
24
24
|
</script>
|
|
25
25
|
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
value = timeString;
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
value = dayjs().format('HH:mm');
|
|
154
|
+
value = dayjs().format('HH:mm:ss');
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
if (value === undefined) {
|
|
@@ -7,7 +7,7 @@ export interface TimePickerProps {
|
|
|
7
7
|
required?: boolean;
|
|
8
8
|
/** CSS classes for the container element */
|
|
9
9
|
containerClass?: string;
|
|
10
|
-
/** Selected time value in HH:mm format (bindable) */
|
|
10
|
+
/** Selected time value in HH:mm:ss format (bindable). Accepts HH:mm or HH:mm:ss on input; always emits HH:mm:ss. */
|
|
11
11
|
value?: string | undefined;
|
|
12
12
|
/** Use rounded time increments */
|
|
13
13
|
rounded?: boolean;
|
|
@@ -18,7 +18,7 @@ export interface TimePickerProps {
|
|
|
18
18
|
/** Currently selected date (for date-time combinations) */
|
|
19
19
|
selectedDate?: string | undefined;
|
|
20
20
|
/** Callback when selected time changes */
|
|
21
|
-
onchange?: (
|
|
21
|
+
onchange?: (time: string | undefined) => void;
|
|
22
22
|
}
|
|
23
23
|
declare const TimePicker: import("svelte").Component<TimePickerProps, {}, "value">;
|
|
24
24
|
type TimePicker = ReturnType<typeof TimePicker>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@placeholderco/placeholder-ui",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "A modern, customizable Svelte 5 UI component library with comprehensive theming support. Re-brand it with a single config object.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Placeholderco",
|