@orianatech/pire 0.21.0 → 0.23.0

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.
@@ -1,12 +1,30 @@
1
1
  import type * as React from 'react';
2
2
  import type { DateValue } from 'react-aria-components';
3
- export interface DatePickerProps {
3
+ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
4
4
  label?: React.ReactNode;
5
- value?: DateValue | null;
6
- defaultValue?: DateValue | null;
7
- onChange?: (value: DateValue | null) => void;
8
- minValue?: DateValue;
9
- maxValue?: DateValue;
5
+ /** A `DateValue`, or the `YYYY-MM-DD` string one arrived as — a value straight off a JSON
6
+ * response needs no conversion. A datetime is accepted and trimmed to its date (`date`
7
+ * columns commonly serialise as `"2026-08-14T00:00:00.000000Z"`); the time and zone are
8
+ * discarded, because a `DateValue` is a calendar date and holds neither. A malformed date
9
+ * shows as an empty field rather than throwing. */
10
+ value?: DateValue | string | null;
11
+ defaultValue?: DateValue | string | null;
12
+ onChange?: (value: (TFormat extends 'iso' ? string : DateValue) | null) => void;
13
+ /**
14
+ * The shape `onChange` emits.
15
+ *
16
+ * `'object'` (the default) emits the `@internationalized/date` `DateValue` this component has
17
+ * always emitted. `'iso'` emits the `YYYY-MM-DD` string a consumer sends back to its API, and
18
+ * `null` for an empty field. Input accepts both shapes in either mode.
19
+ */
20
+ valueFormat?: TFormat;
21
+ /** Earliest date that can be picked, in either shape `value` accepts. `null` and `undefined`
22
+ * both mean "no bound", so a bound read out of the same state as the value needs no `??
23
+ * undefined` on the way in. An unreadable bound stops applying rather than throwing. */
24
+ minValue?: DateValue | string | null;
25
+ /** Latest date that can be picked — see `minValue`. In a from/to pair each end bounds the
26
+ * other, and both ends come out of the same state in the same shape. */
27
+ maxValue?: DateValue | string | null;
10
28
  /** Return true for dates that cannot be picked — factory calendar, blocked periods. */
11
29
  isDateUnavailable?: (date: DateValue) => boolean;
12
30
  description?: React.ReactNode;
@@ -24,4 +42,4 @@ export interface DatePickerProps {
24
42
  /** Date entry with a segmented field and a calendar popover. Segments follow the user's locale,
25
43
  * so a German user types dd.mm.yyyy without any prop change. Wrap the app in React Aria's
26
44
  * I18nProvider to pin a locale. */
27
- export declare function DatePicker({ label, description, errorMessage, size, fullWidth, className, style, ...rest }: DatePickerProps): React.JSX.Element;
45
+ export declare function DatePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, size, fullWidth, className, style, value, defaultValue, onChange, valueFormat, minValue, maxValue, ...rest }: DatePickerProps<TFormat>): React.JSX.Element;
@@ -1,12 +1,30 @@
1
1
  import type * as React from 'react';
2
2
  import type { DateValue } from 'react-aria-components';
3
- export interface DatePickerProps {
3
+ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
4
4
  label?: React.ReactNode;
5
- value?: DateValue | null;
6
- defaultValue?: DateValue | null;
7
- onChange?: (value: DateValue | null) => void;
8
- minValue?: DateValue;
9
- maxValue?: DateValue;
5
+ /** A `DateValue`, or the `YYYY-MM-DD` string one arrived as — a value straight off a JSON
6
+ * response needs no conversion. A datetime is accepted and trimmed to its date (`date`
7
+ * columns commonly serialise as `"2026-08-14T00:00:00.000000Z"`); the time and zone are
8
+ * discarded, because a `DateValue` is a calendar date and holds neither. A malformed date
9
+ * shows as an empty field rather than throwing. */
10
+ value?: DateValue | string | null;
11
+ defaultValue?: DateValue | string | null;
12
+ onChange?: (value: (TFormat extends 'iso' ? string : DateValue) | null) => void;
13
+ /**
14
+ * The shape `onChange` emits.
15
+ *
16
+ * `'object'` (the default) emits the `@internationalized/date` `DateValue` this component has
17
+ * always emitted. `'iso'` emits the `YYYY-MM-DD` string a consumer sends back to its API, and
18
+ * `null` for an empty field. Input accepts both shapes in either mode.
19
+ */
20
+ valueFormat?: TFormat;
21
+ /** Earliest date that can be picked, in either shape `value` accepts. `null` and `undefined`
22
+ * both mean "no bound", so a bound read out of the same state as the value needs no `??
23
+ * undefined` on the way in. An unreadable bound stops applying rather than throwing. */
24
+ minValue?: DateValue | string | null;
25
+ /** Latest date that can be picked — see `minValue`. In a from/to pair each end bounds the
26
+ * other, and both ends come out of the same state in the same shape. */
27
+ maxValue?: DateValue | string | null;
10
28
  /** Return true for dates that cannot be picked — factory calendar, blocked periods. */
11
29
  isDateUnavailable?: (date: DateValue) => boolean;
12
30
  description?: React.ReactNode;
@@ -24,5 +42,5 @@ export interface DatePickerProps {
24
42
  /** Date entry with a segmented field and a calendar popover. Segments follow the user's locale,
25
43
  * so a German user types dd.mm.yyyy without any prop change. Wrap the app in React Aria's
26
44
  * I18nProvider to pin a locale. */
27
- export declare function DatePicker({ label, description, errorMessage, size, fullWidth, className, style, ...rest }: DatePickerProps): React.JSX.Element;
45
+ export declare function DatePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, size, fullWidth, className, style, value, defaultValue, onChange, valueFormat, minValue, maxValue, ...rest }: DatePickerProps<TFormat>): React.JSX.Element;
28
46
  //# sourceMappingURL=DatePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/forms/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IACjD,W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G;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;6FAEyF;IACzF,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC;6EACyE;IACzE,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IACjD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;oCAEoC;AACpC,wBAAgB,UAAU,CAAC,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,QAAQ,EAAE,EAAE,KAAK,EAAE,WAAW,EAC1F,YAAY,EAAE,IAAW,EAAE,SAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAC5F,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,qBAqDrE"}
@@ -1,22 +1,56 @@
1
1
  import type * as React from 'react';
2
2
  import type { DateValue } from 'react-aria-components';
3
+ /** A complete range: what this component emits, and what `rangeLengthInDays` measures. */
3
4
  export interface DateRange {
4
5
  start: DateValue;
5
6
  end: DateValue;
6
7
  }
8
+ /** A complete range as ISO strings — what `onChange` emits under `valueFormat="iso"`. */
9
+ export interface IsoDateRange {
10
+ start: string;
11
+ end: string;
12
+ }
13
+ /**
14
+ * What `value` accepts: either end in either shape, and either end absent.
15
+ *
16
+ * The two ends are read separately on purpose. An unreadable or empty end leaves *that* end
17
+ * without a date instead of voiding the whole range, so a caller can pass the two halves of its
18
+ * state straight through rather than guarding that both parsed before building an object. Deciding
19
+ * what counts as a usable range is this component's job, which is the point of the prop.
20
+ */
21
+ export interface DateRangeInput {
22
+ start?: DateValue | string | null;
23
+ end?: DateValue | string | null;
24
+ }
7
25
  export interface DateRangePreset {
8
26
  id: string;
9
27
  label: string;
10
- /** The app computes the range: Pire cannot know when a customer's fiscal year starts. */
11
- range: () => DateRange;
28
+ /** The app computes the range: Pire cannot know when a customer's fiscal year starts. It also
29
+ * computes in whatever shape it stores, so either shape is accepted here. */
30
+ range: () => DateRangeInput;
12
31
  }
13
- export interface DateRangePickerProps {
32
+ export interface DateRangePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
14
33
  label?: React.ReactNode;
15
- value?: DateRange | null;
16
- defaultValue?: DateRange | null;
17
- onChange?: (value: DateRange | null) => void;
18
- minValue?: DateValue;
19
- maxValue?: DateValue;
34
+ /** Either end in either shape — see `DateRangeInput`. A range whose ends are both empty is an
35
+ * empty field. */
36
+ value?: DateRangeInput | null;
37
+ defaultValue?: DateRangeInput | null;
38
+ onChange?: (value: (TFormat extends 'iso' ? IsoDateRange : DateRange) | null) => void;
39
+ /**
40
+ * The shape `onChange` emits.
41
+ *
42
+ * `'object'` (the default) emits the `DateValue` pair this component has always emitted. `'iso'`
43
+ * emits `{ start: 'YYYY-MM-DD', end: 'YYYY-MM-DD' }`, the shape a consumer sends back to its API.
44
+ *
45
+ * Either way the emitted range is always complete or `null`: React Aria never reports half a
46
+ * range, even though it will happily *display* one while a caller is still filling it in.
47
+ */
48
+ valueFormat?: TFormat;
49
+ /** Earliest date either end can take, in either shape `value` accepts. `null` and `undefined`
50
+ * both mean "no bound". An unreadable bound stops applying rather than throwing. */
51
+ minValue?: DateValue | string | null;
52
+ /** Latest date either end can take — see `minValue`. */
53
+ maxValue?: DateValue | string | null;
20
54
  /** Return true for dates that cannot be picked — blocked periods, closed books. */
21
55
  isDateUnavailable?: (date: DateValue) => boolean;
22
56
  /**
@@ -43,8 +77,15 @@ export interface DateRangePickerProps {
43
77
  className?: string;
44
78
  style?: React.CSSProperties;
45
79
  }
46
- /** Whole days between the two ends, inclusive of both. */
80
+ /**
81
+ * Whole days between the two ends, inclusive of both.
82
+ *
83
+ * A complete `DateRange` measures to a number, which is the signature this has always had. Given
84
+ * the looser shape `value` now takes — either end a string, either end absent — it returns `null`
85
+ * for a range it cannot measure, so a caller holding two strings can pass them straight in.
86
+ */
47
87
  export declare function rangeLengthInDays(range: DateRange): number;
88
+ export declare function rangeLengthInDays(range: DateRangeInput | null | undefined): number | null;
48
89
  /**
49
90
  * Two dates that belong together — the default filter on 24 ERP screens.
50
91
  *
@@ -52,4 +93,4 @@ export declare function rangeLengthInDays(range: DateRange): number;
52
93
  * between them, and locale-driven segment order. Wrap the app in `I18nProvider` to pin a locale:
53
94
  * `es-PY` reads dd/mm/yyyy and `en-US` mm/dd/yyyy off the same value.
54
95
  */
55
- export declare function DateRangePicker({ label, description, errorMessage, maxRangeDays, presets, size, fullWidth, startName, endName, className, style, ...rest }: DateRangePickerProps): React.JSX.Element;
96
+ export declare function DateRangePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, maxRangeDays, presets, size, fullWidth, startName, endName, className, style, value, defaultValue, onChange, valueFormat, minValue, maxValue, ...rest }: DateRangePickerProps<TFormat>): React.JSX.Element;
@@ -1,22 +1,56 @@
1
1
  import type * as React from 'react';
2
2
  import type { DateValue } from 'react-aria-components';
3
+ /** A complete range: what this component emits, and what `rangeLengthInDays` measures. */
3
4
  export interface DateRange {
4
5
  start: DateValue;
5
6
  end: DateValue;
6
7
  }
8
+ /** A complete range as ISO strings — what `onChange` emits under `valueFormat="iso"`. */
9
+ export interface IsoDateRange {
10
+ start: string;
11
+ end: string;
12
+ }
13
+ /**
14
+ * What `value` accepts: either end in either shape, and either end absent.
15
+ *
16
+ * The two ends are read separately on purpose. An unreadable or empty end leaves *that* end
17
+ * without a date instead of voiding the whole range, so a caller can pass the two halves of its
18
+ * state straight through rather than guarding that both parsed before building an object. Deciding
19
+ * what counts as a usable range is this component's job, which is the point of the prop.
20
+ */
21
+ export interface DateRangeInput {
22
+ start?: DateValue | string | null;
23
+ end?: DateValue | string | null;
24
+ }
7
25
  export interface DateRangePreset {
8
26
  id: string;
9
27
  label: string;
10
- /** The app computes the range: Pire cannot know when a customer's fiscal year starts. */
11
- range: () => DateRange;
28
+ /** The app computes the range: Pire cannot know when a customer's fiscal year starts. It also
29
+ * computes in whatever shape it stores, so either shape is accepted here. */
30
+ range: () => DateRangeInput;
12
31
  }
13
- export interface DateRangePickerProps {
32
+ export interface DateRangePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
14
33
  label?: React.ReactNode;
15
- value?: DateRange | null;
16
- defaultValue?: DateRange | null;
17
- onChange?: (value: DateRange | null) => void;
18
- minValue?: DateValue;
19
- maxValue?: DateValue;
34
+ /** Either end in either shape — see `DateRangeInput`. A range whose ends are both empty is an
35
+ * empty field. */
36
+ value?: DateRangeInput | null;
37
+ defaultValue?: DateRangeInput | null;
38
+ onChange?: (value: (TFormat extends 'iso' ? IsoDateRange : DateRange) | null) => void;
39
+ /**
40
+ * The shape `onChange` emits.
41
+ *
42
+ * `'object'` (the default) emits the `DateValue` pair this component has always emitted. `'iso'`
43
+ * emits `{ start: 'YYYY-MM-DD', end: 'YYYY-MM-DD' }`, the shape a consumer sends back to its API.
44
+ *
45
+ * Either way the emitted range is always complete or `null`: React Aria never reports half a
46
+ * range, even though it will happily *display* one while a caller is still filling it in.
47
+ */
48
+ valueFormat?: TFormat;
49
+ /** Earliest date either end can take, in either shape `value` accepts. `null` and `undefined`
50
+ * both mean "no bound". An unreadable bound stops applying rather than throwing. */
51
+ minValue?: DateValue | string | null;
52
+ /** Latest date either end can take — see `minValue`. */
53
+ maxValue?: DateValue | string | null;
20
54
  /** Return true for dates that cannot be picked — blocked periods, closed books. */
21
55
  isDateUnavailable?: (date: DateValue) => boolean;
22
56
  /**
@@ -43,8 +77,15 @@ export interface DateRangePickerProps {
43
77
  className?: string;
44
78
  style?: React.CSSProperties;
45
79
  }
46
- /** Whole days between the two ends, inclusive of both. */
80
+ /**
81
+ * Whole days between the two ends, inclusive of both.
82
+ *
83
+ * A complete `DateRange` measures to a number, which is the signature this has always had. Given
84
+ * the looser shape `value` now takes — either end a string, either end absent — it returns `null`
85
+ * for a range it cannot measure, so a caller holding two strings can pass them straight in.
86
+ */
47
87
  export declare function rangeLengthInDays(range: DateRange): number;
88
+ export declare function rangeLengthInDays(range: DateRangeInput | null | undefined): number | null;
48
89
  /**
49
90
  * Two dates that belong together — the default filter on 24 ERP screens.
50
91
  *
@@ -52,5 +93,5 @@ export declare function rangeLengthInDays(range: DateRange): number;
52
93
  * between them, and locale-driven segment order. Wrap the app in `I18nProvider` to pin a locale:
53
94
  * `es-PY` reads dd/mm/yyyy and `en-US` mm/dd/yyyy off the same value.
54
95
  */
55
- export declare function DateRangePicker({ label, description, errorMessage, maxRangeDays, presets, size, fullWidth, startName, endName, className, style, ...rest }: DateRangePickerProps): React.JSX.Element;
96
+ export declare function DateRangePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, maxRangeDays, presets, size, fullWidth, startName, endName, className, style, value, defaultValue, onChange, valueFormat, minValue, maxValue, ...rest }: DateRangePickerProps<TFormat>): React.JSX.Element;
56
97
  //# sourceMappingURL=DateRangePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/components/forms/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAMpC,OAAO,KAAK,E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C5D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;AAQ3F;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,QAAQ,EAAE,EAC3E,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,IAAW,EAAE,SAAgB,EACtF,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAChF,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAC5B,EAAE,oBAAoB,CAAC,OAAO,CAAC,qBA6G/B"}
@@ -1,12 +1,27 @@
1
1
  import type * as React from 'react';
2
- export interface NumberFieldProps {
2
+ export interface NumberFieldProps<TEmpty extends '' | null = never> {
3
3
  label?: React.ReactNode;
4
4
  /** Accessible name when `label` is omitted — e.g. in a table cell where the column header
5
5
  * already carries the visible text. A field with neither is unnamed and fails axe. */
6
6
  'aria-label'?: string;
7
- value?: number;
8
- defaultValue?: number;
9
- onChange?: (value: number) => void;
7
+ /** A figure, or the string one arrived as — a `decimal` column serialises as `"1500.00"`, so
8
+ * a value straight off a JSON response needs no conversion. Strings are read with `Number`,
9
+ * which is machine format only: `"1500.00"`, never the `"1.500,00"` the field *displays*
10
+ * under es-PY. Anything unparseable shows as empty rather than as `NaN`. */
11
+ value?: number | string | null;
12
+ defaultValue?: number | string | null;
13
+ onChange?: (value: number | NoInfer<TEmpty>) => void;
14
+ /**
15
+ * What this field uses to mean "empty", in both directions: accepted in `value` and emitted by
16
+ * `onChange`.
17
+ *
18
+ * Defaults to `NaN`, which is what React Aria uses internally and what this component has
19
+ * always emitted. Declare `''` or `null` when the form is serialised to JSON: `NaN` does not
20
+ * survive `JSON.stringify` (it becomes `null`) and compares `false` against everything
21
+ * including itself, so a guard like `Math.abs(total) > 0` reads an empty field as a balanced
22
+ * one.
23
+ */
24
+ emptyValue?: TEmpty;
10
25
  minValue?: number;
11
26
  maxValue?: number;
12
27
  step?: number;
@@ -45,4 +60,4 @@ export interface NumberFieldProps {
45
60
  * Enable the action and validate when it is pressed, surfacing the reason. A disabled control that
46
61
  * does not say why is a worse affordance regardless, so the fix costs nothing.
47
62
  */
48
- export declare function NumberField({ label, suffix, description, errorMessage, hideStepper, size, fullWidth, className, style, ...rest }: NumberFieldProps): React.JSX.Element;
63
+ export declare function NumberField<TEmpty extends '' | null = never>({ label, suffix, description, errorMessage, hideStepper, size, fullWidth, className, style, value, defaultValue, onChange, emptyValue, ...rest }: NumberFieldProps<TEmpty>): React.JSX.Element;
@@ -1,12 +1,27 @@
1
1
  import type * as React from 'react';
2
- export interface NumberFieldProps {
2
+ export interface NumberFieldProps<TEmpty extends '' | null = never> {
3
3
  label?: React.ReactNode;
4
4
  /** Accessible name when `label` is omitted — e.g. in a table cell where the column header
5
5
  * already carries the visible text. A field with neither is unnamed and fails axe. */
6
6
  'aria-label'?: string;
7
- value?: number;
8
- defaultValue?: number;
9
- onChange?: (value: number) => void;
7
+ /** A figure, or the string one arrived as — a `decimal` column serialises as `"1500.00"`, so
8
+ * a value straight off a JSON response needs no conversion. Strings are read with `Number`,
9
+ * which is machine format only: `"1500.00"`, never the `"1.500,00"` the field *displays*
10
+ * under es-PY. Anything unparseable shows as empty rather than as `NaN`. */
11
+ value?: number | string | null;
12
+ defaultValue?: number | string | null;
13
+ onChange?: (value: number | NoInfer<TEmpty>) => void;
14
+ /**
15
+ * What this field uses to mean "empty", in both directions: accepted in `value` and emitted by
16
+ * `onChange`.
17
+ *
18
+ * Defaults to `NaN`, which is what React Aria uses internally and what this component has
19
+ * always emitted. Declare `''` or `null` when the form is serialised to JSON: `NaN` does not
20
+ * survive `JSON.stringify` (it becomes `null`) and compares `false` against everything
21
+ * including itself, so a guard like `Math.abs(total) > 0` reads an empty field as a balanced
22
+ * one.
23
+ */
24
+ emptyValue?: TEmpty;
10
25
  minValue?: number;
11
26
  maxValue?: number;
12
27
  step?: number;
@@ -45,5 +60,5 @@ export interface NumberFieldProps {
45
60
  * Enable the action and validate when it is pressed, surfacing the reason. A disabled control that
46
61
  * does not say why is a worse affordance regardless, so the fix costs nothing.
47
62
  */
48
- export declare function NumberField({ label, suffix, description, errorMessage, hideStepper, size, fullWidth, className, style, ...rest }: NumberFieldProps): React.JSX.Element;
63
+ export declare function NumberField<TEmpty extends '' | null = never>({ label, suffix, description, errorMessage, hideStepper, size, fullWidth, className, style, value, defaultValue, onChange, emptyValue, ...rest }: NumberFieldProps<TEmpty>): React.JSX.Element;
49
64
  //# sourceMappingURL=NumberField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../src/components/forms/NumberField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAkCpC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;2FACuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sGAAsG;IACtG,aAAa,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IACzC,uDAAuD;IACvD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAA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,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sGAAsG;IACtG,aAAa,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IACzC,uDAAuD;IACvD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAeD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAS,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EACxF,YAAY,EAAE,WAAW,EAAE,IAAW,EAAE,SAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAC/F,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,qBA+D1D"}
@@ -0,0 +1,22 @@
1
+ import type { DateValue } from 'react-aria-components';
2
+ /**
3
+ * What React Aria is given for a date. `undefined` stays `undefined`, since that is what keeps an
4
+ * uncontrolled field uncontrolled — coercing it to `null` would silently disable `defaultValue`
5
+ * and freeze the field.
6
+ *
7
+ * The rest is why this belongs in the library: `parseDate` *throws* on a malformed date, and a bad
8
+ * date arriving from a server must empty one field, never unmount the screen. A datetime is
9
+ * trimmed to its date, because a `DateValue` is a calendar date and holds neither time nor zone.
10
+ */
11
+ export declare function coerceDateValue(value: DateValue | string | null | undefined): DateValue | null | undefined;
12
+ /**
13
+ * The same coercion for `minValue` / `maxValue`, where the two ways of saying "no bound" — `null`
14
+ * and `undefined` — collapse into the one React Aria's own types accept.
15
+ *
16
+ * Worth knowing which way this degrades: an unreadable *value* is visible, because the field shows
17
+ * empty. An unreadable *bound* is not — the constraint simply stops applying, and the user can
18
+ * pick a date the screen meant to forbid. Degrading still beats throwing, since a bound arriving
19
+ * malformed from a server should not take the screen down, but it is the quieter failure of the
20
+ * two.
21
+ */
22
+ export declare function coerceBound(value: DateValue | string | null | undefined): DateValue | undefined;
@@ -0,0 +1,23 @@
1
+ import type { DateValue } from 'react-aria-components';
2
+ /**
3
+ * What React Aria is given for a date. `undefined` stays `undefined`, since that is what keeps an
4
+ * uncontrolled field uncontrolled — coercing it to `null` would silently disable `defaultValue`
5
+ * and freeze the field.
6
+ *
7
+ * The rest is why this belongs in the library: `parseDate` *throws* on a malformed date, and a bad
8
+ * date arriving from a server must empty one field, never unmount the screen. A datetime is
9
+ * trimmed to its date, because a `DateValue` is a calendar date and holds neither time nor zone.
10
+ */
11
+ export declare function coerceDateValue(value: DateValue | string | null | undefined): DateValue | null | undefined;
12
+ /**
13
+ * The same coercion for `minValue` / `maxValue`, where the two ways of saying "no bound" — `null`
14
+ * and `undefined` — collapse into the one React Aria's own types accept.
15
+ *
16
+ * Worth knowing which way this degrades: an unreadable *value* is visible, because the field shows
17
+ * empty. An unreadable *bound* is not — the constraint simply stops applying, and the user can
18
+ * pick a date the screen meant to forbid. Degrading still beats throwing, since a bound arriving
19
+ * malformed from a server should not take the screen down, but it is the quieter failure of the
20
+ * two.
21
+ */
22
+ export declare function coerceBound(value: DateValue | string | null | undefined): DateValue | undefined;
23
+ //# sourceMappingURL=dateValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateValues.d.ts","sourceRoot":"","sources":["../../../src/components/forms/dateValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAW1G;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAE/F"}