@veevarts/design-system 2.1.0-beta.24 → 2.1.0-beta.25
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/dist/components/DatePicker/DatePicker.d.ts +9 -2
- package/dist/components/DatePicker/defaults.d.ts +28 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +5736 -5314
- package/dist/patterns/AdminTable/styles.d.ts +2 -1
- package/dist/patterns/ExpandableTable/ExpandableTable.d.ts +6 -0
- package/dist/patterns/ExpandableTable/index.d.ts +2 -0
- package/dist/patterns/ExpandableTable/styles.d.ts +43 -0
- package/dist/patterns/ExpandableTable/types.d.ts +99 -0
- package/dist/patterns/NeedsFixDot/NeedsFixDot.d.ts +16 -0
- package/dist/patterns/NeedsFixDot/firstNeedsFixKey.d.ts +18 -0
- package/dist/patterns/NeedsFixDot/index.d.ts +4 -0
- package/dist/patterns/NeedsFixDot/styles.d.ts +20 -0
- package/dist/patterns/TimeField/TimeField.d.ts +6 -0
- package/dist/patterns/TimeField/index.d.ts +3 -0
- package/dist/patterns/TimeField/time.d.ts +40 -0
- package/dist/patterns/TimeField/types.d.ts +77 -0
- package/dist/patterns/UnderlineTabs/UnderlineTabs.d.ts +13 -1
- package/dist/patterns/UnderlineTabs/styles.d.ts +5 -0
- package/dist/patterns/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* They are exported for the one screen that cannot use `AdminTable`: react-aria's
|
|
12
12
|
* collection API rejects an interleaved `<tr>`, so a table that expands a row
|
|
13
|
-
* into a full-width panel renders its own `<table>` and dresses it with these
|
|
13
|
+
* into a full-width panel renders its own `<table>` and dresses it with these
|
|
14
|
+
* (`ExpandableTable` does, and so does the accounting ledger).
|
|
14
15
|
*
|
|
15
16
|
* The arbitrary values (`text-[11px]`, `tracking-[.04em]`) are the mockups'
|
|
16
17
|
* measurements, pinned rather than rounded to the nearest scale step: these
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { ExpandableTableProps } from './types';
|
|
3
|
+
export declare function ExpandableTable<Row>({ ariaLabel, columns, rows, getRowKey, getRowLabel, renderCell, renderExpanded, renderExpandedActions, getRowActions, rowNeedsFix, expandedKeys, defaultExpandedKeys, onExpandedChange, labels, emptyContent, className, 'data-testid': dataTestId, }: ExpandableTableProps<Row>): JSX.Element;
|
|
4
|
+
export declare namespace ExpandableTable {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ExpandableTableBreakpoint } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* warning-50 (`#FFFBEB`), the prototype's pale amber row. Not `--warn-fill`
|
|
4
|
+
* (warning-100): on that, the `--sub` text a row's second line uses drops to
|
|
5
|
+
* 4.35:1. On this one `--sub` holds 4.67:1 and `--warn` 4.85:1, pinned in the
|
|
6
|
+
* tests.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NEEDS_FIX_ROW_TINT: "#fffbeb";
|
|
9
|
+
/** The toggle's chevron: down while closed, up while open. */
|
|
10
|
+
export declare const EXPANDABLE_TABLE_CHEVRON_ICON = "solar:alt-arrow-down-outline";
|
|
11
|
+
/** Before the open panel's title. */
|
|
12
|
+
export declare const EXPANDABLE_TABLE_PANEL_ICON = "solar:pen-2-outline";
|
|
13
|
+
/** `hidden <bp>:table-cell` per breakpoint, written out so Tailwind sees every class. */
|
|
14
|
+
export declare const expandableTableHideBelowClass: Record<ExpandableTableBreakpoint, string>;
|
|
15
|
+
export declare const expandableTableClass: {
|
|
16
|
+
/** The `VerticalSteps` card; scrolls sideways rather than overflow the page. */
|
|
17
|
+
readonly root: "w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface";
|
|
18
|
+
readonly table: "w-full";
|
|
19
|
+
readonly th: "text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent";
|
|
20
|
+
readonly alignRight: "text-right";
|
|
21
|
+
/** Shrinks to the toggle and the icon buttons. */
|
|
22
|
+
readonly thActions: "w-px";
|
|
23
|
+
readonly row: "border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page";
|
|
24
|
+
readonly rowOpen: "bg-acct-page hover:bg-acct-page";
|
|
25
|
+
/** The admin cell had HeroUI's padding under it; a native cell needs its own (12px). */
|
|
26
|
+
readonly td: import('tailwind-variants').CnReturn;
|
|
27
|
+
readonly tdActions: "w-px whitespace-nowrap py-2 pl-2 pr-3 align-middle";
|
|
28
|
+
readonly actions: "flex items-center justify-end gap-0.5";
|
|
29
|
+
readonly toggle: "gap-1.5 text-acct-ink2 data-[hover=true]:bg-acct-hair";
|
|
30
|
+
readonly toggleOpen: "bg-acct-surface shadow-sm ring-1 ring-acct-border data-[hover=true]:bg-acct-surface";
|
|
31
|
+
readonly chevron: "size-4 shrink-0 transition-transform duration-150 motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none";
|
|
32
|
+
readonly chevronOpen: "rotate-180";
|
|
33
|
+
/** The open panel's row: same tint as the open summary line, no hairline between them. */
|
|
34
|
+
readonly panelRow: "bg-acct-page";
|
|
35
|
+
readonly panelCell: "px-4 pb-4 pt-0";
|
|
36
|
+
readonly panel: "rounded-xl border border-acct-border bg-acct-surface p-4 shadow-sm";
|
|
37
|
+
/** 12px uppercase in `--sub` (4.83:1 on white). */
|
|
38
|
+
readonly panelTitle: "mb-4 flex items-center gap-1.5 border-b border-acct-hair pb-3 text-xs font-semibold uppercase tracking-wide text-acct-sub";
|
|
39
|
+
readonly panelTitleIcon: "size-3.5 shrink-0";
|
|
40
|
+
readonly panelFooter: "mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-acct-hair pt-3";
|
|
41
|
+
readonly done: "border-acct-border bg-acct-surface";
|
|
42
|
+
readonly empty: "px-4 py-10 text-center text-sm text-acct-sub";
|
|
43
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RowAction } from '../RowActions';
|
|
3
|
+
/** A breakpoint below which a column (header and cells) is not drawn. */
|
|
4
|
+
export type ExpandableTableBreakpoint = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface ExpandableTableColumn {
|
|
6
|
+
/** Stable id. `renderCell` receives it to know which cell it is drawing. */
|
|
7
|
+
key: string;
|
|
8
|
+
/** Header text. */
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
/** `'right'` for numbers (price); `'left'` by default. */
|
|
11
|
+
align?: 'left' | 'right';
|
|
12
|
+
/** Width hint for the column: px number or any CSS length. Omit to size to content. */
|
|
13
|
+
width?: number | string;
|
|
14
|
+
/** Not drawn below this breakpoint, so a narrow screen keeps the columns that matter. */
|
|
15
|
+
hideBelow?: ExpandableTableBreakpoint;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Every string the table draws or speaks, translated by the host. No English
|
|
19
|
+
* lives in the component.
|
|
20
|
+
*/
|
|
21
|
+
export interface ExpandableTableLabels {
|
|
22
|
+
/** Visible text of each row's toggle ("Quick edit"). */
|
|
23
|
+
toggle: string;
|
|
24
|
+
/**
|
|
25
|
+
* Accessible name of one row's toggle, and of the panel it opens:
|
|
26
|
+
* `(rowLabel) => \`Quick edit ${rowLabel}\``. Keep `toggle` inside it, so
|
|
27
|
+
* voice control can say what it sees (WCAG 2.5.3).
|
|
28
|
+
*/
|
|
29
|
+
toggleRow: (rowLabel: string) => string;
|
|
30
|
+
/** Header of the controls column, read by screen readers only ("Actions"). */
|
|
31
|
+
actions: string;
|
|
32
|
+
/** The button at the foot of an open panel that closes it ("Done"). */
|
|
33
|
+
done: string;
|
|
34
|
+
/** Small heading at the top of an open panel ("Quick edit"). Omit for none. */
|
|
35
|
+
panelTitle?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Why a row closed or opened. `toggle` is the row's own button; the rest only
|
|
39
|
+
* close: `done` is the Done button or `close()`, `enter` is Enter in a
|
|
40
|
+
* single-line field, `escape` is Escape anywhere in the panel. Changes apply
|
|
41
|
+
* as the host's fields change, so none of them reverts anything; a host that
|
|
42
|
+
* keeps a draft can discard it on `escape`.
|
|
43
|
+
*/
|
|
44
|
+
export type ExpandableTableReason = 'toggle' | 'done' | 'enter' | 'escape';
|
|
45
|
+
export interface ExpandableTableExpandedChange {
|
|
46
|
+
/** The row that opened or closed. */
|
|
47
|
+
key: string;
|
|
48
|
+
expanded: boolean;
|
|
49
|
+
reason: ExpandableTableReason;
|
|
50
|
+
}
|
|
51
|
+
/** What `renderExpanded` and `renderExpandedActions` get besides the row. */
|
|
52
|
+
export interface ExpandableTableRowContext {
|
|
53
|
+
rowIndex: number;
|
|
54
|
+
/** Closes this row's panel and returns focus to its toggle (reason `done`). */
|
|
55
|
+
close: () => void;
|
|
56
|
+
}
|
|
57
|
+
export interface ExpandableTableProps<Row> {
|
|
58
|
+
/** Accessible name of the table ("Ticket types"). */
|
|
59
|
+
ariaLabel: string;
|
|
60
|
+
columns: ExpandableTableColumn[];
|
|
61
|
+
rows: Row[];
|
|
62
|
+
/** Stable, unique id of a row: keys its group, its test ids and the open set. */
|
|
63
|
+
getRowKey: (row: Row) => string;
|
|
64
|
+
/** Short name of a row ("Adult"), used in the accessible names of its controls. */
|
|
65
|
+
getRowLabel: (row: Row) => string;
|
|
66
|
+
/** One cell of the summary line. */
|
|
67
|
+
renderCell: (row: Row, columnKey: string, rowIndex: number) => ReactNode;
|
|
68
|
+
/** The fields an open row shows under its summary line (the Quick edit form). */
|
|
69
|
+
renderExpanded: (row: Row, context: ExpandableTableRowContext) => ReactNode;
|
|
70
|
+
/** Buttons at the foot of an open row, before Done ("More details"). */
|
|
71
|
+
renderExpandedActions?: (row: Row, context: ExpandableTableRowContext) => ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Icon buttons after the toggle, drawn by `RowActions` (Duplicate, All
|
|
74
|
+
* details, Delete). Name each with its subject: "Duplicate Adult".
|
|
75
|
+
*/
|
|
76
|
+
getRowActions?: (row: Row, rowIndex: number) => RowAction[];
|
|
77
|
+
/**
|
|
78
|
+
* Rows that need a fix get a pale warning tint (warning-50) while closed,
|
|
79
|
+
* and `data-needs-fix="true"`. The tint is a cue, not the message: say what
|
|
80
|
+
* is missing in a cell, as text.
|
|
81
|
+
*/
|
|
82
|
+
rowNeedsFix?: (row: Row) => boolean;
|
|
83
|
+
/** Open rows, controlled. Several can be open at once. */
|
|
84
|
+
expandedKeys?: Iterable<string>;
|
|
85
|
+
/** Open rows at first render, uncontrolled. */
|
|
86
|
+
defaultExpandedKeys?: Iterable<string>;
|
|
87
|
+
/** Every open or close, with the new open set and which row changed why. */
|
|
88
|
+
onExpandedChange?: (keys: Set<string>, change: ExpandableTableExpandedChange) => void;
|
|
89
|
+
labels: ExpandableTableLabels;
|
|
90
|
+
/** Shown in place of the rows when there are none. */
|
|
91
|
+
emptyContent?: ReactNode;
|
|
92
|
+
className?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Root test id (default `expandable-table`). Per row: `-row-<key>` (with
|
|
95
|
+
* `data-expanded` and `data-needs-fix`), `-toggle-<key>`, `-panel-<key>`,
|
|
96
|
+
* `-done-<key>` and `-actions-<key>` (each action `-actions-<key>-<action>`).
|
|
97
|
+
*/
|
|
98
|
+
'data-testid'?: string;
|
|
99
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
export interface NeedsFixDotProps {
|
|
3
|
+
/**
|
|
4
|
+
* Read out in place of the dot ("Needs a fix"). Required: without it the
|
|
5
|
+
* state is color alone. It follows the label it sits beside, so include any
|
|
6
|
+
* punctuation your language wants between the two.
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Root test id. The visible dot is `${data-testid}-mark`. */
|
|
11
|
+
'data-testid'?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function NeedsFixDot({ label, className, 'data-testid': dataTestId, }: NeedsFixDotProps): JSX.Element;
|
|
14
|
+
export declare namespace NeedsFixDot {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The shape `firstNeedsFixKey` reads: an `UnderlineTabItem`, or any keyed item. */
|
|
2
|
+
export interface NeedsFixItem<K extends string = string> {
|
|
3
|
+
key: K;
|
|
4
|
+
needsFix?: boolean;
|
|
5
|
+
isDisabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The key a details panel should open on: the first item that needs a fix and
|
|
9
|
+
* can be selected, else `fallback`.
|
|
10
|
+
*
|
|
11
|
+
* A pure helper rather than tab behaviour, because only the host knows when
|
|
12
|
+
* the panel "opens" — moving to the next record keeps the tab the user is on.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* if (justOpened) setTab(firstNeedsFixKey(tabs, 'general'));
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function firstNeedsFixKey<K extends string>(items: ReadonlyArray<NeedsFixItem<K>>, fallback: K): K;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The needs-fix dot's appearance, in one place.
|
|
3
|
+
*
|
|
4
|
+
* The color is inline, read from `adminSurfaceTokens`, not a Tailwind class:
|
|
5
|
+
* the dot carries meaning, so it must survive a consumer whose Tailwind
|
|
6
|
+
* `content` globs miss this package. Same reasoning as `VerticalSteps`'
|
|
7
|
+
* status tones and `StatusChip`'s `DOT_TONE`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* `--warn` (warning-700), the tone `VerticalSteps` paints a step that needs a
|
|
11
|
+
* fix with. The prototype's amber-500 measures 2.15:1 on white, under the 3:1
|
|
12
|
+
* WCAG 1.4.11 asks of a graphic a sighted user reads state from; warning-700
|
|
13
|
+
* measures 5.02:1.
|
|
14
|
+
*/
|
|
15
|
+
export declare const NEEDS_FIX_DOT_COLOR: string;
|
|
16
|
+
export declare const needsFixDotClass: {
|
|
17
|
+
readonly root: "inline-flex shrink-0 items-center";
|
|
18
|
+
/** 6px, the prototype's `size-1.5`, in rem so a root font size change scales it. */
|
|
19
|
+
readonly dot: "block size-1.5 shrink-0 rounded-full";
|
|
20
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { TimeFieldProps } from './types';
|
|
3
|
+
export declare function TimeField({ value: valueProp, defaultValue, onChange, label, 'aria-label': ariaLabel, placeholder, emptyContent, invalidMessage, minTime, minTimeMessage, listStart, listEnd, listStep, locale, isRequired, isDisabled, isInvalid, errorMessage, isClearable, clearLabel, onBlur, size, variant, labelPlacement, className, inputProps, popoverProps, 'data-testid': dataTestId, }: TimeFieldProps): JSX.Element;
|
|
4
|
+
export declare namespace TimeField {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The time logic behind {@link TimeField}, kept free of React so it can be
|
|
3
|
+
* tested and reused on its own. Every time in and out is 24-hour `"HH:mm"`.
|
|
4
|
+
*/
|
|
5
|
+
/** Minutes since midnight of an `"HH:mm"` time. */
|
|
6
|
+
export declare function toMinutes(time: string): number;
|
|
7
|
+
/**
|
|
8
|
+
* Read typed text as a time: `"HH:mm"`, or `null` when it is not one.
|
|
9
|
+
*
|
|
10
|
+
* Forgiving on purpose: `"7:15 pm"`, `"7:15pm"`, `"715p"`, `"7p"`, `"19:15"`,
|
|
11
|
+
* `"1915"` and `"7"` all work; case, spaces and dots do not matter
|
|
12
|
+
* (`"7:15 P.M."`). Without am/pm, hours 1–6 read as afternoon (no venue opens
|
|
13
|
+
* at 3 AM) and every other hour as 24-hour: `"3"` is 15:00, `"7"` is 07:00,
|
|
14
|
+
* `"19"` is 19:00, `"0"` is midnight.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* parseTimeInput('715p'); // '19:15'
|
|
18
|
+
* parseTimeInput('3'); // '15:00'
|
|
19
|
+
* parseTimeInput('25'); // null
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseTimeInput(input: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The suggested times: `start` to `end` inclusive, every `step` whole
|
|
24
|
+
* minutes. Empty when `step` is under a minute or `end` is before `start`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTimeOptions(start: string, end: string, step: number): string[];
|
|
27
|
+
/**
|
|
28
|
+
* Whether the list keeps `time` while `query` is typed. It compares against
|
|
29
|
+
* the 12-hour form (`"7:30"`) and the 24-hour forms (`"19:30"`, `"07:30"`), so
|
|
30
|
+
* it does not depend on how the label is formatted: `"7"` keeps 7:00 and
|
|
31
|
+
* 7:30 AM and PM, `"7p"` only the PM ones, `"19"` the 7 PM ones, `"p"` every
|
|
32
|
+
* PM time.
|
|
33
|
+
*/
|
|
34
|
+
export declare function matchesTimeQuery(time: string, query: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The label for a time in `locale`: `"7:15 PM"` in `en-US`, `"19:15"` in
|
|
37
|
+
* `en-GB`, `"7:15 p. m."` in `es-CO`. No-break spaces become plain ones, so
|
|
38
|
+
* the label matches what people type and what tests search for.
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatTimeLabel(time: string, locale: string): string;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FocusEvent, ReactNode } from 'react';
|
|
2
|
+
import { AutocompleteProps } from '../../components';
|
|
3
|
+
/** One row of the list: the `"HH:mm"` key and its locale label. */
|
|
4
|
+
export interface TimeFieldOption {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TimeFieldProps {
|
|
9
|
+
/**
|
|
10
|
+
* The time as 24-hour `"HH:mm"` text, or `null` for none. Omit for
|
|
11
|
+
* uncontrolled mode.
|
|
12
|
+
*/
|
|
13
|
+
value?: string | null;
|
|
14
|
+
/** Starting time in uncontrolled mode. */
|
|
15
|
+
defaultValue?: string | null;
|
|
16
|
+
/** Called with the committed `"HH:mm"`, or `null` when a clearable field is emptied. */
|
|
17
|
+
onChange?: (time: string | null) => void;
|
|
18
|
+
/** Visible label. Without one, pass `aria-label`. */
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
/** "e.g. 7:15 PM". */
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Shown in the list when nothing matches the typed text, or the text was
|
|
25
|
+
* erased ("Type a time like 7:15 PM"). Required and non-empty: HeroUI's
|
|
26
|
+
* own is English, and an Autocomplete that hides an empty list loses its
|
|
27
|
+
* options to `aria-hidden` when they come back.
|
|
28
|
+
*/
|
|
29
|
+
emptyContent: ReactNode;
|
|
30
|
+
/** Shown when the typed text is not a time ("Enter a time like 7:15 PM."). */
|
|
31
|
+
invalidMessage: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Earliest allowed `"HH:mm"`. Earlier times leave the list, and typing
|
|
34
|
+
* one, or receiving one as `value`, shows `minTimeMessage`.
|
|
35
|
+
*/
|
|
36
|
+
minTime?: string;
|
|
37
|
+
/** Shown for a time before `minTime` ("Ends after it starts."). Defaults to `invalidMessage`. */
|
|
38
|
+
minTimeMessage?: ReactNode;
|
|
39
|
+
/** First time the list suggests. @default '07:00' */
|
|
40
|
+
listStart?: string;
|
|
41
|
+
/** Last time the list suggests, inclusive. @default '21:00' */
|
|
42
|
+
listEnd?: string;
|
|
43
|
+
/** Minutes between suggested times. @default 30 */
|
|
44
|
+
listStep?: number;
|
|
45
|
+
/**
|
|
46
|
+
* BCP 47 locale the times are written in: "7:15 PM" in `en-US`, "19:15"
|
|
47
|
+
* in `en-GB`. Pass the same one as `HeroUIProvider`. @default 'en-US'
|
|
48
|
+
*/
|
|
49
|
+
locale?: string;
|
|
50
|
+
isRequired?: boolean;
|
|
51
|
+
isDisabled?: boolean;
|
|
52
|
+
/** Marks the field invalid from outside; `errorMessage` is shown with it. */
|
|
53
|
+
isInvalid?: boolean;
|
|
54
|
+
errorMessage?: ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the field may be emptied: a clear button shows, and leaving it
|
|
57
|
+
* empty commits `null`. Otherwise leaving it empty restores the time it
|
|
58
|
+
* had. @default false
|
|
59
|
+
*/
|
|
60
|
+
isClearable?: boolean;
|
|
61
|
+
/** Accessible name of the clear button ("Clear time"); HeroUI gives it none. */
|
|
62
|
+
clearLabel?: string;
|
|
63
|
+
/** Called after the field has committed what was typed (react-hook-form's `field.onBlur`). */
|
|
64
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
65
|
+
size?: AutocompleteProps['size'];
|
|
66
|
+
/** @default 'bordered' */
|
|
67
|
+
variant?: AutocompleteProps['variant'];
|
|
68
|
+
/** @default 'outside-top' */
|
|
69
|
+
labelPlacement?: AutocompleteProps['labelPlacement'];
|
|
70
|
+
className?: string;
|
|
71
|
+
/** Passed to HeroUI's input: `{ classNames: { inputWrapper: 'h-11' } }`. */
|
|
72
|
+
inputProps?: AutocompleteProps['inputProps'];
|
|
73
|
+
/** Passed to HeroUI's popover. */
|
|
74
|
+
popoverProps?: AutocompleteProps['popoverProps'];
|
|
75
|
+
/** Lands on the `<input>`. Options get `${data-testid}-option-${HH:mm}`. */
|
|
76
|
+
'data-testid'?: string;
|
|
77
|
+
}
|
|
@@ -30,6 +30,12 @@ export interface UnderlineTabItem<K extends string = string> {
|
|
|
30
30
|
* cannot be gifted").
|
|
31
31
|
*/
|
|
32
32
|
hint?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Something on this tab's panel needs a fix: a warning dot after the label,
|
|
35
|
+
* and `needsFixLabel` read out with the tab's name. Pick the tab a panel
|
|
36
|
+
* opens on with `firstNeedsFixKey(items, fallback)`.
|
|
37
|
+
*/
|
|
38
|
+
needsFix?: boolean;
|
|
33
39
|
}
|
|
34
40
|
export interface UnderlineTabsProps<K extends string = string> {
|
|
35
41
|
items: UnderlineTabItem<K>[];
|
|
@@ -49,10 +55,16 @@ export interface UnderlineTabsProps<K extends string = string> {
|
|
|
49
55
|
* follows. `false`: neither, for a strip at the foot of a card.
|
|
50
56
|
*/
|
|
51
57
|
showDivider?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Spoken after the name of a tab with `needsFix` ("Needs a fix"), in place
|
|
60
|
+
* of the dot, which is hidden from assistive tech. Pass it whenever an
|
|
61
|
+
* item can need a fix: without it the state is color alone.
|
|
62
|
+
*/
|
|
63
|
+
needsFixLabel?: string;
|
|
52
64
|
className?: string;
|
|
53
65
|
'data-testid'?: string;
|
|
54
66
|
}
|
|
55
|
-
export declare function UnderlineTabs<K extends string = string>({ items, value, onChange, ariaLabel, size, level, showDivider, className, 'data-testid': dataTestId, }: UnderlineTabsProps<K>): import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export declare function UnderlineTabs<K extends string = string>({ items, value, onChange, ariaLabel, size, level, showDivider, needsFixLabel, className, 'data-testid': dataTestId, }: UnderlineTabsProps<K>): import("react/jsx-runtime").JSX.Element;
|
|
56
68
|
export declare namespace UnderlineTabs {
|
|
57
69
|
var displayName: string;
|
|
58
70
|
}
|
|
@@ -12,5 +12,10 @@ export declare const underlineTabsSlots: Record<'md' | 'lg' | 'sm-primary' | 'sm
|
|
|
12
12
|
* `base`, so both slots drop theirs (and `-mb-px`, which only overlapped it).
|
|
13
13
|
*/
|
|
14
14
|
export declare const underlineTabsNoDivider: Pick<UnderlineTabsSlots, 'base' | 'tabList'>;
|
|
15
|
+
/**
|
|
16
|
+
* The title of a tab with `needsFix`: the label, then the dot 6px after it
|
|
17
|
+
* (the prototype's `gap-1.5`), centred on the label's line.
|
|
18
|
+
*/
|
|
19
|
+
export declare const underlineTabsNeedsFixTitleClass = "inline-flex items-center gap-1.5";
|
|
15
20
|
/** Added to the `md` cursor under reduced motion: it jumps instead of sliding. */
|
|
16
21
|
export declare const stillCursorClass = "data-[animated=true]:transition-none";
|
package/dist/patterns/index.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ export { TableSkeleton } from './TableSkeleton';
|
|
|
59
59
|
export type { TableSkeletonProps, TableSkeletonClassNames } from './TableSkeleton';
|
|
60
60
|
export { AdminTable, adminRowClass, adminTableClass, adminTableFooterClass, adminTdClass, adminThClass, } from './AdminTable';
|
|
61
61
|
export type { AdminTableProps, AdminTableColumn, AdminTableClassNames } from './AdminTable';
|
|
62
|
+
export { ExpandableTable } from './ExpandableTable';
|
|
63
|
+
export type { ExpandableTableBreakpoint, ExpandableTableColumn, ExpandableTableExpandedChange, ExpandableTableLabels, ExpandableTableProps, ExpandableTableReason, ExpandableTableRowContext, } from './ExpandableTable';
|
|
64
|
+
export { NeedsFixDot, firstNeedsFixKey } from './NeedsFixDot';
|
|
65
|
+
export type { NeedsFixDotProps, NeedsFixItem } from './NeedsFixDot';
|
|
62
66
|
export { AdminToolbar } from './AdminToolbar';
|
|
63
67
|
export type { AdminToolbarProps, AdminToolbarSearchWidth, AdminToolbarSize } from './AdminToolbar';
|
|
64
68
|
export { ToolbarButton } from './ToolbarButton';
|
|
@@ -67,6 +71,8 @@ export { UnderlineTabs } from './UnderlineTabs';
|
|
|
67
71
|
export type { UnderlineTabsProps, UnderlineTabItem, UnderlineTabsSize, UnderlineTabsLevel } from './UnderlineTabs';
|
|
68
72
|
export { AdminFieldLabel, AdminTextField, adminFieldErrorClass, adminFieldHelpButtonClass, adminFieldHelpContentClass, adminFieldHelpIconClass, adminFieldHintClass, adminFieldLabelClass, adminFieldLabelNoAutoMarkClass, adminFieldLabelRowClass, adminFieldLabelSuffixClass, adminFieldRequiredClass, adminInputClass, adminInputReadOnlyClass, adminInputWrapperClass, } from './AdminTextField';
|
|
69
73
|
export type { AdminTextFieldProps, AdminFieldLabelProps, AdminFieldRequiredProps, AdminFieldHelpProps, } from './AdminTextField';
|
|
74
|
+
export { TimeField, parseTimeInput } from './TimeField';
|
|
75
|
+
export type { TimeFieldProps } from './TimeField';
|
|
70
76
|
export { RowActions } from './RowActions';
|
|
71
77
|
export type { RowActionsProps, RowAction } from './RowActions';
|
|
72
78
|
export { PickerRow } from './PickerRow';
|