@orianatech/pire 0.22.0 → 1.0.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.
package/README.md CHANGED
@@ -130,9 +130,17 @@ see the Icons section of `CLAUDE.md`.
130
130
 
131
131
  ## Release checklist
132
132
 
133
- 1. `pnpm typecheck`, `pnpm lint` and `pnpm build` clean.
134
- 2. `pnpm build-storybook` — publish `storybook-static/` for the team.
135
- 3. Bump the version, tag, publish to the internal registry.
133
+ Releases are driven by Changesets and GitHub Actions — nothing is bumped, tagged or published by
134
+ hand.
135
+
136
+ 1. `pnpm typecheck`, `pnpm lint`, `pnpm test` and `pnpm build` clean, plus `pnpm pack:check`, which
137
+ validates the published package against a real packed tarball.
138
+ 2. `pnpm changeset` — describe the change the way a consumer will read it in the changelog. A PR
139
+ without one publishes nothing.
140
+ 3. Merge the PR. `release.yml` opens a `chore: version packages` PR; merging *that* bumps the
141
+ version, writes `CHANGELOG.md` and publishes `@orianatech/pire` to npm.
142
+ 4. `docs.yml` deploys Storybook to GitHub Pages on every push to `main`, so the docs site needs no
143
+ step of its own.
136
144
 
137
145
  ## Toolchain notes
138
146
 
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../../src/components/forms/ComboBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAc;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE;AAE1G,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EA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O,CAAC;IACpB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,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,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,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;AAKD;0GAC0G;AAC1G,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,OAAY,EACtG,WAAW,EAAE,YAAY,EAAE,IAAW,EAAE,SAAgB,EAAE,oBAAoB,EAAE,SAAS,EACzF,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,qBAiH1G"}
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  import type { DateValue } from 'react-aria-components';
3
3
  export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
4
4
  label?: React.ReactNode;
@@ -18,8 +18,13 @@ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
18
18
  * `null` for an empty field. Input accepts both shapes in either mode.
19
19
  */
20
20
  valueFormat?: TFormat;
21
- minValue?: DateValue;
22
- maxValue?: DateValue;
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;
23
28
  /** Return true for dates that cannot be picked — factory calendar, blocked periods. */
24
29
  isDateUnavailable?: (date: DateValue) => boolean;
25
30
  description?: React.ReactNode;
@@ -28,6 +33,16 @@ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
28
33
  isDisabled?: boolean;
29
34
  isReadOnly?: boolean;
30
35
  isRequired?: boolean;
36
+ /**
37
+ * Show a button that empties the field.
38
+ *
39
+ * There is otherwise no way for a user to say "no date" once one is set: React Aria substitutes
40
+ * a date when a segment is cleared and never reports an empty value back, so a field that has
41
+ * been filled in cannot be emptied from the keyboard at all.
42
+ */
43
+ isClearable?: boolean;
44
+ /** The clear button's visible text. Defaults to the dictionary's `inputClear`. */
45
+ clearLabel?: string;
31
46
  size?: 'sm' | 'md' | 'lg';
32
47
  fullWidth?: boolean;
33
48
  name?: string;
@@ -37,4 +52,4 @@ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
37
52
  /** Date entry with a segmented field and a calendar popover. Segments follow the user's locale,
38
53
  * so a German user types dd.mm.yyyy without any prop change. Wrap the app in React Aria's
39
54
  * I18nProvider to pin a locale. */
40
- export declare function DatePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, size, fullWidth, className, style, value, defaultValue, onChange, valueFormat, ...rest }: DatePickerProps<TFormat>): React.JSX.Element;
55
+ export declare function DatePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, size, fullWidth, className, style, value, defaultValue, onChange, valueFormat, minValue, maxValue, isClearable, clearLabel, ...rest }: DatePickerProps<TFormat>): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  import type { DateValue } from 'react-aria-components';
3
3
  export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
4
4
  label?: React.ReactNode;
@@ -18,8 +18,13 @@ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
18
18
  * `null` for an empty field. Input accepts both shapes in either mode.
19
19
  */
20
20
  valueFormat?: TFormat;
21
- minValue?: DateValue;
22
- maxValue?: DateValue;
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;
23
28
  /** Return true for dates that cannot be picked — factory calendar, blocked periods. */
24
29
  isDateUnavailable?: (date: DateValue) => boolean;
25
30
  description?: React.ReactNode;
@@ -28,6 +33,16 @@ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
28
33
  isDisabled?: boolean;
29
34
  isReadOnly?: boolean;
30
35
  isRequired?: boolean;
36
+ /**
37
+ * Show a button that empties the field.
38
+ *
39
+ * There is otherwise no way for a user to say "no date" once one is set: React Aria substitutes
40
+ * a date when a segment is cleared and never reports an empty value back, so a field that has
41
+ * been filled in cannot be emptied from the keyboard at all.
42
+ */
43
+ isClearable?: boolean;
44
+ /** The clear button's visible text. Defaults to the dictionary's `inputClear`. */
45
+ clearLabel?: string;
31
46
  size?: 'sm' | 'md' | 'lg';
32
47
  fullWidth?: boolean;
33
48
  name?: string;
@@ -37,5 +52,5 @@ export interface DatePickerProps<TFormat extends 'object' | 'iso' = 'object'> {
37
52
  /** Date entry with a segmented field and a calendar popover. Segments follow the user's locale,
38
53
  * so a German user types dd.mm.yyyy without any prop change. Wrap the app in React Aria's
39
54
  * I18nProvider to pin a locale. */
40
- export declare function DatePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, size, fullWidth, className, style, value, defaultValue, onChange, valueFormat, ...rest }: DatePickerProps<TFormat>): React.JSX.Element;
55
+ export declare function DatePicker<TFormat extends 'object' | 'iso' = 'object'>({ label, description, errorMessage, size, fullWidth, className, style, value, defaultValue, onChange, valueFormat, minValue, maxValue, isClearable, clearLabel, ...rest }: DatePickerProps<TFormat>): React.JSX.Element;
41
56
  //# 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;AAMvD,MAAM,WAAW,eAAe,CAAC,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,QAAQ;IAC1E,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;;;wDAIoD;IACpD,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,OAAO,SAAS,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAChF;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,uFAAuF;IACvF,iBA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E,QAAQ,EAC5F,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,qBAwD9F"}
@@ -1,22 +1,56 @@
1
- import type * as React from 'react';
1
+ import * 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
  /**
@@ -29,6 +63,15 @@ export interface DateRangePickerProps {
29
63
  maxRangeDays?: number;
30
64
  /** Shortcuts beside the calendar: "This month", "Last 30 days". */
31
65
  presets?: DateRangePreset[];
66
+ /**
67
+ * Show a button that empties both ends at once.
68
+ *
69
+ * Same gap as on `DatePicker`, and worse here: a user who fills one end and changes their mind
70
+ * has no way back to an empty period, since React Aria never reports an emptied field.
71
+ */
72
+ isClearable?: boolean;
73
+ /** The clear button's visible text. Defaults to the dictionary's `inputClear`. */
74
+ clearLabel?: string;
32
75
  description?: React.ReactNode;
33
76
  errorMessage?: React.ReactNode;
34
77
  isInvalid?: boolean;
@@ -43,8 +86,15 @@ export interface DateRangePickerProps {
43
86
  className?: string;
44
87
  style?: React.CSSProperties;
45
88
  }
46
- /** Whole days between the two ends, inclusive of both. */
89
+ /**
90
+ * Whole days between the two ends, inclusive of both.
91
+ *
92
+ * A complete `DateRange` measures to a number, which is the signature this has always had. Given
93
+ * the looser shape `value` now takes — either end a string, either end absent — it returns `null`
94
+ * for a range it cannot measure, so a caller holding two strings can pass them straight in.
95
+ */
47
96
  export declare function rangeLengthInDays(range: DateRange): number;
97
+ export declare function rangeLengthInDays(range: DateRangeInput | null | undefined): number | null;
48
98
  /**
49
99
  * Two dates that belong together — the default filter on 24 ERP screens.
50
100
  *
@@ -52,4 +102,4 @@ export declare function rangeLengthInDays(range: DateRange): number;
52
102
  * between them, and locale-driven segment order. Wrap the app in `I18nProvider` to pin a locale:
53
103
  * `es-PY` reads dd/mm/yyyy and `en-US` mm/dd/yyyy off the same value.
54
104
  */
55
- export declare function DateRangePicker({ label, description, errorMessage, maxRangeDays, presets, size, fullWidth, startName, endName, className, style, ...rest }: DateRangePickerProps): React.JSX.Element;
105
+ 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, isClearable, clearLabel, ...rest }: DateRangePickerProps<TFormat>): React.JSX.Element;
@@ -1,22 +1,56 @@
1
- import type * as React from 'react';
1
+ import * 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
  /**
@@ -29,6 +63,15 @@ export interface DateRangePickerProps {
29
63
  maxRangeDays?: number;
30
64
  /** Shortcuts beside the calendar: "This month", "Last 30 days". */
31
65
  presets?: DateRangePreset[];
66
+ /**
67
+ * Show a button that empties both ends at once.
68
+ *
69
+ * Same gap as on `DatePicker`, and worse here: a user who fills one end and changes their mind
70
+ * has no way back to an empty period, since React Aria never reports an emptied field.
71
+ */
72
+ isClearable?: boolean;
73
+ /** The clear button's visible text. Defaults to the dictionary's `inputClear`. */
74
+ clearLabel?: string;
32
75
  description?: React.ReactNode;
33
76
  errorMessage?: React.ReactNode;
34
77
  isInvalid?: boolean;
@@ -43,8 +86,15 @@ export interface DateRangePickerProps {
43
86
  className?: string;
44
87
  style?: React.CSSProperties;
45
88
  }
46
- /** Whole days between the two ends, inclusive of both. */
89
+ /**
90
+ * Whole days between the two ends, inclusive of both.
91
+ *
92
+ * A complete `DateRange` measures to a number, which is the signature this has always had. Given
93
+ * the looser shape `value` now takes — either end a string, either end absent — it returns `null`
94
+ * for a range it cannot measure, so a caller holding two strings can pass them straight in.
95
+ */
47
96
  export declare function rangeLengthInDays(range: DateRange): number;
97
+ export declare function rangeLengthInDays(range: DateRangeInput | null | undefined): number | null;
48
98
  /**
49
99
  * Two dates that belong together — the default filter on 24 ERP screens.
50
100
  *
@@ -52,5 +102,5 @@ export declare function rangeLengthInDays(range: DateRange): number;
52
102
  * between them, and locale-driven segment order. Wrap the app in `I18nProvider` to pin a locale:
53
103
  * `es-PY` reads dd/mm/yyyy and `en-US` mm/dd/yyyy off the same value.
54
104
  */
55
- export declare function DateRangePicker({ label, description, errorMessage, maxRangeDays, presets, size, fullWidth, startName, endName, className, style, ...rest }: DateRangePickerProps): React.JSX.Element;
105
+ 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, isClearable, clearLabel, ...rest }: DateRangePickerProps<TFormat>): React.JSX.Element;
56
106
  //# 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,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,SA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AgB,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,qBA0CvG"}
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
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
@@ -37,6 +37,15 @@ export interface NumberFieldProps<TEmpty extends '' | null = never> {
37
37
  isRequired?: boolean;
38
38
  /** Hide the increment/decrement buttons — typical inside dense table cells. */
39
39
  hideStepper?: boolean;
40
+ /**
41
+ * Show a button that empties the field, reporting whatever `emptyValue` declares.
42
+ *
43
+ * Worth it wherever "no figure" is a meaningful answer rather than zero — an optional discount,
44
+ * a filter bound. Works controlled or uncontrolled.
45
+ */
46
+ isClearable?: boolean;
47
+ /** The clear button's visible text. Defaults to the dictionary's `inputClear`. */
48
+ clearLabel?: string;
40
49
  size?: 'sm' | 'md' | 'lg';
41
50
  fullWidth?: boolean;
42
51
  name?: string;
@@ -60,4 +69,4 @@ export interface NumberFieldProps<TEmpty extends '' | null = never> {
60
69
  * Enable the action and validate when it is pressed, surfacing the reason. A disabled control that
61
70
  * does not say why is a worse affordance regardless, so the fix costs nothing.
62
71
  */
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;
72
+ export declare function NumberField<TEmpty extends '' | null = never>({ label, suffix, description, errorMessage, hideStepper, size, fullWidth, className, style, value, defaultValue, onChange, emptyValue, isClearable, clearLabel, ...rest }: NumberFieldProps<TEmpty>): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
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
@@ -37,6 +37,15 @@ export interface NumberFieldProps<TEmpty extends '' | null = never> {
37
37
  isRequired?: boolean;
38
38
  /** Hide the increment/decrement buttons — typical inside dense table cells. */
39
39
  hideStepper?: boolean;
40
+ /**
41
+ * Show a button that empties the field, reporting whatever `emptyValue` declares.
42
+ *
43
+ * Worth it wherever "no figure" is a meaningful answer rather than zero — an optional discount,
44
+ * a filter bound. Works controlled or uncontrolled.
45
+ */
46
+ isClearable?: boolean;
47
+ /** The clear button's visible text. Defaults to the dictionary's `inputClear`. */
48
+ clearLabel?: string;
40
49
  size?: 'sm' | 'md' | 'lg';
41
50
  fullWidth?: boolean;
42
51
  name?: string;
@@ -60,5 +69,5 @@ export interface NumberFieldProps<TEmpty extends '' | null = never> {
60
69
  * Enable the action and validate when it is pressed, surfacing the reason. A disabled control that
61
70
  * does not say why is a worse affordance regardless, so the fix costs nothing.
62
71
  */
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;
72
+ export declare function NumberField<TEmpty extends '' | null = never>({ label, suffix, description, errorMessage, hideStepper, size, fullWidth, className, style, value, defaultValue, onChange, emptyValue, isClearable, clearLabel, ...rest }: NumberFieldProps<TEmpty>): React.JSX.Element;
64
73
  //# 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,CAAC,MAAM,SAAS,EAAE,GAAG,IAAI,GAAG,KAAK;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;2FACuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;iFAG6E;IAC7E,KAAK,CAA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O,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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;AAoCD;;;;;;;;;;;;;;;;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,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,qBAsHnF"}
@@ -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"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Put focus back into the field a clear button belongs to.
3
+ *
4
+ * Every clear button in this library unmounts the moment it works — there is nothing left to clear
5
+ * — so without this the browser drops focus on `<body>` and a keyboard or screen-reader user is
6
+ * dumped at the top of the document, several tab stops from the field they were editing.
7
+ *
8
+ * The selector list is ordered: a date field's first segment, otherwise the input. Both live
9
+ * inside the same `.pire-control` shell as the button.
10
+ */
11
+ export declare function focusFieldOf(button: EventTarget | null): void;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Put focus back into the field a clear button belongs to.
3
+ *
4
+ * Every clear button in this library unmounts the moment it works — there is nothing left to clear
5
+ * — so without this the browser drops focus on `<body>` and a keyboard or screen-reader user is
6
+ * dumped at the top of the document, several tab stops from the field they were editing.
7
+ *
8
+ * The selector list is ordered: a date field's first segment, otherwise the input. Both live
9
+ * inside the same `.pire-control` shell as the button.
10
+ */
11
+ export declare function focusFieldOf(button: EventTarget | null): void;
12
+ //# sourceMappingURL=focusField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusField.d.ts","sourceRoot":"","sources":["../../../src/components/utils/focusField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAG7D"}