@crewlethq/ui 0.149.0 → 0.150.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/dist/DataGrid/index.js +2 -1
- package/dist/DurationField/DurationField.d.ts +59 -0
- package/dist/DurationField/index.d.ts +3 -0
- package/dist/DurationField/index.js +32 -0
- package/dist/DurationField-TJFIAUMW.css +23 -0
- package/dist/LinkInterstitial/index.js +2 -2
- package/dist/NumberField/NumberField.d.ts +56 -0
- package/dist/NumberField/index.d.ts +3 -0
- package/dist/NumberField/index.js +29 -0
- package/dist/NumberField-G7H4VNZP.css +30 -0
- package/dist/OrgTable/index.js +4 -3
- package/dist/PresetChips/PresetChips.d.ts +27 -0
- package/dist/PresetChips/index.d.ts +2 -0
- package/dist/PresetChips/index.js +21 -0
- package/dist/RailList/index.js +3 -3
- package/dist/SettingForm/SettingForm.d.ts +50 -0
- package/dist/SettingForm/index.d.ts +3 -0
- package/dist/SettingForm/index.js +20 -0
- package/dist/SettingForm-ODVZZ7JZ.css +30 -0
- package/dist/SettingsTable/SettingsTable.d.ts +47 -34
- package/dist/SettingsTable/index.d.ts +3 -2
- package/dist/SettingsTable/index.js +3 -1
- package/dist/SettingsTable-KAMWVCQB.css +169 -0
- package/dist/SheetColumnEditor/index.js +1 -1
- package/dist/TreeGrid/index.js +3 -2
- package/dist/{chunk-5C7MP4C7.js → chunk-3Q5USPLM.js} +1 -1
- package/dist/chunk-6QWSGM4W.js +21 -0
- package/dist/chunk-BQMDD2FD.js +224 -0
- package/dist/chunk-DDGHRDGV.js +134 -0
- package/dist/chunk-HU56GCZ7.js +198 -0
- package/dist/chunk-NG6GEBSJ.js +53 -0
- package/dist/chunk-OX332RI7.js +127 -0
- package/dist/{chunk-3SUIU2ZO.js → chunk-Q3SHCEXN.js} +5 -194
- package/dist/{chunk-O3CY4MHN.js → chunk-RUKSDKG5.js} +2 -1
- package/dist/generated/index.d.ts +4 -0
- package/dist/generated/index.js +65 -60
- package/dist/index.js +65 -60
- package/dist/styles.css +166 -87
- package/package.json +3 -3
- package/dist/SettingsTable-MTZJTKA6.css +0 -182
- package/dist/chunk-RTMFZLU3.js +0 -94
- package/dist/{chunk-II7TPQ64.js → chunk-2DASEYUG.js} +0 -0
- package/dist/{chunk-UPQ4MDPE.js → chunk-733FZXNS.js} +1 -1
- package/dist/{chunk-3GWCWUSY.js → chunk-ECYA6XZL.js} +1 -1
package/dist/DataGrid/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { ChooserList, ColumnChooser, DATA_GRID_ICON_TRACK, DataGrid, columnChoicesOf, countDataGridRows, fitGridColumns,
|
|
1
|
+
export { ChooserList, ColumnChooser, DATA_GRID_ICON_TRACK, DataGrid, columnChoicesOf, countDataGridRows, fitGridColumns, sortGridRows, useAnyDataGridDriving, useDataGridDriving } from '../chunk-Q3SHCEXN.js';
|
|
2
|
+
export { nextGridSort, parseGridSort } from '../chunk-HU56GCZ7.js';
|
|
2
3
|
import '../chunk-WFAJYBLX.js';
|
|
3
4
|
import '../chunk-WSIJDWUG.js';
|
|
4
5
|
import '../chunk-JMBPMSNI.js';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** The units a duration is typed in. */
|
|
2
|
+
export type DurationUnit = 'seconds' | 'minutes' | 'hours' | 'days';
|
|
3
|
+
/** Each unit's length in seconds, largest first. */
|
|
4
|
+
export declare const DURATION_UNIT_SECONDS: Readonly<Record<DurationUnit, number>>;
|
|
5
|
+
/** A duration as the field holds it: the amount as typed, in a unit. Empty is the default. */
|
|
6
|
+
export interface DurationValue {
|
|
7
|
+
amount: string;
|
|
8
|
+
unit: DurationUnit;
|
|
9
|
+
}
|
|
10
|
+
/** Every string the field draws itself. */
|
|
11
|
+
export interface DurationFieldLabels {
|
|
12
|
+
/** A unit's name, for one and for many. */
|
|
13
|
+
units: Readonly<Record<DurationUnit, readonly [one: string, many: string]>>;
|
|
14
|
+
/** Names the unit picker. */
|
|
15
|
+
unit: string;
|
|
16
|
+
/** The preset that empties the field, with the default it stands for: "Default (12 hours)". */
|
|
17
|
+
defaultPreset: (words: string) => string;
|
|
18
|
+
presets: string;
|
|
19
|
+
decrease: string;
|
|
20
|
+
increase: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const DURATION_FIELD_LABELS: DurationFieldLabels;
|
|
23
|
+
/** A number of seconds as the field holds it, in the largest whole unit; null is the default (empty). */
|
|
24
|
+
export declare function durationValue(seconds: number | null, fallback?: number | null, units?: readonly DurationUnit[]): DurationValue;
|
|
25
|
+
/** What the field holds, in seconds: null where it is empty, NaN where the amount is not a number. */
|
|
26
|
+
export declare function durationSeconds(value: DurationValue): number | null;
|
|
27
|
+
/** A number of seconds in words, in its largest whole unit: "12 hours", "90 seconds". */
|
|
28
|
+
export declare function durationWords(seconds: number, labels?: Pick<DurationFieldLabels, 'units'>): string;
|
|
29
|
+
export interface DurationFieldProps {
|
|
30
|
+
id?: string | undefined;
|
|
31
|
+
value: DurationValue;
|
|
32
|
+
onValueChange: (value: DurationValue) => void;
|
|
33
|
+
/** The duration an empty field stands for, in seconds. */
|
|
34
|
+
defaultValue?: number | undefined;
|
|
35
|
+
/** The bounds, in seconds: the amount's steppers hold to them in whichever unit is picked. */
|
|
36
|
+
min?: number | undefined;
|
|
37
|
+
max?: number | undefined;
|
|
38
|
+
/** The units offered, from those the bounds can hold. All four by default. */
|
|
39
|
+
units?: readonly DurationUnit[] | undefined;
|
|
40
|
+
/** Durations offered as chips, in seconds, after a "Default" chip where `defaultValue` is set. */
|
|
41
|
+
presets?: readonly number[] | undefined;
|
|
42
|
+
error?: boolean | undefined;
|
|
43
|
+
disabled?: boolean | undefined;
|
|
44
|
+
/** Puts the focus in the amount once it is drawn. */
|
|
45
|
+
focusOnMount?: boolean | undefined;
|
|
46
|
+
'aria-label'?: string | undefined;
|
|
47
|
+
'aria-describedby'?: string | undefined;
|
|
48
|
+
labels?: Partial<DurationFieldLabels> | undefined;
|
|
49
|
+
className?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A duration typed as an amount and a unit (seconds, minutes, hours, days),
|
|
53
|
+
* with common durations as chips: "12" and "hours", never "43200" or "12h".
|
|
54
|
+
*
|
|
55
|
+
* A PRESET PICKS ITS OWN UNIT: "7 days" fills 7 and days. A typed amount
|
|
56
|
+
* keeps the unit beside it, and an empty field (the default) shows the
|
|
57
|
+
* default's amount as its placeholder in the default's unit.
|
|
58
|
+
*/
|
|
59
|
+
export declare function DurationField({ id, value, onValueChange, defaultValue, min, max, units, presets, error, disabled, focusOnMount, labels: overrides, className, ...aria }: DurationFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import './DurationField.css';
|
|
2
|
+
export { DURATION_FIELD_LABELS, DURATION_UNIT_SECONDS, DurationField, durationSeconds, durationValue, durationWords, } from './DurationField.js';
|
|
3
|
+
export type { DurationFieldLabels, DurationFieldProps, DurationUnit, DurationValue } from './DurationField.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { DURATION_FIELD_LABELS, DURATION_UNIT_SECONDS, DurationField, durationSeconds, durationValue, durationWords } from '../chunk-OX332RI7.js';
|
|
2
|
+
import '../chunk-657WR3MX.js';
|
|
3
|
+
import '../chunk-DDGHRDGV.js';
|
|
4
|
+
import '../chunk-6QWSGM4W.js';
|
|
5
|
+
import '../chunk-KW7T23RT.js';
|
|
6
|
+
import '../chunk-B3UJKLVI.js';
|
|
7
|
+
import '../chunk-GMXOZEF5.js';
|
|
8
|
+
import '../chunk-XJU53WMW.js';
|
|
9
|
+
import '../chunk-7F3OPUM5.js';
|
|
10
|
+
import '../chunk-QRE6JCHS.js';
|
|
11
|
+
import '../chunk-ZMZNKDPO.js';
|
|
12
|
+
import '../chunk-XQMRSL7Z.js';
|
|
13
|
+
import '../chunk-NICEDVZM.js';
|
|
14
|
+
import '../chunk-JLKO7PSK.js';
|
|
15
|
+
import '../chunk-PJV5HVZY.js';
|
|
16
|
+
import '../chunk-TEXK4RK6.js';
|
|
17
|
+
import '../chunk-IMF3CPTY.js';
|
|
18
|
+
import '../chunk-XSPCITPN.js';
|
|
19
|
+
import '../chunk-2YTOOH3A.js';
|
|
20
|
+
import '../chunk-KM5OKCW6.js';
|
|
21
|
+
import '../chunk-TDFLCUBE.js';
|
|
22
|
+
import '../chunk-BFZAGIXR.js';
|
|
23
|
+
import '../chunk-L72URIHR.js';
|
|
24
|
+
import '../chunk-HTS5RJ7S.js';
|
|
25
|
+
import '../chunk-AVJKMQXK.js';
|
|
26
|
+
import '../chunk-EDPMHSLZ.js';
|
|
27
|
+
import '../chunk-4ITETIGZ.js';
|
|
28
|
+
import '../chunk-Y5CMDLQM.js';
|
|
29
|
+
import '../chunk-PQADV6P6.js';
|
|
30
|
+
import '../chunk-WGMKERCR.js';
|
|
31
|
+
import '../chunk-RRRK2KB6.js';
|
|
32
|
+
import '../chunk-ODEQTPFM.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* DurationField: the amount with its steppers, the unit beside it, then its preset chips. */
|
|
2
|
+
|
|
3
|
+
.crewlet-duration-field {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--spacing-2);
|
|
7
|
+
min-width: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.crewlet-duration-field__row {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
gap: var(--spacing-2);
|
|
14
|
+
min-width: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.crewlet-duration-field__amount {
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.crewlet-duration-field__unit {
|
|
22
|
+
flex: none;
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { LinkInterstitial, openExternal } from '../chunk-
|
|
2
|
-
import '../chunk-W4UJWFCZ.js';
|
|
1
|
+
export { LinkInterstitial, openExternal } from '../chunk-733FZXNS.js';
|
|
3
2
|
import '../chunk-7PK2Z5JY.js';
|
|
3
|
+
import '../chunk-W4UJWFCZ.js';
|
|
4
4
|
import '../chunk-HZXS5CEL.js';
|
|
5
5
|
import '../chunk-UEO3A76N.js';
|
|
6
6
|
import '../chunk-IMF3CPTY.js';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PresetChip } from '../PresetChips/index.js';
|
|
3
|
+
/** Every string the field draws itself. */
|
|
4
|
+
export interface NumberFieldLabels {
|
|
5
|
+
decrease: string;
|
|
6
|
+
increase: string;
|
|
7
|
+
/** The preset that empties the field, with the default it stands for: "Default (10)". */
|
|
8
|
+
defaultPreset: (value: string) => string;
|
|
9
|
+
/** Names the preset row. */
|
|
10
|
+
presets: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const NUMBER_FIELD_LABELS: NumberFieldLabels;
|
|
13
|
+
export interface NumberFieldProps {
|
|
14
|
+
id?: string | undefined;
|
|
15
|
+
/** What is typed. Empty is the default, drawn as the placeholder. */
|
|
16
|
+
value: string;
|
|
17
|
+
onValueChange: (value: string) => void;
|
|
18
|
+
/** The value an empty field stands for: its placeholder, and where a step from empty starts. */
|
|
19
|
+
defaultValue?: number | undefined;
|
|
20
|
+
min?: number | undefined;
|
|
21
|
+
max?: number | undefined;
|
|
22
|
+
/** How far one press or arrow moves the value. Defaults to 1. */
|
|
23
|
+
step?: number | undefined;
|
|
24
|
+
/** The unit after the number, inside the field: "characters", "%". */
|
|
25
|
+
unit?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Values offered as chips under the field. Given (even empty), a "Default"
|
|
28
|
+
* chip leads them where `defaultValue` is set; left out, no chips are drawn.
|
|
29
|
+
*/
|
|
30
|
+
presets?: readonly PresetChip[] | undefined;
|
|
31
|
+
/** How a preset or the default is said on its chip: "10 characters". Defaults to the number. */
|
|
32
|
+
formatValue?: ((value: number) => string) | undefined;
|
|
33
|
+
error?: boolean | undefined;
|
|
34
|
+
disabled?: boolean | undefined;
|
|
35
|
+
/** Puts the focus in the field once it is drawn: a panel opened to change this value. */
|
|
36
|
+
focusOnMount?: boolean | undefined;
|
|
37
|
+
'aria-label'?: string | undefined;
|
|
38
|
+
'aria-describedby'?: string | undefined;
|
|
39
|
+
labels?: Partial<NumberFieldLabels> | undefined;
|
|
40
|
+
className?: string | undefined;
|
|
41
|
+
}
|
|
42
|
+
/** What is typed, as a number, or null where it is empty or not one. */
|
|
43
|
+
export declare function typedNumber(value: string): number | null;
|
|
44
|
+
/**
|
|
45
|
+
* A number typed or stepped: a field between a decrease and an increase
|
|
46
|
+
* button, held to its bounds, with the default as its placeholder.
|
|
47
|
+
*
|
|
48
|
+
* THE STEPPERS STAND BESIDE THE FIELD, never inside it, and take no tab stop:
|
|
49
|
+
* the arrows step from the field itself (Page Up and Page Down by ten steps),
|
|
50
|
+
* as a spin button does. A step from an empty field starts at the default, so
|
|
51
|
+
* one press of + on "10 (default)" reads 11. At a bound its button is held.
|
|
52
|
+
*
|
|
53
|
+
* WHAT IS TYPED STAYS THE CALLER'S, as text: a half-typed "1." or a word is
|
|
54
|
+
* the caller's to read and refuse, and empty is the default.
|
|
55
|
+
*/
|
|
56
|
+
export declare const NumberField: import("react").ForwardRefExoticComponent<NumberFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { NUMBER_FIELD_LABELS, NumberField, typedNumber } from '../chunk-DDGHRDGV.js';
|
|
2
|
+
import '../chunk-6QWSGM4W.js';
|
|
3
|
+
import '../chunk-B3UJKLVI.js';
|
|
4
|
+
import '../chunk-GMXOZEF5.js';
|
|
5
|
+
import '../chunk-XJU53WMW.js';
|
|
6
|
+
import '../chunk-7F3OPUM5.js';
|
|
7
|
+
import '../chunk-QRE6JCHS.js';
|
|
8
|
+
import '../chunk-ZMZNKDPO.js';
|
|
9
|
+
import '../chunk-XQMRSL7Z.js';
|
|
10
|
+
import '../chunk-NICEDVZM.js';
|
|
11
|
+
import '../chunk-JLKO7PSK.js';
|
|
12
|
+
import '../chunk-PJV5HVZY.js';
|
|
13
|
+
import '../chunk-TEXK4RK6.js';
|
|
14
|
+
import '../chunk-IMF3CPTY.js';
|
|
15
|
+
import '../chunk-XSPCITPN.js';
|
|
16
|
+
import '../chunk-2YTOOH3A.js';
|
|
17
|
+
import '../chunk-KM5OKCW6.js';
|
|
18
|
+
import '../chunk-TDFLCUBE.js';
|
|
19
|
+
import '../chunk-BFZAGIXR.js';
|
|
20
|
+
import '../chunk-L72URIHR.js';
|
|
21
|
+
import '../chunk-HTS5RJ7S.js';
|
|
22
|
+
import '../chunk-AVJKMQXK.js';
|
|
23
|
+
import '../chunk-EDPMHSLZ.js';
|
|
24
|
+
import '../chunk-4ITETIGZ.js';
|
|
25
|
+
import '../chunk-Y5CMDLQM.js';
|
|
26
|
+
import '../chunk-PQADV6P6.js';
|
|
27
|
+
import '../chunk-WGMKERCR.js';
|
|
28
|
+
import '../chunk-RRRK2KB6.js';
|
|
29
|
+
import '../chunk-ODEQTPFM.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* NumberField: a field between its two steppers, then its preset chips. */
|
|
2
|
+
|
|
3
|
+
.crewlet-number-field {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--spacing-2);
|
|
7
|
+
min-width: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.crewlet-number-field__row {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--spacing-1);
|
|
14
|
+
min-width: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.crewlet-number-field__input {
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Figures line up under each other as they are stepped. */
|
|
23
|
+
.crewlet-number-field__input input {
|
|
24
|
+
font-variant-numeric: tabular-nums;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.crewlet-number-field__unit {
|
|
28
|
+
color: var(--color-text-tertiary);
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
}
|
package/dist/OrgTable/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { OrgTable, OrgTableActions, OrgTableAdd, OrgTableName } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { OrgTable, OrgTableActions, OrgTableAdd, OrgTableName } from '../chunk-3Q5USPLM.js';
|
|
2
|
+
import '../chunk-RUKSDKG5.js';
|
|
3
3
|
import '../chunk-PFP5HHZF.js';
|
|
4
4
|
import '../chunk-MY374UUD.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-Q3SHCEXN.js';
|
|
6
|
+
import '../chunk-HU56GCZ7.js';
|
|
6
7
|
import '../chunk-CUEPPDBC.js';
|
|
7
8
|
import '../chunk-WFAJYBLX.js';
|
|
8
9
|
import '../chunk-WSIJDWUG.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** One value a field offers to fill in. */
|
|
3
|
+
export interface PresetChip {
|
|
4
|
+
/** What a pick hands the field, as the field holds it: "" for its default. */
|
|
5
|
+
value: string;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface PresetChipsProps {
|
|
9
|
+
/** Names the row: "Common values". */
|
|
10
|
+
label: string;
|
|
11
|
+
options: readonly PresetChip[];
|
|
12
|
+
/** What the field holds now. The chip of that value is drawn chosen; none is where no chip matches. */
|
|
13
|
+
value: string;
|
|
14
|
+
onPick: (value: string) => void;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
className?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Common values for one field, as a row of chips that fill it in: the
|
|
20
|
+
* default first, then a few a reader most often wants.
|
|
21
|
+
*
|
|
22
|
+
* A SHORTCUT, NOT THE CONTROL. The field beside it stays the value: a pick
|
|
23
|
+
* writes into it, typing past a chip leaves every chip unchosen, and the chip
|
|
24
|
+
* matching what the field holds is drawn chosen, so a typed "1h" lights the
|
|
25
|
+
* "1 hour" chip.
|
|
26
|
+
*/
|
|
27
|
+
export declare function PresetChips({ label, options, value, onPick, disabled, className }: PresetChipsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { PresetChips } from '../chunk-6QWSGM4W.js';
|
|
2
|
+
import '../chunk-B3UJKLVI.js';
|
|
3
|
+
import '../chunk-GMXOZEF5.js';
|
|
4
|
+
import '../chunk-XJU53WMW.js';
|
|
5
|
+
import '../chunk-7F3OPUM5.js';
|
|
6
|
+
import '../chunk-QRE6JCHS.js';
|
|
7
|
+
import '../chunk-ZMZNKDPO.js';
|
|
8
|
+
import '../chunk-IMF3CPTY.js';
|
|
9
|
+
import '../chunk-XSPCITPN.js';
|
|
10
|
+
import '../chunk-2YTOOH3A.js';
|
|
11
|
+
import '../chunk-KM5OKCW6.js';
|
|
12
|
+
import '../chunk-TDFLCUBE.js';
|
|
13
|
+
import '../chunk-BFZAGIXR.js';
|
|
14
|
+
import '../chunk-L72URIHR.js';
|
|
15
|
+
import '../chunk-HTS5RJ7S.js';
|
|
16
|
+
import '../chunk-AVJKMQXK.js';
|
|
17
|
+
import '../chunk-EDPMHSLZ.js';
|
|
18
|
+
import '../chunk-4ITETIGZ.js';
|
|
19
|
+
import '../chunk-Y5CMDLQM.js';
|
|
20
|
+
import '../chunk-RRRK2KB6.js';
|
|
21
|
+
import '../chunk-ODEQTPFM.js';
|
package/dist/RailList/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { RAIL_LIST_LABELS, RailList } from '../chunk-
|
|
2
|
-
import '../chunk-657WR3MX.js';
|
|
1
|
+
export { RAIL_LIST_LABELS, RailList } from '../chunk-ECYA6XZL.js';
|
|
3
2
|
import '../chunk-TTUFOH2Y.js';
|
|
3
|
+
import '../chunk-657WR3MX.js';
|
|
4
4
|
import '../chunk-6KWNXIDE.js';
|
|
5
|
-
import '../chunk-KW7T23RT.js';
|
|
6
5
|
import '../chunk-TODOBUXO.js';
|
|
6
|
+
import '../chunk-KW7T23RT.js';
|
|
7
7
|
import '../chunk-HBDA76EZ.js';
|
|
8
8
|
import '../chunk-E7KRB77B.js';
|
|
9
9
|
import '../chunk-AV2DXAEL.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { FormHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type FormFieldRender } from '../Input/index.js';
|
|
3
|
+
/** Every string the form draws itself. */
|
|
4
|
+
export interface SettingFormLabels {
|
|
5
|
+
save: string;
|
|
6
|
+
cancel: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SETTING_FORM_LABELS: SettingFormLabels;
|
|
9
|
+
export interface SettingFormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit' | 'children' | 'aria-label'> {
|
|
10
|
+
/** The setting's name, as the control's label. */
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
/** The control's id, which the label names. */
|
|
13
|
+
htmlFor?: string | undefined;
|
|
14
|
+
/** Whose setting it is, above the field where the label alone does not say: a seat's name. */
|
|
15
|
+
subject?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The control: a `NumberField`, a `DurationField`, a choice or a text field.
|
|
18
|
+
* As a function it is handed the ids to wire, as `FormField` hands them.
|
|
19
|
+
*/
|
|
20
|
+
children: ((field: FormFieldRender) => ReactNode) | ReactNode;
|
|
21
|
+
/** What the value may be, short: "1 to 100". Said on the line under the control. */
|
|
22
|
+
hint?: ReactNode;
|
|
23
|
+
/** Why what is typed cannot be saved, short: "At least 1." */
|
|
24
|
+
error?: ReactNode;
|
|
25
|
+
/** The save's outcome, between the field and the buttons: a warning, a refusal, a conflict. */
|
|
26
|
+
status?: ReactNode;
|
|
27
|
+
/** Save was asked for: the button, or Enter in the field. Not called while Save is held. */
|
|
28
|
+
onSave: () => void;
|
|
29
|
+
onCancel: () => void;
|
|
30
|
+
/** A save is in flight: Save spins. */
|
|
31
|
+
saving?: boolean | undefined;
|
|
32
|
+
/** Why Save does nothing now: said on the button, which stays reachable. */
|
|
33
|
+
saveHeld?: string | undefined;
|
|
34
|
+
/** Save's word for this press: "Save anyway" once a warning asked for a second one. */
|
|
35
|
+
saveLabel?: string | undefined;
|
|
36
|
+
labels?: Partial<SettingFormLabels> | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The panel that changes one setting: its name over the control, what the
|
|
40
|
+
* value may be and why a typed one cannot be saved under it, the save's
|
|
41
|
+
* outcome, then Cancel and Save.
|
|
42
|
+
*
|
|
43
|
+
* ONE VALUE, SO ENTER SAVES, from the field, as any one-field form does;
|
|
44
|
+
* Escape is the panel's to close. Save is never a dead button: held, it says
|
|
45
|
+
* why on hover and focus.
|
|
46
|
+
*
|
|
47
|
+
* THE CONTROL CARRIES THE DEFAULT (a placeholder, a "Default" chip or
|
|
48
|
+
* option), so no sentence under the field has to explain it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function SettingForm({ label, htmlFor, subject, children, hint, error, status, onSave, onCancel, saving, saveHeld, saveLabel, labels: overrides, className, ...rest }: SettingFormProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { SETTING_FORM_LABELS, SettingForm } from '../chunk-NG6GEBSJ.js';
|
|
2
|
+
import '../chunk-XQMRSL7Z.js';
|
|
3
|
+
import '../chunk-NICEDVZM.js';
|
|
4
|
+
import '../chunk-JLKO7PSK.js';
|
|
5
|
+
import '../chunk-PJV5HVZY.js';
|
|
6
|
+
import '../chunk-TEXK4RK6.js';
|
|
7
|
+
import '../chunk-IMF3CPTY.js';
|
|
8
|
+
import '../chunk-XSPCITPN.js';
|
|
9
|
+
import '../chunk-KM5OKCW6.js';
|
|
10
|
+
import '../chunk-TDFLCUBE.js';
|
|
11
|
+
import '../chunk-BFZAGIXR.js';
|
|
12
|
+
import '../chunk-L72URIHR.js';
|
|
13
|
+
import '../chunk-HTS5RJ7S.js';
|
|
14
|
+
import '../chunk-AVJKMQXK.js';
|
|
15
|
+
import '../chunk-EDPMHSLZ.js';
|
|
16
|
+
import '../chunk-4ITETIGZ.js';
|
|
17
|
+
import '../chunk-PQADV6P6.js';
|
|
18
|
+
import '../chunk-WGMKERCR.js';
|
|
19
|
+
import '../chunk-RRRK2KB6.js';
|
|
20
|
+
import '../chunk-ODEQTPFM.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* SettingForm: one setting's panel, sized for a popover a phone can hold. */
|
|
2
|
+
|
|
3
|
+
.crewlet-setting-form {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--spacing-3);
|
|
7
|
+
width: min(22rem, calc(100vw - 2 * var(--spacing-4)));
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
padding: var(--spacing-3);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.crewlet-setting-form__subject {
|
|
13
|
+
margin: 0;
|
|
14
|
+
font-size: var(--font-size-compact);
|
|
15
|
+
font-weight: var(--font-weight-medium);
|
|
16
|
+
color: var(--color-text-primary);
|
|
17
|
+
overflow-wrap: anywhere;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* No gap for an outcome not yet said: the slot holds the caller's own status element, empty while idle. */
|
|
21
|
+
.crewlet-setting-form__status:empty,
|
|
22
|
+
.crewlet-setting-form__status:not(:has(> :not(:empty))) {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.crewlet-setting-form__actions {
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: flex-end;
|
|
29
|
+
gap: var(--spacing-2);
|
|
30
|
+
}
|
|
@@ -1,68 +1,81 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/** The words the
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
/** The words the four columns are named by, for assistive technology and the header row. */
|
|
3
3
|
export interface SettingsTableColumns {
|
|
4
4
|
setting?: string | undefined;
|
|
5
5
|
value?: string | undefined;
|
|
6
6
|
source?: string | undefined;
|
|
7
|
+
/** The row-end column of controls, which draws no word and is still read. */
|
|
8
|
+
actions?: string | undefined;
|
|
7
9
|
}
|
|
8
10
|
export interface SettingsTableProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
11
|
/**
|
|
10
|
-
* Draws the column
|
|
11
|
-
*
|
|
12
|
-
* words over every card. The names are always exposed to assistive
|
|
13
|
-
* technology, drawn or not.
|
|
12
|
+
* Draws the column heads, as every DataGrid does. On by default; off, the
|
|
13
|
+
* names are still the table's column headers for assistive technology.
|
|
14
14
|
*/
|
|
15
15
|
header?: boolean | undefined;
|
|
16
|
-
/** The column names. Defaults to Setting, Value and
|
|
16
|
+
/** The column names. Defaults to Setting, Value, Source and Actions. */
|
|
17
17
|
columns?: SettingsTableColumns | undefined;
|
|
18
18
|
children?: ReactNode;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* A
|
|
22
|
-
*
|
|
21
|
+
* A table of settings: what each is called, the value in force, where that
|
|
22
|
+
* value comes from, and the controls that change it at the row's end.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* width puts every value and every source on one vertical line down the page.
|
|
28
|
-
* A term column sized to its own longest term started the values at a
|
|
29
|
-
* different place in every card, and a fixed one left them floating a third
|
|
30
|
-
* of the way across a wide card with the rest of the row empty.
|
|
24
|
+
* DATAGRID'S ANATOMY, NOT A SECOND LOOK. The head, the rows, the cells, the
|
|
25
|
+
* hairlines, the row height and the hover are DataGrid's own classes, so a
|
|
26
|
+
* card of settings and a card of records read as one kind of table.
|
|
31
27
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* row in the table a reader scanning it came to find.
|
|
28
|
+
* ONE COLUMN GRID FOR EVERY TABLE ON A PAGE. The tracks are fractions of the
|
|
29
|
+
* table's width (`--crewlet-settings-table-columns`) and the controls' track
|
|
30
|
+
* is a fixed width, so cards of one width stacked down a page put every value,
|
|
31
|
+
* every source and every pencil on one vertical line.
|
|
37
32
|
*
|
|
38
|
-
* A TABLE, BECAUSE IT IS ONE
|
|
39
|
-
*
|
|
40
|
-
* the row's header. The roles are written out rather than taken from table
|
|
41
|
-
* elements because the row folds into two lines on a narrow table, and a
|
|
42
|
-
* table element that changes its display loses its semantics in some
|
|
43
|
-
* browsers.
|
|
33
|
+
* A TABLE, BECAUSE IT IS ONE: announced with its column names, each row
|
|
34
|
+
* headed by its setting's name.
|
|
44
35
|
*/
|
|
45
36
|
export declare function SettingsTable({ header, columns, className, children, ...rest }: SettingsTableProps): import("react").JSX.Element;
|
|
46
37
|
export declare namespace SettingsTable {
|
|
47
38
|
var Row: typeof SettingsTableRow;
|
|
48
39
|
}
|
|
40
|
+
/** Every string a row draws itself. */
|
|
41
|
+
export interface SettingsTableRowLabels {
|
|
42
|
+
/** The reset control's name. */
|
|
43
|
+
reset: string;
|
|
44
|
+
/** The question the reset asks first, with the default where the row names one. */
|
|
45
|
+
confirm: (defaultLabel: ReactNode) => ReactNode;
|
|
46
|
+
/** The confirmation's button. */
|
|
47
|
+
confirmReset: string;
|
|
48
|
+
cancel: string;
|
|
49
|
+
}
|
|
50
|
+
export declare const SETTINGS_TABLE_ROW_LABELS: SettingsTableRowLabels;
|
|
49
51
|
export interface SettingsTableRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
50
52
|
/** What the setting is called, in a reader's words. */
|
|
51
53
|
label: ReactNode;
|
|
52
54
|
/**
|
|
53
55
|
* The setting's address in the document it is written in
|
|
54
|
-
* (`turn_engine.max_iterations`)
|
|
55
|
-
*
|
|
56
|
-
* on hover and focus and puts it on the clipboard. Where a pointer can
|
|
57
|
-
* hover, the control itself shows only with its row.
|
|
56
|
+
* (`turn_engine.max_iterations`). Not drawn as words: a copy control after
|
|
57
|
+
* the name shows it on hover and focus and puts it on the clipboard.
|
|
58
58
|
*/
|
|
59
59
|
settingKey?: string | undefined;
|
|
60
60
|
/** The value in force, in its own unit. Drawn in tabular figures. */
|
|
61
61
|
children?: ReactNode;
|
|
62
|
-
/** Where the value comes from: "Default", "
|
|
62
|
+
/** Where the value comes from: "Default", "Changed from 10". */
|
|
63
63
|
source?: ReactNode;
|
|
64
64
|
/** The value differs from its default: the source carries a mark. */
|
|
65
65
|
changed?: boolean | undefined;
|
|
66
|
+
/** The controls at the row's end: the pencil that opens the setting's editor. */
|
|
67
|
+
actions?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Puts the setting back to its default. Offered as a control before the
|
|
70
|
+
* actions while `changed`, and called only once a short inline question
|
|
71
|
+
* ("Reset to 10?") is answered.
|
|
72
|
+
*/
|
|
73
|
+
onReset?: (() => void) | undefined;
|
|
74
|
+
/** The default, in the value column's words, for that question. */
|
|
75
|
+
defaultLabel?: ReactNode;
|
|
76
|
+
/** Why this reader may not reset it: the control is drawn held with the reason, never hidden. */
|
|
77
|
+
resetHeld?: string | undefined;
|
|
78
|
+
labels?: Partial<SettingsTableRowLabels> | undefined;
|
|
66
79
|
}
|
|
67
|
-
/** One setting: its name (and key), its value and its
|
|
68
|
-
export declare function SettingsTableRow({ label, settingKey, source, changed, className, children, ...rest }: SettingsTableRowProps): import("react").JSX.Element;
|
|
80
|
+
/** One setting: its name (and key), its value, its source and its controls. */
|
|
81
|
+
export declare function SettingsTableRow({ label, settingKey, source, changed, actions, onReset, defaultLabel, resetHeld, labels: overrides, className, children, ...rest }: SettingsTableRowProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '../DataGrid/DataGrid.css';
|
|
1
2
|
import './SettingsTable.css';
|
|
2
|
-
export { SettingsTable, SettingsTableRow } from './SettingsTable.js';
|
|
3
|
-
export type { SettingsTableColumns, SettingsTableProps, SettingsTableRowProps } from './SettingsTable.js';
|
|
3
|
+
export { SETTINGS_TABLE_ROW_LABELS, SettingsTable, SettingsTableRow } from './SettingsTable.js';
|
|
4
|
+
export type { SettingsTableColumns, SettingsTableProps, SettingsTableRowLabels, SettingsTableRowProps, } from './SettingsTable.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { SettingsTable, SettingsTableRow } from '../chunk-
|
|
1
|
+
export { SETTINGS_TABLE_ROW_LABELS, SettingsTable, SettingsTableRow } from '../chunk-BQMDD2FD.js';
|
|
2
|
+
import '../chunk-HU56GCZ7.js';
|
|
2
3
|
import '../chunk-IRGS5FEC.js';
|
|
3
4
|
import '../chunk-STJ7QBC3.js';
|
|
4
5
|
import '../chunk-DTIW4CHZ.js';
|
|
6
|
+
import '../chunk-WSIJDWUG.js';
|
|
5
7
|
import '../chunk-QRE6JCHS.js';
|
|
6
8
|
import '../chunk-IMF3CPTY.js';
|
|
7
9
|
import '../chunk-XSPCITPN.js';
|