@sveltia/ui 0.80.3 → 0.81.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/components/text-editor/core.js +26 -14
- package/dist/components/text-editor/markdown.d.ts +21 -0
- package/dist/components/text-editor/markdown.js +305 -36
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/text-editor/transformers/block-escape.d.ts +8 -4
- package/dist/components/text-editor/transformers/block-escape.js +111 -14
- package/dist/components/text-editor/transformers/table.js +14 -3
- package/dist/components/text-field/number-input.d.ts +15 -0
- package/dist/components/text-field/number-input.js +86 -0
- package/dist/components/text-field/number-input.svelte +102 -52
- package/dist/components/text-field/number-input.svelte.d.ts +30 -2
- package/dist/locales/ar.yaml +6 -0
- package/dist/locales/bg.yaml +6 -0
- package/dist/locales/ca.yaml +6 -0
- package/dist/locales/cs.yaml +6 -0
- package/dist/locales/da.yaml +6 -0
- package/dist/locales/de.yaml +6 -0
- package/dist/locales/el.yaml +6 -0
- package/dist/locales/en-CA.yaml +6 -0
- package/dist/locales/en-GB.yaml +6 -0
- package/dist/locales/en-US.yaml +6 -0
- package/dist/locales/es-CO.yaml +6 -0
- package/dist/locales/fa.yaml +6 -0
- package/dist/locales/fi.yaml +6 -0
- package/dist/locales/fr.yaml +6 -0
- package/dist/locales/he.yaml +6 -0
- package/dist/locales/hr.yaml +6 -0
- package/dist/locales/it.yaml +6 -0
- package/dist/locales/ja.yaml +6 -0
- package/dist/locales/ko.yaml +6 -0
- package/dist/locales/nl.yaml +6 -0
- package/dist/locales/pl.yaml +6 -0
- package/dist/locales/pt-BR.yaml +6 -0
- package/dist/locales/pt-PT.yaml +6 -0
- package/dist/locales/ru.yaml +6 -0
- package/dist/locales/sk.yaml +6 -0
- package/dist/locales/sv.yaml +6 -0
- package/dist/locales/tr.yaml +6 -0
- package/dist/locales/uk.yaml +6 -0
- package/dist/locales/vi.yaml +6 -0
- package/dist/locales/zh-CN.yaml +6 -0
- package/dist/locales/zh-TW.yaml +6 -0
- package/package.json +1 -1
|
@@ -23,6 +23,8 @@ import {
|
|
|
23
23
|
} from '@lexical/table';
|
|
24
24
|
import { $isParagraphNode as isParagraphNode, $isTextNode as isTextNode } from 'lexical';
|
|
25
25
|
|
|
26
|
+
import { BLOCK_SYNTAX_ESCAPE } from './block-escape.js';
|
|
27
|
+
|
|
26
28
|
/**
|
|
27
29
|
* @import { ElementTransformer } from '@lexical/markdown';
|
|
28
30
|
*/
|
|
@@ -48,7 +50,8 @@ export const getTableColumnsSize = (table) => {
|
|
|
48
50
|
* @returns {TableCellNode}
|
|
49
51
|
*/
|
|
50
52
|
const createTableCell = (textContent) => {
|
|
51
|
-
|
|
53
|
+
// An escaped pipe is part of the cell, even within inline code, like GitHub Flavored Markdown
|
|
54
|
+
textContent = textContent.replace(/\\n/g, '\n').replace(/\\\|/g, '|');
|
|
52
55
|
|
|
53
56
|
const cell = createTableCellNode(TableCellHeaderStates.NO_STATUS);
|
|
54
57
|
|
|
@@ -70,7 +73,9 @@ export const mapToTableCells = (textContent) => {
|
|
|
70
73
|
return null;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
// Split the row at the pipes that are not escaped, which are preceded by an even number of
|
|
77
|
+
// backslashes
|
|
78
|
+
return match.split(/(?<=(?<!\\)(?:\\\\)*)\|/).map((text) => createTableCell(text));
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
/**
|
|
@@ -99,7 +104,13 @@ export const TABLE = {
|
|
|
99
104
|
row.getChildren().forEach((cell) => {
|
|
100
105
|
// It’s TableCellNode so it’s just to make flow happy
|
|
101
106
|
if (isTableCellNode(cell)) {
|
|
102
|
-
rowOutput.push(
|
|
107
|
+
rowOutput.push(
|
|
108
|
+
convertToMarkdownString([...TRANSFORMERS, BLOCK_SYNTAX_ESCAPE], cell)
|
|
109
|
+
// Escape a pipe, which would otherwise end the cell, even within inline code
|
|
110
|
+
.replace(/\|/g, '\\|')
|
|
111
|
+
.replace(/\n/g, '\\n')
|
|
112
|
+
.trim(),
|
|
113
|
+
);
|
|
103
114
|
|
|
104
115
|
if (cell.__headerState === TableCellHeaderStates.ROW) {
|
|
105
116
|
isHeaderRow = true;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logic behind `<NumberInput>`, kept apart from the component so the number handling can be tested
|
|
3
|
+
* without rendering anything.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Step value that turns stepping off: the spin buttons are hidden and the arrow keys are ignored.
|
|
7
|
+
*/
|
|
8
|
+
export const STEP_DISABLED: -1;
|
|
9
|
+
export function normalizeStep(step: number | null | undefined): number;
|
|
1
10
|
export function getMaximumFractionDigits(step: number): number;
|
|
11
|
+
export function getInputMode({ fractional, min }: {
|
|
12
|
+
fractional: boolean;
|
|
13
|
+
min?: number | undefined;
|
|
14
|
+
}): "text" | "decimal" | "numeric";
|
|
15
|
+
export function getDecimalSeparator(locale: string | undefined): string;
|
|
16
|
+
export function normalizeNumber(inputValue: string, locale: string | undefined): string;
|
|
2
17
|
export function parseNumber(inputValue: string): number | undefined;
|
|
3
18
|
export function isAtMin(inputValue: string, min: number | undefined): boolean;
|
|
4
19
|
export function isAtMax(inputValue: string, max: number | undefined): boolean;
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
* without rendering anything.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Step value that turns stepping off: the spin buttons are hidden and the arrow keys are ignored.
|
|
8
|
+
*/
|
|
9
|
+
export const STEP_DISABLED = -1;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the step to use, falling back to `1` for a value that isn’t a positive number, like `0`,
|
|
13
|
+
* `null` or `NaN`, which would leave the spin buttons and the arrow keys with nowhere to go.
|
|
14
|
+
* @param {number | null | undefined} step Step value.
|
|
15
|
+
* @returns {number} Positive step.
|
|
16
|
+
*/
|
|
17
|
+
export const normalizeStep = (step) =>
|
|
18
|
+
typeof step === 'number' && Number.isFinite(step) && step > 0 ? step : 1;
|
|
19
|
+
|
|
6
20
|
/**
|
|
7
21
|
* Get the number of fraction digits a value should be formatted with, so stepping by `0.1` yields
|
|
8
22
|
* `0.3` rather than `0.30000000000000004`.
|
|
@@ -17,6 +31,78 @@ export const getMaximumFractionDigits = (step) => {
|
|
|
17
31
|
return Math.max(digits, 0);
|
|
18
32
|
};
|
|
19
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Get the `inputmode` attribute for the field. The numeric and decimal keypads on iOS have no minus
|
|
36
|
+
* key, so a field that accepts a negative number gets the full keyboard instead.
|
|
37
|
+
* @param {object} options Options.
|
|
38
|
+
* @param {boolean} options.fractional Whether the number can have a fraction.
|
|
39
|
+
* @param {number} [options.min] Minimum allowed value.
|
|
40
|
+
* @returns {'text' | 'decimal' | 'numeric'} Input mode.
|
|
41
|
+
*/
|
|
42
|
+
export const getInputMode = ({ fractional, min }) => {
|
|
43
|
+
if (!(typeof min === 'number' && min >= 0)) {
|
|
44
|
+
return 'text';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return fractional ? 'decimal' : 'numeric';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Decimal separators of the locales looked up, keyed by locale. The separator is read on every
|
|
52
|
+
* keystroke, while creating an `Intl.NumberFormat` is comparatively expensive.
|
|
53
|
+
* @type {Map<string, string>}
|
|
54
|
+
*/
|
|
55
|
+
const decimalSeparatorCache = new Map();
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the decimal separator of the given locale, like `,` in German.
|
|
59
|
+
* @param {string | undefined} locale Locale, like `de`. If omitted, the browser’s default locale is
|
|
60
|
+
* used.
|
|
61
|
+
* @returns {string} Decimal separator. `.` if the locale is invalid.
|
|
62
|
+
*/
|
|
63
|
+
export const getDecimalSeparator = (locale) => {
|
|
64
|
+
const key = locale || '';
|
|
65
|
+
let separator = decimalSeparatorCache.get(key);
|
|
66
|
+
|
|
67
|
+
if (separator === undefined) {
|
|
68
|
+
try {
|
|
69
|
+
separator = /** @type {Intl.NumberFormatPart} */ (
|
|
70
|
+
new Intl.NumberFormat(locale || undefined)
|
|
71
|
+
.formatToParts(1.5)
|
|
72
|
+
.find(({ type }) => type === 'decimal')
|
|
73
|
+
).value;
|
|
74
|
+
} catch {
|
|
75
|
+
separator = '.';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
decimalSeparatorCache.set(key, separator);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return separator;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Normalize the text entered in the field, so a number typed with the locale’s decimal separator,
|
|
86
|
+
* like `1,5` in German, can be parsed as `1.5`. A period is always accepted as the decimal
|
|
87
|
+
* separator, as a value set from outside is shown with one, so the text is left as is if it has
|
|
88
|
+
* one, or more than one decimal separator of the locale. Thousands separators are not supported:
|
|
89
|
+
* `1,500` in English, whose decimal separator is a period, remains no number.
|
|
90
|
+
* @param {string} inputValue Text in the field.
|
|
91
|
+
* @param {string | undefined} locale Locale of the field.
|
|
92
|
+
* @returns {string} Normalized text.
|
|
93
|
+
*/
|
|
94
|
+
export const normalizeNumber = (inputValue, locale) => {
|
|
95
|
+
const separator = getDecimalSeparator(locale);
|
|
96
|
+
|
|
97
|
+
if (!inputValue || separator === '.' || inputValue.includes('.')) {
|
|
98
|
+
return inputValue;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const parts = inputValue.split(separator);
|
|
102
|
+
|
|
103
|
+
return parts.length === 2 ? parts.join('.') : inputValue;
|
|
104
|
+
};
|
|
105
|
+
|
|
20
106
|
/**
|
|
21
107
|
* Parse the text entered in the field.
|
|
22
108
|
* @param {string} inputValue Text in the field.
|
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#textbox
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
-
import { _ } from '@sveltia/i18n';
|
|
8
|
+
import { _, locale } from '@sveltia/i18n';
|
|
9
9
|
import { untrack } from 'svelte';
|
|
10
10
|
import Button from '../button/button.svelte';
|
|
11
11
|
import Icon from '../icon/icon.svelte';
|
|
12
12
|
import {
|
|
13
|
+
STEP_DISABLED,
|
|
14
|
+
getInputMode,
|
|
13
15
|
getMaximumFractionDigits,
|
|
14
16
|
isAtMax,
|
|
15
17
|
isAtMin,
|
|
16
18
|
isInvalidNumber,
|
|
19
|
+
normalizeNumber,
|
|
20
|
+
normalizeStep,
|
|
17
21
|
parseNumber,
|
|
18
22
|
stepNumber,
|
|
19
23
|
} from './number-input.js';
|
|
@@ -30,7 +34,15 @@
|
|
|
30
34
|
* @property {number} [min] Minimum allowed value.
|
|
31
35
|
* @property {number} [max] Maximum allowed value.
|
|
32
36
|
* @property {number} [step] Value to be added or removed when using the up/down arrow key or
|
|
33
|
-
* button.
|
|
37
|
+
* button. Set to `-1` to hide the buttons and disable stepping with the arrow keys, for a number
|
|
38
|
+
* that isn’t meant to be stepped, like an ID. Any other value that isn’t a positive number falls
|
|
39
|
+
* back to `1`.
|
|
40
|
+
* @property {boolean} [fractional] Whether the number can have a fraction, which brings up the
|
|
41
|
+
* decimal keypad rather than the numeric one on mobile. If omitted, it’s inferred from `step`:
|
|
42
|
+
* `true` for a fractional step or with stepping turned off, `false` for an integer step.
|
|
43
|
+
* @property {'text' | 'decimal' | 'numeric'} [inputmode] The `inputmode` attribute on the
|
|
44
|
+
* `<input>`. If omitted, it’s `text` if a negative number is allowed, as the numeric and decimal
|
|
45
|
+
* keypads on iOS have no minus key, otherwise `decimal` or `numeric` depending on `fractional`.
|
|
34
46
|
* @property {Snippet} [increaseIcon] Increase icon slot content.
|
|
35
47
|
* @property {Snippet} [decreaseIcon] Decrease icon slot content.
|
|
36
48
|
*/
|
|
@@ -46,6 +58,8 @@
|
|
|
46
58
|
min = undefined,
|
|
47
59
|
max = undefined,
|
|
48
60
|
step = 1,
|
|
61
|
+
fractional = undefined,
|
|
62
|
+
inputmode = undefined,
|
|
49
63
|
class: className,
|
|
50
64
|
hidden = false,
|
|
51
65
|
disabled = false,
|
|
@@ -66,9 +80,40 @@
|
|
|
66
80
|
let edited = $state(false);
|
|
67
81
|
let inputValue = $state('');
|
|
68
82
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
83
|
+
// `-1` turns stepping off altogether, leaving a plain text box: a spin button promises the arrow
|
|
84
|
+
// keys step the value
|
|
85
|
+
const stepEnabled = $derived(step !== STEP_DISABLED);
|
|
86
|
+
const stepSize = $derived(normalizeStep(step));
|
|
87
|
+
const isFractional = $derived(
|
|
88
|
+
fractional ?? (!stepEnabled || getMaximumFractionDigits(stepSize) > 0),
|
|
89
|
+
);
|
|
90
|
+
// A plain text box can’t expose the range with `aria-valuemin` and `aria-valuemax`, so it’s
|
|
91
|
+
// described instead, by a hidden element: `aria-description` isn’t supported everywhere
|
|
92
|
+
const rangeDescription = $derived.by(() => {
|
|
93
|
+
const hasMin = typeof min === 'number';
|
|
94
|
+
const hasMax = typeof max === 'number';
|
|
95
|
+
|
|
96
|
+
if (stepEnabled || (!hasMin && !hasMax)) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (hasMin && hasMax) {
|
|
101
|
+
return _('_sui.number_input.range', { values: { min, max } });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return hasMin
|
|
105
|
+
? _('_sui.number_input.min', { values: { min } })
|
|
106
|
+
: _('_sui.number_input.max', { values: { max } });
|
|
107
|
+
});
|
|
108
|
+
const describedBy = $derived(
|
|
109
|
+
[restProps['aria-describedby'], rangeDescription ? `${id}-range` : undefined]
|
|
110
|
+
.filter(Boolean)
|
|
111
|
+
.join(' ') || undefined,
|
|
112
|
+
);
|
|
113
|
+
// Accept the decimal separator of the field’s language, or that of the UI, like `,` in German
|
|
114
|
+
const numberValue = $derived(normalizeNumber(inputValue, restProps.lang ?? locale.current));
|
|
115
|
+
const isMin = $derived(isAtMin(numberValue, min));
|
|
116
|
+
const isMax = $derived(isAtMax(numberValue, max));
|
|
72
117
|
|
|
73
118
|
$effect(() => {
|
|
74
119
|
const newValue = value;
|
|
@@ -76,19 +121,19 @@
|
|
|
76
121
|
// Only overwrite the field when it doesn’t already hold the value, so text that is still being
|
|
77
122
|
// typed, like `1.` or `-`, isn’t wiped out when it parses to the same number or no number
|
|
78
123
|
untrack(() => {
|
|
79
|
-
if (parseNumber(
|
|
124
|
+
if (parseNumber(numberValue) !== newValue) {
|
|
80
125
|
inputValue = String(newValue ?? '');
|
|
81
126
|
}
|
|
82
127
|
});
|
|
83
128
|
});
|
|
84
129
|
|
|
85
130
|
$effect(() => {
|
|
86
|
-
value = parseNumber(
|
|
131
|
+
value = parseNumber(numberValue);
|
|
87
132
|
});
|
|
88
133
|
|
|
89
134
|
$effect(() => {
|
|
90
135
|
if (edited) {
|
|
91
|
-
invalid = isInvalidNumber(
|
|
136
|
+
invalid = isInvalidNumber(numberValue, { required, min, max });
|
|
92
137
|
}
|
|
93
138
|
});
|
|
94
139
|
|
|
@@ -97,7 +142,7 @@
|
|
|
97
142
|
* @param {1 | -1} direction `1` to increase, `-1` to decrease.
|
|
98
143
|
*/
|
|
99
144
|
const stepValue = (direction) => {
|
|
100
|
-
const newInputValue = stepNumber(
|
|
145
|
+
const newInputValue = stepNumber(numberValue, { step: stepSize, direction, min, max });
|
|
101
146
|
|
|
102
147
|
if (newInputValue !== undefined) {
|
|
103
148
|
inputValue = newInputValue;
|
|
@@ -127,46 +172,50 @@
|
|
|
127
172
|
class:readonly
|
|
128
173
|
{hidden}
|
|
129
174
|
>
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
{#
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
{#
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
175
|
+
{#if stepEnabled}
|
|
176
|
+
<div role="none" class="buttons">
|
|
177
|
+
<Button
|
|
178
|
+
iconic
|
|
179
|
+
disabled={disabled || readonly || Number.isNaN(Number(numberValue)) || isMax}
|
|
180
|
+
aria-label={_('_sui.number_input.increase')}
|
|
181
|
+
aria-controls={id}
|
|
182
|
+
onclick={() => {
|
|
183
|
+
increase();
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
{#snippet startIcon()}
|
|
187
|
+
{#if increaseIcon}
|
|
188
|
+
{@render increaseIcon()}
|
|
189
|
+
{:else}
|
|
190
|
+
<Icon name="expand_less" />
|
|
191
|
+
{/if}
|
|
192
|
+
{/snippet}
|
|
193
|
+
</Button>
|
|
194
|
+
<Button
|
|
195
|
+
iconic
|
|
196
|
+
disabled={disabled || readonly || Number.isNaN(Number(numberValue)) || isMin}
|
|
197
|
+
aria-label={_('_sui.number_input.decrease')}
|
|
198
|
+
aria-controls={id}
|
|
199
|
+
onclick={() => {
|
|
200
|
+
decrease();
|
|
201
|
+
}}
|
|
202
|
+
>
|
|
203
|
+
{#snippet startIcon()}
|
|
204
|
+
{#if decreaseIcon}
|
|
205
|
+
{@render decreaseIcon()}
|
|
206
|
+
{:else}
|
|
207
|
+
<Icon name="expand_more" />
|
|
208
|
+
{/if}
|
|
209
|
+
{/snippet}
|
|
210
|
+
</Button>
|
|
211
|
+
</div>
|
|
212
|
+
{:else if rangeDescription}
|
|
213
|
+
<span id="{id}-range" hidden>{rangeDescription}</span>
|
|
214
|
+
{/if}
|
|
166
215
|
<TextInput
|
|
167
216
|
dir="ltr"
|
|
168
217
|
{...restProps}
|
|
169
|
-
role=
|
|
218
|
+
role={stepEnabled ? 'spinbutton' : 'textbox'}
|
|
170
219
|
{id}
|
|
171
220
|
bind:value={inputValue}
|
|
172
221
|
spellcheck="false"
|
|
@@ -176,15 +225,16 @@
|
|
|
176
225
|
{readonly}
|
|
177
226
|
{required}
|
|
178
227
|
{invalid}
|
|
179
|
-
aria-valuenow={Number.isFinite(value) ? value : undefined}
|
|
180
|
-
aria-valuemin={min}
|
|
181
|
-
aria-valuemax={max}
|
|
182
|
-
inputmode={
|
|
228
|
+
aria-valuenow={stepEnabled && Number.isFinite(value) ? value : undefined}
|
|
229
|
+
aria-valuemin={stepEnabled ? min : undefined}
|
|
230
|
+
aria-valuemax={stepEnabled ? max : undefined}
|
|
231
|
+
inputmode={inputmode ?? getInputMode({ fractional: isFractional, min })}
|
|
232
|
+
aria-describedby={describedBy}
|
|
183
233
|
onkeydown={(event) => {
|
|
184
234
|
const { key, ctrlKey, metaKey, altKey, shiftKey } = event;
|
|
185
235
|
const hasModifier = shiftKey || altKey || ctrlKey || metaKey;
|
|
186
236
|
// A read-only field can’t be stepped, just like the spin buttons
|
|
187
|
-
const canStep = !disabled && !readonly && !hasModifier;
|
|
237
|
+
const canStep = stepEnabled && !disabled && !readonly && !hasModifier;
|
|
188
238
|
|
|
189
239
|
if (key === 'ArrowDown' && canStep) {
|
|
190
240
|
event.preventDefault();
|
|
@@ -232,7 +282,7 @@
|
|
|
232
282
|
.number-input:not(.disabled) :global(button[aria-disabled='true']) :global(*) {
|
|
233
283
|
filter: grayscale(1) opacity(var(--sui-disabled-opacity, 0.35));
|
|
234
284
|
}
|
|
235
|
-
.number-input :global(:
|
|
285
|
+
.number-input :global(.buttons) + :global(*) :global(input) {
|
|
236
286
|
border-start-start-radius: 0;
|
|
237
287
|
border-end-start-radius: 0;
|
|
238
288
|
}
|
|
@@ -23,9 +23,23 @@ declare const NumberInput: import("svelte").Component<TextInputProps & import(".
|
|
|
23
23
|
max?: number | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* Value to be added or removed when using the up/down arrow key or
|
|
26
|
-
* button.
|
|
26
|
+
* button. Set to `-1` to hide the buttons and disable stepping with the arrow keys, for a number
|
|
27
|
+
* that isn’t meant to be stepped, like an ID. Any other value that isn’t a positive number falls
|
|
28
|
+
* back to `1`.
|
|
27
29
|
*/
|
|
28
30
|
step?: number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the number can have a fraction, which brings up the
|
|
33
|
+
* decimal keypad rather than the numeric one on mobile. If omitted, it’s inferred from `step`:
|
|
34
|
+
* `true` for a fractional step or with stepping turned off, `false` for an integer step.
|
|
35
|
+
*/
|
|
36
|
+
fractional?: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The `inputmode` attribute on the
|
|
39
|
+
* `<input>`. If omitted, it’s `text` if a negative number is allowed, as the numeric and decimal
|
|
40
|
+
* keypads on iOS have no minus key, otherwise `decimal` or `numeric` depending on `fractional`.
|
|
41
|
+
*/
|
|
42
|
+
inputmode?: "text" | "decimal" | "numeric" | undefined;
|
|
29
43
|
/**
|
|
30
44
|
* Increase icon slot content.
|
|
31
45
|
*/
|
|
@@ -50,9 +64,23 @@ type Props = {
|
|
|
50
64
|
max?: number | undefined;
|
|
51
65
|
/**
|
|
52
66
|
* Value to be added or removed when using the up/down arrow key or
|
|
53
|
-
* button.
|
|
67
|
+
* button. Set to `-1` to hide the buttons and disable stepping with the arrow keys, for a number
|
|
68
|
+
* that isn’t meant to be stepped, like an ID. Any other value that isn’t a positive number falls
|
|
69
|
+
* back to `1`.
|
|
54
70
|
*/
|
|
55
71
|
step?: number | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the number can have a fraction, which brings up the
|
|
74
|
+
* decimal keypad rather than the numeric one on mobile. If omitted, it’s inferred from `step`:
|
|
75
|
+
* `true` for a fractional step or with stepping turned off, `false` for an integer step.
|
|
76
|
+
*/
|
|
77
|
+
fractional?: boolean | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The `inputmode` attribute on the
|
|
80
|
+
* `<input>`. If omitted, it’s `text` if a negative number is allowed, as the numeric and decimal
|
|
81
|
+
* keypads on iOS have no minus key, otherwise `decimal` or `numeric` depending on `fractional`.
|
|
82
|
+
*/
|
|
83
|
+
inputmode?: "text" | "decimal" | "numeric" | undefined;
|
|
56
84
|
/**
|
|
57
85
|
* Increase icon slot content.
|
|
58
86
|
*/
|
package/dist/locales/ar.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: زيادة
|
|
76
76
|
decrease: نقصان
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: من {$min} إلى {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: الحد الأدنى {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: الحد الأقصى {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/bg.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Увеличаване
|
|
76
76
|
decrease: Намаляване
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: От {$min} до {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Минимум {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Максимум {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/ca.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Augmenta
|
|
76
76
|
decrease: Redueix
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: De {$min} a {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Mínim {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Màxim {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/cs.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Zvýšit
|
|
76
76
|
decrease: Snížit
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: Od {$min} do {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maximum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/da.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Forøg
|
|
76
76
|
decrease: Formindsk
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: Fra {$min} til {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maksimum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/de.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Erhöhen
|
|
76
76
|
decrease: Verringern
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: Von {$min} bis {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maximum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/el.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Αύξηση
|
|
76
76
|
decrease: Μείωση
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: Από {$min} έως {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Ελάχιστο {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Μέγιστο {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/en-CA.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Increase
|
|
76
76
|
decrease: Decrease
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: From {$min} to {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maximum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/en-GB.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Increase
|
|
76
76
|
decrease: Decrease
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: From {$min} to {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maximum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/en-US.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Increase
|
|
76
76
|
decrease: Decrease
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: From {$min} to {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maximum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/es-CO.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Aumentar
|
|
76
76
|
decrease: Disminuir
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: De {$min} a {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Mínimo {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Máximo {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/fa.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: افزایش
|
|
76
76
|
decrease: کاهش
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: از {$min} تا {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: حداقل {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: حداکثر {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/fi.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Lisää
|
|
76
76
|
decrease: Vähennä
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: Välillä {$min}–{$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Vähintään {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Enintään {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/fr.yaml
CHANGED
|
@@ -74,6 +74,12 @@ number_input:
|
|
|
74
74
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
75
75
|
increase: Augmenter
|
|
76
76
|
decrease: Diminuer
|
|
77
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
78
|
+
range: De {$min} à {$max}
|
|
79
|
+
# Description of the minimum value when the number can’t be stepped
|
|
80
|
+
min: Minimum {$min}
|
|
81
|
+
# Description of the maximum value when the number can’t be stepped
|
|
82
|
+
max: Maximum {$max}
|
|
77
83
|
|
|
78
84
|
# Password input component
|
|
79
85
|
password_input:
|
package/dist/locales/he.yaml
CHANGED
|
@@ -79,6 +79,12 @@ number_input:
|
|
|
79
79
|
# Spin button aria-labels for incrementing/decrementing the number value
|
|
80
80
|
increase: הגדלה
|
|
81
81
|
decrease: הקטנה
|
|
82
|
+
# Description of the allowed range when the number can’t be stepped, e.g. “From 1 to 10”
|
|
83
|
+
range: מ־{$min} עד {$max}
|
|
84
|
+
# Description of the minimum value when the number can’t be stepped
|
|
85
|
+
min: מינימום {$min}
|
|
86
|
+
# Description of the maximum value when the number can’t be stepped
|
|
87
|
+
max: מקסימום {$max}
|
|
82
88
|
|
|
83
89
|
# Password input component
|
|
84
90
|
password_input:
|