@eifi1/ui-kit 0.21.0 → 0.23.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 +42 -25
- package/dist/chart.d.ts +19 -14
- package/dist/components/account-chips.d.ts +10 -3
- package/dist/components/account-chips.js +5 -2
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/account-settings.d.ts +33 -2
- package/dist/components/account-settings.js +43 -21
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/amount-input.d.ts +53 -14
- package/dist/components/amount-input.js +17 -28
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.d.ts +29 -0
- package/dist/components/autocomplete.js +134 -104
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/button-group.d.ts +19 -14
- package/dist/components/calculator.d.ts +19 -14
- package/dist/components/checkbox-group.d.ts +104 -0
- package/dist/components/checkbox-group.js +111 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.d.ts +19 -0
- package/dist/components/checkbox.js +30 -7
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip.d.ts +18 -0
- package/dist/components/chip.js +47 -10
- package/dist/components/chip.js.map +1 -1
- package/dist/components/column-mapper.d.ts +182 -0
- package/dist/components/column-mapper.js +375 -0
- package/dist/components/column-mapper.js.map +1 -0
- package/dist/components/combobox-core.d.ts +39 -2
- package/dist/components/combobox-core.js +29 -6
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +91 -2
- package/dist/components/combobox.js +454 -308
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +69 -161
- package/dist/components/confirm-dialog.js +7 -8
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button.d.ts +16 -11
- package/dist/components/country-select.d.ts +167 -0
- package/dist/components/country-select.js +293 -0
- package/dist/components/country-select.js.map +1 -0
- package/dist/components/currency-select.d.ts +17 -1
- package/dist/components/currency-select.js +56 -23
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +69 -166
- package/dist/components/danger-confirm.js +144 -50
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +1 -2
- package/dist/components/data-table-filter-popover.d.ts +1 -2
- package/dist/components/data-table-filters.d.ts +1 -2
- package/dist/components/data-table-labels.d.ts +4 -97
- package/dist/components/data-table-labels.js +9 -1
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -1
- package/dist/components/data-table.d.ts +1 -2
- package/dist/components/data-table.js +98 -3
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +66 -5
- package/dist/components/date-picker.js +378 -66
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +42 -1
- package/dist/components/entity-combobox.js +154 -113
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/facing-pair.d.ts +19 -14
- package/dist/components/field-parts.d.ts +224 -0
- package/dist/components/field-parts.js +156 -0
- package/dist/components/field-parts.js.map +1 -0
- package/dist/components/field-strip.d.ts +105 -0
- package/dist/components/field-strip.js +46 -0
- package/dist/components/field-strip.js.map +1 -0
- package/dist/components/file-button.d.ts +19 -14
- package/dist/components/file-button.js +13 -3
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +41 -15
- package/dist/components/file-dropzone.js +57 -34
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/form-actions.d.ts +18 -13
- package/dist/components/form-actions.js +69 -5
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/iban-input.d.ts +69 -0
- package/dist/components/iban-input.js +125 -0
- package/dist/components/iban-input.js.map +1 -0
- package/dist/components/icon-picker.d.ts +21 -2
- package/dist/components/icon-picker.js +19 -4
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-edit-field.d.ts +167 -0
- package/dist/components/inline-edit-field.js +293 -0
- package/dist/components/inline-edit-field.js.map +1 -0
- package/dist/components/language-select.d.ts +130 -0
- package/dist/components/language-select.js +18 -0
- package/dist/components/language-select.js.map +1 -0
- package/dist/components/line-items.d.ts +25 -3
- package/dist/components/line-items.js +55 -46
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +25 -0
- package/dist/components/list.js +16 -5
- package/dist/components/list.js.map +1 -1
- package/dist/components/money-field.d.ts +32 -14
- package/dist/components/money-field.js.map +1 -1
- package/dist/components/month-picker.d.ts +52 -4
- package/dist/components/month-picker.js +291 -86
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +26 -1
- package/dist/components/multi-entity-combobox.js +143 -102
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +8 -1
- package/dist/components/multi-select.js +9 -4
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-field.d.ts +34 -19
- package/dist/components/number-field.js +6 -20
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +79 -19
- package/dist/components/number-input.js +90 -38
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +19 -14
- package/dist/components/one-time-code-input.d.ts +100 -0
- package/dist/components/one-time-code-input.js +137 -0
- package/dist/components/one-time-code-input.js.map +1 -0
- package/dist/components/phone-input.d.ts +69 -0
- package/dist/components/phone-input.js +171 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/reauth-dialog.d.ts +2 -2
- package/dist/components/reauth-dialog.js +6 -8
- package/dist/components/reauth-dialog.js.map +1 -1
- package/dist/components/series-chart.d.ts +19 -14
- package/dist/components/settings-fields.d.ts +19 -14
- package/dist/components/share-card.d.ts +16 -11
- package/dist/components/sign-chip.d.ts +66 -0
- package/dist/components/sign-chip.js +39 -0
- package/dist/components/sign-chip.js.map +1 -0
- package/dist/components/swatch-picker.d.ts +43 -2
- package/dist/components/swatch-picker.js +80 -32
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/switch.d.ts +19 -0
- package/dist/components/switch.js +24 -6
- package/dist/components/switch.js.map +1 -1
- package/dist/components/text-link.d.ts +18 -13
- package/dist/components/tile-radio.d.ts +88 -13
- package/dist/components/tile-radio.js +28 -11
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +24 -15
- package/dist/components/time-input.js.map +1 -1
- package/dist/components/toggle-group.d.ts +47 -1
- package/dist/components/toggle-group.js +110 -69
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/trigger-aria.d.ts +3 -0
- package/dist/components/trigger-aria.js +3 -1
- package/dist/components/trigger-aria.js.map +1 -1
- package/dist/components/ui.d.ts +16 -11
- package/dist/components/ui.js +284 -88
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -2
- package/dist/{data-table-3mi2R3so.d.ts → data-table-labels-B7OdnM0S.d.ts} +140 -3
- package/dist/data-table.d.ts +1 -2
- package/dist/data-table.js +2 -1
- package/dist/data-table.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +1 -1
- package/dist/feedback/feedback-attachment.js +348 -41
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.d.ts +1 -1
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +3 -2
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +68 -253
- package/dist/feedback/feedback-thread.js +46 -10
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/{kit-labels-D1J2_jyD.d.ts → feedback-BxeQVzwq.d.ts} +1206 -20
- package/dist/{feedback-attachment-WFiXJ8We.d.ts → feedback-attachment-fGAzZPf0.d.ts} +178 -11
- package/dist/feedback.d.ts +66 -2
- package/dist/hooks/use-file-drop.d.ts +19 -14
- package/dist/i18n/defaults.d.ts +19 -14
- package/dist/i18n/defaults.js +19 -2
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +19 -14
- package/dist/i18n/german.js +84 -5
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +15 -10
- package/dist/i18n/kit-labels.js +8 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +19 -14
- package/dist/i18n/locales/de-CH.d.ts +19 -14
- package/dist/i18n/locales/en.d.ts +19 -14
- package/dist/i18n/locales/en.js +16 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +19 -14
- package/dist/i18n/locales/es.js +83 -5
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +19 -14
- package/dist/i18n/locales/fr.js +82 -5
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +19 -14
- package/dist/i18n/locales/hu.js +85 -5
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +19 -14
- package/dist/i18n/locales/it.js +84 -5
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +19 -14
- package/dist/i18n/locales/zh.js +80 -5
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +19 -14
- package/dist/i18n/review.js +27 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +21 -10
- package/dist/index.js +73 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/column-mapping.d.ts +81 -0
- package/dist/lib/column-mapping.js +108 -0
- package/dist/lib/column-mapping.js.map +1 -0
- package/dist/lib/countries.d.ts +43 -0
- package/dist/lib/countries.js +39 -0
- package/dist/lib/countries.js.map +1 -0
- package/dist/lib/decimal-marks.d.ts +46 -0
- package/dist/lib/decimal-marks.js +40 -0
- package/dist/lib/decimal-marks.js.map +1 -0
- package/dist/lib/iban.d.ts +98 -0
- package/dist/lib/iban.js +154 -0
- package/dist/lib/iban.js.map +1 -0
- package/dist/lib/isin.d.ts +30 -0
- package/dist/lib/isin.js +36 -0
- package/dist/lib/isin.js.map +1 -0
- package/dist/lib/phone.d.ts +69 -0
- package/dist/lib/phone.js +121 -0
- package/dist/lib/phone.js.map +1 -0
- package/dist/lib/table-text.d.ts +109 -1
- package/dist/lib/table-text.js +122 -1
- package/dist/lib/table-text.js.map +1 -1
- package/dist/rhf/fields.d.ts +233 -18
- package/dist/rhf/fields.js +456 -3
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form.d.ts +19 -14
- package/dist/rhf.d.ts +22 -15
- package/dist/rhf.js.map +1 -1
- package/dist/shell/app-shell.d.ts +18 -13
- package/dist/shell/top-bar-brand.d.ts +19 -14
- package/dist/shell/topbar-action-menu.d.ts +36 -3
- package/dist/shell/topbar-action-menu.js +74 -33
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell.d.ts +18 -13
- package/dist/table-text.d.ts +1 -1
- package/dist/tour/tour.js +20 -24
- package/dist/tour/tour.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +49 -16
- package/dist/wizard/stepper-nav.js +4 -0
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard.d.ts +19 -14
- package/package.json +1 -1
- package/src/components/account-chips.tsx +17 -3
- package/src/components/account-settings.tsx +92 -26
- package/src/components/amount-input.tsx +68 -56
- package/src/components/autocomplete.tsx +198 -114
- package/src/components/checkbox-group.tsx +229 -0
- package/src/components/checkbox.tsx +72 -8
- package/src/components/chip.tsx +80 -10
- package/src/components/column-mapper.tsx +666 -0
- package/src/components/combobox-core.tsx +82 -9
- package/src/components/combobox.tsx +661 -340
- package/src/components/confirm-dialog.tsx +12 -8
- package/src/components/country-select.tsx +556 -0
- package/src/components/currency-select.tsx +109 -33
- package/src/components/danger-confirm.tsx +429 -82
- package/src/components/data-table-labels.ts +16 -1
- package/src/components/data-table.tsx +175 -6
- package/src/components/date-picker.tsx +595 -71
- package/src/components/entity-combobox.tsx +235 -124
- package/src/components/field-parts.tsx +403 -0
- package/src/components/field-strip.tsx +149 -0
- package/src/components/file-button.tsx +36 -3
- package/src/components/file-dropzone.tsx +106 -38
- package/src/components/form-actions.tsx +147 -6
- package/src/components/iban-input.tsx +231 -0
- package/src/components/icon-picker.tsx +47 -6
- package/src/components/inline-edit-field.tsx +533 -0
- package/src/components/language-select.tsx +78 -0
- package/src/components/line-items.tsx +35 -2
- package/src/components/list.tsx +55 -6
- package/src/components/money-field.tsx +13 -0
- package/src/components/month-picker.tsx +400 -63
- package/src/components/multi-entity-combobox.tsx +207 -120
- package/src/components/multi-select.tsx +80 -58
- package/src/components/number-field.tsx +28 -46
- package/src/components/number-input.tsx +210 -43
- package/src/components/one-time-code-input.tsx +288 -0
- package/src/components/phone-input.tsx +299 -0
- package/src/components/reauth-dialog.tsx +17 -18
- package/src/components/sign-chip.tsx +103 -0
- package/src/components/swatch-picker.tsx +143 -31
- package/src/components/switch.tsx +58 -7
- package/src/components/tile-radio.tsx +145 -29
- package/src/components/time-input.tsx +8 -1
- package/src/components/toggle-group.tsx +206 -73
- package/src/components/trigger-aria.ts +5 -0
- package/src/components/ui.tsx +479 -138
- package/src/data-table.ts +2 -1
- package/src/feedback/feedback-attachment.tsx +597 -46
- package/src/feedback/feedback-dialog.tsx +9 -3
- package/src/feedback/feedback-inbox.tsx +3 -2
- package/src/feedback/feedback-thread.tsx +113 -9
- package/src/i18n/defaults.ts +18 -1
- package/src/i18n/german.ts +89 -0
- package/src/i18n/kit-labels.tsx +82 -2
- package/src/i18n/locales/en.ts +36 -4
- package/src/i18n/locales/es.ts +87 -0
- package/src/i18n/locales/fr.ts +87 -0
- package/src/i18n/locales/hu.ts +83 -0
- package/src/i18n/locales/it.ts +88 -0
- package/src/i18n/locales/zh.ts +76 -0
- package/src/i18n/review.ts +26 -0
- package/src/index.ts +71 -3
- package/src/lib/column-mapping.ts +234 -0
- package/src/lib/countries.ts +91 -0
- package/src/lib/decimal-marks.ts +99 -0
- package/src/lib/iban.ts +171 -0
- package/src/lib/isin.ts +62 -0
- package/src/lib/phone.ts +211 -0
- package/src/lib/table-text.ts +271 -0
- package/src/rhf/fields.tsx +860 -9
- package/src/rhf.ts +3 -1
- package/src/shell/topbar-action-menu.tsx +134 -38
- package/src/tour/tour.tsx +66 -28
- package/src/wizard/stepper-nav.tsx +35 -1
|
@@ -2,17 +2,21 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { CalculatorButtonLabels } from './calculator.js';
|
|
4
4
|
import { NumberPadSheetLabels } from './numpad-sheet.js';
|
|
5
|
-
import '../
|
|
6
|
-
import '
|
|
5
|
+
import '../feedback-BxeQVzwq.js';
|
|
6
|
+
import '../feedback-attachment-fGAzZPf0.js';
|
|
7
|
+
import '../feedback/feedback-inbox.js';
|
|
8
|
+
import 'lucide-react';
|
|
9
|
+
import './tooltip.js';
|
|
10
|
+
import '../hooks/use-anchored-rect.js';
|
|
11
|
+
import '../lib/clipping.js';
|
|
12
|
+
import '../data-table-labels-B7OdnM0S.js';
|
|
13
|
+
import './data-table-sort.js';
|
|
14
|
+
import './swipeable-row.js';
|
|
7
15
|
import './mini-calendar.js';
|
|
8
16
|
import './calendar-heatmap.js';
|
|
9
17
|
import './popover.js';
|
|
10
18
|
import './chip.js';
|
|
11
|
-
import 'lucide-react';
|
|
12
19
|
import './field-sync.js';
|
|
13
|
-
import './tooltip.js';
|
|
14
|
-
import '../hooks/use-anchored-rect.js';
|
|
15
|
-
import '../lib/clipping.js';
|
|
16
20
|
import '../wizard/types.js';
|
|
17
21
|
import '../tour/tour.js';
|
|
18
22
|
import '../search/command-palette.js';
|
|
@@ -26,7 +30,6 @@ import './sparkline.js';
|
|
|
26
30
|
import './stat-tile.js';
|
|
27
31
|
import './signature-pad.js';
|
|
28
32
|
import './password-strength.js';
|
|
29
|
-
import './danger-confirm.js';
|
|
30
33
|
import './swatch-picker.js';
|
|
31
34
|
import './tile-radio.js';
|
|
32
35
|
import './icon-picker.js';
|
|
@@ -34,11 +37,7 @@ import './dialog-frame.js';
|
|
|
34
37
|
import './modal.js';
|
|
35
38
|
import '../hooks/use-search-param-state.js';
|
|
36
39
|
import './measured-grid.js';
|
|
37
|
-
import '../feedback-attachment-WFiXJ8We.js';
|
|
38
|
-
import '../feedback/feedback-thread.js';
|
|
39
|
-
import '../feedback/feedback-inbox.js';
|
|
40
40
|
import './account-settings-labels.js';
|
|
41
|
-
import './confirm-dialog.js';
|
|
42
41
|
import './floating-panel.js';
|
|
43
42
|
import './bulk-action-bar.js';
|
|
44
43
|
import './list.js';
|
|
@@ -57,19 +56,30 @@ import './write-lock.js';
|
|
|
57
56
|
import './legal.js';
|
|
58
57
|
import './account-chips.js';
|
|
59
58
|
import '../lib/format.js';
|
|
60
|
-
import '../data-table-3mi2R3so.js';
|
|
61
|
-
import './data-table-sort.js';
|
|
62
|
-
import './swipeable-row.js';
|
|
63
59
|
import './reauth-dialog.js';
|
|
64
60
|
import './server-wake.js';
|
|
65
61
|
import '../lib/server-wake.js';
|
|
66
62
|
import './translation-review-labels.js';
|
|
67
63
|
import '../lib/translation-review.js';
|
|
64
|
+
import './country-select.js';
|
|
65
|
+
import './inline-edit-field.js';
|
|
66
|
+
import '../lib/iban.js';
|
|
67
|
+
import '../lib/phone.js';
|
|
68
|
+
import './sign-chip.js';
|
|
69
|
+
import './column-mapper.js';
|
|
70
|
+
import '../lib/column-mapping.js';
|
|
71
|
+
import '../lib/table-text.js';
|
|
72
|
+
import './field-parts.js';
|
|
68
73
|
|
|
69
74
|
interface NumberInputProps {
|
|
75
|
+
/** The text, DOT-decimal ("1234.5", or a calculation being typed: "12+5"), as
|
|
76
|
+
* `onChange` reports it — so a caller's `Number(value)` reads it. The field SHOWS it
|
|
77
|
+
* in the locale's mark (see `locale`). A comma here is read as the decimal mark too,
|
|
78
|
+
* never as grouping. */
|
|
70
79
|
value: string;
|
|
71
|
-
/** Fired on every keystroke with the
|
|
72
|
-
* a
|
|
80
|
+
/** Fired on every keystroke with the text as a number reads it: grouping marks read
|
|
81
|
+
* off ("1.234,56" → "1234.56" for a German typist, keksdose K5), the decimal mark
|
|
82
|
+
* folded to a dot, operators kept so a typed expression survives. */
|
|
73
83
|
onChange: (value: string) => void;
|
|
74
84
|
/** Fired on blur/Enter with the *evaluated* value — use this for save-on-blur
|
|
75
85
|
* fields so the save always sees the resolved number, never "10+5". */
|
|
@@ -119,6 +129,29 @@ interface NumberInputProps {
|
|
|
119
129
|
hint?: ReactNode;
|
|
120
130
|
/** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */
|
|
121
131
|
invalid?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* What is wrong with the value, in the caller's own words — {@link Input}'s `error`,
|
|
134
|
+
* the same anatomy (keksdose K5/K4: of the kit's fields only `Input` and
|
|
135
|
+
* `NumberField` had one, so a goal target or a rate field wrote its message as a
|
|
136
|
+
* loose `<p>` that nothing pointed at). Rendered under the field, after a text
|
|
137
|
+
* `hint`; merged into `aria-describedby` after the caller's ids and the hint's; and
|
|
138
|
+
* it implies `invalid`, so the field paints as well as announces. `null`, `false`
|
|
139
|
+
* and `""` — a `touched && errors.x` on the happy path — are no message.
|
|
140
|
+
*
|
|
141
|
+
* Passing the key at all (even `undefined`) keeps the field in a steady wrapper,
|
|
142
|
+
* message or not, so the message coming and going never remounts the `<input>` and
|
|
143
|
+
* takes the caret with it — see `Input`'s `FieldGroup`. A field that never passes
|
|
144
|
+
* `error` renders exactly the DOM it did before the prop existed.
|
|
145
|
+
*/
|
|
146
|
+
error?: ReactNode;
|
|
147
|
+
/**
|
|
148
|
+
* BCP 47 tag that decides the decimal mark the field SHOWS; default the
|
|
149
|
+
* `<UiKitProvider locale>`, else the runtime's (keksdose K5). A French or Italian
|
|
150
|
+
* reader sees "3,5", a German one too, de-CH and en-US see "3.5" — `Intl`
|
|
151
|
+
* decides, not a guess about a country. Display only: `value` and `onChange` stay
|
|
152
|
+
* dot-decimal. {@link NumberField} passes its own `locale` through here.
|
|
153
|
+
*/
|
|
154
|
+
locale?: string;
|
|
122
155
|
/**
|
|
123
156
|
* Set on the `<input>`, with `id` above. Declared so `Field`'s render-prop spread —
|
|
124
157
|
* `{(ids) => <NumberInput {...ids} … />}` — is typed and reaches the input: the hint
|
|
@@ -175,9 +208,36 @@ declare function stepNumber(current: number | null, count: number, step: number,
|
|
|
175
208
|
* A numeric text field with a built-in calculator: type a calculation straight
|
|
176
209
|
* in (e.g. "12+5", evaluated on blur/Enter) or click the trailing calculator
|
|
177
210
|
* icon for a keypad. String `value`/`onChange` contract, mirroring
|
|
178
|
-
* {@link AmountInput} — the currency-free counterpart for
|
|
179
|
-
*
|
|
211
|
+
* {@link AmountInput} — the currency-free counterpart for quantities, rates,
|
|
212
|
+
* percentages and measurements.
|
|
213
|
+
*
|
|
214
|
+
* NOT FOR MONEY. This field never rounds: "12.345", or a calculator's "100/3", is
|
|
215
|
+
* reported exactly as typed. kastlan's journal lines, a payment allocation and a
|
|
216
|
+
* defect's estimated cost were NumberInputs, and a 3-decimal amount reached a
|
|
217
|
+
* 2-decimal Money column and failed the save with a 422 — in one wizard after the
|
|
218
|
+
* record before it had already been created (kastlan 5). Money goes in
|
|
219
|
+
* {@link AmountInput} (string value, like this one) or {@link MoneyField} (number
|
|
220
|
+
* value): both settle to the currency's minor unit on blur, Enter and every calculator
|
|
221
|
+
* result, and take `digits` for a unit price at a finer scale. In development a
|
|
222
|
+
* NumberInput that looks like money — a currency as its unit, or a currency in the
|
|
223
|
+
* label of a field with no unit — says so on the console, once per field. A unit of
|
|
224
|
+
* measure ("mm", "N·m", "%") keeps it quiet, as does any number of decimals.
|
|
225
|
+
*
|
|
226
|
+
* THE LOCALE'S MARK (keksdose K5). The field shows the `locale`'s decimal mark — "3,5"
|
|
227
|
+
* to a French, Italian or German reader — and reads what is typed the way
|
|
228
|
+
* {@link AmountInput} does (keksdose G1): "1.234,56" from a German typist is 1234.56,
|
|
229
|
+
* "1,234.56" from an English one too, and a lone mark that cannot be grouping is the
|
|
230
|
+
* decimal, whichever key typed it. Before, it always showed "3.5" and folded
|
|
231
|
+
* "1.234,56" into 1.23456. `value` and `onChange` stay dot-decimal, which is the
|
|
232
|
+
* contract every caller's `Number(value)` reads.
|
|
233
|
+
*
|
|
234
|
+
* While a figure is being typed the field shows the typist's OWN text — "1.234,5"
|
|
235
|
+
* stays exactly that — rather than the value re-spelt: re-spelling turned a grouping
|
|
236
|
+
* "." into a "," under their fingers, after which no rule could tell the two apart, and
|
|
237
|
+
* a text that changes length under the caret moves it to the end. It is re-spelt in the
|
|
238
|
+
* locale's mark, without grouping, once the figure settles (blur, Enter, a step or a
|
|
239
|
+
* calculator result) or when the value changes from outside.
|
|
180
240
|
*/
|
|
181
|
-
declare function NumberInput(
|
|
241
|
+
declare function NumberInput(props: NumberInputProps): react.JSX.Element;
|
|
182
242
|
|
|
183
243
|
export { NumberInput, stepNumber };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { CalculatorButton } from "./calculator.js";
|
|
5
5
|
import { NumberPadSheet } from "./numpad-sheet.js";
|
|
6
6
|
import { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FloatingField, PHONE_QUERY } from "./ui.js";
|
|
7
|
+
import { CURRENCIES } from "./currency-select.js";
|
|
8
|
+
import { hasMessage, mergeDescribedBy } from "./choice-parts.js";
|
|
7
9
|
import { cn } from "../lib/cn.js";
|
|
8
|
-
import { commitExpression, formatResult
|
|
10
|
+
import { commitExpression, formatResult } from "../lib/calc.js";
|
|
11
|
+
import { decimalMark, localizeMark, readTyped, showsTyped } from "../lib/decimal-marks.js";
|
|
9
12
|
import { useMediaQuery } from "../hooks/use-media-query.js";
|
|
13
|
+
import { useKitLocale } from "../i18n/kit-labels.js";
|
|
10
14
|
function decimalsOf(n) {
|
|
11
15
|
const text = formatResult(n);
|
|
12
16
|
const dot = text.indexOf(".");
|
|
@@ -23,37 +27,58 @@ function stepNumber(current, count, step, min, max) {
|
|
|
23
27
|
const places = Math.min(Math.max(decimalsOf(step), decimalsOf(origin)), 20);
|
|
24
28
|
return clamp(Number((origin + k * step).toFixed(places)));
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
const FIELD_ERROR_CLASS = "mt-1 text-[11px] leading-tight text-[var(--danger)]";
|
|
31
|
+
const CURRENCY_CODE = new RegExp(`(?:^|[^A-Za-z])(?:${CURRENCIES.map((c) => c.code).join("|")})(?![A-Za-z])`);
|
|
32
|
+
const CURRENCY_SYMBOL = /[€$£¥₹₺₽₪₩₫฿₴₦₱]/;
|
|
33
|
+
function namesMoney(node) {
|
|
34
|
+
if (typeof node !== "string" && typeof node !== "number") return false;
|
|
35
|
+
const text = String(node);
|
|
36
|
+
return (CURRENCY_CODE.test(text) || CURRENCY_SYMBOL.test(text)) && !text.includes("/") && !text.includes("%");
|
|
37
|
+
}
|
|
38
|
+
function looksLikeMoney(suffix, texts) {
|
|
39
|
+
if (suffix !== void 0 && suffix !== null && suffix !== "") return namesMoney(suffix);
|
|
40
|
+
return texts.some(namesMoney);
|
|
41
|
+
}
|
|
42
|
+
function devWarnings() {
|
|
43
|
+
return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;
|
|
44
|
+
}
|
|
45
|
+
function NumberInput(props) {
|
|
46
|
+
const {
|
|
47
|
+
value,
|
|
48
|
+
onChange,
|
|
49
|
+
onCommit,
|
|
50
|
+
label,
|
|
51
|
+
ariaLabel,
|
|
52
|
+
labels,
|
|
53
|
+
placeholder,
|
|
54
|
+
disabled,
|
|
55
|
+
autoFocus,
|
|
56
|
+
className,
|
|
57
|
+
inputClassName,
|
|
58
|
+
id,
|
|
59
|
+
calculator = true,
|
|
60
|
+
variant = "field",
|
|
61
|
+
hint,
|
|
62
|
+
invalid: invalidProp,
|
|
63
|
+
error,
|
|
64
|
+
locale: localeProp,
|
|
65
|
+
"aria-describedby": ariaDescribedBy,
|
|
66
|
+
"aria-invalid": ariaInvalid,
|
|
67
|
+
"aria-required": ariaRequired,
|
|
68
|
+
suffix,
|
|
69
|
+
step,
|
|
70
|
+
min,
|
|
71
|
+
max
|
|
72
|
+
} = props;
|
|
51
73
|
const generatedId = useId();
|
|
52
74
|
const fieldId = id ?? generatedId;
|
|
53
75
|
const hintId = useId();
|
|
76
|
+
const errorId = useId();
|
|
54
77
|
const textHint = typeof hint === "string" && hint !== "" || typeof hint === "number";
|
|
55
|
-
const
|
|
56
|
-
const
|
|
78
|
+
const hasError = hasMessage(error);
|
|
79
|
+
const reserve = "error" in props || "hint" in props;
|
|
80
|
+
const describedBy = mergeDescribedBy(ariaDescribedBy, textHint && hintId, hasError && errorId);
|
|
81
|
+
const invalid = Boolean(invalidProp) || hasError || ariaInvalid === true || ariaInvalid === "true";
|
|
57
82
|
const labelled = label !== void 0;
|
|
58
83
|
const isMobile = useMediaQuery(PHONE_QUERY, false);
|
|
59
84
|
const asDisplay = isMobile && variant === "display";
|
|
@@ -76,12 +101,36 @@ function NumberInput({
|
|
|
76
101
|
}, [hasEnd]);
|
|
77
102
|
const showNumpad = isMobile && !disabled && focused;
|
|
78
103
|
const inputRef = useRef(null);
|
|
104
|
+
const mark = decimalMark(useKitLocale(localeProp));
|
|
105
|
+
const [draft, setDraft] = useState(null);
|
|
106
|
+
const derived = localizeMark(value, mark);
|
|
107
|
+
const display = draft !== null && showsTyped(draft, mark, value) ? draft : derived;
|
|
108
|
+
const typed = (raw) => {
|
|
109
|
+
setDraft(raw);
|
|
110
|
+
onChange(readTyped(raw, mark));
|
|
111
|
+
};
|
|
112
|
+
const result = (next) => {
|
|
113
|
+
setDraft(null);
|
|
114
|
+
onChange(next);
|
|
115
|
+
};
|
|
116
|
+
const warnedMoney = useRef(false);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (warnedMoney.current || !devWarnings()) return;
|
|
119
|
+
if (!looksLikeMoney(suffix, [label, ariaLabel, placeholder])) return;
|
|
120
|
+
warnedMoney.current = true;
|
|
121
|
+
const name = [label, ariaLabel, suffix].find((t) => typeof t === "string" || typeof t === "number");
|
|
122
|
+
console.warn(
|
|
123
|
+
`[ui-kit] NumberInput${name === void 0 ? "" : ` "${String(name)}"`} looks like a money field: a currency, and no unit. NumberInput never rounds, so "12.345" or a calculator's "100/3" is sent with three or more decimals (kastlan 5: a 422 from a 2-decimal Money column). Use AmountInput (string value) or MoneyField (number value) \u2014 both settle to the currency's minor unit. (Development builds only; once per field.)`
|
|
124
|
+
);
|
|
125
|
+
}, [suffix, label, ariaLabel, placeholder]);
|
|
79
126
|
const commit = () => {
|
|
127
|
+
setDraft(null);
|
|
80
128
|
const next = commitExpression(value);
|
|
81
129
|
if (next !== value) onChange(next);
|
|
82
130
|
onCommit?.(next);
|
|
83
131
|
};
|
|
84
132
|
const stepBy = (count) => {
|
|
133
|
+
setDraft(null);
|
|
85
134
|
const resolved = commitExpression(value).trim();
|
|
86
135
|
const n = resolved === "" ? NaN : Number(resolved);
|
|
87
136
|
const next = formatResult(stepNumber(Number.isFinite(n) ? n : null, count, step, min, max));
|
|
@@ -116,8 +165,8 @@ function NumberInput({
|
|
|
116
165
|
autoFocus,
|
|
117
166
|
disabled,
|
|
118
167
|
placeholder: asDisplay ? placeholder ?? "0" : labelled ? " " : placeholder,
|
|
119
|
-
value,
|
|
120
|
-
onChange: (e) =>
|
|
168
|
+
value: display,
|
|
169
|
+
onChange: (e) => typed(e.target.value),
|
|
121
170
|
onFocus: () => setFocused(true),
|
|
122
171
|
onBlur: () => {
|
|
123
172
|
commit();
|
|
@@ -143,8 +192,8 @@ function NumberInput({
|
|
|
143
192
|
showCalc && /* @__PURE__ */ jsx(
|
|
144
193
|
CalculatorButton,
|
|
145
194
|
{
|
|
146
|
-
value,
|
|
147
|
-
onChange,
|
|
195
|
+
value: derived,
|
|
196
|
+
onChange: result,
|
|
148
197
|
className: "self-stretch px-2.5",
|
|
149
198
|
ariaLabel: labels?.calculatorTrigger,
|
|
150
199
|
labels: labels?.calculator
|
|
@@ -162,20 +211,23 @@ function NumberInput({
|
|
|
162
211
|
showNumpad && /* @__PURE__ */ jsx(
|
|
163
212
|
NumberPadSheet,
|
|
164
213
|
{
|
|
165
|
-
value,
|
|
166
|
-
onChange,
|
|
214
|
+
value: display,
|
|
215
|
+
onChange: typed,
|
|
216
|
+
onResult: result,
|
|
167
217
|
onDone: () => inputRef.current?.blur(),
|
|
168
218
|
label,
|
|
169
|
-
labels: labels?.pad
|
|
219
|
+
labels: labels?.pad,
|
|
220
|
+
decimalMark: mark
|
|
170
221
|
}
|
|
171
222
|
)
|
|
172
223
|
]
|
|
173
224
|
}
|
|
174
225
|
);
|
|
175
|
-
if (!textHint) return field;
|
|
226
|
+
if (!textHint && !hasError && !reserve) return field;
|
|
176
227
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
177
228
|
field,
|
|
178
|
-
/* @__PURE__ */ jsx("p", { id: hintId, className: "mt-1 text-[11px] leading-tight text-[var(--text-muted)]", children: hint })
|
|
229
|
+
textHint && /* @__PURE__ */ jsx("p", { id: hintId, className: "mt-1 text-[11px] leading-tight text-[var(--text-muted)]", children: hint }),
|
|
230
|
+
hasError && /* @__PURE__ */ jsx("p", { id: errorId, className: FIELD_ERROR_CLASS, children: error })
|
|
179
231
|
] });
|
|
180
232
|
}
|
|
181
233
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/number-input.tsx"],"sourcesContent":["import { useId, useLayoutEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { CalculatorButton, type CalculatorButtonLabels } from \"./calculator\";\nimport { NumberPadSheet, type NumberPadSheetLabels } from \"./numpad-sheet\";\nimport { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FloatingField, PHONE_QUERY } from \"./ui\";\nimport { cn } from \"../lib/cn\";\nimport { commitExpression, formatResult, sanitizeLive } from \"../lib/calc\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\n\ninterface NumberInputProps {\n value: string;\n /** Fired on every keystroke with the raw text (comma → dot, operators kept so\n * a typed expression survives). */\n onChange: (value: string) => void;\n /** Fired on blur/Enter with the *evaluated* value — use this for save-on-blur\n * fields so the save always sees the resolved number, never \"10+5\". */\n onCommit?: (value: string) => void;\n label?: ReactNode;\n ariaLabel?: string;\n /** Names for the calculator this field renders — its trigger, and the controls\n * inside the popover — and for the numpad sheet it opens on a phone. Overrides\n * for THIS field only: both resolve the `calculator` namespace of\n * `<UiKitProvider labels>` themselves, then fall back to English.\n *\n * `pad` is not optional plumbing: this field renders a {@link NumberPadSheet}\n * exactly as {@link AmountInput} does, but had no way to pass it anything, so\n * the SAME keypad announced itself in German when a money field opened it and in\n * English when a goal target did. */\n labels?: {\n calculatorTrigger?: string;\n calculator?: CalculatorButtonLabels;\n pad?: NumberPadSheetLabels;\n };\n placeholder?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Wrapper class. */\n className?: string;\n /** Overrides the input's own styling (merged after the field base). */\n inputClassName?: string;\n id?: string;\n /** Show the calculator-popover trigger (default true). Set false for fields in\n * an ephemeral close-on-blur editor, where clicking the icon would blur away\n * and tear the editor down before the popover could open — inline typing\n * (e.g. \"200+50\" → Enter) still evaluates there. */\n calculator?: boolean;\n /** {@link FIELD_DISPLAY} — on a phone, the figure at display size with the field\n * chrome dropped. The currency-free half of the same treatment `AmountInput`\n * carries, for a dialog whose whole point is the one number (a budget goal's\n * target); not for a field among many, and never for the compact inline\n * editors this control also serves. */\n variant?: \"field\" | \"display\";\n /** A {@link FieldHint} \"?\" on the label's own line, beside the label rather\n * than at the far end of the strip — the far end is where the calculator\n * lives, and a hint placed there landed on top of it (steering-design\n * feedback #48). Plain TEXT (a string or a number) is a caption instead, UNDER\n * the field and attached through `aria-describedby` after the caller's own —\n * the same rule as {@link Select}'s `hint`: the label line has no room for a\n * sentence, and one placed there ran over the label and into the value. */\n hint?: ReactNode;\n /** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */\n invalid?: boolean;\n /**\n * Set on the `<input>`, with `id` above. Declared so `Field`'s render-prop spread —\n * `{(ids) => <NumberInput {...ids} … />}` — is typed and reaches the input: the hint\n * and error are described, a required number is announced as required, and\n * `aria-invalid` paints {@link FIELD_INVALID} the way `invalid` does.\n */\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean | \"true\" | \"false\";\n \"aria-required\"?: boolean | \"true\" | \"false\";\n /**\n * A static unit shown at the field's right edge — \"%\", \"kg\", \"km/h\".\n *\n * The read-out half of {@link AmountInput}'s currency chip, and it exists for the\n * same reason that one does: a unit belongs to the FIELD, not to the text, so\n * typing it is a way to get it into the value. Keksdose had a percentage spelled\n * three different ways across three screens — `<Input type=\"number\" step=\"0.01\">`\n * for a loan rate, `step=\"0.1\"` for a tax rate, `inputMode=\"decimal\"` for a VAT\n * rate — and none of the three showed a \"%\" anywhere near the box, so what the\n * digits meant was a question the label alone had to answer.\n *\n * `aria-hidden`, like the currency read-out: it is a property of the field that\n * the label already names (\"Interest rate (%)\"), and announcing it again after\n * every value reads as part of the number.\n */\n suffix?: ReactNode;\n /**\n * Turns on the step keys: ArrowUp / ArrowDown add or subtract `step`, PageUp /\n * PageDown ten of them. The result lands on the grid `min + k × step` (or `0 + k ×\n * step` without a `min`), so 3.1 with `step={0.25}` goes up to 3.25, not 3.35 —\n * what a native number input does. Decimal-exact: `0.1 + 0.2` steps to \"0.3\".\n *\n * A step changes the text through `onChange` like a keystroke would; `onCommit`\n * still fires on blur/Enter. Without `step` the arrow keys move the caret as before.\n */\n step?: number;\n /** Bounds for the step keys only — a step never leaves `[min, max]`. This field's\n * value is a STRING, so typed text is not clamped: {@link NumberField} is the\n * numeric field that clamps what is typed as well. */\n min?: number;\n max?: number;\n}\n\n/** Decimal places of `n` as written (\"0.25\" → 2, \"1e-7\" → 7), for decimal-exact\n * stepping. */\nfunction decimalsOf(n: number): number {\n const text = formatResult(n);\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/**\n * `current` moved by `count` steps (negative = down), on the grid `origin + k × step`\n * and clamped into `[min, max]`. An off-grid value moves to the NEXT grid point in\n * that direction first, so one press is never more than one step.\n *\n * The grid index is found by division and the result rebuilt as `origin + k × step`,\n * then cut to the decimals `step` and `origin` are written with — which is where\n * binary noise goes: `0.1 × 3` is 0.30000000000000004, and `toFixed(1)` of it is\n * \"0.3\". Summing steps would accumulate that noise press by press instead.\n */\nexport function stepNumber(\n current: number | null,\n count: number,\n step: number,\n min?: number,\n max?: number,\n): number {\n const clamp = (n: number) => Math.min(max ?? Infinity, Math.max(min ?? -Infinity, n));\n // Nothing to step from: land on the value nearest zero the bounds allow, rather\n // than on ±step — a room count with `min={1}` goes to 1, a rate to 0.\n if (current === null || !Number.isFinite(current)) return clamp(0);\n const origin = min !== undefined && Number.isFinite(min) ? min : 0;\n const raw = (current - origin) / step;\n const nearest = Math.round(raw);\n // \"On the grid\" within float tolerance: (0.3 - 0) / 0.1 is 2.9999999999999996.\n const onGrid = Math.abs(raw - nearest) < 1e-9;\n const k = onGrid\n ? nearest + count\n : count > 0\n ? Math.ceil(raw) + count - 1\n : Math.floor(raw) + count + 1;\n const places = Math.min(Math.max(decimalsOf(step), decimalsOf(origin)), 20);\n return clamp(Number((origin + k * step).toFixed(places)));\n}\n\n/**\n * A numeric text field with a built-in calculator: type a calculation straight\n * in (e.g. \"12+5\", evaluated on blur/Enter) or click the trailing calculator\n * icon for a keypad. String `value`/`onChange` contract, mirroring\n * {@link AmountInput} — the currency-free counterpart for budgets, goals,\n * invoice totals and split lines.\n */\nexport function NumberInput({\n value,\n onChange,\n onCommit,\n label,\n ariaLabel,\n labels,\n placeholder,\n disabled,\n autoFocus,\n className,\n inputClassName,\n id,\n calculator = true,\n variant = \"field\",\n hint,\n invalid: invalidProp,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n \"aria-required\": ariaRequired,\n suffix,\n step,\n min,\n max,\n}: NumberInputProps) {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const hintId = useId();\n // Text is a caption under the field; a FieldHint rides the label line. See `hint`.\n const textHint = (typeof hint === \"string\" && hint !== \"\") || typeof hint === \"number\";\n const describedBy = textHint ? (ariaDescribedBy ? `${ariaDescribedBy} ${hintId}` : hintId) : ariaDescribedBy;\n const invalid = Boolean(invalidProp) || ariaInvalid === true || ariaInvalid === \"true\";\n const labelled = label !== undefined;\n // On phones we suppress the OS keyboard (inputMode=\"none\" below) for our own\n // calculator numpad, so the desktop popover trigger is hidden (feedback #334).\n const isMobile = useMediaQuery(PHONE_QUERY, false);\n const asDisplay = isMobile && variant === \"display\";\n const showCalc = calculator && !disabled && !isMobile;\n const [focused, setFocused] = useState(false);\n // The unit and the calculator's measured width, reserved as the field's end padding.\n const endRef = useRef<HTMLDivElement>(null);\n const [endWidth, setEndWidth] = useState<number | null>(null);\n const hasEnd = showCalc || suffix !== undefined;\n // Before the first measurement (and wherever there is no layout), a TEXT unit\n // reserves an estimate from its length — one `ch` a character, in the input's own\n // (larger) font, so it errs wide — plus the span's `pe-2` and the 4px gap, and the\n // calculator's 36px. The class fallback's flat pe-8 gave a \"%\" 32px for a frame and\n // \"km/h\" too little.\n const suffixChars = typeof suffix === \"string\" || typeof suffix === \"number\" ? String(suffix).length : null;\n const estimatedEnd =\n suffixChars !== null ? `calc(${suffixChars}ch + 0.75rem${showCalc ? \" + 2.25rem\" : \"\"})` : undefined;\n useLayoutEffect(() => {\n const el = endRef.current;\n if (!hasEnd || !el || typeof ResizeObserver === \"undefined\") return;\n // The first callback fires on `observe`; no layout (jsdom) keeps the class fallback.\n const observer = new ResizeObserver(() => {\n const width = el.getBoundingClientRect().width;\n setEndWidth(width > 0 ? Math.ceil(width) : null);\n });\n observer.observe(el);\n return () => observer.disconnect();\n }, [hasEnd]);\n // On mobile, focusing opens the numpad bottom sheet instead of the native\n // keyboard (#334); the ref lets its \"Done\" blur → commit + close.\n const showNumpad = isMobile && !disabled && focused;\n const inputRef = useRef<HTMLInputElement>(null);\n\n const commit = () => {\n const next = commitExpression(value);\n if (next !== value) onChange(next);\n onCommit?.(next);\n };\n\n const stepBy = (count: number) => {\n // The step starts from the text as a commit would read it, so \"12+5\" steps from 17.\n const resolved = commitExpression(value).trim();\n const n = resolved === \"\" ? NaN : Number(resolved);\n const next = formatResult(stepNumber(Number.isFinite(n) ? n : null, count, step as number, min, max));\n if (next !== value) onChange(next);\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") return commit();\n // A zero, negative or non-finite step is no step: the keys stay the caret's.\n if (!step || !(step > 0) || !Number.isFinite(step) || e.altKey || e.ctrlKey || e.metaKey) return;\n const count =\n e.key === \"ArrowUp\" ? 1 : e.key === \"ArrowDown\" ? -1 : e.key === \"PageUp\" ? 10 : e.key === \"PageDown\" ? -10 : 0;\n if (count === 0) return;\n // Otherwise ArrowUp/Down also jump the caret to the start/end of the text.\n e.preventDefault();\n stepBy(count);\n };\n\n const field = (\n <FloatingField\n className={cn(\"w-full\", className)}\n htmlFor={fieldId}\n label={label}\n srOnlyLabel={asDisplay}\n hint={textHint ? undefined : hint}\n >\n <input\n ref={inputRef}\n id={fieldId}\n aria-label={ariaLabel}\n type=\"text\"\n // Mobile: suppress the OS keyboard so the numpad sheet owns entry (field\n // keeps focus/caret); desktop keeps the native decimal keypad.\n inputMode={isMobile ? \"none\" : \"decimal\"}\n autoComplete=\"off\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- a documented prop the caller opts into (off by default); the field never takes focus on its own.\n autoFocus={autoFocus}\n disabled={disabled}\n // Display mode has no floating label to feed the blank-placeholder trick,\n // and an empty borderless figure shows nothing — so it keeps whatever\n // placeholder the caller gave, falling back to a zero to aim at.\n placeholder={asDisplay ? (placeholder ?? \"0\") : labelled ? \" \" : placeholder}\n value={value}\n onChange={(e) => onChange(sanitizeLive(e.target.value))}\n onFocus={() => setFocused(true)}\n onBlur={() => {\n commit();\n setFocused(false);\n }}\n onKeyDown={onKeyDown}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n aria-required={ariaRequired}\n // The end padding sits last so it always wins over an inputClassName that\n // sets its own px. Both trailing controls can be on at once, so the room\n // they need is reserved together rather than by whichever happens to render:\n // the calculator is ~36px and a short unit ~24px, and a field that reserved\n // only one of them would let the digits run under the other.\n className={cn(\n asDisplay\n ? cn(FIELD_DISPLAY, \"text-4xl font-semibold leading-tight tracking-tight tabular-nums\")\n : labelled\n ? FLOATING_INPUT_CLASS\n : FIELD_BASE,\n inputClassName,\n showCalc && suffix !== undefined ? \"pe-16\" : showCalc ? \"pe-9\" : suffix !== undefined ? \"pe-8\" : undefined,\n invalid && FIELD_INVALID,\n )}\n // The classes above are the fallback; once the end controls are measured the\n // field reserves exactly their width (+4px). A fixed pe-8 for any unit left a\n // \"%\" in a ~78px table cell 32px of padding and the digits ~32px of room\n // (keksdose live #367); a long unit (\"km/h\") got too little.\n style={\n hasEnd && endWidth != null\n ? { paddingInlineEnd: endWidth + 4 }\n : estimatedEnd !== undefined\n ? { paddingInlineEnd: estimatedEnd }\n : undefined\n }\n />\n {(showCalc || suffix !== undefined) && (\n // One flex track for both, so the unit and the calculator sit side by side\n // instead of stacking on the same corner — AmountInput's arrangement, which\n // has carried a chip and a calculator together since #430.\n <div ref={endRef} className=\"absolute inset-y-0 end-0 flex items-center\">\n {showCalc && (\n <CalculatorButton\n value={value}\n onChange={onChange}\n className=\"self-stretch px-2.5\"\n ariaLabel={labels?.calculatorTrigger}\n labels={labels?.calculator}\n />\n )}\n {suffix !== undefined && (\n <span\n aria-hidden\n // pe-2, not the input's px-3: the unit is chrome at the box's edge, and\n // with pe-3 plus the 4px gap it took ~26px of a narrow table cell.\n className=\"pointer-events-none pe-2 text-xs font-medium text-[var(--text-muted)]\"\n >\n {suffix}\n </span>\n )}\n </div>\n )}\n {showNumpad && (\n <NumberPadSheet\n value={value}\n onChange={onChange}\n onDone={() => inputRef.current?.blur()}\n label={label}\n labels={labels?.pad}\n />\n )}\n </FloatingField>\n );\n if (!textHint) return field;\n // Outside the field's own `relative` box, as Select's caption is: the calculator\n // and the unit are `inset-y-0` in it and would stretch down over a second line.\n // `className` stays on the field, so adding a caption cannot change what it styles.\n return (\n <div>\n {field}\n <p id={hintId} className=\"mt-1 text-[11px] leading-tight text-[var(--text-muted)]\">\n {hint}\n </p>\n </div>\n );\n}\n"],"mappings":";AA+PM,cA0DE,YA1DF;AA/PN,SAAS,OAAO,iBAAiB,QAAQ,gBAAgB;AAEzD,SAAS,wBAAqD;AAC9D,SAAS,sBAAiD;AAC1D,SAAS,YAAY,eAAe,eAAe,sBAAsB,eAAe,mBAAmB;AAC3G,SAAS,UAAU;AACnB,SAAS,kBAAkB,cAAc,oBAAoB;AAC7D,SAAS,qBAAqB;AAmG9B,SAAS,WAAW,GAAmB;AACrC,QAAM,OAAO,aAAa,CAAC;AAC3B,QAAM,MAAM,KAAK,QAAQ,GAAG;AAC5B,SAAO,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM;AAC9C;AAYO,SAAS,WACd,SACA,OACA,MACA,KACA,KACQ;AACR,QAAM,QAAQ,CAAC,MAAc,KAAK,IAAI,OAAO,UAAU,KAAK,IAAI,OAAO,WAAW,CAAC,CAAC;AAGpF,MAAI,YAAY,QAAQ,CAAC,OAAO,SAAS,OAAO,EAAG,QAAO,MAAM,CAAC;AACjE,QAAM,SAAS,QA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sBACC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA,WAAU;AAAA,cACV,WAAW,QAAQ;AAAA,cACnB,QAAQ,QAAQ;AAAA;AAAA,UAClB;AAAA,UAED,WAAW,UACV;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cAGX,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,WAEJ;AAAA,QAED,cACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,QAAQ,MAAM,SAAS,SAAS,KAAK;AAAA,YACrC;AAAA,YACA,QAAQ,QAAQ;AAAA;AAAA,QAClB;AAAA;AAAA;AAAA,EAEJ;AAEF,MAAI,CAAC,SAAU,QAAO;AAItB,SACE,qBAAC,SACE;AAAA;AAAA,IACD,oBAAC,OAAE,IAAI,QAAQ,WAAU,2DACtB,gBACH;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/number-input.tsx"],"sourcesContent":["import { useEffect, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { CalculatorButton, type CalculatorButtonLabels } from \"./calculator\";\nimport { NumberPadSheet, type NumberPadSheetLabels } from \"./numpad-sheet\";\nimport { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FloatingField, PHONE_QUERY } from \"./ui\";\nimport { CURRENCIES } from \"./currency-select\";\nimport { hasMessage, mergeDescribedBy } from \"./choice-parts\";\nimport { cn } from \"../lib/cn\";\nimport { commitExpression, formatResult } from \"../lib/calc\";\nimport { decimalMark, localizeMark, readTyped, showsTyped } from \"../lib/decimal-marks\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { useKitLocale } from \"../i18n/kit-labels\";\n\ninterface NumberInputProps {\n /** The text, DOT-decimal (\"1234.5\", or a calculation being typed: \"12+5\"), as\n * `onChange` reports it — so a caller's `Number(value)` reads it. The field SHOWS it\n * in the locale's mark (see `locale`). A comma here is read as the decimal mark too,\n * never as grouping. */\n value: string;\n /** Fired on every keystroke with the text as a number reads it: grouping marks read\n * off (\"1.234,56\" → \"1234.56\" for a German typist, keksdose K5), the decimal mark\n * folded to a dot, operators kept so a typed expression survives. */\n onChange: (value: string) => void;\n /** Fired on blur/Enter with the *evaluated* value — use this for save-on-blur\n * fields so the save always sees the resolved number, never \"10+5\". */\n onCommit?: (value: string) => void;\n label?: ReactNode;\n ariaLabel?: string;\n /** Names for the calculator this field renders — its trigger, and the controls\n * inside the popover — and for the numpad sheet it opens on a phone. Overrides\n * for THIS field only: both resolve the `calculator` namespace of\n * `<UiKitProvider labels>` themselves, then fall back to English.\n *\n * `pad` is not optional plumbing: this field renders a {@link NumberPadSheet}\n * exactly as {@link AmountInput} does, but had no way to pass it anything, so\n * the SAME keypad announced itself in German when a money field opened it and in\n * English when a goal target did. */\n labels?: {\n calculatorTrigger?: string;\n calculator?: CalculatorButtonLabels;\n pad?: NumberPadSheetLabels;\n };\n placeholder?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Wrapper class. */\n className?: string;\n /** Overrides the input's own styling (merged after the field base). */\n inputClassName?: string;\n id?: string;\n /** Show the calculator-popover trigger (default true). Set false for fields in\n * an ephemeral close-on-blur editor, where clicking the icon would blur away\n * and tear the editor down before the popover could open — inline typing\n * (e.g. \"200+50\" → Enter) still evaluates there. */\n calculator?: boolean;\n /** {@link FIELD_DISPLAY} — on a phone, the figure at display size with the field\n * chrome dropped. The currency-free half of the same treatment `AmountInput`\n * carries, for a dialog whose whole point is the one number (a budget goal's\n * target); not for a field among many, and never for the compact inline\n * editors this control also serves. */\n variant?: \"field\" | \"display\";\n /** A {@link FieldHint} \"?\" on the label's own line, beside the label rather\n * than at the far end of the strip — the far end is where the calculator\n * lives, and a hint placed there landed on top of it (steering-design\n * feedback #48). Plain TEXT (a string or a number) is a caption instead, UNDER\n * the field and attached through `aria-describedby` after the caller's own —\n * the same rule as {@link Select}'s `hint`: the label line has no room for a\n * sentence, and one placed there ran over the label and into the value. */\n hint?: ReactNode;\n /** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */\n invalid?: boolean;\n /**\n * What is wrong with the value, in the caller's own words — {@link Input}'s `error`,\n * the same anatomy (keksdose K5/K4: of the kit's fields only `Input` and\n * `NumberField` had one, so a goal target or a rate field wrote its message as a\n * loose `<p>` that nothing pointed at). Rendered under the field, after a text\n * `hint`; merged into `aria-describedby` after the caller's ids and the hint's; and\n * it implies `invalid`, so the field paints as well as announces. `null`, `false`\n * and `\"\"` — a `touched && errors.x` on the happy path — are no message.\n *\n * Passing the key at all (even `undefined`) keeps the field in a steady wrapper,\n * message or not, so the message coming and going never remounts the `<input>` and\n * takes the caret with it — see `Input`'s `FieldGroup`. A field that never passes\n * `error` renders exactly the DOM it did before the prop existed.\n */\n error?: ReactNode;\n /**\n * BCP 47 tag that decides the decimal mark the field SHOWS; default the\n * `<UiKitProvider locale>`, else the runtime's (keksdose K5). A French or Italian\n * reader sees \"3,5\", a German one too, de-CH and en-US see \"3.5\" — `Intl`\n * decides, not a guess about a country. Display only: `value` and `onChange` stay\n * dot-decimal. {@link NumberField} passes its own `locale` through here.\n */\n locale?: string;\n /**\n * Set on the `<input>`, with `id` above. Declared so `Field`'s render-prop spread —\n * `{(ids) => <NumberInput {...ids} … />}` — is typed and reaches the input: the hint\n * and error are described, a required number is announced as required, and\n * `aria-invalid` paints {@link FIELD_INVALID} the way `invalid` does.\n */\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean | \"true\" | \"false\";\n \"aria-required\"?: boolean | \"true\" | \"false\";\n /**\n * A static unit shown at the field's right edge — \"%\", \"kg\", \"km/h\".\n *\n * The read-out half of {@link AmountInput}'s currency chip, and it exists for the\n * same reason that one does: a unit belongs to the FIELD, not to the text, so\n * typing it is a way to get it into the value. Keksdose had a percentage spelled\n * three different ways across three screens — `<Input type=\"number\" step=\"0.01\">`\n * for a loan rate, `step=\"0.1\"` for a tax rate, `inputMode=\"decimal\"` for a VAT\n * rate — and none of the three showed a \"%\" anywhere near the box, so what the\n * digits meant was a question the label alone had to answer.\n *\n * `aria-hidden`, like the currency read-out: it is a property of the field that\n * the label already names (\"Interest rate (%)\"), and announcing it again after\n * every value reads as part of the number.\n */\n suffix?: ReactNode;\n /**\n * Turns on the step keys: ArrowUp / ArrowDown add or subtract `step`, PageUp /\n * PageDown ten of them. The result lands on the grid `min + k × step` (or `0 + k ×\n * step` without a `min`), so 3.1 with `step={0.25}` goes up to 3.25, not 3.35 —\n * what a native number input does. Decimal-exact: `0.1 + 0.2` steps to \"0.3\".\n *\n * A step changes the text through `onChange` like a keystroke would; `onCommit`\n * still fires on blur/Enter. Without `step` the arrow keys move the caret as before.\n */\n step?: number;\n /** Bounds for the step keys only — a step never leaves `[min, max]`. This field's\n * value is a STRING, so typed text is not clamped: {@link NumberField} is the\n * numeric field that clamps what is typed as well. */\n min?: number;\n max?: number;\n}\n\n/** Decimal places of `n` as written (\"0.25\" → 2, \"1e-7\" → 7), for decimal-exact\n * stepping. */\nfunction decimalsOf(n: number): number {\n const text = formatResult(n);\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/**\n * `current` moved by `count` steps (negative = down), on the grid `origin + k × step`\n * and clamped into `[min, max]`. An off-grid value moves to the NEXT grid point in\n * that direction first, so one press is never more than one step.\n *\n * The grid index is found by division and the result rebuilt as `origin + k × step`,\n * then cut to the decimals `step` and `origin` are written with — which is where\n * binary noise goes: `0.1 × 3` is 0.30000000000000004, and `toFixed(1)` of it is\n * \"0.3\". Summing steps would accumulate that noise press by press instead.\n */\nexport function stepNumber(\n current: number | null,\n count: number,\n step: number,\n min?: number,\n max?: number,\n): number {\n const clamp = (n: number) => Math.min(max ?? Infinity, Math.max(min ?? -Infinity, n));\n // Nothing to step from: land on the value nearest zero the bounds allow, rather\n // than on ±step — a room count with `min={1}` goes to 1, a rate to 0.\n if (current === null || !Number.isFinite(current)) return clamp(0);\n const origin = min !== undefined && Number.isFinite(min) ? min : 0;\n const raw = (current - origin) / step;\n const nearest = Math.round(raw);\n // \"On the grid\" within float tolerance: (0.3 - 0) / 0.1 is 2.9999999999999996.\n const onGrid = Math.abs(raw - nearest) < 1e-9;\n const k = onGrid\n ? nearest + count\n : count > 0\n ? Math.ceil(raw) + count - 1\n : Math.floor(raw) + count + 1;\n const places = Math.min(Math.max(decimalsOf(step), decimalsOf(origin)), 20);\n return clamp(Number((origin + k * step).toFixed(places)));\n}\n\n// The error line under a field — the type of `ui.tsx`'s (module-private) one, so a\n// NumberInput's message is indistinguishable from an Input's.\nconst FIELD_ERROR_CLASS = \"mt-1 text-[11px] leading-tight text-[var(--danger)]\";\n\n// ── The money guard (kastlan 5, Kurvenschmiede) ─────────────────────────────────\n\n// The codes the kit's own currency pickers offer, as whole words: \"Amount (CHF)\",\n// \"EUR\", \"Kosten CHF\". Not every ISO 4217 code — \"ALL\", \"TOP\" and \"PEN\" are codes too,\n// and an upper-case label would trip on them.\nconst CURRENCY_CODE = new RegExp(`(?:^|[^A-Za-z])(?:${CURRENCIES.map((c) => c.code).join(\"|\")})(?![A-Za-z])`);\n// Symbols no unit of measure is written with. Not \"kr\", \"R\" or \"Fr\": those are words\n// and units as often as they are money.\nconst CURRENCY_SYMBOL = /[€$£¥₹₺₽₪₩₫฿₴₦₱]/;\n\n/** Text that names a currency and no unit to go with it. A slash makes it a rate or\n * a unit price (\"CHF/m²\", \"€/kWh\") — a figure whose decimals are its column's\n * business, not the currency's — and that is not what the guard is for. */\nfunction namesMoney(node: ReactNode): boolean {\n if (typeof node !== \"string\" && typeof node !== \"number\") return false;\n const text = String(node);\n return (CURRENCY_CODE.test(text) || CURRENCY_SYMBOL.test(text)) && !text.includes(\"/\") && !text.includes(\"%\");\n}\n\n/**\n * Is this field being used for MONEY? A currency in the unit (`suffix=\"CHF\"`), or in\n * the label, `ariaLabel` or placeholder of a field with no unit at all (\"Estimated\n * cost (CHF)\"). Any other suffix is a unit — \"%\", \"mm\", \"N·m\" — and says what the\n * digits are, whatever the label says. `digits` plays no part: NumberInput has none,\n * and Kurvenschmiede's engineering fields at 2 and 3 decimals are exactly what this\n * must stay quiet about.\n */\nfunction looksLikeMoney(suffix: ReactNode, texts: ReactNode[]): boolean {\n if (suffix !== undefined && suffix !== null && suffix !== \"\") return namesMoney(suffix);\n return texts.some(namesMoney);\n}\n\n/**\n * The kit's dev switch, as `lib/logger.ts` reads it: a development build, never a\n * production one — the consumer's bundler replaces `import.meta.env.DEV` with `false`\n * there, and this branch is dead code — and never under vitest, where every consumer\n * suite would print it once per render of every field it has not migrated yet. Read\n * per call rather than once per module, so a test can switch it on with `vi.stubEnv`.\n * Optional-chained: `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\n\n/**\n * A numeric text field with a built-in calculator: type a calculation straight\n * in (e.g. \"12+5\", evaluated on blur/Enter) or click the trailing calculator\n * icon for a keypad. String `value`/`onChange` contract, mirroring\n * {@link AmountInput} — the currency-free counterpart for quantities, rates,\n * percentages and measurements.\n *\n * NOT FOR MONEY. This field never rounds: \"12.345\", or a calculator's \"100/3\", is\n * reported exactly as typed. kastlan's journal lines, a payment allocation and a\n * defect's estimated cost were NumberInputs, and a 3-decimal amount reached a\n * 2-decimal Money column and failed the save with a 422 — in one wizard after the\n * record before it had already been created (kastlan 5). Money goes in\n * {@link AmountInput} (string value, like this one) or {@link MoneyField} (number\n * value): both settle to the currency's minor unit on blur, Enter and every calculator\n * result, and take `digits` for a unit price at a finer scale. In development a\n * NumberInput that looks like money — a currency as its unit, or a currency in the\n * label of a field with no unit — says so on the console, once per field. A unit of\n * measure (\"mm\", \"N·m\", \"%\") keeps it quiet, as does any number of decimals.\n *\n * THE LOCALE'S MARK (keksdose K5). The field shows the `locale`'s decimal mark — \"3,5\"\n * to a French, Italian or German reader — and reads what is typed the way\n * {@link AmountInput} does (keksdose G1): \"1.234,56\" from a German typist is 1234.56,\n * \"1,234.56\" from an English one too, and a lone mark that cannot be grouping is the\n * decimal, whichever key typed it. Before, it always showed \"3.5\" and folded\n * \"1.234,56\" into 1.23456. `value` and `onChange` stay dot-decimal, which is the\n * contract every caller's `Number(value)` reads.\n *\n * While a figure is being typed the field shows the typist's OWN text — \"1.234,5\"\n * stays exactly that — rather than the value re-spelt: re-spelling turned a grouping\n * \".\" into a \",\" under their fingers, after which no rule could tell the two apart, and\n * a text that changes length under the caret moves it to the end. It is re-spelt in the\n * locale's mark, without grouping, once the figure settles (blur, Enter, a step or a\n * calculator result) or when the value changes from outside.\n */\nexport function NumberInput(props: NumberInputProps) {\n const {\n value,\n onChange,\n onCommit,\n label,\n ariaLabel,\n labels,\n placeholder,\n disabled,\n autoFocus,\n className,\n inputClassName,\n id,\n calculator = true,\n variant = \"field\",\n hint,\n invalid: invalidProp,\n error,\n locale: localeProp,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n \"aria-required\": ariaRequired,\n suffix,\n step,\n min,\n max,\n } = props;\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const hintId = useId();\n const errorId = useId();\n // Text is a caption under the field; a FieldHint rides the label line. See `hint`.\n const textHint = (typeof hint === \"string\" && hint !== \"\") || typeof hint === \"number\";\n const hasError = hasMessage(error);\n // Passed at all — even as `undefined` — the field keeps its box; see `error`.\n const reserve = \"error\" in props || \"hint\" in props;\n // The standing advice first, the news second: the caller's ids, the caption, the error.\n const describedBy = mergeDescribedBy(ariaDescribedBy, textHint && hintId, hasError && errorId);\n const invalid = Boolean(invalidProp) || hasError || ariaInvalid === true || ariaInvalid === \"true\";\n const labelled = label !== undefined;\n // On phones we suppress the OS keyboard (inputMode=\"none\" below) for our own\n // calculator numpad, so the desktop popover trigger is hidden (feedback #334).\n const isMobile = useMediaQuery(PHONE_QUERY, false);\n const asDisplay = isMobile && variant === \"display\";\n const showCalc = calculator && !disabled && !isMobile;\n const [focused, setFocused] = useState(false);\n // The unit and the calculator's measured width, reserved as the field's end padding.\n const endRef = useRef<HTMLDivElement>(null);\n const [endWidth, setEndWidth] = useState<number | null>(null);\n const hasEnd = showCalc || suffix !== undefined;\n // Before the first measurement (and wherever there is no layout), a TEXT unit\n // reserves an estimate from its length — one `ch` a character, in the input's own\n // (larger) font, so it errs wide — plus the span's `pe-2` and the 4px gap, and the\n // calculator's 36px. The class fallback's flat pe-8 gave a \"%\" 32px for a frame and\n // \"km/h\" too little.\n const suffixChars = typeof suffix === \"string\" || typeof suffix === \"number\" ? String(suffix).length : null;\n const estimatedEnd =\n suffixChars !== null ? `calc(${suffixChars}ch + 0.75rem${showCalc ? \" + 2.25rem\" : \"\"})` : undefined;\n useLayoutEffect(() => {\n const el = endRef.current;\n if (!hasEnd || !el || typeof ResizeObserver === \"undefined\") return;\n // The first callback fires on `observe`; no layout (jsdom) keeps the class fallback.\n const observer = new ResizeObserver(() => {\n const width = el.getBoundingClientRect().width;\n setEndWidth(width > 0 ? Math.ceil(width) : null);\n });\n observer.observe(el);\n return () => observer.disconnect();\n }, [hasEnd]);\n // On mobile, focusing opens the numpad bottom sheet instead of the native\n // keyboard (#334); the ref lets its \"Done\" blur → commit + close.\n const showNumpad = isMobile && !disabled && focused;\n const inputRef = useRef<HTMLInputElement>(null);\n\n // The mark is the locale's; see the component's note. `derived` is the value in that\n // mark — one character for one, no grouping — and `draft` the typist's own text,\n // shown only while it still says what the value says (see `showsTyped`).\n const mark = decimalMark(useKitLocale(localeProp));\n const [draft, setDraft] = useState<string | null>(null);\n const derived = localizeMark(value, mark);\n const display = draft !== null && showsTyped(draft, mark, value) ? draft : derived;\n\n // A keystroke, a paste or a numpad key: the typist's text is kept, the value is what\n // a number reads it as.\n const typed = (raw: string) => {\n setDraft(raw);\n onChange(readTyped(raw, mark));\n };\n // A RESULT — the calculator's, the numpad's \"=\" — is dot-decimal already. It does not\n // go through `typed`: \"1.234\" out of `100/81.03…` is never a thousand.\n const result = (next: string) => {\n setDraft(null);\n onChange(next);\n };\n\n // The money guard: once per field, development only. See `looksLikeMoney`.\n const warnedMoney = useRef(false);\n useEffect(() => {\n if (warnedMoney.current || !devWarnings()) return;\n if (!looksLikeMoney(suffix, [label, ariaLabel, placeholder])) return;\n warnedMoney.current = true;\n const name = [label, ariaLabel, suffix].find((t) => typeof t === \"string\" || typeof t === \"number\");\n console.warn(\n `[ui-kit] NumberInput${name === undefined ? \"\" : ` \"${String(name)}\"`} looks like a money field: a ` +\n `currency, and no unit. NumberInput never rounds, so \"12.345\" or a calculator's \"100/3\" is sent with ` +\n `three or more decimals (kastlan 5: a 422 from a 2-decimal Money column). Use AmountInput (string ` +\n `value) or MoneyField (number value) — both settle to the currency's minor unit. ` +\n `(Development builds only; once per field.)`,\n );\n }, [suffix, label, ariaLabel, placeholder]);\n\n const commit = () => {\n setDraft(null);\n const next = commitExpression(value);\n if (next !== value) onChange(next);\n onCommit?.(next);\n };\n\n const stepBy = (count: number) => {\n setDraft(null);\n // The step starts from the text as a commit would read it, so \"12+5\" steps from 17.\n const resolved = commitExpression(value).trim();\n const n = resolved === \"\" ? NaN : Number(resolved);\n const next = formatResult(stepNumber(Number.isFinite(n) ? n : null, count, step as number, min, max));\n if (next !== value) onChange(next);\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") return commit();\n // A zero, negative or non-finite step is no step: the keys stay the caret's.\n if (!step || !(step > 0) || !Number.isFinite(step) || e.altKey || e.ctrlKey || e.metaKey) return;\n const count =\n e.key === \"ArrowUp\" ? 1 : e.key === \"ArrowDown\" ? -1 : e.key === \"PageUp\" ? 10 : e.key === \"PageDown\" ? -10 : 0;\n if (count === 0) return;\n // Otherwise ArrowUp/Down also jump the caret to the start/end of the text.\n e.preventDefault();\n stepBy(count);\n };\n\n const field = (\n <FloatingField\n className={cn(\"w-full\", className)}\n htmlFor={fieldId}\n label={label}\n srOnlyLabel={asDisplay}\n hint={textHint ? undefined : hint}\n >\n <input\n ref={inputRef}\n id={fieldId}\n aria-label={ariaLabel}\n type=\"text\"\n // Mobile: suppress the OS keyboard so the numpad sheet owns entry (field\n // keeps focus/caret); desktop keeps the native decimal keypad.\n inputMode={isMobile ? \"none\" : \"decimal\"}\n autoComplete=\"off\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- a documented prop the caller opts into (off by default); the field never takes focus on its own.\n autoFocus={autoFocus}\n disabled={disabled}\n // Display mode has no floating label to feed the blank-placeholder trick,\n // and an empty borderless figure shows nothing — so it keeps whatever\n // placeholder the caller gave, falling back to a zero to aim at.\n placeholder={asDisplay ? (placeholder ?? \"0\") : labelled ? \" \" : placeholder}\n value={display}\n onChange={(e) => typed(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => {\n commit();\n setFocused(false);\n }}\n onKeyDown={onKeyDown}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n aria-required={ariaRequired}\n // The end padding sits last so it always wins over an inputClassName that\n // sets its own px. Both trailing controls can be on at once, so the room\n // they need is reserved together rather than by whichever happens to render:\n // the calculator is ~36px and a short unit ~24px, and a field that reserved\n // only one of them would let the digits run under the other.\n className={cn(\n asDisplay\n ? cn(FIELD_DISPLAY, \"text-4xl font-semibold leading-tight tracking-tight tabular-nums\")\n : labelled\n ? FLOATING_INPUT_CLASS\n : FIELD_BASE,\n inputClassName,\n showCalc && suffix !== undefined ? \"pe-16\" : showCalc ? \"pe-9\" : suffix !== undefined ? \"pe-8\" : undefined,\n invalid && FIELD_INVALID,\n )}\n // The classes above are the fallback; once the end controls are measured the\n // field reserves exactly their width (+4px). A fixed pe-8 for any unit left a\n // \"%\" in a ~78px table cell 32px of padding and the digits ~32px of room\n // (keksdose live #367); a long unit (\"km/h\") got too little.\n style={\n hasEnd && endWidth != null\n ? { paddingInlineEnd: endWidth + 4 }\n : estimatedEnd !== undefined\n ? { paddingInlineEnd: estimatedEnd }\n : undefined\n }\n />\n {(showCalc || suffix !== undefined) && (\n // One flex track for both, so the unit and the calculator sit side by side\n // instead of stacking on the same corner — AmountInput's arrangement, which\n // has carried a chip and a calculator together since #430.\n <div ref={endRef} className=\"absolute inset-y-0 end-0 flex items-center\">\n {showCalc && (\n <CalculatorButton\n // Seeded with the value in the field's mark but WITHOUT the typist's\n // grouping: the evaluator reads either mark, but \"1.234,5\" is two of them.\n value={derived}\n onChange={result}\n className=\"self-stretch px-2.5\"\n ariaLabel={labels?.calculatorTrigger}\n labels={labels?.calculator}\n />\n )}\n {suffix !== undefined && (\n <span\n aria-hidden\n // pe-2, not the input's px-3: the unit is chrome at the box's edge, and\n // with pe-3 plus the 4px gap it took ~26px of a narrow table cell.\n className=\"pointer-events-none pe-2 text-xs font-medium text-[var(--text-muted)]\"\n >\n {suffix}\n </span>\n )}\n </div>\n )}\n {showNumpad && (\n <NumberPadSheet\n // Localised like the field it mirrors, as AmountInput's is: its keys are\n // typing, read by the locale's marks like the keyboard's; \"=\" is a result.\n value={display}\n onChange={typed}\n onResult={result}\n onDone={() => inputRef.current?.blur()}\n label={label}\n labels={labels?.pad}\n decimalMark={mark}\n />\n )}\n </FloatingField>\n );\n if (!textHint && !hasError && !reserve) return field;\n // Outside the field's own `relative` box, as Select's caption is: the calculator\n // and the unit are `inset-y-0` in it and would stretch down over a second line.\n // `className` stays on the field, so adding a caption cannot change what it styles.\n return (\n <div>\n {field}\n {textHint && (\n <p id={hintId} className=\"mt-1 text-[11px] leading-tight text-[var(--text-muted)]\">\n {hint}\n </p>\n )}\n {hasError && (\n <p id={errorId} className={FIELD_ERROR_CLASS}>\n {error}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";AAyZM,cA0DE,YA1DF;AAzZN,SAAS,WAAW,OAAO,iBAAiB,QAAQ,gBAAgB;AAEpE,SAAS,wBAAqD;AAC9D,SAAS,sBAAiD;AAC1D,SAAS,YAAY,eAAe,eAAe,sBAAsB,eAAe,mBAAmB;AAC3G,SAAS,kBAAkB;AAC3B,SAAS,YAAY,wBAAwB;AAC7C,SAAS,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SAAS,SAAS,KAAK;AAAA,YACrC;AAAA,YACA,QAAQ,QAAQ;AAAA,YAChB,aAAa;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EAEJ;AAEF,MAAI,CAAC,YAAY,CAAC,YAAY,CAAC,QAAS,QAAO;AAI/C,SACE,qBAAC,SACE;AAAA;AAAA,IACA,YACC,oBAAC,OAAE,IAAI,QAAQ,WAAU,2DACtB,gBACH;AAAA,IAED,YACC,oBAAC,OAAE,IAAI,SAAS,WAAW,mBACxB,iBACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { C as CalculatorLabels } from '../
|
|
4
|
-
import '
|
|
3
|
+
import { C as CalculatorLabels } from '../feedback-BxeQVzwq.js';
|
|
4
|
+
import '../feedback-attachment-fGAzZPf0.js';
|
|
5
|
+
import '../feedback/feedback-inbox.js';
|
|
6
|
+
import 'lucide-react';
|
|
7
|
+
import './tooltip.js';
|
|
8
|
+
import '../hooks/use-anchored-rect.js';
|
|
9
|
+
import '../lib/clipping.js';
|
|
10
|
+
import '../data-table-labels-B7OdnM0S.js';
|
|
11
|
+
import './data-table-sort.js';
|
|
12
|
+
import './swipeable-row.js';
|
|
5
13
|
import './mini-calendar.js';
|
|
6
14
|
import './calendar-heatmap.js';
|
|
7
15
|
import './popover.js';
|
|
8
16
|
import './chip.js';
|
|
9
|
-
import 'lucide-react';
|
|
10
17
|
import './field-sync.js';
|
|
11
|
-
import './tooltip.js';
|
|
12
|
-
import '../hooks/use-anchored-rect.js';
|
|
13
|
-
import '../lib/clipping.js';
|
|
14
18
|
import '../wizard/types.js';
|
|
15
19
|
import '../tour/tour.js';
|
|
16
20
|
import '../search/command-palette.js';
|
|
@@ -24,7 +28,6 @@ import './sparkline.js';
|
|
|
24
28
|
import './stat-tile.js';
|
|
25
29
|
import './signature-pad.js';
|
|
26
30
|
import './password-strength.js';
|
|
27
|
-
import './danger-confirm.js';
|
|
28
31
|
import './swatch-picker.js';
|
|
29
32
|
import './tile-radio.js';
|
|
30
33
|
import './icon-picker.js';
|
|
@@ -32,11 +35,7 @@ import './dialog-frame.js';
|
|
|
32
35
|
import './modal.js';
|
|
33
36
|
import '../hooks/use-search-param-state.js';
|
|
34
37
|
import './measured-grid.js';
|
|
35
|
-
import '../feedback-attachment-WFiXJ8We.js';
|
|
36
|
-
import '../feedback/feedback-thread.js';
|
|
37
|
-
import '../feedback/feedback-inbox.js';
|
|
38
38
|
import './account-settings-labels.js';
|
|
39
|
-
import './confirm-dialog.js';
|
|
40
39
|
import './floating-panel.js';
|
|
41
40
|
import './bulk-action-bar.js';
|
|
42
41
|
import './list.js';
|
|
@@ -55,14 +54,20 @@ import './write-lock.js';
|
|
|
55
54
|
import './legal.js';
|
|
56
55
|
import './account-chips.js';
|
|
57
56
|
import '../lib/format.js';
|
|
58
|
-
import '../data-table-3mi2R3so.js';
|
|
59
|
-
import './data-table-sort.js';
|
|
60
|
-
import './swipeable-row.js';
|
|
61
57
|
import './reauth-dialog.js';
|
|
62
58
|
import './server-wake.js';
|
|
63
59
|
import '../lib/server-wake.js';
|
|
64
60
|
import './translation-review-labels.js';
|
|
65
61
|
import '../lib/translation-review.js';
|
|
62
|
+
import './country-select.js';
|
|
63
|
+
import './inline-edit-field.js';
|
|
64
|
+
import '../lib/iban.js';
|
|
65
|
+
import '../lib/phone.js';
|
|
66
|
+
import './sign-chip.js';
|
|
67
|
+
import './column-mapper.js';
|
|
68
|
+
import '../lib/column-mapping.js';
|
|
69
|
+
import '../lib/table-text.js';
|
|
70
|
+
import './field-parts.js';
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
73
|
* A full calculator keypad rendered as a bottom sheet — the mobile counterpart to
|