Skip to content

Commit

Permalink
fix: progress
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Jan 9, 2024
1 parent 0c7861a commit 880d65e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-gorillas-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": minor
---

Progress: update `value` type to include `null` for `'indeterminate'` state
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"type": "module",
"dependencies": {
"@internationalized/date": "^3.5.1",
"@melt-ui/svelte": "0.67.0",
"@melt-ui/svelte": "0.68.0",
"nanoid": "^5.0.4"
},
"peerDependencies": {
Expand Down
22 changes: 8 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/lib/bits/date-field/components/date-field.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
export let readonly: $$Props["readonly"] = undefined;
export let validationId: $$Props["validationId"] = undefined;
export let descriptionId: $$Props["descriptionId"] = undefined;
export let readonlySegments: $$Props["readonlySegments"] = undefined;
const {
states: {
Expand All @@ -40,6 +41,7 @@
maxValue,
minValue,
readonly,
readonlySegments,
isDateUnavailable,
onValueChange: ({ next }) => {
if (value !== next) {
Expand Down Expand Up @@ -121,6 +123,7 @@
$: updateOption("maxValue", maxValue);
$: updateOption("minValue", minValue);
$: updateOption("readonly", readonly);
$: updateOption("readonlySegments", readonlySegments);
</script>

<slot isInvalid={$localIsInvalid} ids={$idValues} />
4 changes: 2 additions & 2 deletions src/lib/bits/date-range-field/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import type { Expand, OnChangeFn, OmitDates, DOMElement } from "$lib/internal/index.js";
import type { DateRange, SegmentPart } from "$lib/shared/index.js";
import type { DateValue } from "@internationalized/date";
import type { CreateDateFieldProps } from "@melt-ui/svelte";
import type { CreateDateRangeFieldProps } from "@melt-ui/svelte";

type Props = Expand<
Omit<OmitDates<CreateDateFieldProps>, "required" | "name"> & {
Omit<OmitDates<CreateDateRangeFieldProps>, "required" | "name"> & {
/**
* The value of the date field.
* You can bind this to a `DateValue` object to programmatically control the value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
export let readonly: $$Props["readonly"] = undefined;
export let validationId: $$Props["validationId"] = undefined;
export let descriptionId: $$Props["descriptionId"] = undefined;
export let readonlySegments: $$Props["readonlySegments"] = undefined;
const {
states: {
Expand All @@ -41,6 +42,7 @@
minValue,
readonly,
isDateUnavailable,
readonlySegments,
onValueChange: ({ next }) => {
if (value !== next) {
onValueChange?.(next);
Expand Down Expand Up @@ -174,6 +176,7 @@
$: updateOption("maxValue", maxValue);
$: updateOption("minValue", minValue);
$: updateOption("readonly", readonly);
$: updateOption("readonlySegments", readonlySegments);
$: idSlotProp = {
start: $startIdValues,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/bits/progress/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ type Props = Expand<
* The value of the progress bar.
* You can bind this to a number value to programmatically control the value.
*/
value?: CreateProgressProps["defaultValue"] & {};
value?: CreateProgressProps["defaultValue"];

/**
* A callback function called when the value changes.
*/
onValueChange?: OnChangeFn<number>;
onValueChange?: OnChangeFn<number | null>;
} & DOMElement
>;

Expand Down

0 comments on commit 880d65e

Please sign in to comment.