bits-ui 2.9.7 → 2.9.8
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/app.d.ts +1 -0
- package/dist/bits/accordion/components/accordion.svelte +1 -1
- package/dist/bits/calendar/components/calendar.svelte +1 -1
- package/dist/bits/command/compute-command-score.js +1 -1
- package/dist/bits/date-field/components/date-field.svelte +12 -5
- package/dist/bits/date-field/date-field.svelte.js +18 -12
- package/dist/bits/pin-input/pin-input.svelte.js +1 -1
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-x.svelte +1 -1
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-y.svelte +1 -1
- package/dist/bits/select/components/select.svelte +1 -1
- package/dist/bits/time-field/time-field.svelte.js +1 -1
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +2 -2
- package/dist/internal/date-time/calendar-helpers.svelte.js +2 -2
- package/dist/internal/debounce.js +1 -1
- package/dist/internal/focus.js +1 -1
- package/dist/shared/css.d.ts +1 -2
- package/package.json +7 -7
package/dist/app.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// oxlint-disable no-var
|
|
1
2
|
import type { ReadableBox } from "svelte-toolbelt";
|
|
2
3
|
import type { DismissibleLayerState } from "./bits/utilities/dismissible-layer/use-dismissable-layer.svelte.ts";
|
|
3
4
|
import type { InteractOutsideBehaviorType } from "./bits/utilities/dismissible-layer/types.ts";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { watch } from "runed";
|
|
3
3
|
import { box } from "svelte-toolbelt";
|
|
4
|
-
import type { DateValue } from "@internationalized/date";
|
|
5
4
|
import { DateFieldRootState } from "../date-field.svelte.js";
|
|
6
5
|
import type { DateFieldRootProps } from "../types.js";
|
|
7
6
|
import { noop } from "../../../internal/noop.js";
|
|
@@ -29,15 +28,19 @@
|
|
|
29
28
|
children,
|
|
30
29
|
}: DateFieldRootProps = $props();
|
|
31
30
|
|
|
32
|
-
function handleDefaultPlaceholder() {
|
|
33
|
-
if (placeholder !== undefined) return;
|
|
31
|
+
function handleDefaultPlaceholder(setPlaceholder = true) {
|
|
32
|
+
if (placeholder !== undefined) return placeholder;
|
|
34
33
|
|
|
35
34
|
const defaultPlaceholder = getDefaultDate({
|
|
36
35
|
granularity,
|
|
37
36
|
defaultValue: value,
|
|
38
37
|
});
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
if (setPlaceholder) {
|
|
40
|
+
placeholder = defaultPlaceholder;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return defaultPlaceholder;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
// SSR
|
|
@@ -64,8 +67,12 @@
|
|
|
64
67
|
}
|
|
65
68
|
),
|
|
66
69
|
placeholder: box.with(
|
|
67
|
-
() =>
|
|
70
|
+
() => {
|
|
71
|
+
if (placeholder === undefined) return handleDefaultPlaceholder(false);
|
|
72
|
+
return placeholder;
|
|
73
|
+
},
|
|
68
74
|
(v) => {
|
|
75
|
+
if (v === undefined) return;
|
|
69
76
|
placeholder = v;
|
|
70
77
|
onPlaceholderChange(v);
|
|
71
78
|
}
|
|
@@ -33,7 +33,11 @@ const SEGMENT_CONFIGS = {
|
|
|
33
33
|
max: 12,
|
|
34
34
|
cycle: 1,
|
|
35
35
|
padZero: true,
|
|
36
|
-
getAnnouncement: (month, root) =>
|
|
36
|
+
getAnnouncement: (month, root) => {
|
|
37
|
+
if (!root.placeholder.current)
|
|
38
|
+
return "";
|
|
39
|
+
return `${month} - ${root.formatter.fullMonth(toDate(root.placeholder.current.set({ month })))}`;
|
|
40
|
+
},
|
|
37
41
|
},
|
|
38
42
|
year: {
|
|
39
43
|
min: 1,
|
|
@@ -384,16 +388,18 @@ export class DateFieldRootState {
|
|
|
384
388
|
const inferred = inferGranularity(this.placeholder.current, this.granularity.current);
|
|
385
389
|
return inferred;
|
|
386
390
|
});
|
|
387
|
-
dateRef = $derived.by(() => this.value.current
|
|
388
|
-
allSegmentContent = $derived.by(() =>
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
391
|
+
dateRef = $derived.by(() => this.value.current !== undefined ? this.value.current : this.placeholder.current);
|
|
392
|
+
allSegmentContent = $derived.by(() => {
|
|
393
|
+
return createContent({
|
|
394
|
+
segmentValues: this.segmentValues,
|
|
395
|
+
formatter: this.formatter,
|
|
396
|
+
locale: this.locale.current,
|
|
397
|
+
granularity: this.inferredGranularity,
|
|
398
|
+
dateRef: this.dateRef,
|
|
399
|
+
hideTimeZone: this.hideTimeZone.current,
|
|
400
|
+
hourCycle: this.hourCycle.current,
|
|
401
|
+
});
|
|
402
|
+
});
|
|
397
403
|
segmentContents = $derived.by(() => this.allSegmentContent.arr);
|
|
398
404
|
sharedSegmentAttrs = {
|
|
399
405
|
role: "spinbutton",
|
|
@@ -1055,7 +1061,7 @@ class DateFieldHourSegmentState extends BaseNumericSegmentState {
|
|
|
1055
1061
|
// Add special handling for hour display with dayPeriod
|
|
1056
1062
|
if (isNumberString(e.key)) {
|
|
1057
1063
|
const oldUpdateSegment = this.root.updateSegment.bind(this.root);
|
|
1058
|
-
//
|
|
1064
|
+
// oxlint-disable-next-line no-explicit-any
|
|
1059
1065
|
this.root.updateSegment = (part, cb) => {
|
|
1060
1066
|
const result = oldUpdateSegment(part, cb);
|
|
1061
1067
|
// After updating hour, check if we need to display "12" instead of "0"
|
|
@@ -413,7 +413,7 @@ export class PinInputCellState {
|
|
|
413
413
|
...this.attachment,
|
|
414
414
|
}));
|
|
415
415
|
}
|
|
416
|
-
//
|
|
416
|
+
// oxlint-disable-next-line no-explicit-any
|
|
417
417
|
export function syncTimeouts(cb, domContext) {
|
|
418
418
|
const t1 = domContext.setTimeout(cb, 0); // For faster machines
|
|
419
419
|
const t2 = domContext.setTimeout(cb, 1_0);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const scrollbarXState = ScrollAreaScrollbarXState.create({
|
|
13
13
|
mounted: box.with(() => isMounted.current),
|
|
14
14
|
});
|
|
15
|
-
//
|
|
15
|
+
// oxlint-disable-next-line no-explicit-any
|
|
16
16
|
const mergedProps = $derived(mergeProps(restProps, scrollbarXState.props)) as any;
|
|
17
17
|
</script>
|
|
18
18
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
mounted: box.with(() => isMounted.current),
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// oxlint-disable-next-line no-explicit-any
|
|
17
17
|
const mergedProps = $derived(mergeProps(restProps, scrollbarYState.props)) as any;
|
|
18
18
|
</script>
|
|
19
19
|
|
|
@@ -796,7 +796,7 @@ class TimeFieldHourSegmentState extends BaseTimeSegmentState {
|
|
|
796
796
|
onkeydown(e) {
|
|
797
797
|
if (isNumberString(e.key)) {
|
|
798
798
|
const oldUpdateSegment = this.root.updateSegment.bind(this.root);
|
|
799
|
-
//
|
|
799
|
+
// oxlint-disable-next-line no-explicit-any
|
|
800
800
|
this.root.updateSegment = (part, cb) => {
|
|
801
801
|
const result = oldUpdateSegment(part, cb);
|
|
802
802
|
// after updating hour, check if we need to display "12" instead of "0"
|
|
@@ -227,10 +227,10 @@ function createWrappedEvent(e) {
|
|
|
227
227
|
return isPrevented;
|
|
228
228
|
}
|
|
229
229
|
if (prop in target) {
|
|
230
|
-
//
|
|
230
|
+
// oxlint-disable-next-line no-explicit-any
|
|
231
231
|
return target[prop];
|
|
232
232
|
}
|
|
233
|
-
//
|
|
233
|
+
// oxlint-disable-next-line no-explicit-any
|
|
234
234
|
return e[prop];
|
|
235
235
|
},
|
|
236
236
|
});
|
|
@@ -227,7 +227,7 @@ export function handleCalendarKeydown({ event, handleCellClick, shiftFocus, plac
|
|
|
227
227
|
const currentCell = event.target;
|
|
228
228
|
if (!isCalendarDayNode(currentCell))
|
|
229
229
|
return;
|
|
230
|
-
//
|
|
230
|
+
// oxlint-disable-next-line no-explicit-any
|
|
231
231
|
if (!ARROW_KEYS.includes(event.key) && !SELECT_KEYS.includes(event.key))
|
|
232
232
|
return;
|
|
233
233
|
event.preventDefault();
|
|
@@ -237,7 +237,7 @@ export function handleCalendarKeydown({ event, handleCellClick, shiftFocus, plac
|
|
|
237
237
|
[kbd.ARROW_LEFT]: -1,
|
|
238
238
|
[kbd.ARROW_RIGHT]: 1,
|
|
239
239
|
};
|
|
240
|
-
//
|
|
240
|
+
// oxlint-disable-next-line no-explicit-any
|
|
241
241
|
if (ARROW_KEYS.includes(event.key)) {
|
|
242
242
|
const add = kbdFocusMap[event.key];
|
|
243
243
|
if (add !== undefined) {
|
package/dist/internal/focus.js
CHANGED
|
@@ -84,7 +84,7 @@ export function getTabbableCandidates(container) {
|
|
|
84
84
|
const nodes = [];
|
|
85
85
|
const doc = getDocument(container);
|
|
86
86
|
const walker = doc.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
87
|
-
//
|
|
87
|
+
// oxlint-disable-next-line no-explicit-any
|
|
88
88
|
acceptNode: (node) => {
|
|
89
89
|
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
90
90
|
if (node.disabled || node.hidden || isHiddenInput)
|
package/dist/shared/css.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
1
|
import type * as CSS from "csstype";
|
|
3
2
|
|
|
4
3
|
declare module "csstype" {
|
|
5
4
|
interface Properties {
|
|
6
5
|
// Allow any CSS Custom Properties
|
|
7
|
-
//
|
|
6
|
+
// oxlint-disable-next-line no-explicit-any
|
|
8
7
|
[index: `--${string}`]: any;
|
|
9
8
|
}
|
|
10
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bits-ui",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "github:huntabyte/bits-ui",
|
|
6
6
|
"funding": "https://github.com/sponsors/huntabyte",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@internationalized/date": "^3.8.2",
|
|
23
23
|
"@sveltejs/kit": "^2.31.0",
|
|
24
|
-
"@sveltejs/package": "
|
|
25
|
-
"@sveltejs/vite-plugin-svelte": "^6.
|
|
24
|
+
"@sveltejs/package": "2.5.0",
|
|
25
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.0",
|
|
26
26
|
"@types/node": "^20.19.0",
|
|
27
27
|
"@types/resize-observer-browser": "^0.1.11",
|
|
28
28
|
"csstype": "^3.1.3",
|
|
29
29
|
"jsdom": "^24.1.3",
|
|
30
30
|
"publint": "^0.2.12",
|
|
31
|
-
"svelte": "^5.38.
|
|
31
|
+
"svelte": "^5.38.10",
|
|
32
32
|
"svelte-check": "^4.3.1",
|
|
33
|
-
"typescript": "^5.
|
|
34
|
-
"vite": "^7.
|
|
35
|
-
"vitest": "^3.2.
|
|
33
|
+
"typescript": "^5.9.2",
|
|
34
|
+
"vite": "^7.1.5",
|
|
35
|
+
"vitest": "^3.2.4"
|
|
36
36
|
},
|
|
37
37
|
"svelte": "./dist/index.js",
|
|
38
38
|
"types": "./dist/index.d.ts",
|