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 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";
@@ -43,7 +43,7 @@
43
43
  () => value!,
44
44
  (v) => {
45
45
  value = v;
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ // oxlint-disable-next-line no-explicit-any
47
47
  onValueChange(v as any);
48
48
  }
49
49
  ) as WritableBox<string> | WritableBox<string[]>,
@@ -109,7 +109,7 @@
109
109
  () => value,
110
110
  (v) => {
111
111
  value = v;
112
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
+ // oxlint-disable-next-line no-explicit-any
113
113
  onValueChange(v as any);
114
114
  }
115
115
  ),
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
1
+ // oxlint-disable ban-ts-comment
2
2
  // @ts-nocheck
3
3
  // The scores are arranged so that a continuous match of characters will
4
4
  // result in a total score of 1.
@@ -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
- placeholder = defaultPlaceholder;
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
- () => placeholder as DateValue,
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) => `${month} - ${root.formatter.fullMonth(toDate(root.placeholder.current.set({ month })))}`,
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 ?? this.placeholder.current);
388
- allSegmentContent = $derived.by(() => createContent({
389
- segmentValues: this.segmentValues,
390
- formatter: this.formatter,
391
- locale: this.locale.current,
392
- granularity: this.inferredGranularity,
393
- dateRef: this.dateRef,
394
- hideTimeZone: this.hideTimeZone.current,
395
- hourCycle: this.hourCycle.current,
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ // oxlint-disable-next-line no-explicit-any
17
17
  const mergedProps = $derived(mergeProps(restProps, scrollbarYState.props)) as any;
18
18
  </script>
19
19
 
@@ -48,7 +48,7 @@
48
48
  () => value!,
49
49
  (v) => {
50
50
  value = v;
51
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ // oxlint-disable-next-line no-explicit-any
52
52
  onValueChange(v as any);
53
53
  }
54
54
  ) as WritableBox<string> | WritableBox<string[]>,
@@ -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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
230
+ // oxlint-disable-next-line no-explicit-any
231
231
  return target[prop];
232
232
  }
233
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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) {
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ // oxlint-disable-next-line no-explicit-any
2
2
  export function debounce(fn, wait = 500) {
3
3
  let timeout = null;
4
4
  const debounced = (...args) => {
@@ -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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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)
@@ -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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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.7",
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": "^2.4.1",
25
- "@sveltejs/vite-plugin-svelte": "^6.1.2",
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.1",
31
+ "svelte": "^5.38.10",
32
32
  "svelte-check": "^4.3.1",
33
- "typescript": "^5.8.3",
34
- "vite": "^7.0.4",
35
- "vitest": "^3.2.3"
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",