@scattered-light/loomiere-base-ui 0.6.0 → 0.7.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 +135 -5
- package/dist/chunk-JUUPOOQQ.js +3723 -0
- package/dist/chunk-JUUPOOQQ.js.map +1 -0
- package/dist/chunk-M7KJASGK.js +802 -0
- package/dist/chunk-M7KJASGK.js.map +1 -0
- package/dist/chunk-Y2CPBMFJ.js +147 -0
- package/dist/chunk-Y2CPBMFJ.js.map +1 -0
- package/dist/custom/collection/index.d.ts +534 -0
- package/dist/custom/collection/index.js +1471 -0
- package/dist/custom/collection/index.js.map +1 -0
- package/dist/custom/index.d.ts +5 -0
- package/dist/custom/index.js +4 -0
- package/dist/custom/index.js.map +1 -0
- package/dist/design-system/components/Badge/README.md +35 -0
- package/dist/design-system/components/Badge/preview.html +19 -0
- package/dist/design-system/components/Collection/README.md +14 -0
- package/dist/design-system/components/CollectionPagination/README.md +15 -0
- package/dist/design-system/components/CollectionToolbar/README.md +24 -0
- package/dist/design-system/components/DataList/README.md +39 -0
- package/dist/design-system/components/DataList/preview.html +475 -0
- package/dist/design-system/components/DataTable/README.md +41 -0
- package/dist/design-system/components/DataTable/preview.html +475 -0
- package/dist/design-system/components/DatePicker/README.md +55 -0
- package/dist/design-system/components/DatePicker/preview.html +475 -0
- package/dist/design-system/components/EditableList/README.md +33 -0
- package/dist/design-system/components/EditableList/preview.html +475 -0
- package/dist/design-system/components/EmptyState/README.md +60 -0
- package/dist/design-system/components/EmptyState/preview.html +475 -0
- package/dist/design-system/components/ListDetail/README.md +43 -0
- package/dist/design-system/components/ListDetail/preview.html +475 -0
- package/dist/design-system/components/MoneyField/README.md +52 -0
- package/dist/design-system/components/MoneyField/preview.html +475 -0
- package/dist/design-system/components/Splitter/README.md +42 -0
- package/dist/design-system/components/Splitter/preview.html +475 -0
- package/dist/design-system/components/Table/README.md +2 -1
- package/dist/design-system/components/Table/preview.html +1 -1
- package/dist/design-system/components/bundle.js +7 -5
- package/dist/design-system/components/index.d.ts +3 -21
- package/dist/design-system/components/styles.css +2266 -186
- package/dist/index-ChJXlxzq.d.ts +809 -0
- package/dist/index.d.ts +3 -21
- package/dist/index.js +176 -891
- package/dist/index.js.map +1 -1
- package/dist/styles/components/Accordion.css +1 -1
- package/dist/styles/components/AlertDialog.css +1 -1
- package/dist/styles/components/Autocomplete.css +1 -1
- package/dist/styles/components/Avatar.css +1 -1
- package/dist/styles/components/Button.css +1 -1
- package/dist/styles/components/Checkbox.css +1 -1
- package/dist/styles/components/CheckboxGroup.css +1 -1
- package/dist/styles/components/Collapsible.css +1 -1
- package/dist/styles/components/Combobox.css +1 -1
- package/dist/styles/components/ContextMenu.css +1 -1
- package/dist/styles/components/Dialog.css +1 -1
- package/dist/styles/components/Drawer.css +1 -1
- package/dist/styles/components/Field.css +1 -1
- package/dist/styles/components/Fieldset.css +1 -1
- package/dist/styles/components/Form.css +1 -1
- package/dist/styles/components/Input.css +1 -1
- package/dist/styles/components/Menu.css +1 -1
- package/dist/styles/components/Menubar.css +1 -1
- package/dist/styles/components/Meter.css +1 -1
- package/dist/styles/components/NavigationMenu.css +1 -1
- package/dist/styles/components/NumberField.css +1 -1
- package/dist/styles/components/OTPField.css +1 -1
- package/dist/styles/components/Popover.css +1 -1
- package/dist/styles/components/PreviewCard.css +1 -1
- package/dist/styles/components/Progress.css +1 -1
- package/dist/styles/components/Radio.css +1 -1
- package/dist/styles/components/ScrollArea.css +1 -1
- package/dist/styles/components/Select.css +1 -1
- package/dist/styles/components/Separator.css +1 -1
- package/dist/styles/components/Slider.css +1 -1
- package/dist/styles/components/Switch.css +1 -1
- package/dist/styles/components/Tabs.css +1 -1
- package/dist/styles/components/Toast.css +1 -1
- package/dist/styles/components/Toggle.css +1 -1
- package/dist/styles/components/ToggleGroup.css +1 -1
- package/dist/styles/components/Toolbar.css +1 -1
- package/dist/styles/components/Tooltip.css +1 -1
- package/dist/styles/custom/Badge.css +104 -0
- package/dist/styles/custom/Collection.css +15 -0
- package/dist/styles/custom/CollectionPagination.css +24 -0
- package/dist/styles/custom/CollectionToolbar.css +57 -0
- package/dist/styles/custom/DataList.css +123 -0
- package/dist/styles/custom/DataTable.css +120 -0
- package/dist/styles/custom/DatePicker.css +572 -0
- package/dist/styles/custom/EditableList.css +98 -0
- package/dist/styles/custom/EmptyState.css +255 -0
- package/dist/styles/custom/ListDetail.css +126 -0
- package/dist/styles/custom/MoneyField.css +344 -0
- package/dist/styles/custom/Splitter.css +207 -0
- package/dist/styles/{components → custom}/Table.css +31 -4
- package/dist/styles/index.css +12 -2
- package/dist/styles/reset/accessibility.css +1 -1
- package/dist/styles/reset/reset-accessibility.css +1 -1
- package/dist/styles/reset/reset-tailwind.css +1 -1
- package/dist/styles/reset/reset.css +1 -1
- package/dist/styles/tailwind.css +12 -2
- package/package.json +36 -8
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as _base_ui_react from '@base-ui/react';
|
|
4
|
+
import { NumberFieldRoot } from '@base-ui/react/number-field';
|
|
5
|
+
|
|
6
|
+
type NumberFieldLabelProps = Omit<React.ComponentProps<'label'>, 'htmlFor'> & {
|
|
7
|
+
htmlFor: string;
|
|
8
|
+
};
|
|
9
|
+
/** The field label. Number field has no label part; this is the same text as {@link Field.Label}. */
|
|
10
|
+
declare function NumberFieldLabel({ className, htmlFor, ...props }: NumberFieldLabelProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Base UI [Number Field](https://base-ui.com/react/components/number-field) with design-system classes.
|
|
13
|
+
* The input is Input, and the label is Field's label. Only the steppers are drawn here.
|
|
14
|
+
*/
|
|
15
|
+
declare const NumberField: {
|
|
16
|
+
Root: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
Group: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
Input: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
+
Increment: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldIncrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
20
|
+
Decrement: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldDecrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
ScrubArea: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldScrubAreaProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
22
|
+
ScrubAreaCursor: React.ForwardRefExoticComponent<Omit<_base_ui_react.NumberFieldScrubAreaCursorProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
23
|
+
Label: typeof NumberFieldLabel;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type BadgeProps = React.ComponentProps<'span'> & {
|
|
27
|
+
/** How loud the badge is. The brand's roles decide what each level looks like. Default is subtle. */
|
|
28
|
+
emphasis?: 'bold' | 'standard' | 'subtle' | 'quiet';
|
|
29
|
+
/** Paint the level in a status palette (info, success, warning, error). */
|
|
30
|
+
status?: 'info' | 'success' | 'warning' | 'error';
|
|
31
|
+
/** Paint the level in another palette instead of the level's own color (e.g. "secondary", "error"). */
|
|
32
|
+
palette?: string;
|
|
33
|
+
/** Type tier. Default is condense. */
|
|
34
|
+
size?: 'minimize' | 'condense' | 'base';
|
|
35
|
+
/** A leading dot in the label color. */
|
|
36
|
+
dot?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A status or count label. Not a Base UI part and not interactive, so this is a span
|
|
40
|
+
* and does not take Base UI's `render` prop. Wrap it when it needs to be another element.
|
|
41
|
+
* A number on its own needs an accessible name: `aria-label` (for example "3 unread") or visually hidden text.
|
|
42
|
+
*/
|
|
43
|
+
declare const Badge: React.ForwardRefExoticComponent<Omit<BadgeProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
44
|
+
|
|
45
|
+
/** Past this many codes, the picker is a combobox so people can type a code or a name. */
|
|
46
|
+
declare const CURRENCY_SEARCH_THRESHOLD = 12;
|
|
47
|
+
/**
|
|
48
|
+
* The affix when there are two or more currencies. Shows the code, not the symbol:
|
|
49
|
+
* `$` is shared by USD, CAD, AUD, MXN and others. A start-side picker is before the
|
|
50
|
+
* input in tab order; an end-side picker is after it, because that is the visual order.
|
|
51
|
+
*/
|
|
52
|
+
declare function CurrencySelect(): react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Money amounts as integers in minor units (cents, yen, fils).
|
|
56
|
+
*
|
|
57
|
+
* Integers avoid `0.1 + 0.2`, match what payment APIs send, and compare safely.
|
|
58
|
+
* Conversion goes through a fixed-point string and rounds half away from zero
|
|
59
|
+
* (the same halfExpand rule `Intl` uses). Never `Math.round(major * 100)`:
|
|
60
|
+
* `1.005 * 100` is `100.49999…`.
|
|
61
|
+
*
|
|
62
|
+
* Values must stay inside `Number.MAX_SAFE_INTEGER` minor units. The field's default
|
|
63
|
+
* maximum is lower: `MAX_MINOR_UNITS` (`10^15 - 1`). A major amount with more than
|
|
64
|
+
* 15 significant digits is not exact as a float, and Number field counts in floats.
|
|
65
|
+
*/
|
|
66
|
+
type CurrencyCode = string;
|
|
67
|
+
type MoneyDisplay = 'narrowSymbol' | 'symbol' | 'code' | 'none';
|
|
68
|
+
/**
|
|
69
|
+
* Largest minor-unit integer whose major form has at most 15 significant digits,
|
|
70
|
+
* for every currency. `Number.MAX_SAFE_INTEGER` is about 9e15 (16 digits) and is
|
|
71
|
+
* not exact once it is divided into dollars and cents.
|
|
72
|
+
*/
|
|
73
|
+
declare const MAX_MINOR_UNITS: number;
|
|
74
|
+
/**
|
|
75
|
+
* Well-formed ISO 4217 code that `Intl` knows.
|
|
76
|
+
* `supportedValuesOf('currency')` is the list where it exists. Some engines omit a real
|
|
77
|
+
* code from that list and still format it (CLF is 4 digits). Those still count. A code
|
|
78
|
+
* the engine does not know falls back to the code itself and 2 digits, and does not.
|
|
79
|
+
*/
|
|
80
|
+
declare function isValidCurrency(code: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Fraction digits for a currency. `override` is for prices `Intl` gets wrong for the
|
|
83
|
+
* business (whole dollars, fuel, cash versus accounting). Cached per code.
|
|
84
|
+
*/
|
|
85
|
+
declare function getCurrencyDigits(currency: CurrencyCode, override?: number): number;
|
|
86
|
+
/** Round a non-negative decimal string to `digits` places, half away from zero. */
|
|
87
|
+
declare function roundHalfExpand(unsigned: string, digits: number): string;
|
|
88
|
+
/** Major units (12.5) to minor units (1250). */
|
|
89
|
+
declare function toMinorUnits(major: number, currency: CurrencyCode, override?: number): number;
|
|
90
|
+
/** Minor units to an exact major-unit decimal string (`"1234.50"`). */
|
|
91
|
+
declare function toDecimalString(minor: number, currency: CurrencyCode, override?: number): string;
|
|
92
|
+
/** Exact decimal string (`"1234.50"` or `"1234.5"`) to minor units. */
|
|
93
|
+
declare function parseDecimalString(decimal: string, currency: CurrencyCode, override?: number): number;
|
|
94
|
+
/** Minor units to major units for `NumberField`, which counts in major units. */
|
|
95
|
+
declare function fromMinorUnits(minor: number, currency: CurrencyCode, override?: number): number;
|
|
96
|
+
/** Show an amount the same way the field does, for tables and summaries. */
|
|
97
|
+
declare function formatMoney(minor: number, currency: CurrencyCode, options?: {
|
|
98
|
+
locale?: string;
|
|
99
|
+
display?: MoneyDisplay;
|
|
100
|
+
fractionDigits?: number;
|
|
101
|
+
}): string;
|
|
102
|
+
/** Which side of the number the currency sits on, from the locale rather than a prop. */
|
|
103
|
+
declare function affixSide(locale: string, currency: CurrencyCode): 'start' | 'end';
|
|
104
|
+
/** The affix text: `$`, `US$`, `USD`, or nothing. */
|
|
105
|
+
declare function currencySymbol(locale: string, currency: CurrencyCode, display: MoneyDisplay): string;
|
|
106
|
+
/** Spoken currency name ("US dollar"), for the accessible description. */
|
|
107
|
+
declare function currencyName(locale: string, currency: CurrencyCode): string;
|
|
108
|
+
interface NormalizedPaste {
|
|
109
|
+
/** Text to hand to the number parser. `null` means the paste is not an amount (`1e5`, or a negative when negatives are off). */
|
|
110
|
+
text: string | null;
|
|
111
|
+
/** A different currency the picker includes and the paste names. Otherwise `null` (don't guess). */
|
|
112
|
+
currency: CurrencyCode | null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Strip currency symbols, ISO codes, and spaces that are not the locale's group separator
|
|
116
|
+
* so the number field can parse `$1,234.56`, `USD 1234.56`, and `1 234,56 €`.
|
|
117
|
+
* `(12.00)` is negative only when negatives are allowed. Otherwise the paste is rejected,
|
|
118
|
+
* so a refund is not quietly stored as a charge.
|
|
119
|
+
* A run of letters sitting against a currency mark (`R$`, `CA$`) is stripped. The
|
|
120
|
+
* field's own symbols and ISO codes are stripped too.
|
|
121
|
+
*/
|
|
122
|
+
declare function normalizePaste(raw: string, locale: string, currency: CurrencyCode, options?: {
|
|
123
|
+
allowNegative?: boolean;
|
|
124
|
+
currencies?: CurrencyCode[];
|
|
125
|
+
}): NormalizedPaste;
|
|
126
|
+
/** True when extra typed fraction digits would change the amount once rounded. */
|
|
127
|
+
declare function roundingChangesValue(raw: string, locale: string, digits: number): boolean;
|
|
128
|
+
|
|
129
|
+
type NumberFieldRootProps = React.ComponentProps<typeof NumberField.Root>;
|
|
130
|
+
interface MoneyFieldSteps {
|
|
131
|
+
/** Arrow keys and the stepper buttons, in minor units. Default: one major unit. */
|
|
132
|
+
step?: number;
|
|
133
|
+
/** Alt+Arrow, in minor units. Default: one minor unit. */
|
|
134
|
+
small?: number;
|
|
135
|
+
/** Shift+Arrow, in minor units. Default: 100 major units. */
|
|
136
|
+
large?: number;
|
|
137
|
+
}
|
|
138
|
+
interface MoneyChangeDetails {
|
|
139
|
+
currency: CurrencyCode;
|
|
140
|
+
/** The same amount as an exact major-unit decimal (`"1234.50"`), or null when the field is empty. */
|
|
141
|
+
decimal: string | null;
|
|
142
|
+
reason: NumberFieldRoot.ChangeEventReason;
|
|
143
|
+
}
|
|
144
|
+
interface MoneyFieldRootProps extends Omit<NumberFieldRootProps, 'value' | 'defaultValue' | 'onValueChange' | 'onValueCommitted' | 'format' | 'min' | 'max' | 'step' | 'smallStep' | 'largeStep' | 'name'> {
|
|
145
|
+
/** Minor units: cents for USD, yen for JPY, fils for KWD. Empty is `null`, not `0`. */
|
|
146
|
+
value?: number | null;
|
|
147
|
+
defaultValue?: number | null;
|
|
148
|
+
onValueChange?: (value: number | null, details: MoneyChangeDetails) => void;
|
|
149
|
+
onValueCommitted?: (value: number | null, details: {
|
|
150
|
+
currency: CurrencyCode;
|
|
151
|
+
decimal: string | null;
|
|
152
|
+
}) => void;
|
|
153
|
+
/** Fixed or controlled currency. Required unless `currencies` is set. */
|
|
154
|
+
currency?: CurrencyCode;
|
|
155
|
+
defaultCurrency?: CurrencyCode;
|
|
156
|
+
/** Two or more codes show the picker. The first is the default when `currency` is omitted. */
|
|
157
|
+
currencies?: CurrencyCode[];
|
|
158
|
+
onCurrencyChange?: (currency: CurrencyCode) => void;
|
|
159
|
+
/** Document language by default. Decides separators, numerals, and which side the symbol sits on. */
|
|
160
|
+
locale?: string;
|
|
161
|
+
/** Override the currency's fraction digits (whole dollars, fuel prices, cash versus accounting). */
|
|
162
|
+
fractionDigits?: number;
|
|
163
|
+
/** `always` keeps `12.00`. `auto` drops decimals on a whole amount, for a price tag like `$1,200`. */
|
|
164
|
+
trailingZeros?: 'always' | 'auto';
|
|
165
|
+
/** Off by default, which also sets the default minimum to 0. On for refunds and balances. */
|
|
166
|
+
allowNegative?: boolean;
|
|
167
|
+
/** Minor units, same as `value`. */
|
|
168
|
+
min?: number;
|
|
169
|
+
/**
|
|
170
|
+
* Minor units. The default is `MAX_MINOR_UNITS` (`10^15 - 1`): the largest minor
|
|
171
|
+
* value whose major form has at most 15 significant digits. Past that, Number
|
|
172
|
+
* field's float is not exact.
|
|
173
|
+
*/
|
|
174
|
+
max?: number;
|
|
175
|
+
steps?: MoneyFieldSteps;
|
|
176
|
+
/** Stepper buttons. Off by default; arrow keys still step. */
|
|
177
|
+
steppers?: boolean;
|
|
178
|
+
symbolDisplay?: MoneyDisplay;
|
|
179
|
+
/** `end` lines the amount up with other amounts, in a ledger or a table. */
|
|
180
|
+
align?: 'start' | 'end';
|
|
181
|
+
/**
|
|
182
|
+
* Submits the major-unit decimal string (`"1234.50"`). `minor` submits the integer instead.
|
|
183
|
+
* This name is not passed to Number field. A parent `Field.Root` name still names Number
|
|
184
|
+
* field's hidden input, because that input is the field's control.
|
|
185
|
+
*/
|
|
186
|
+
name?: string;
|
|
187
|
+
submitAs?: 'decimal' | 'minor';
|
|
188
|
+
/** Submits the currency code when the picker is showing. */
|
|
189
|
+
currencyName?: string;
|
|
190
|
+
/** Accessible name of the picker. Default "Currency". */
|
|
191
|
+
currencyLabel?: string;
|
|
192
|
+
/** `true` always filters. `auto` (default) filters once there are more than 12 codes. `false` never does. */
|
|
193
|
+
searchable?: boolean | 'auto';
|
|
194
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
195
|
+
placeholder?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Holds the money: currency, fraction digits, and the minor-unit value.
|
|
199
|
+
* Everything else is passed through to NumberField, so a new Number Field prop works here too.
|
|
200
|
+
*/
|
|
201
|
+
declare const MoneyFieldRoot: React.ForwardRefExoticComponent<Omit<MoneyFieldRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
202
|
+
declare const MoneyFieldGroup: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.NumberFieldGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
203
|
+
declare const MoneyFieldInput: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.NumberFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
204
|
+
/** The currency symbol, or the picker. Clicking a fixed symbol focuses the amount. */
|
|
205
|
+
declare const MoneyFieldAffix: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
206
|
+
type MoneyFieldProps = MoneyFieldRootProps;
|
|
207
|
+
/**
|
|
208
|
+
* An amount of money, in one currency or a currency the person picks.
|
|
209
|
+
* Put it in Field for the label, description, and error, the same way as NumberField.
|
|
210
|
+
* The value is an integer in minor units.
|
|
211
|
+
*/
|
|
212
|
+
declare const MoneyField: React.ForwardRefExoticComponent<Omit<MoneyFieldRootProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
213
|
+
Root: React.ForwardRefExoticComponent<Omit<MoneyFieldRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
214
|
+
Group: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.NumberFieldGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
215
|
+
Input: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.NumberFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
216
|
+
Affix: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
217
|
+
CurrencySelect: typeof CurrencySelect;
|
|
218
|
+
Increment: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldIncrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
219
|
+
Decrement: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.NumberFieldDecrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
220
|
+
Error: React.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.FieldErrorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Calendar dates as ISO strings (`YYYY-MM-DD`), never `Date` objects.
|
|
225
|
+
*
|
|
226
|
+
* A `Date` at local midnight becomes the day before when something reads it in UTC,
|
|
227
|
+
* and adding 24 hours skips or repeats a day when daylight saving changes. Every
|
|
228
|
+
* calculation here uses UTC date parts, so the calendar day stays put in
|
|
229
|
+
* `America/New_York` and `Australia/Sydney`. "Today" is the only local read:
|
|
230
|
+
* the year, month and day of the clock the user is on, then stored as an ISO date.
|
|
231
|
+
*/
|
|
232
|
+
type DateValue = string;
|
|
233
|
+
type DateRange = {
|
|
234
|
+
start: DateValue | null;
|
|
235
|
+
end: DateValue | null;
|
|
236
|
+
};
|
|
237
|
+
type PresetValue = DateValue | DateRange;
|
|
238
|
+
type Preset = {
|
|
239
|
+
id: string;
|
|
240
|
+
label: string;
|
|
241
|
+
hint?: string;
|
|
242
|
+
/** A fixed value, or a function of today's ISO date. Week-based presets close over `weekStartsOn`. */
|
|
243
|
+
value: PresetValue | ((today: DateValue) => PresetValue);
|
|
244
|
+
};
|
|
245
|
+
declare function parseDate(value: string): {
|
|
246
|
+
y: number;
|
|
247
|
+
m: number;
|
|
248
|
+
d: number;
|
|
249
|
+
} | null;
|
|
250
|
+
/** Days in a month. February respects leap years (2028 has 29). */
|
|
251
|
+
declare function daysInMonth(year: number, month: number): number;
|
|
252
|
+
/**
|
|
253
|
+
* The user's local calendar day, as an ISO date.
|
|
254
|
+
* This is the one read that uses the clock's time zone. Everything else stays on UTC date parts.
|
|
255
|
+
*/
|
|
256
|
+
declare function todayDate(now?: Date): DateValue;
|
|
257
|
+
declare function addDays(value: DateValue, days: number): DateValue;
|
|
258
|
+
/** Moves by calendar months and clamps the day (Jan 31 + 1 month is Feb 28, or Feb 29 in a leap year). */
|
|
259
|
+
declare function addMonths(value: DateValue, months: number): DateValue;
|
|
260
|
+
/** `weekStartsOn` is 0 (Sunday) through 6 (Saturday), matching `Date#getDay`. */
|
|
261
|
+
declare function startOfWeek(value: DateValue, weekStartsOn: number): DateValue;
|
|
262
|
+
declare function endOfWeek(value: DateValue, weekStartsOn: number): DateValue;
|
|
263
|
+
/**
|
|
264
|
+
* ISO week number. Week 1 is the week that contains the year's first Thursday,
|
|
265
|
+
* so late December can be week 1 of the next year and early January week 52 or 53.
|
|
266
|
+
*/
|
|
267
|
+
declare function isoWeek(value: DateValue): number;
|
|
268
|
+
declare function clampDate(value: DateValue, min?: DateValue | null, max?: DateValue | null): DateValue;
|
|
269
|
+
/** Inclusive length: the same day is 1, Oct 1 through Oct 24 is 24. */
|
|
270
|
+
declare function inclusiveDays(start: DateValue, end: DateValue): number;
|
|
271
|
+
declare function orderRange(a: DateValue, b: DateValue): {
|
|
272
|
+
start: DateValue;
|
|
273
|
+
end: DateValue;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Why `day` cannot end a range that started on `start`, or null when it can.
|
|
277
|
+
* Length is inclusive. The wording is the day's accessible description.
|
|
278
|
+
*/
|
|
279
|
+
declare function lengthBlockReason(start: DateValue, day: DateValue, minLength?: number, maxLength?: number): string | null;
|
|
280
|
+
/**
|
|
281
|
+
* First day of the week for a locale. `Intl.Locale#getWeekInfo` uses 1 (Monday)
|
|
282
|
+
* through 7 (Sunday); we store Sunday as 0. Without that API, Monday, except the
|
|
283
|
+
* Sunday-first regions above.
|
|
284
|
+
*/
|
|
285
|
+
declare function defaultWeekStartsOn(locale: string): number;
|
|
286
|
+
type GridCell = {
|
|
287
|
+
date: DateValue;
|
|
288
|
+
outside: boolean;
|
|
289
|
+
};
|
|
290
|
+
/** Six weeks, starting on `weekStartsOn`, so the grid doesn't jump when the month changes. */
|
|
291
|
+
declare function monthCells(month: DateValue, weekStartsOn: number): GridCell[];
|
|
292
|
+
declare function formatDay(value: DateValue, locale: string): string;
|
|
293
|
+
declare function formatFull(value: DateValue, locale: string): string;
|
|
294
|
+
/** One date: today. Mix with other presets: `[today, last7Days]`. */
|
|
295
|
+
declare const today: Preset;
|
|
296
|
+
declare const yesterday: Preset;
|
|
297
|
+
declare const tomorrow: Preset;
|
|
298
|
+
/** Week presets take the week's first day (0 Sunday … 6 Saturday). Default is Monday. */
|
|
299
|
+
declare function thisWeek(weekStartsOn?: number): Preset;
|
|
300
|
+
declare function lastWeek(weekStartsOn?: number): Preset;
|
|
301
|
+
declare function nextWeek(weekStartsOn?: number): Preset;
|
|
302
|
+
declare const last7Days: Preset;
|
|
303
|
+
declare const last30Days: Preset;
|
|
304
|
+
declare const thisMonth: Preset;
|
|
305
|
+
declare const lastMonth: Preset;
|
|
306
|
+
declare const nextMonth: Preset;
|
|
307
|
+
declare const thisQuarter: Preset;
|
|
308
|
+
declare const yearToDate: Preset;
|
|
309
|
+
/** The built-in quick selections, in order. Week presets use `weekStartsOn`. */
|
|
310
|
+
declare function builtinPresets(weekStartsOn: number): Preset[];
|
|
311
|
+
declare function defaultPresets(mode: 'single' | 'range', weekStartsOn: number): Preset[];
|
|
312
|
+
declare function resolvePreset(preset: Preset, todayValue: DateValue): PresetValue;
|
|
313
|
+
/** A one-day range and the same ISO date count as the same selection. */
|
|
314
|
+
declare function sameSelection(a: PresetValue | null, b: PresetValue | null): boolean;
|
|
315
|
+
declare function presetInBounds(value: PresetValue, min?: DateValue | null, max?: DateValue | null, isDateDisabled?: (date: DateValue) => boolean): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* The next focused date for an arrow key on the day grid.
|
|
318
|
+
* Left and Right swap in RTL. Returns null when the key isn't a grid key.
|
|
319
|
+
*/
|
|
320
|
+
declare function moveFocusDate(date: DateValue, key: string, opts: {
|
|
321
|
+
weekStartsOn: number;
|
|
322
|
+
rtl: boolean;
|
|
323
|
+
shift: boolean;
|
|
324
|
+
}): DateValue | null;
|
|
325
|
+
|
|
326
|
+
type CalendarMode = 'single' | 'range';
|
|
327
|
+
type CalendarProps = {
|
|
328
|
+
mode?: CalendarMode;
|
|
329
|
+
value?: DateValue | null | DateRange;
|
|
330
|
+
defaultValue?: DateValue | null | DateRange;
|
|
331
|
+
onValueChange?: (value: DateValue | null | DateRange) => void;
|
|
332
|
+
/** The first visible month. Any day in the month is accepted. */
|
|
333
|
+
month?: DateValue;
|
|
334
|
+
defaultMonth?: DateValue;
|
|
335
|
+
onMonthChange?: (month: DateValue) => void;
|
|
336
|
+
/** Months side by side. `auto` is resolved by the picker; Calendar itself wants a number. */
|
|
337
|
+
months?: 1 | 2 | 3;
|
|
338
|
+
min?: DateValue;
|
|
339
|
+
max?: DateValue;
|
|
340
|
+
isDateDisabled?: (date: DateValue) => boolean;
|
|
341
|
+
minLength?: number;
|
|
342
|
+
maxLength?: number;
|
|
343
|
+
weekStartsOn?: number;
|
|
344
|
+
locale?: string;
|
|
345
|
+
showOutsideDays?: boolean;
|
|
346
|
+
showWeekNumbers?: boolean;
|
|
347
|
+
/** Move focus into the grid (the popup does this when it opens). */
|
|
348
|
+
focusSelected?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Set while the month or year chooser is open, so Escape can return to the days
|
|
351
|
+
* instead of closing the popup. Cleared on the day view.
|
|
352
|
+
*/
|
|
353
|
+
chooserBackRef?: React.MutableRefObject<(() => void) | null>;
|
|
354
|
+
onAnnounce?: (message: string) => void;
|
|
355
|
+
className?: string;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* The month grid on its own: no popup, no presets. Pages that keep a calendar
|
|
359
|
+
* open use this. DatePicker composes it.
|
|
360
|
+
*/
|
|
361
|
+
declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<HTMLDivElement>>;
|
|
362
|
+
|
|
363
|
+
type PopupKind = 'auto' | 'popover' | 'drawer';
|
|
364
|
+
type Shared = {
|
|
365
|
+
min?: DateValue;
|
|
366
|
+
max?: DateValue;
|
|
367
|
+
isDateDisabled?: (date: DateValue) => boolean;
|
|
368
|
+
minLength?: number;
|
|
369
|
+
maxLength?: number;
|
|
370
|
+
/** `false` hides them, `true` uses the default list for the mode, or pass your own. */
|
|
371
|
+
presets?: boolean | Preset[];
|
|
372
|
+
/** `auto` is 2 months for a range and 1 for a single date, dropping when the panel is narrow. */
|
|
373
|
+
months?: 1 | 2 | 3 | 'auto';
|
|
374
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
375
|
+
locale?: string;
|
|
376
|
+
showOutsideDays?: boolean;
|
|
377
|
+
showWeekNumbers?: boolean;
|
|
378
|
+
/** `apply` keeps a draft until Apply. `immediate` writes the value as soon as a day is picked. */
|
|
379
|
+
commit?: 'apply' | 'immediate';
|
|
380
|
+
clearable?: boolean;
|
|
381
|
+
placeholder?: string;
|
|
382
|
+
name?: string;
|
|
383
|
+
nameStart?: string;
|
|
384
|
+
nameEnd?: string;
|
|
385
|
+
required?: boolean;
|
|
386
|
+
disabled?: boolean;
|
|
387
|
+
readOnly?: boolean;
|
|
388
|
+
formatValue?: (value: DateValue | DateRange | null, locale: string) => string;
|
|
389
|
+
open?: boolean;
|
|
390
|
+
defaultOpen?: boolean;
|
|
391
|
+
onOpenChange?: (open: boolean) => void;
|
|
392
|
+
popup?: PopupKind;
|
|
393
|
+
/** The month to open on when there is no value yet. Any day in the month is accepted. */
|
|
394
|
+
defaultMonth?: DateValue;
|
|
395
|
+
/**
|
|
396
|
+
* Accessible name of the field and the dialog when there is no `Field.Label`.
|
|
397
|
+
* The value is described, not part of the name.
|
|
398
|
+
*/
|
|
399
|
+
label?: string;
|
|
400
|
+
id?: string;
|
|
401
|
+
className?: string;
|
|
402
|
+
};
|
|
403
|
+
type DatePickerProps = Shared & ({
|
|
404
|
+
mode?: 'single';
|
|
405
|
+
value?: DateValue | null;
|
|
406
|
+
defaultValue?: DateValue | null;
|
|
407
|
+
onValueChange?: (value: DateValue | null) => void;
|
|
408
|
+
} | {
|
|
409
|
+
mode: 'range';
|
|
410
|
+
value?: DateRange;
|
|
411
|
+
defaultValue?: DateRange;
|
|
412
|
+
onValueChange?: (value: DateRange) => void;
|
|
413
|
+
});
|
|
414
|
+
/**
|
|
415
|
+
* A field that opens a calendar. Single date or a period is chosen by the
|
|
416
|
+
* developer (`mode`); the person using it cannot switch. Not a Base UI part:
|
|
417
|
+
* the popup is Popover or Drawer, the trigger is styled like a field.
|
|
418
|
+
*
|
|
419
|
+
* A range is a start click, then an end click. An end before the start swaps.
|
|
420
|
+
* Clicking the start again makes a one-day range. Hover or focus previews the
|
|
421
|
+
* band; that preview is not announced as selected.
|
|
422
|
+
*
|
|
423
|
+
* `commit="immediate"` (the default for one date) writes as soon as the day is
|
|
424
|
+
* picked and closes. For a range it writes `{ start, end: null }` on the first
|
|
425
|
+
* click and leaves the popup open, then writes the finished range and closes
|
|
426
|
+
* on the second click. `commit="apply"` (the default for a range) keeps a draft
|
|
427
|
+
* until Apply or Cancel.
|
|
428
|
+
*
|
|
429
|
+
* Escape on a half-picked range clears the start and stays open; a second
|
|
430
|
+
* Escape closes. Escape in the month or year chooser returns to the days.
|
|
431
|
+
* Clicking outside, or any other close, throws the draft away and shows the
|
|
432
|
+
* committed value again. In immediate mode the half range is already committed,
|
|
433
|
+
* so that close keeps it.
|
|
434
|
+
*
|
|
435
|
+
* `readOnly` stays in the tab order and announces the value. It does not open.
|
|
436
|
+
* Direction is read when the popup opens. A dir change while it is open is not picked up.
|
|
437
|
+
*/
|
|
438
|
+
declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLElement>>;
|
|
439
|
+
|
|
440
|
+
type DatePresetsProps = {
|
|
441
|
+
presets: Preset[];
|
|
442
|
+
/** The committed or draft selection. A matching preset is checked. */
|
|
443
|
+
value: PresetValue | null;
|
|
444
|
+
onSelect: (preset: Preset, value: PresetValue) => void;
|
|
445
|
+
min?: DateValue;
|
|
446
|
+
max?: DateValue;
|
|
447
|
+
isDateDisabled?: (date: DateValue) => boolean;
|
|
448
|
+
locale?: string;
|
|
449
|
+
/** `row` is the scrolling chip row; `column` is the side list. */
|
|
450
|
+
layout?: 'column' | 'row';
|
|
451
|
+
/**
|
|
452
|
+
* Apply mode checks a preset as the arrows land on it.
|
|
453
|
+
* Immediate mode only moves focus; Enter, Space, or a click selects, so a range doesn't close on the first arrow.
|
|
454
|
+
*/
|
|
455
|
+
selectOnNavigate?: boolean;
|
|
456
|
+
label?: string;
|
|
457
|
+
className?: string;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Quick selections. A radio group: arrows move, the current value checks the
|
|
461
|
+
* preset it equals, and none are checked when the value is custom.
|
|
462
|
+
*/
|
|
463
|
+
declare function DatePresets({ presets, value, onSelect, min, max, isDateDisabled, locale, layout, selectOnNavigate, label, className, }: DatePresetsProps): react_jsx_runtime.JSX.Element;
|
|
464
|
+
|
|
465
|
+
/** Why the detail closed. Escape is the key; Back is the page-mode button. */
|
|
466
|
+
type ListDetailCloseReason = 'close-button' | 'escape' | 'back';
|
|
467
|
+
type ListDetailLayout = 'split' | 'drawer' | 'page';
|
|
468
|
+
interface ListDetailRootProps extends Omit<React.ComponentProps<'div'>, 'onChange'> {
|
|
469
|
+
open: boolean;
|
|
470
|
+
onOpenChange?: (open: boolean, reason: ListDetailCloseReason) => void;
|
|
471
|
+
/** What the narrow layout is. Wide layouts are always a splitter. */
|
|
472
|
+
narrow?: 'drawer' | 'page';
|
|
473
|
+
/** Override the `--sl-list-detail-split-min-width` token. Compared to this element's width, not the window. */
|
|
474
|
+
splitMinWidth?: number;
|
|
475
|
+
/** Remember the splitter position. */
|
|
476
|
+
storageKey?: string;
|
|
477
|
+
defaultDetailSize?: string;
|
|
478
|
+
minDetailSize?: string;
|
|
479
|
+
maxDetailSize?: string;
|
|
480
|
+
/** Accessible name of the separator. */
|
|
481
|
+
handleLabel?: string;
|
|
482
|
+
/** Accessible name of the list, when the list has no heading of its own. */
|
|
483
|
+
listLabel?: string;
|
|
484
|
+
}
|
|
485
|
+
interface ListDetailDetailProps extends Omit<React.ComponentProps<'section'>, 'title'> {
|
|
486
|
+
title: React.ReactNode;
|
|
487
|
+
actions?: React.ReactNode;
|
|
488
|
+
closeDisabled?: boolean;
|
|
489
|
+
/** Accessible name of the icon-only Close button. */
|
|
490
|
+
closeLabel?: string;
|
|
491
|
+
/** Visible label of the page-mode Back button. */
|
|
492
|
+
backLabel?: string;
|
|
493
|
+
/** Defaults to 2. Drawer titles use the same level. */
|
|
494
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
495
|
+
}
|
|
496
|
+
interface ListDetailValue {
|
|
497
|
+
layout: ListDetailLayout;
|
|
498
|
+
close: () => void;
|
|
499
|
+
}
|
|
500
|
+
declare function useListDetail(): ListDetailValue;
|
|
501
|
+
/**
|
|
502
|
+
* A list and the detail of the selected item. Wide: a Splitter. Narrow: a Drawer,
|
|
503
|
+
* or the detail replaces the list. The app owns the selection.
|
|
504
|
+
*
|
|
505
|
+
* The list stays in the splitter's first panel the whole time, so opening, closing,
|
|
506
|
+
* and crossing the width never reparents it and never resets its scroll. The detail
|
|
507
|
+
* portals into a div this component created with createElement. React does not
|
|
508
|
+
* reconcile that div, so moving it between the split panel, the drawer, and the
|
|
509
|
+
* page is safe.
|
|
510
|
+
*/
|
|
511
|
+
declare const ListDetailRoot: React.ForwardRefExoticComponent<Omit<ListDetailRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
512
|
+
declare const ListDetailList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
513
|
+
declare const ListDetailDetail: React.ForwardRefExoticComponent<Omit<ListDetailDetailProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
514
|
+
declare const ListDetail: {
|
|
515
|
+
Root: React.ForwardRefExoticComponent<Omit<ListDetailRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
516
|
+
List: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
517
|
+
Detail: React.ForwardRefExoticComponent<Omit<ListDetailDetailProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Splitter layout math, with no DOM. Sizes are a number (percent of the root) or a
|
|
522
|
+
* "NNNpx" / "NN%" string. One panel is the filler: the only one without a size, or the
|
|
523
|
+
* last panel when every panel has one. The filler takes what the others leave.
|
|
524
|
+
* Px and percent mix. A drag, a key, or a smaller root never pushes a panel past its
|
|
525
|
+
* min or max. Collapsing remembers the size to restore. A collapse that happened
|
|
526
|
+
* because the root was too small is marked, and it opens again when the room returns.
|
|
527
|
+
* A collapse the person chose stays collapsed. Pass the handles' total size to
|
|
528
|
+
* measure so the panels share what's left after the bars.
|
|
529
|
+
*/
|
|
530
|
+
interface Size {
|
|
531
|
+
unit: 'px' | 'percent';
|
|
532
|
+
value: number;
|
|
533
|
+
}
|
|
534
|
+
type SizeInput = number | string;
|
|
535
|
+
interface PanelSpec {
|
|
536
|
+
id: string;
|
|
537
|
+
/** Omitted on the filler. A number is a percent of the root. */
|
|
538
|
+
defaultSize?: SizeInput;
|
|
539
|
+
minSize?: SizeInput;
|
|
540
|
+
maxSize?: SizeInput;
|
|
541
|
+
collapsible?: boolean;
|
|
542
|
+
/** Defaults to 0. */
|
|
543
|
+
collapsedSize?: SizeInput;
|
|
544
|
+
defaultCollapsed?: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Take the collapsed size for this render and hide the panel. Not a choice, and
|
|
547
|
+
* not stored. List detail uses it while the detail is closed or in a drawer.
|
|
548
|
+
*/
|
|
549
|
+
suspended?: boolean;
|
|
550
|
+
}
|
|
551
|
+
/** One panel after the defaults are resolved. `size` is the size the person chose. */
|
|
552
|
+
interface RuntimePanel {
|
|
553
|
+
id: string;
|
|
554
|
+
fill: boolean;
|
|
555
|
+
size: Size;
|
|
556
|
+
defaultSize: Size;
|
|
557
|
+
min: Size;
|
|
558
|
+
max: Size | null;
|
|
559
|
+
collapsible: boolean;
|
|
560
|
+
collapsedSize: Size;
|
|
561
|
+
collapsed: boolean;
|
|
562
|
+
/** The size to put back on Enter. Set when the panel collapses. */
|
|
563
|
+
restore: Size | null;
|
|
564
|
+
/**
|
|
565
|
+
* True when settle collapsed this panel because the root was too small.
|
|
566
|
+
* Never written to storage. A collapse from Enter or a button leaves it false.
|
|
567
|
+
*/
|
|
568
|
+
autoCollapsed: boolean;
|
|
569
|
+
/** See PanelSpec.suspended. */
|
|
570
|
+
suspended: boolean;
|
|
571
|
+
}
|
|
572
|
+
interface StoredPanel {
|
|
573
|
+
size: string;
|
|
574
|
+
collapsed: boolean;
|
|
575
|
+
}
|
|
576
|
+
type StoredLayout = Record<string, StoredPanel>;
|
|
577
|
+
type SplitterKey = 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End' | 'Enter';
|
|
578
|
+
interface KeyOptions {
|
|
579
|
+
orientation: 'horizontal' | 'vertical';
|
|
580
|
+
shift?: boolean;
|
|
581
|
+
rtl?: boolean;
|
|
582
|
+
/** Percent of the root. */
|
|
583
|
+
step: number;
|
|
584
|
+
largeStep: number;
|
|
585
|
+
}
|
|
586
|
+
declare function parseSize(input: SizeInput | null | undefined): Size | null;
|
|
587
|
+
declare function serializeSize(size: Size): string;
|
|
588
|
+
/** Build the runtime panels. The filler is the only panel without a size, or the last one. */
|
|
589
|
+
declare function createPanels(specs: PanelSpec[]): RuntimePanel[];
|
|
590
|
+
/**
|
|
591
|
+
* New min, max, or collapsible props. Keep the size the person chose when it still
|
|
592
|
+
* fits. A size outside the new range takes the new default. A panel that can no
|
|
593
|
+
* longer collapse opens.
|
|
594
|
+
*/
|
|
595
|
+
declare function syncPanels(current: RuntimePanel[], specs: PanelSpec[]): RuntimePanel[];
|
|
596
|
+
/**
|
|
597
|
+
* Pixel width (or height) of each panel. `root` is the splitter's content box.
|
|
598
|
+
* `handles` is the total size of the bars, which are flex items too: the panels
|
|
599
|
+
* share what's left, or the filler and the values would be short by that many pixels.
|
|
600
|
+
*/
|
|
601
|
+
declare function measure(panels: RuntimePanel[], root: number, handles?: number): number[];
|
|
602
|
+
/** Collapse panels from the end when even their minimums no longer fit. */
|
|
603
|
+
declare function settle(panels: RuntimePanel[], root: number): RuntimePanel[];
|
|
604
|
+
declare function handleTarget(panels: RuntimePanel[], handleIndex: number): number;
|
|
605
|
+
/**
|
|
606
|
+
* Move the handle by `deltaPx` toward the end of the axis. The sized neighbor
|
|
607
|
+
* changes; the filler absorbs it. Stops at min and max on both.
|
|
608
|
+
*/
|
|
609
|
+
declare function resizeByDelta(panels: RuntimePanel[], root: number, handleIndex: number, deltaPx: number): RuntimePanel[];
|
|
610
|
+
declare function toggleCollapsed(panels: RuntimePanel[], handleIndex: number): RuntimePanel[] | null;
|
|
611
|
+
declare function resetToDefault(panels: RuntimePanel[], handleIndex: number): RuntimePanel[];
|
|
612
|
+
/** `null` when the key does not apply, or the panel cannot collapse. */
|
|
613
|
+
declare function applyKey(panels: RuntimePanel[], root: number, handleIndex: number, key: SplitterKey, options: KeyOptions): RuntimePanel[] | null;
|
|
614
|
+
/**
|
|
615
|
+
* Read a stored layout. Corrupt JSON, a bad size, or a size outside min/max returns
|
|
616
|
+
* null so the caller keeps the defaults. The filler's entry is ignored.
|
|
617
|
+
*
|
|
618
|
+
* `partial: 'reject'` (the controlled `layout` prop) returns null when a panel is
|
|
619
|
+
* missing, and warns in development. `'ignore'` (a stored layout from an older
|
|
620
|
+
* panel list) skips an extra or missing id and keeps that panel's default.
|
|
621
|
+
*/
|
|
622
|
+
declare function applyStored(raw: string | null, panels: RuntimePanel[], partial?: 'reject' | 'ignore'): RuntimePanel[] | null;
|
|
623
|
+
declare function layoutOf(panels: RuntimePanel[]): StoredLayout;
|
|
624
|
+
declare function sizeText(panel: RuntimePanel): string;
|
|
625
|
+
/**
|
|
626
|
+
* The size to paint before the root has been measured (the server, and the first
|
|
627
|
+
* client paint). Where the size, min, and max share a unit, clamp with CSS so a
|
|
628
|
+
* declared 240px still respects its min. Mixed units wait for the measured pixels.
|
|
629
|
+
*/
|
|
630
|
+
declare function cssSize(panel: RuntimePanel): string;
|
|
631
|
+
/** Percent of the root, 0–100, for aria-valuenow / min / max. */
|
|
632
|
+
declare function ariaPercents(panel: RuntimePanel, pixels: number, root: number): {
|
|
633
|
+
now: number;
|
|
634
|
+
min: number;
|
|
635
|
+
max: number;
|
|
636
|
+
};
|
|
637
|
+
declare function valueText(panel: RuntimePanel, pixels: number): string;
|
|
638
|
+
|
|
639
|
+
interface SplitterRootProps extends Omit<React.ComponentProps<'div'>, 'onChange'> {
|
|
640
|
+
/** `horizontal` puts panels in a row and the handle is a vertical bar. */
|
|
641
|
+
orientation?: 'horizontal' | 'vertical';
|
|
642
|
+
/** Remember sizes and collapsed state. Read after mount so the server and client match. */
|
|
643
|
+
storageKey?: string;
|
|
644
|
+
/** Controlled sizes. Keys are panel ids. A missing panel warns in development and is ignored. */
|
|
645
|
+
layout?: StoredLayout;
|
|
646
|
+
/** Fires when a drag or a key press ends, not while the pointer is moving. */
|
|
647
|
+
onLayoutChange?: (layout: StoredLayout) => void;
|
|
648
|
+
}
|
|
649
|
+
interface SplitterPanelProps extends React.ComponentProps<'div'> {
|
|
650
|
+
/**
|
|
651
|
+
* The panel's key in storage and in `layout`. The DOM id is this, prefixed with
|
|
652
|
+
* the splitter's useId, so two splitters can both have a panel called `main`.
|
|
653
|
+
*/
|
|
654
|
+
id: string;
|
|
655
|
+
/** A number is a percent of the root. `'240px'` and `'30%'` are sizes too. Omit on the filler. */
|
|
656
|
+
defaultSize?: number | string;
|
|
657
|
+
minSize?: number | string;
|
|
658
|
+
maxSize?: number | string;
|
|
659
|
+
collapsible?: boolean;
|
|
660
|
+
/** Defaults to 0. A collapsed panel at 0 is `hidden`, so its contents leave the tab order. */
|
|
661
|
+
collapsedSize?: number | string;
|
|
662
|
+
defaultCollapsed?: boolean;
|
|
663
|
+
/** Hide the panel at its collapsed size for this render. Not stored. */
|
|
664
|
+
suspended?: boolean;
|
|
665
|
+
}
|
|
666
|
+
type SplitterHandleProps = Omit<React.ComponentProps<'div'>, 'aria-label'> & {
|
|
667
|
+
/** Required: the separator's accessible name, for example "Resize navigation". */
|
|
668
|
+
'aria-label': string;
|
|
669
|
+
disabled?: boolean;
|
|
670
|
+
/** A small grip in the middle of the line. Off unless set. */
|
|
671
|
+
grip?: boolean;
|
|
672
|
+
/** Injected by Root from the handle's place between panels. */
|
|
673
|
+
index?: number;
|
|
674
|
+
};
|
|
675
|
+
declare const SplitterRoot: React.ForwardRefExoticComponent<Omit<SplitterRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
676
|
+
declare const SplitterPanel: React.ForwardRefExoticComponent<Omit<SplitterPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
677
|
+
declare const SplitterHandle: React.ForwardRefExoticComponent<Omit<SplitterHandleProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
678
|
+
declare const Splitter: {
|
|
679
|
+
Root: React.ForwardRefExoticComponent<Omit<SplitterRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
680
|
+
Panel: React.ForwardRefExoticComponent<Omit<SplitterPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
681
|
+
Handle: React.ForwardRefExoticComponent<Omit<SplitterHandleProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
type EmptyStateKind = 'start' | 'no-results' | 'error' | 'done' | 'no-access' | 'unselected';
|
|
685
|
+
type EmptyStateSize = 'compact' | 'standard' | 'spacious';
|
|
686
|
+
type EmptyStateRootProps = React.ComponentProps<'div'> & {
|
|
687
|
+
kind?: EmptyStateKind;
|
|
688
|
+
size?: EmptyStateSize;
|
|
689
|
+
/** true announces; false stays silent; omitted uses the kind's default. */
|
|
690
|
+
announce?: boolean;
|
|
691
|
+
};
|
|
692
|
+
type EmptyStateMediaProps = React.ComponentProps<'div'> & {
|
|
693
|
+
/** Overrides the root kind. error and done tint the circle. Other kinds stay neutral. */
|
|
694
|
+
kind?: EmptyStateKind;
|
|
695
|
+
/** An illustration the app owns. Not tinted. */
|
|
696
|
+
custom?: boolean;
|
|
697
|
+
};
|
|
698
|
+
type EmptyStateTitleProps = React.ComponentProps<'h2'> & {
|
|
699
|
+
/** Overrides the root size. Compact is a paragraph unless headingLevel is set. */
|
|
700
|
+
size?: EmptyStateSize;
|
|
701
|
+
/** 2–6. Compact is a paragraph unless this is set. */
|
|
702
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
703
|
+
};
|
|
704
|
+
type EmptyStateProps = Omit<React.ComponentProps<'div'>, 'title'> & {
|
|
705
|
+
/** What is empty. Required. */
|
|
706
|
+
title: React.ReactNode;
|
|
707
|
+
kind?: EmptyStateKind;
|
|
708
|
+
size?: EmptyStateSize;
|
|
709
|
+
/**
|
|
710
|
+
* A Material Symbols name, or a node. Omit it for the kind's icon.
|
|
711
|
+
* null hides the media.
|
|
712
|
+
*/
|
|
713
|
+
icon?: React.ReactNode;
|
|
714
|
+
/** Replaces the media slot. Not tinted. An image or illustration the app owns. */
|
|
715
|
+
media?: React.ReactNode;
|
|
716
|
+
description?: React.ReactNode;
|
|
717
|
+
/** First action is the main one. The app picks each button's emphasis. */
|
|
718
|
+
actions?: React.ReactNode;
|
|
719
|
+
headingLevel?: EmptyStateTitleProps['headingLevel'];
|
|
720
|
+
announce?: boolean;
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* The block a screen, pane, table, list or popup shows when it has nothing to show.
|
|
724
|
+
* One component for every situation: the kind picks the icon, the media tone and whether
|
|
725
|
+
* it is announced. The app writes the copy and decides when to show it.
|
|
726
|
+
*/
|
|
727
|
+
declare const EmptyState: React.ForwardRefExoticComponent<Omit<EmptyStateProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
728
|
+
Root: React.ForwardRefExoticComponent<Omit<EmptyStateRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
729
|
+
Media: React.ForwardRefExoticComponent<Omit<EmptyStateMediaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
730
|
+
Title: React.ForwardRefExoticComponent<Omit<EmptyStateTitleProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
731
|
+
Description: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
732
|
+
Actions: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
interface EditableListApi<T> {
|
|
736
|
+
update: (patch: Partial<T>) => void;
|
|
737
|
+
remove: () => void;
|
|
738
|
+
index: number;
|
|
739
|
+
}
|
|
740
|
+
interface EditableListRootProps<T> {
|
|
741
|
+
value?: T[];
|
|
742
|
+
defaultValue?: T[];
|
|
743
|
+
onValueChange?: (value: T[]) => void;
|
|
744
|
+
getRowId: (row: T) => string;
|
|
745
|
+
createRow: () => T;
|
|
746
|
+
minRows?: number;
|
|
747
|
+
maxRows?: number;
|
|
748
|
+
label: string;
|
|
749
|
+
/** Singular name for a row: "Allocation". Used in remove labels and the stacked title. */
|
|
750
|
+
itemLabel?: string;
|
|
751
|
+
/** When set, each primitive field also submits as name[index].field. Do not combine this with fields the app names itself. */
|
|
752
|
+
name?: string;
|
|
753
|
+
/** Which keys submit. By default, id and non-primitives are skipped. */
|
|
754
|
+
fields?: (keyof T)[];
|
|
755
|
+
locale?: string;
|
|
756
|
+
rowError?: (row: T) => string | null;
|
|
757
|
+
children: React.ReactNode;
|
|
758
|
+
className?: string;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Repeating form rows. Move up, Move down, To top and To bottom are not here yet:
|
|
762
|
+
* nothing in Dryden is user-ordered. Those buttons would sit in the row, before any drag handle.
|
|
763
|
+
*/
|
|
764
|
+
declare function EditableListRoot<T extends object>({ value, defaultValue, onValueChange, getRowId, createRow, minRows, maxRows, label, itemLabel, name, fields, locale, rowError, children, className, }: EditableListRootProps<T>): react_jsx_runtime.JSX.Element;
|
|
765
|
+
declare function EditableListHeader({ columns }: {
|
|
766
|
+
columns: string[];
|
|
767
|
+
}): react_jsx_runtime.JSX.Element;
|
|
768
|
+
declare function EditableListRows<T>({ children }: {
|
|
769
|
+
children: (row: T, index: number, api: EditableListApi<T>) => React.ReactNode;
|
|
770
|
+
}): react_jsx_runtime.JSX.Element;
|
|
771
|
+
declare function EditableListRow({ children }: {
|
|
772
|
+
children: React.ReactNode;
|
|
773
|
+
}): react_jsx_runtime.JSX.Element;
|
|
774
|
+
/** The id and aria-labelledby for the field in this cell. Put them on the input. A Select or MoneyField takes the same id on its own input. */
|
|
775
|
+
declare function useEditableListField(column: string): {
|
|
776
|
+
id: string;
|
|
777
|
+
'aria-labelledby': string;
|
|
778
|
+
};
|
|
779
|
+
declare function EditableListCell({ column, align, children }: {
|
|
780
|
+
column: string;
|
|
781
|
+
align?: 'end';
|
|
782
|
+
children: React.ReactNode;
|
|
783
|
+
}): react_jsx_runtime.JSX.Element;
|
|
784
|
+
declare function EditableListRemoveButton(): react_jsx_runtime.JSX.Element;
|
|
785
|
+
declare function EditableListAddButton({ children }: {
|
|
786
|
+
children: React.ReactNode;
|
|
787
|
+
}): react_jsx_runtime.JSX.Element;
|
|
788
|
+
declare function EditableListError({ children }: {
|
|
789
|
+
children: React.ReactNode;
|
|
790
|
+
}): react_jsx_runtime.JSX.Element;
|
|
791
|
+
declare function EditableListBalance<T extends object>({ control, currency, sum }: {
|
|
792
|
+
control: number | string;
|
|
793
|
+
currency: string;
|
|
794
|
+
sum: (rows: T[]) => Array<number | string | null | undefined>;
|
|
795
|
+
}): react_jsx_runtime.JSX.Element;
|
|
796
|
+
declare const EditableList: {
|
|
797
|
+
useField: typeof useEditableListField;
|
|
798
|
+
Root: typeof EditableListRoot;
|
|
799
|
+
Header: typeof EditableListHeader;
|
|
800
|
+
Rows: typeof EditableListRows;
|
|
801
|
+
Row: typeof EditableListRow;
|
|
802
|
+
Cell: typeof EditableListCell;
|
|
803
|
+
RemoveButton: typeof EditableListRemoveButton;
|
|
804
|
+
AddButton: typeof EditableListAddButton;
|
|
805
|
+
Error: typeof EditableListError;
|
|
806
|
+
Balance: typeof EditableListBalance;
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
export { nextMonth as $, addMonths as A, Badge as B, Calendar as C, DatePicker as D, EditableList as E, builtinPresets as F, clampDate as G, daysInMonth as H, defaultPresets as I, defaultWeekStartsOn as J, endOfWeek as K, ListDetail as L, MoneyField as M, NumberField as N, formatMoney as O, type Preset as P, fromMinorUnits as Q, getCurrencyDigits as R, Splitter as S, inclusiveDays as T, isValidCurrency as U, isoWeek as V, last30Days as W, last7Days as X, lastMonth as Y, lastWeek as Z, lengthBlockReason as _, type BadgeProps as a, roundingChangesValue as a$, nextWeek as a0, orderRange as a1, parseDecimalString as a2, resolvePreset as a3, startOfWeek as a4, thisMonth as a5, thisQuarter as a6, thisWeek as a7, toDecimalString as a8, toMinorUnits as a9, type SplitterKey as aA, SplitterPanel as aB, SplitterRoot as aC, type StoredLayout as aD, type StoredPanel as aE, affixSide as aF, applyKey as aG, applyStored as aH, ariaPercents as aI, createPanels as aJ, cssSize as aK, currencyName as aL, currencySymbol as aM, formatDay as aN, formatFull as aO, handleTarget as aP, layoutOf as aQ, measure as aR, monthCells as aS, moveFocusDate as aT, normalizePaste as aU, parseDate as aV, parseSize as aW, presetInBounds as aX, resetToDefault as aY, resizeByDelta as aZ, roundHalfExpand as a_, today as aa, todayDate as ab, tomorrow as ac, useListDetail as ad, yearToDate as ae, yesterday as af, CURRENCY_SEARCH_THRESHOLD as ag, CurrencySelect as ah, type KeyOptions as ai, ListDetailDetail as aj, ListDetailList as ak, ListDetailRoot as al, MAX_MINOR_UNITS as am, type MoneyChangeDetails as an, type MoneyDisplay as ao, MoneyFieldAffix as ap, MoneyFieldGroup as aq, MoneyFieldInput as ar, MoneyFieldRoot as as, type MoneyFieldSteps as at, type NormalizedPaste as au, type PanelSpec as av, type RuntimePanel as aw, type Size as ax, type SizeInput as ay, SplitterHandle as az, type CalendarProps as b, sameSelection as b0, serializeSize as b1, settle as b2, sizeText as b3, syncPanels as b4, toggleCollapsed as b5, valueText as b6, type CurrencyCode as c, type DatePickerProps as d, DatePresets as e, type DatePresetsProps as f, type DateRange as g, type DateValue as h, type EditableListApi as i, type EditableListRootProps as j, EmptyState as k, type EmptyStateKind as l, type EmptyStateProps as m, type ListDetailCloseReason as n, type ListDetailDetailProps as o, type ListDetailLayout as p, type ListDetailRootProps as q, type ListDetailValue as r, type MoneyFieldProps as s, type MoneyFieldRootProps as t, type NumberFieldLabelProps as u, type PresetValue as v, type SplitterHandleProps as w, type SplitterPanelProps as x, type SplitterRootProps as y, addDays as z };
|