bits-ui 2.8.6 → 2.8.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.
@@ -129,11 +129,11 @@ export declare class CalendarCellState {
129
129
  readonly opts: CalendarCellStateOpts;
130
130
  readonly root: CalendarRootState;
131
131
  readonly cellDate: Date;
132
- readonly isDisabled: boolean;
133
132
  readonly isUnavailable: boolean;
134
133
  readonly isDateToday: boolean;
135
134
  readonly isOutsideMonth: boolean;
136
135
  readonly isOutsideVisibleMonths: boolean;
136
+ readonly isDisabled: boolean;
137
137
  readonly isFocusedDate: boolean;
138
138
  readonly isSelectedDate: boolean;
139
139
  readonly labelText: string;
@@ -143,6 +143,7 @@ export declare class CalendarCellState {
143
143
  disabled: boolean;
144
144
  unavailable: boolean;
145
145
  selected: boolean;
146
+ day: string;
146
147
  };
147
148
  readonly ariaDisabled: boolean;
148
149
  readonly sharedDataAttrs: {
@@ -450,11 +450,12 @@ export class CalendarCellState {
450
450
  opts;
451
451
  root;
452
452
  cellDate = $derived.by(() => toDate(this.opts.date.current));
453
- isDisabled = $derived.by(() => this.root.isDateDisabled(this.opts.date.current));
454
453
  isUnavailable = $derived.by(() => this.root.opts.isDateUnavailable.current(this.opts.date.current));
455
454
  isDateToday = $derived.by(() => isToday(this.opts.date.current, getLocalTimeZone()));
456
455
  isOutsideMonth = $derived.by(() => !isSameMonth(this.opts.date.current, this.opts.month.current));
457
456
  isOutsideVisibleMonths = $derived.by(() => this.root.isOutsideVisibleMonths(this.opts.date.current));
457
+ isDisabled = $derived.by(() => this.root.isDateDisabled(this.opts.date.current) ||
458
+ (this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current));
458
459
  isFocusedDate = $derived.by(() => isSameDay(this.opts.date.current, this.root.opts.placeholder.current));
459
460
  isSelectedDate = $derived.by(() => this.root.isDateSelected(this.opts.date.current));
460
461
  labelText = $derived.by(() => this.root.formatter.custom(this.cellDate, {
@@ -473,6 +474,7 @@ export class CalendarCellState {
473
474
  disabled: this.isDisabled,
474
475
  unavailable: this.isUnavailable,
475
476
  selected: this.isSelectedDate,
477
+ day: `${this.opts.date.current.day}`,
476
478
  }));
477
479
  ariaDisabled = $derived.by(() => {
478
480
  return (this.isDisabled ||
@@ -2,6 +2,7 @@ import { attachRef } from "svelte-toolbelt";
2
2
  import { Context, watch } from "runed";
3
3
  import { createBitsAttrs, getAriaChecked, getAriaRequired, getDataDisabled, } from "../../internal/attrs.js";
4
4
  import { kbd } from "../../internal/kbd.js";
5
+ import { arraysAreEqual } from "../../internal/arrays.js";
5
6
  const checkboxAttrs = createBitsAttrs({
6
7
  component: "checkbox",
7
8
  parts: ["root", "group", "group-label", "input"],
@@ -24,6 +25,8 @@ export class CheckboxGroupState {
24
25
  if (!this.opts.value.current.includes(checkboxValue)) {
25
26
  const newValue = [...$state.snapshot(this.opts.value.current), checkboxValue];
26
27
  this.opts.value.current = newValue;
28
+ if (arraysAreEqual(this.opts.value.current, newValue))
29
+ return;
27
30
  this.opts.onValueChange.current(newValue);
28
31
  }
29
32
  }
@@ -35,6 +38,8 @@ export class CheckboxGroupState {
35
38
  return;
36
39
  const newValue = this.opts.value.current.filter((v) => v !== checkboxValue);
37
40
  this.opts.value.current = newValue;
41
+ if (arraysAreEqual(this.opts.value.current, newValue))
42
+ return;
38
43
  this.opts.onValueChange.current(newValue);
39
44
  }
40
45
  props = $derived.by(() => ({
@@ -4,6 +4,7 @@
4
4
  import { CheckboxGroupState } from "../checkbox.svelte.js";
5
5
  import { noop } from "../../../internal/noop.js";
6
6
  import { createId } from "../../../internal/create-id.js";
7
+ import { arraysAreEqual } from "../../../internal/arrays.js";
7
8
 
8
9
  const uid = $props.id();
9
10
 
@@ -32,6 +33,7 @@
32
33
  value: box.with(
33
34
  () => $state.snapshot(value),
34
35
  (v) => {
36
+ if (arraysAreEqual(value, v)) return;
35
37
  value = $state.snapshot(v);
36
38
  onValueChange(v);
37
39
  }
@@ -123,10 +123,10 @@ export declare class RangeCalendarCellState {
123
123
  readonly root: RangeCalendarRootState;
124
124
  readonly attachment: RefAttachment;
125
125
  readonly cellDate: Date;
126
+ readonly isOutsideMonth: boolean;
126
127
  readonly isDisabled: boolean;
127
128
  readonly isUnavailable: boolean;
128
129
  readonly isDateToday: boolean;
129
- readonly isOutsideMonth: boolean;
130
130
  readonly isOutsideVisibleMonths: boolean;
131
131
  readonly isFocusedDate: boolean;
132
132
  readonly isSelectedDate: boolean;
@@ -539,10 +539,11 @@ export class RangeCalendarCellState {
539
539
  root;
540
540
  attachment;
541
541
  cellDate = $derived.by(() => toDate(this.opts.date.current));
542
- isDisabled = $derived.by(() => this.root.isDateDisabled(this.opts.date.current));
542
+ isOutsideMonth = $derived.by(() => !isSameMonth(this.opts.date.current, this.opts.month.current));
543
+ isDisabled = $derived.by(() => this.root.isDateDisabled(this.opts.date.current) ||
544
+ (this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current));
543
545
  isUnavailable = $derived.by(() => this.root.opts.isDateUnavailable.current(this.opts.date.current));
544
546
  isDateToday = $derived.by(() => isToday(this.opts.date.current, getLocalTimeZone()));
545
- isOutsideMonth = $derived.by(() => !isSameMonth(this.opts.date.current, this.opts.month.current));
546
547
  isOutsideVisibleMonths = $derived.by(() => this.root.isOutsideVisibleMonths(this.opts.date.current));
547
548
  isFocusedDate = $derived.by(() => isSameDay(this.opts.date.current, this.root.opts.placeholder.current));
548
549
  isSelectedDate = $derived.by(() => this.root.isSelected(this.opts.date.current));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "2.8.6",
3
+ "version": "2.8.8",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",