@orianatech/pire 2.2.0 → 2.3.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,4 +1,11 @@
1
1
  import * as React from 'react';
2
+ /** What `renderEdit` receives besides the row: the same commit and cancel Enter and Escape run. */
3
+ export interface DataTableEditActions {
4
+ /** Runs `onCommitRow` for this row, with the focus hand-off Enter gets. */
5
+ commit: () => void;
6
+ /** Runs `onCancelRow` for this row, as Escape does. */
7
+ cancel: () => void;
8
+ }
2
9
  /** Value states a single cell can carry. The same five `Badge` uses, so a red cell and a red badge
3
10
  * mean the same thing on one screen. */
4
11
  export type DataTableCellTone = 'positive' | 'critical' | 'negative' | 'informative' | 'neutral';
@@ -31,8 +38,12 @@ export interface DataTableColumn<T = any> {
31
38
  *
32
39
  * For the pending row it is called with `pendingRow`, which is not a full record: read nothing
33
40
  * off it that the pending row does not carry.
41
+ *
42
+ * `actions.commit` / `actions.cancel` run exactly what Enter / Escape run, focus hand-off included,
43
+ * for a row that also draws its own Save / Cancel buttons — typically in an actions column whose
44
+ * `renderEdit` returns only those buttons.
34
45
  */
35
- renderEdit?: (row: T) => React.ReactNode;
46
+ renderEdit?: (row: T, actions: DataTableEditActions) => React.ReactNode;
36
47
  /**
37
48
  * Freezes the column at the start of the grid while the rest scroll horizontally. For a
38
49
  * comparison matrix — one product across thirty-four branches — where the row is unreadable
@@ -1,4 +1,11 @@
1
1
  import * as React from 'react';
2
+ /** What `renderEdit` receives besides the row: the same commit and cancel Enter and Escape run. */
3
+ export interface DataTableEditActions {
4
+ /** Runs `onCommitRow` for this row, with the focus hand-off Enter gets. */
5
+ commit: () => void;
6
+ /** Runs `onCancelRow` for this row, as Escape does. */
7
+ cancel: () => void;
8
+ }
2
9
  /** Value states a single cell can carry. The same five `Badge` uses, so a red cell and a red badge
3
10
  * mean the same thing on one screen. */
4
11
  export type DataTableCellTone = 'positive' | 'critical' | 'negative' | 'informative' | 'neutral';
@@ -31,8 +38,12 @@ export interface DataTableColumn<T = any> {
31
38
  *
32
39
  * For the pending row it is called with `pendingRow`, which is not a full record: read nothing
33
40
  * off it that the pending row does not carry.
41
+ *
42
+ * `actions.commit` / `actions.cancel` run exactly what Enter / Escape run, focus hand-off included,
43
+ * for a row that also draws its own Save / Cancel buttons — typically in an actions column whose
44
+ * `renderEdit` returns only those buttons.
34
45
  */
35
- renderEdit?: (row: T) => React.ReactNode;
46
+ renderEdit?: (row: T, actions: DataTableEditActions) => React.ReactNode;
36
47
  /**
37
48
  * Freezes the column at the start of the grid while the rest scroll horizontally. For a
38
49
  * comparison matrix — one product across thirty-four branches — where the row is unreadable
@@ -10,7 +10,11 @@ export interface ProgressBarProps {
10
10
  /** Colours the fill — e.g. negative when a budget is overrun. */
11
11
  status?: 'informative' | 'positive' | 'critical' | 'negative';
12
12
  size?: 'sm' | 'md';
13
+ /** Names a bar with no visible `label` — one in a table cell, say. Prefer `label` where it fits. */
14
+ 'aria-label'?: string;
15
+ /** Names the bar from text already on screen, such as the row's own first cell. */
16
+ 'aria-labelledby'?: string;
13
17
  className?: string;
14
18
  style?: React.CSSProperties;
15
19
  }
16
- export declare function ProgressBar({ value, minValue, maxValue, label, showValue, isIndeterminate, status, size, className, style, }: ProgressBarProps): React.JSX.Element;
20
+ export declare function ProgressBar({ value, minValue, maxValue, label, showValue, isIndeterminate, status, size, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, style, }: ProgressBarProps): React.JSX.Element;
@@ -10,7 +10,11 @@ export interface ProgressBarProps {
10
10
  /** Colours the fill — e.g. negative when a budget is overrun. */
11
11
  status?: 'informative' | 'positive' | 'critical' | 'negative';
12
12
  size?: 'sm' | 'md';
13
+ /** Names a bar with no visible `label` — one in a table cell, say. Prefer `label` where it fits. */
14
+ 'aria-label'?: string;
15
+ /** Names the bar from text already on screen, such as the row's own first cell. */
16
+ 'aria-labelledby'?: string;
13
17
  className?: string;
14
18
  style?: React.CSSProperties;
15
19
  }
16
- export declare function ProgressBar({ value, minValue, maxValue, label, showValue, isIndeterminate, status, size, className, style, }: ProgressBarProps): React.JSX.Element;
20
+ export declare function ProgressBar({ value, minValue, maxValue, label, showValue, isIndeterminate, status, size, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, style, }: ProgressBarProps): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  /** The `help` prop, documented once for every field that draws its own label. */
3
3
  export interface WithFieldHelp {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  /** The `help` prop, documented once for every field that draws its own label. */
3
3
  export interface WithFieldHelp {
4
4
  /**
@@ -1,10 +1,16 @@
1
1
  import type * as React from 'react';
2
2
  export interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
3
3
  title: React.ReactNode;
4
+ /**
5
+ * A status `Badge` drawn after the title — «Activo», «Borrador». Kept outside the heading, so the
6
+ * page's `h1` is named by the title alone, and spaced and aligned by the library rather than by
7
+ * each screen. Same name as `ObjectHeader`'s slot.
8
+ */
9
+ badge?: React.ReactNode;
4
10
  /** One line of context: scope, plant, data timestamp. */
5
11
  subtitle?: React.ReactNode;
6
12
  actions?: React.ReactNode;
7
13
  }
8
14
  /** Heading block for pages that are not a single object — launchpads, settings, reports.
9
15
  * Object pages use ObjectHeader instead. */
10
- export declare function PageHeader({ title, subtitle, actions, className, ...rest }: PageHeaderProps): React.JSX.Element;
16
+ export declare function PageHeader({ title, badge, subtitle, actions, className, ...rest }: PageHeaderProps): React.JSX.Element;
@@ -1,10 +1,16 @@
1
1
  import type * as React from 'react';
2
2
  export interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
3
3
  title: React.ReactNode;
4
+ /**
5
+ * A status `Badge` drawn after the title — «Activo», «Borrador». Kept outside the heading, so the
6
+ * page's `h1` is named by the title alone, and spaced and aligned by the library rather than by
7
+ * each screen. Same name as `ObjectHeader`'s slot.
8
+ */
9
+ badge?: React.ReactNode;
4
10
  /** One line of context: scope, plant, data timestamp. */
5
11
  subtitle?: React.ReactNode;
6
12
  actions?: React.ReactNode;
7
13
  }
8
14
  /** Heading block for pages that are not a single object — launchpads, settings, reports.
9
15
  * Object pages use ObjectHeader instead. */
10
- export declare function PageHeader({ title, subtitle, actions, className, ...rest }: PageHeaderProps): React.JSX.Element;
16
+ export declare function PageHeader({ title, badge, subtitle, actions, className, ...rest }: PageHeaderProps): React.JSX.Element;
@@ -428,10 +428,15 @@
428
428
  font: var(--type-caption);
429
429
  color: var(--status-negative-fg);
430
430
  }
431
+ /* The row is exactly one label line tall (`1lh` of the label's own type), help or not. The 32px
432
+ help trigger overflows it evenly above and below instead of growing it, so a helped field lines
433
+ up with its unhelped neighbour and the trigger keeps its full hit area. */
431
434
  .pire-field-labelrow {
432
435
  display: flex;
433
436
  align-items: center;
434
437
  gap: var(--sp-1);
438
+ font: var(--type-label);
439
+ height: 1lh;
435
440
  }
436
441
  .pire-field[data-layout="horizontal"] {
437
442
  display: grid;
@@ -1981,10 +1986,13 @@
1981
1986
  position: static;
1982
1987
  transform: none;
1983
1988
  }
1989
+ /* Fills its container. Sized to content instead, a bar with no visible label has no content width
1990
+ and collapses to nothing in any parent that does not stretch it. */
1984
1991
  .pire-progress {
1985
1992
  display: flex;
1986
1993
  flex-direction: column;
1987
1994
  gap: var(--sp-1);
1995
+ width: 100%;
1988
1996
  }
1989
1997
  .pire-progress-head {
1990
1998
  display: flex;
@@ -2784,6 +2792,13 @@
2784
2792
  gap: var(--sp-4);
2785
2793
  flex-wrap: wrap;
2786
2794
  }
2795
+ /* Title and status badge on one line; the badge is a sibling of the h1, never inside it. */
2796
+ .pire-pageheader-titlerow {
2797
+ display: flex;
2798
+ align-items: center;
2799
+ flex-wrap: wrap;
2800
+ gap: var(--sp-2);
2801
+ }
2787
2802
  .pire-pageheader-title {
2788
2803
  font: var(--type-h1);
2789
2804
  letter-spacing: var(--ls-heading);