@eifi1/ui-kit 0.49.0 → 0.50.1

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.
Files changed (166) hide show
  1. package/README.md +12 -8
  2. package/dist/admin/user-roster.d.ts +16 -10
  3. package/dist/admin/user-roster.js +7 -3
  4. package/dist/admin/user-roster.js.map +1 -1
  5. package/dist/auth/verify-email.d.ts +9 -1
  6. package/dist/auth/verify-email.js +3 -1
  7. package/dist/auth/verify-email.js.map +1 -1
  8. package/dist/components/amount-input.d.ts +2 -1
  9. package/dist/components/amount-input.js +3 -2
  10. package/dist/components/amount-input.js.map +1 -1
  11. package/dist/components/autocomplete.js +14 -0
  12. package/dist/components/autocomplete.js.map +1 -1
  13. package/dist/components/combobox-core.js +1 -0
  14. package/dist/components/combobox-core.js.map +1 -1
  15. package/dist/components/combobox-suggestions.js +1 -0
  16. package/dist/components/combobox-suggestions.js.map +1 -1
  17. package/dist/components/combobox.js +3 -1
  18. package/dist/components/combobox.js.map +1 -1
  19. package/dist/components/currency-select.d.ts +28 -2
  20. package/dist/components/currency-select.js +56 -10
  21. package/dist/components/currency-select.js.map +1 -1
  22. package/dist/components/data-table-mobile.d.ts +11 -2
  23. package/dist/components/data-table-mobile.js +62 -8
  24. package/dist/components/data-table-mobile.js.map +1 -1
  25. package/dist/components/data-table-row.d.ts +1 -1
  26. package/dist/components/data-table-row.js.map +1 -1
  27. package/dist/components/data-table.js +3 -1
  28. package/dist/components/data-table.js.map +1 -1
  29. package/dist/components/dropdown.js +1 -0
  30. package/dist/components/dropdown.js.map +1 -1
  31. package/dist/components/full-bleed-dialog.js +1 -0
  32. package/dist/components/full-bleed-dialog.js.map +1 -1
  33. package/dist/components/inline-entity-combobox.js +12 -0
  34. package/dist/components/inline-entity-combobox.js.map +1 -1
  35. package/dist/components/modal.js +1 -0
  36. package/dist/components/modal.js.map +1 -1
  37. package/dist/components/number-input.d.ts +2 -1
  38. package/dist/components/number-input.js +6 -2
  39. package/dist/components/number-input.js.map +1 -1
  40. package/dist/components/numpad-sheet.js +2 -0
  41. package/dist/components/numpad-sheet.js.map +1 -1
  42. package/dist/components/picker-sheet.js +2 -0
  43. package/dist/components/picker-sheet.js.map +1 -1
  44. package/dist/components/popover.js +1 -0
  45. package/dist/components/popover.js.map +1 -1
  46. package/dist/eslint/index.js +1 -1
  47. package/dist/i18n/defaults.js +2 -0
  48. package/dist/i18n/defaults.js.map +1 -1
  49. package/dist/i18n/german.js +14 -1
  50. package/dist/i18n/german.js.map +1 -1
  51. package/dist/i18n/kit-labels.d.ts +3 -0
  52. package/dist/i18n/kit-labels.js.map +1 -1
  53. package/dist/i18n/locales/en.js +16 -1
  54. package/dist/i18n/locales/en.js.map +3 -3
  55. package/dist/i18n/locales/es.js +14 -1
  56. package/dist/i18n/locales/es.js.map +1 -1
  57. package/dist/i18n/locales/fr.js +14 -1
  58. package/dist/i18n/locales/fr.js.map +1 -1
  59. package/dist/i18n/locales/hu.js +14 -1
  60. package/dist/i18n/locales/hu.js.map +1 -1
  61. package/dist/i18n/locales/it.js +14 -1
  62. package/dist/i18n/locales/it.js.map +1 -1
  63. package/dist/i18n/locales/zh.js +14 -1
  64. package/dist/i18n/locales/zh.js.map +1 -1
  65. package/dist/i18n/review.js +1 -0
  66. package/dist/i18n/review.js.map +1 -1
  67. package/dist/lib/data-attributes.d.ts +11 -0
  68. package/dist/lib/data-attributes.js +10 -0
  69. package/dist/lib/data-attributes.js.map +1 -0
  70. package/dist/lib/format.d.ts +1 -0
  71. package/dist/lib/format.js +2 -0
  72. package/dist/lib/format.js.map +1 -1
  73. package/dist/lib/minus.d.ts +10 -0
  74. package/dist/lib/minus.js.map +1 -1
  75. package/dist/lib/quiet-focus.d.ts +4 -0
  76. package/dist/lib/quiet-focus.js +19 -0
  77. package/dist/lib/quiet-focus.js.map +1 -0
  78. package/dist/testing/index.d.ts +1 -0
  79. package/dist/testing/index.js +4 -0
  80. package/dist/testing/index.js.map +1 -1
  81. package/dist/testing/react.d.ts +25 -0
  82. package/dist/testing/react.js +19 -0
  83. package/dist/testing/react.js.map +1 -0
  84. package/dist/testing/tour.d.ts +31 -0
  85. package/dist/testing/tour.js +12 -0
  86. package/dist/testing/tour.js.map +1 -0
  87. package/dist/tour/tour-dock.d.ts +42 -0
  88. package/dist/tour/tour-dock.js +80 -0
  89. package/dist/tour/tour-dock.js.map +1 -0
  90. package/dist/tour/tour-engine.d.ts +12 -0
  91. package/dist/tour/tour-engine.js +31 -0
  92. package/dist/tour/tour-engine.js.map +1 -0
  93. package/dist/tour/tour-gates.d.ts +71 -0
  94. package/dist/tour/tour-gates.js +114 -0
  95. package/dist/tour/tour-gates.js.map +1 -0
  96. package/dist/tour/tour-guide-button.d.ts +27 -0
  97. package/dist/tour/tour-guide-button.js +45 -0
  98. package/dist/tour/tour-guide-button.js.map +1 -0
  99. package/dist/tour/tour-guide-labels.d.ts +8 -0
  100. package/dist/tour/tour-guide-labels.js +9 -0
  101. package/dist/tour/tour-guide-labels.js.map +1 -0
  102. package/dist/tour/tour-labels.js +9 -1
  103. package/dist/tour/tour-labels.js.map +1 -1
  104. package/dist/tour/tour.d.ts +144 -9
  105. package/dist/tour/tour.js +598 -59
  106. package/dist/tour/tour.js.map +1 -1
  107. package/dist/tour/use-tour-url-sync.d.ts +7 -2
  108. package/dist/tour/use-tour-url-sync.js +27 -1
  109. package/dist/tour/use-tour-url-sync.js.map +1 -1
  110. package/dist/tour.d.ts +2 -0
  111. package/dist/tour.js +3 -0
  112. package/dist/tour.js.map +1 -1
  113. package/dist/wizard/stepper-nav.js +15 -2
  114. package/dist/wizard/stepper-nav.js.map +1 -1
  115. package/dist/wizard/types.d.ts +11 -0
  116. package/dist/wizard/types.js.map +1 -1
  117. package/dist/wizard/use-wizard.js +11 -5
  118. package/dist/wizard/use-wizard.js.map +1 -1
  119. package/package.json +9 -1
  120. package/src/admin/user-roster.tsx +22 -12
  121. package/src/auth/verify-email.tsx +10 -0
  122. package/src/components/amount-input.tsx +5 -4
  123. package/src/components/autocomplete.tsx +20 -0
  124. package/src/components/combobox-core.tsx +2 -0
  125. package/src/components/combobox-suggestions.tsx +2 -0
  126. package/src/components/combobox.tsx +5 -1
  127. package/src/components/currency-select.tsx +95 -6
  128. package/src/components/data-table-mobile.tsx +99 -8
  129. package/src/components/data-table-row.tsx +1 -0
  130. package/src/components/data-table.tsx +9 -1
  131. package/src/components/dropdown.tsx +2 -0
  132. package/src/components/full-bleed-dialog.tsx +3 -0
  133. package/src/components/inline-entity-combobox.tsx +17 -0
  134. package/src/components/modal.tsx +3 -0
  135. package/src/components/number-input.tsx +8 -3
  136. package/src/components/numpad-sheet.tsx +4 -0
  137. package/src/components/picker-sheet.tsx +4 -0
  138. package/src/components/popover.tsx +2 -0
  139. package/src/i18n/defaults.ts +2 -0
  140. package/src/i18n/german.ts +13 -0
  141. package/src/i18n/kit-labels.tsx +3 -0
  142. package/src/i18n/locales/es.ts +13 -0
  143. package/src/i18n/locales/fr.ts +13 -0
  144. package/src/i18n/locales/hu.ts +13 -0
  145. package/src/i18n/locales/it.ts +13 -0
  146. package/src/i18n/locales/zh.ts +13 -0
  147. package/src/i18n/review.ts +1 -0
  148. package/src/lib/data-attributes.ts +14 -0
  149. package/src/lib/format.ts +2 -0
  150. package/src/lib/minus.ts +10 -0
  151. package/src/lib/quiet-focus.ts +32 -0
  152. package/src/testing/index.ts +8 -0
  153. package/src/testing/react.ts +59 -0
  154. package/src/testing/tour.ts +41 -0
  155. package/src/tour/tour-dock.ts +132 -0
  156. package/src/tour/tour-engine.ts +41 -0
  157. package/src/tour/tour-gates.ts +195 -0
  158. package/src/tour/tour-guide-button.tsx +64 -0
  159. package/src/tour/tour-guide-labels.ts +15 -0
  160. package/src/tour/tour-labels.ts +8 -0
  161. package/src/tour/tour.tsx +989 -86
  162. package/src/tour/use-tour-url-sync.ts +43 -4
  163. package/src/tour.ts +3 -0
  164. package/src/wizard/stepper-nav.tsx +23 -3
  165. package/src/wizard/types.ts +12 -0
  166. package/src/wizard/use-wizard.ts +16 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import { Fragment, useId, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { FIELD_BASE, FIELD_FLOATING_PAD, FIELD_INVALID } from \"./field-base\";\nimport { cn } from \"../lib/cn\";\nimport { useDropdown } from \"./dropdown\";\nimport { takeEscape, useDismissLayer } from \"../hooks/use-dismiss\";\nimport { isImeEnter } from \"../lib/ime\";\nimport { usePhoneLayout } from \"../hooks/use-breakpoint\";\nimport { PickerSheet, SHEET_ROW_CLASS } from \"./picker-sheet\";\nimport { ComboboxFieldLabel, endHintRowProps, GROUP_HEADING_STICKY, useActiveOptionScroll } from \"./combobox-core\";\nimport { useKitLocale } from \"../i18n/kit-labels\";\nimport { rankMatch } from \"../lib/text-match\";\nimport {\n EndHintRow,\n FieldCaption,\n LABEL_IN_ROW,\n LockedReason,\n mergeDescribedBy,\n StaticLabelRow,\n useFieldError,\n useFieldHint,\n useLockReason,\n type DisabledReasonDisplay,\n type FieldHelpProps,\n} from \"./field-parts\";\nimport type { CommitScope } from \"./write-lock\";\nimport { lockedKeyDown, rowClass, SuggestionList, usePrimaryPressOnly } from \"./combobox-suggestions\";\n// The id-keyed sibling lives in inline-entity-combobox.tsx (MOD-9), the list both share\n// in combobox-suggestions.tsx; its public names are still this module's.\nexport { InlineEntityCombobox } from \"./inline-entity-combobox\";\nexport type { InlineEntityComboboxProps } from \"./inline-entity-combobox\";\n\n/**\n * Four of the div's own attributes are omitted because this component already owns\n * the name, with a different meaning: `id` is the INPUT's (a caller labels or\n * automates the field, not the box around it), and `onChange`/`onBlur`/`onSubmit`\n * are the field's — a value, a departure, and \"I mean what I typed\" — rather than\n * the DOM events of the wrapper. Everything else a wrapper needs reaches the root.\n */\nexport interface ComboboxProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"id\" | \"onChange\" | \"onBlur\" | \"onSubmit\">,\n FieldHelpProps {\n value: string;\n onChange: (v: string) => void;\n /** Suggestion pool (e.g. existing payee names). */\n options: string[];\n /** The visible label, a `<label for>` above the field: a ReactNode, as on every kit\n * field (a string until 0.34, refactor audit 2026-10, API-9). Without one, name the\n * field with `aria-label`. */\n label?: ReactNode;\n id?: string;\n placeholder?: string;\n className?: string;\n /** Required and unanswered — see {@link Input}'s `invalid`. Set on the `<input>`\n * itself rather than on the wrapper, which is what let Keksdose's account picker\n * delete the `[&_input]:…` copy of {@link FIELD_INVALID} it had been carrying\n * because this component had no `invalid` of its own. */\n invalid?: boolean;\n /** What is wrong with the value, as {@link Input}'s `error`: rendered under the\n * field, on the `<input>`'s `aria-describedby`, and implies `invalid` (lenkbank's\n * scope fields, which moved here off `<Input list>` + `<datalist>`). */\n error?: ReactNode;\n /**\n * Standing advice for the field — {@link Input}'s `hint`, so the combobox family\n * reads like every other field (keksdose K4: the family had `error` and no `hint`, so\n * the app's pickers carried their captions outside the component, attached to\n * nothing). Plain TEXT is a caption under the field on the input's\n * `aria-describedby`, before any error; a {@link FieldHint} \"?\" rides the label line,\n * or with no label sits at the field's end edge, outside the box.\n */\n hint?: ReactNode;\n /** As `<input disabled>`: no focus, no list, the field's settled look. The chevron\n * stops toggling with it — it is a mouse target the input's own `disabled` does\n * not reach. */\n disabled?: boolean;\n /**\n * Why the value cannot be changed — {@link Button}'s `disabledReason`, for a field\n * that SAVES itself (an inline editor whose blur writes). The input stays focusable\n * and `aria-disabled`, is `readOnly`, opens no list and calls neither `onChange` nor\n * `onSubmit`; the reason is in the kit {@link Tooltip} and on its `aria-describedby`.\n * Wins over `disabled`. The family's lock (keksdose G2) — see {@link InlineEntityCombobox}.\n */\n disabledReason?: ReactNode;\n /** This field COMMITS. Under a locked {@link WriteLockProvider} it is locked the\n * `disabledReason` way with the lock's reason; inside a form with its own Save, leave\n * it off and put `commit` on the Save. No provider, or an unlocked one: no effect. */\n commit?: CommitScope;\n /** Where the reason shows — {@link Button}'s `disabledReasonDisplay`: a line under the\n * field at Large and on a touch screen by default, the tooltip otherwise (DUP-3). */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /** Heading an option belongs under. Supplying it makes this list read exactly\n * like {@link InlineEntityCombobox}'s — one heading per group with its rows\n * indented beneath — instead of a flat list (feedback #136 rework: the payee\n * field sat next to the newly-grouped category field and no longer matched).\n * Omit for a plain list. */\n groupBy?: (option: string) => string;\n /**\n * Something to show at the far end of an option's row — a badge saying what the\n * option IS, as distinct from what it is called.\n *\n * Keksdose's category-name field is the case: its proposals carry per-locale\n * names, so picking one stores a category that follows the UI language, and\n * picking a look-alike custom name does not. That difference is invisible in the\n * label and decides what the row DOES, so the row has to show it. Returning\n * `null` for an option renders nothing and costs no layout.\n *\n * Not rendered in the create row, which by definition names nothing in the pool.\n */\n optionAdornment?: (option: string) => ReactNode;\n /** Focus on mount, the way `<input autoFocus>` does — and, through `onFocus`, open\n * the list with it. A click-the-value inline editor needs it: the cell the user\n * clicked names the field the caret should land in. {@link InlineEntityCombobox}\n * has had it since live #218. */\n autoFocus?: boolean;\n /** Focus genuinely LEFT the field. Not fired by picking a row — the rows suppress\n * `mousedown`, so the input never blurs — which is what makes it usable as a\n * \"close the inline editor\" signal. */\n onBlur?: () => void;\n /** Enter pressed with no row highlighted, i.e. \"I mean what I typed\". The list\n * closes either way; this is for a caller whose Enter also submits a row editor. */\n onSubmit?: () => void;\n /** Rows to offer when the field is empty. 8 on a dropdown, where that is all\n * that fits; the phone sheet asks for more because it has a screen. */\n maxSuggestions?: number;\n searchPlaceholder?: string;\n closeLabel?: string;\n /**\n * The phone sheet's heading — and, as a string, the dialog's accessible name — for a\n * field whose label is drawn by someone else: a bound field's label above it,\n * which `RhfTextCombobox` hands over here (0.24). Default: `label`. Without either, the\n * full-screen sheet opened untitled and unnamed, the one screen on a phone that has to\n * say what it is asking for (live #200).\n */\n sheetTitle?: ReactNode;\n /**\n * Label for the row that COMMITS a value the list does not contain — e.g.\n * `(v) => \\`Add \"${v}\" as payee\\``. Supplying it turns the free text into\n * something you confirm rather than something you leave behind.\n *\n * Keksdose live #212: *\"For the payee input have an apply button, when input is\n * placed like 'add xxx as payee' to confirm. Now it can be put in and closed with\n * the right top X, which seems not intuitive.\"* On the phone sheet the search box\n * IS the value, so typing a brand-new name and dismissing the sheet did commit it —\n * but the only control on offer was the close X, which reads as \"discard\". A named\n * affordance says what the typing did.\n *\n * Omit and the row is not rendered, which is the right default for a list whose\n * values are all supposed to already exist.\n */\n createLabel?: (value: string) => string;\n /**\n * The `<input>` — the control a reader types in and the one focus belongs on — as a\n * React 19 ref prop, the way {@link CountrySelect} takes its trigger's (0.24, kastlan:\n * react-hook-form's focus-on-error calls `focus()` on whatever `field.ref` is handed,\n * and a combobox with no ref inside a hand-wired `RhfField` gave it nothing, so a\n * failed submit could not take the user to it). Not the wrapper: a ref is for focus,\n * measurement and selection, and all three are the input's. `RhfTextCombobox` passes it.\n */\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * Free-text combobox that looks like the shared {@link Select} (same FIELD_BASE\n * styling, chevron and static floating label) but lets the user type a value\n * that isn't in the list — e.g. naming a brand-new payee. Picking from the\n * filtered suggestion list fills the value; typing keeps whatever was entered.\n *\n * Use this instead of an `<Input list=\"…\">` + `<datalist>` so the control is\n * visually and behaviourally consistent with the other dropdowns (feedback\n * #230 — the payee field looked/behaved differently from every other select).\n */\nexport function Combobox(props: ComboboxProps) {\n const {\n value,\n onChange,\n options,\n label,\n id,\n placeholder,\n className,\n groupBy,\n maxSuggestions,\n searchPlaceholder,\n closeLabel,\n sheetTitle,\n createLabel,\n invalid,\n error,\n hint,\n help,\n disabled,\n disabledReason,\n disabledReasonDisplay,\n commit,\n optionAdornment,\n autoFocus,\n onBlur,\n onSubmit,\n ref,\n \"aria-label\": ariaLabel,\n // Off `rest` and onto the <input>, which is the combobox a reader meets: `Field`'s\n // render-prop spreads `{ id, aria-describedby, aria-invalid, aria-required }`, and\n // on the wrapper div the hint and required state described nothing.\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n \"aria-required\": ariaRequired,\n ...rest\n } = props;\n const hintParts = useFieldHint(hint, ariaDescribedBy, { help, name: label ?? ariaLabel });\n const field = useFieldError(error, invalid, hintParts.describedBy, ariaInvalid);\n const generated = useId();\n const fieldId = id ?? generated;\n // Derived from the GENERATED id, never from `id`: a caller's id is theirs to\n // collide with, and `aria-controls` has to resolve.\n const listboxId = `${generated}-listbox`;\n const optionId = (index: number) => `${generated}-option-${index}`;\n // `backCloses` is the desktop half of live #309: the phone's list IS a\n // {@link PickerSheet}, which registers its own history entry, so registering a\n // second one here would cost two Back presses to dismiss one sheet. Its Escape\n // layer is this field's own, below — the list can be open with nothing to show.\n const isPhone = usePhoneLayout();\n const { open, setOpen, wrapperRef, panelRef } = useDropdown({ backCloses: !isPhone, escapeLayer: false });\n const primaryOnly = usePrimaryPressOnly();\n const [active, setActive] = useState(-1);\n // The lock (see `lockedKeyDown`): a lock arriving while the list is up closes it,\n // adjusted while rendering so no frame offers a row that can no longer be taken.\n const lock = useLockReason(commit, disabledReason);\n const locked = lock.locked;\n const inert = locked || Boolean(disabled);\n if (locked && open) setOpen(false);\n // A phone opens the list as a full-screen sheet with its own input, the way a\n // native <select> does — live #200: \"Paid as full screen dialog with input.\n // Similar to the account select that already appears as full screen.\" The\n // anchored list stays for pointer devices, where it is the better shape.\n const sheetInputRef = useRef<HTMLInputElement | null>(null);\n // The box the portalled list hangs off — the inner wrapper, which hugs the input,\n // not the outer one (a grid item that can be taller than the field).\n const fieldRef = useRef<HTMLDivElement>(null);\n\n /**\n * Is the text in the field a QUERY, or just what was picked last time?\n *\n * Keksdose dev#549, filed against the category-name field: *\"Currently it acts kind\n * of a filter and clicking again does not open anything since the previous text is\n * still there likely filtering all other options out.\"* A combobox whose filter is\n * its own value can only ever re-offer the answer it already has — after picking\n * \"REWE\" the list reopens holding one row, the one you are looking at, and changing\n * your mind means clearing the field by hand first.\n *\n * So the text filters only while it is being TYPED; opening the list, by focus or\n * by clicking the field again, puts the whole pool back. {@link InlineEntityCombobox}\n * below has had this since it was written (see its `typedQuery`) and the app's\n * category-name field grew its own copy to get it — this one, the payee field, was\n * the one left with the bug.\n *\n * Not derived from \"does the text exactly match an option\": a custom value that\n * happens to collide with one would then behave differently from every other, and\n * what is being tracked is what the user just did, which is not a property of the\n * string.\n */\n const [typing, setTyping] = useState(false);\n\n const query = typing ? value.trim() : \"\";\n // Folded as every kit list folds (DUP-5): \"zurich\" finds Zürich, by the locale's case.\n const locale = useKitLocale();\n const matches = useMemo(() => {\n const seen = new Set<string>();\n const uniq = options.filter((o) => o && !seen.has(o) && seen.add(o));\n let ranked: string[];\n const cap = maxSuggestions ?? (isPhone ? 50 : 8);\n if (!query) {\n ranked = uniq.slice(0, cap);\n } else {\n // The whole name, then prefix matches, then substring matches — most relevant on\n // top (`rankMatch`; a stable sort keeps the pool's order within a rank).\n ranked = uniq\n .map((o) => ({ o, rank: rankMatch(o, query, { locale }) }))\n .filter((x) => x.rank >= 0)\n .sort((a, b) => a.rank - b.rank)\n .map((x) => x.o)\n .slice(0, cap);\n }\n if (!groupBy) return ranked;\n // Keep each group contiguous so a heading appears once instead of every time\n // the ranking interleaves two groups — while preserving \"best match first\":\n // a Map keeps insertion order, so groups come out ordered by their best-ranked\n // member and members keep their rank order inside the group.\n const byGroup = new Map<string, string[]>();\n for (const o of ranked) {\n const key = groupBy(o);\n if (!byGroup.has(key)) byGroup.set(key, []);\n byGroup.get(key)!.push(o);\n }\n return [...byGroup.values()].flat();\n }, [options, query, groupBy, maxSuggestions, isPhone, locale]);\n\n /**\n * Which rows OPEN a group, and with what heading — computed once for both lists.\n *\n * The desktop list had this as `matches[i - 1]`, which is free; the sheet had it as\n * `matches[matches.indexOf(o) - 1]`, which is a scan of the list per row and another\n * per heading test. That is quadratic in the sheet's own cap of 50, on the branch\n * that runs on the slowest hardware we ship to — and it answers the wrong question\n * besides: `indexOf` finds the FIRST row with that string, so a duplicated option\n * would have compared against a neighbour it is not next to. (`matches` de-duplicates\n * today; that is a property of the memo above, not of the row being rendered.)\n */\n const groupHeadings = useMemo(() => {\n if (!groupBy) return null;\n const heads = new Map<number, string>();\n let prev: string | undefined;\n matches.forEach((o, i) => {\n const group = groupBy(o);\n if (group != null && group !== prev) heads.set(i, group);\n prev = group;\n });\n return heads;\n }, [matches, groupBy]);\n\n const take = (v: string) => {\n if (locked) return;\n onChange(v);\n setOpen(false);\n setActive(-1);\n // What is in the field is now an ANSWER, not a query — so reopening offers the\n // whole pool again rather than a one-row filter of the value just chosen.\n setTyping(false);\n };\n\n // Offered only when the typed text is genuinely NOT in the pool: an exact\n // (case-insensitive) match is an existing entry the list is already showing, and a\n // second way to pick it would be noise. Compared against `options`, not `matches` —\n // `matches` is capped, so a pool of 300 payees would otherwise offer to \"add\" one\n // that exists but fell off the end of the list.\n // What the field claims the keyboard is on. Only on a pointer device: the phone\n // renders its rows in a {@link PickerSheet} whose own search box owns focus, and a\n // field pointing at an id that is not there is worse than one pointing nowhere.\n const activeId = !isPhone && active >= 0 && active < matches.length ? optionId(active) : undefined;\n useActiveOptionScroll(activeId);\n\n // While locked the field sits in the reason's Tooltip — in a fragment with a hidden\n // copy of the reason, Button's anatomy; `block` so a full-width field stays full width.\n const withLock = (box: ReactNode) =>\n locked ? (\n <LockedReason lock={lock} display={disabledReasonDisplay} className=\"block\">\n {box}\n </LockedReason>\n ) : (\n box\n );\n\n const typed = value.trim();\n const createRow =\n createLabel && typed.length > 0 && !options.some((o) => o.toLowerCase() === typed.toLowerCase())\n ? createLabel(typed)\n : null;\n\n // The list is a layer on the Escape stack while it SHOWS (Wave 2, DUP-1): an Escape\n // over an empty \"open\" list is the dialog's, as it always was. On a phone the sheet\n // is the layer.\n const showing = !isPhone && open && !inert && (matches.length > 0 || Boolean(createRow));\n useDismissLayer(showing, () => {\n setOpen(false);\n setActive(-1);\n });\n\n return (\n // `rest` dresses the outer box — a `data-tour` anchor, a test id. Not the NAME,\n // description, invalid or required state: those belong on the <input> below,\n // which is the combobox a reader meets. Spread FIRST, so the field's ARIA and the\n // handlers carrying live #309 and dev#549 cannot be replaced from outside.\n <div {...rest} ref={wrapperRef} className={cn(\"relative\", className)}>\n {/* A real <label for> since lenkbank's tests met a field `getByLabelText` could\n not find: it used to be a <span>, with the text copied onto `aria-label`. The\n name a reader hears is the same words either way. With a \"?\" it moves into a\n row after the field, below. */}\n {label !== undefined && hintParts.labelHint === undefined && (\n <ComboboxFieldLabel htmlFor={fieldId} className={inert ? \"opacity-50\" : undefined}>\n {label}\n </ComboboxFieldLabel>\n )}\n <EndHintRow {...endHintRowProps(\"hint\" in props, label !== undefined, hintParts.labelHint)}>\n {withLock(\n /* The chevron centers against this inner wrapper, which hugs the input.\n The outer div can be taller than the input (as a grid item it\n stretches to the row height, e.g. next to the editor's category cell\n with its split button), which used to drag a top-1/2 chevron down to\n the input's bottom edge (feedback #248).\n Dimmed as a whole when disabled (or locked), the way EntityCombobox dims its\n trigger. FIELD_BASE's grey alone left a disabled picker looking like a\n filled-in one beside the pickers that do dim (the label is not the input's\n `peer`, so it is dimmed by hand above). */\n <div ref={fieldRef} className={cn(\"relative\", inert && \"cursor-not-allowed opacity-50\")}>\n <input\n ref={ref}\n id={fieldId}\n value={value}\n placeholder={placeholder}\n // The caller's name, over the <label for> above — which is what names the\n // field otherwise (dev#477: a field with neither announces only its text).\n aria-label={ariaLabel}\n role=\"combobox\"\n aria-expanded={open}\n // The list this field is the mouth of. Required by the role, and the half\n // that was missing: the field said it was expanded and never said what it\n // had expanded, so a reader had no way from the box to the options\n // (ESLint's `role-has-required-aria-props`, the audit's §a11y).\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-invalid={field.isInvalid || undefined}\n aria-describedby={mergeDescribedBy(field.describedBy, locked && lock.reasonId)}\n aria-required={ariaRequired}\n autoComplete=\"off\"\n // Locked: focusable, `readOnly`, `aria-disabled` — see `lockedKeyDown`.\n disabled={locked ? undefined : disabled}\n readOnly={locked || undefined}\n aria-disabled={locked || undefined}\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 onBlur={onBlur}\n onMouseDown={primaryOnly.onMouseDown}\n onFocus={() => {\n // A back/forward mouse button focuses this field on its way to\n // navigating; it is not a request to open anything (live #309 rework).\n // A locked field takes focus to say why, and opens nothing.\n if (primaryOnly.fromAuxButton() || locked) return;\n setOpen(true);\n setTyping(false);\n // The sheet carries its own input, so the field behind it must not also\n // pull up the keyboard and scroll the page under the dialog.\n if (isPhone) sheetInputRef.current?.focus();\n }}\n // A CLICK as well as focus — the other half of dev#549. Picking a suggestion\n // closes the list without moving focus (the rows suppress `mousedown` on\n // purpose, so the input never blurred), which means clicking the field again\n // fires no `focus` event at all and the list stayed shut. \"Does not open\n // anything\" was literally true.\n onClick={() => {\n if (locked) return;\n setOpen(true);\n setTyping(false);\n }}\n // `inputMode=\"none\"` rather than readOnly: the field must not look\n // uneditable (FIELD_BASE greys a read-only field since dev#468) and must\n // still take focus — it just has no keyboard of its own, the same trick\n // the amount field uses for the numpad.\n inputMode={isPhone ? \"none\" : undefined}\n onChange={(e) => {\n if (locked) return;\n onChange(e.target.value);\n setOpen(true);\n setActive(-1);\n setTyping(true);\n }}\n onKeyDown={(e) => {\n if (locked) return lockedKeyDown(e);\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n setActive((i) => Math.min(i + 1, matches.length - 1));\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setActive((i) => Math.max(i - 1, 0));\n } else if (e.key === \"Enter\") {\n // The Enter that confirms an IME composition is the IME's: it picks no\n // row and submits nothing (BUG-9).\n if (isImeEnter(e)) return;\n if (open && active >= 0 && active < matches.length) {\n e.preventDefault();\n take(matches[active]);\n } else {\n // No row highlighted: the typed text is the answer. `preventDefault`\n // only when a caller is taking Enter, so a plain form submit is\n // otherwise left alone.\n if (onSubmit) e.preventDefault();\n setOpen(false);\n onSubmit?.();\n }\n } else if (e.key === \"Escape\") {\n // A list that is SHOWING is the top of the Escape stack, and the key\n // closes it and stops here: a Modal or FullBleedDialog around the field\n // otherwise closed with it, form and all (round 0.34 BUG-1). With no\n // list on screen the key goes on to whoever wants it.\n if (showing && takeEscape(e)) return;\n setOpen(false);\n setActive(-1);\n } else if (e.key === \"Tab\") {\n // Closes, and lets the browser take the Tab: focus is in THIS input,\n // which is staying, so there is nothing to catch — unlike the pickers\n // whose focus sits inside a portalled panel.\n setOpen(false);\n setActive(-1);\n }\n // Home/End are deliberately absent. The APG gives them to the list only\n // where the combobox is not editable; here the text IS the value, a\n // payee name is long enough to want the caret moved to its start, and\n // the desktop list is capped at 8 rows — so jumping it would be worth\n // almost nothing and would cost the one gesture that field is used with.\n }}\n className={cn(\n FIELD_BASE,\n label !== undefined && FIELD_FLOATING_PAD,\n \"pe-9\",\n field.isInvalid && FIELD_INVALID,\n )}\n />\n <ChevronDown\n aria-hidden\n onMouseDown={(e) => {\n // Toggle on the chevron without stealing focus from the input.\n e.preventDefault();\n if (!inert) setOpen((o) => !o);\n }}\n className={cn(\n \"absolute end-2.5 top-1/2 size-4 -translate-y-1/2 text-placeholder\",\n // The box above does the dimming; dimming here too would halve it again.\n !inert && \"cursor-pointer\",\n )}\n />\n </div>,\n )}\n </EndHintRow>\n {/* The label and its \"?\" share the top strip — after the field in the DOM, so the\n \"?\" follows the control in the tab order, as it does on Input and Select. */}\n {label !== undefined && hintParts.labelHint !== undefined && (\n <StaticLabelRow hint={hintParts.labelHint}>\n <ComboboxFieldLabel htmlFor={fieldId} className={cn(LABEL_IN_ROW, inert && \"opacity-50\")}>\n {label}\n </ComboboxFieldLabel>\n </StaticLabelRow>\n )}\n <FieldCaption parts={hintParts} />\n {field.errorEl}\n {isPhone && (\n <PickerSheet\n open={open && !inert}\n onClose={() => setOpen(false)}\n title={sheetTitle ?? label}\n // The sheet's input IS the field: this is a free-text control, so what is\n // typed here is the value (a brand-new payee is just a name nothing\n // matches), and the list below narrows as it changes.\n query={value}\n onQueryChange={(v) => {\n onChange(v);\n setTyping(true);\n }}\n searchPlaceholder={searchPlaceholder ?? placeholder}\n inputRef={sheetInputRef}\n closeLabel={closeLabel}\n >\n <ul id={listboxId} role=\"listbox\">\n {createRow && (\n // `role=\"option\"` rides the BUTTON, not the <li> around it: an option\n // may not contain a separately focusable control, and the button is\n // what a pointer presses. Same shape `CommandPalette` has always had.\n <li role=\"presentation\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={false}\n onClick={() => take(typed)}\n className={cn(SHEET_ROW_CLASS, \"font-medium text-brand\")}\n >\n {createRow}\n </button>\n </li>\n )}\n {matches.map((o, i) => {\n const group = groupHeadings?.get(i);\n return (\n <Fragment key={o}>\n {group !== undefined && (\n <li\n role=\"presentation\"\n className={cn(\n GROUP_HEADING_STICKY,\n \"px-4 pb-0.5 pt-3 text-caption font-semibold uppercase tracking-wide text-muted\",\n )}\n >\n {group}\n </li>\n )}\n <li role=\"presentation\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={o === value}\n onClick={() => take(o)}\n className={cn(\n SHEET_ROW_CLASS,\n optionAdornment && \"flex items-center justify-between gap-2\",\n )}\n >\n {optionAdornment ? <span className=\"truncate-until-large\">{o}</span> : o}\n {optionAdornment?.(o)}\n </button>\n </li>\n </Fragment>\n );\n })}\n </ul>\n </PickerSheet>\n )}\n {showing && (\n <SuggestionList id={listboxId} anchorRef={fieldRef} panelRef={panelRef}>\n {createRow && (\n <li role=\"presentation\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={false}\n tabIndex={-1}\n onMouseDown={(e) => {\n // mousedown, like the rows below: the input's blur would otherwise\n // close the list before the click landed.\n e.preventDefault();\n take(typed);\n }}\n className={cn(rowClass(false), \"font-medium text-brand\")}\n >\n {createRow}\n </button>\n </li>\n )}\n {matches.map((o, i) => {\n // Heading at each group boundary only — `matches` is group-contiguous, so\n // the boundaries are a property of the list rather than of the branch\n // drawing it. See `groupHeadings`.\n const group = groupHeadings?.get(i);\n return (\n <Fragment key={o}>\n {group !== undefined && (\n <li\n role=\"presentation\"\n className={cn(\n GROUP_HEADING_STICKY,\n \"px-3 pb-0.5 pt-2 text-caption font-semibold uppercase tracking-wide text-muted first:pt-1\",\n )}\n >\n {group}\n </li>\n )}\n <li role=\"presentation\">\n <button\n type=\"button\"\n id={optionId(i)}\n role=\"option\"\n // CHOSEN, not highlighted. The row the arrows are on is named by\n // the field's `aria-activedescendant`; saying \"selected\" for it\n // would tell a reader that the row they are passing over is\n // already the answer.\n aria-selected={o === value}\n // Focus stays in the field — that is what\n // `aria-activedescendant` is for — so the rows are not tab stops.\n tabIndex={-1}\n onMouseDown={(e) => {\n // mousedown (not click) so the blur from the input firing first\n // doesn't close the list before the selection registers.\n e.preventDefault();\n take(o);\n }}\n onMouseEnter={() => setActive(i)}\n className={cn(\n rowClass(i === active),\n group != null && \"ps-6\",\n // A row with a badge is a flex row so the label truncates and the\n // badge keeps its width; without one it stays the plain block the\n // other lists render, so nothing shifts for callers that pass none.\n // From Large up the label wraps instead (`truncate-until-large`,\n // text size §10.17, round 0.34 T1), as the badge-less row does.\n optionAdornment && \"flex items-center justify-between gap-2\",\n )}\n >\n {optionAdornment ? <span className=\"truncate-until-large\">{o}</span> : o}\n {optionAdornment?.(o)}\n </button>\n </li>\n </Fragment>\n );\n })}\n </SuggestionList>\n )}\n </div>\n );\n}\n"],"mappings":";AAyVM,cAgDI,YAhDJ;AAzVN,SAAS,UAAU,OAAO,SAAS,QAAQ,gBAAgB;AAE3D,SAAS,mBAAmB;AAC5B,SAAS,YAAY,oBAAoB,qBAAqB;AAC9D,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,YAAY,uBAAuB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,aAAa,uBAAuB;AAC7C,SAAS,oBAAoB,iBAAiB,sB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../../src/components/combobox.tsx"],"sourcesContent":["import { Fragment, useId, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { FIELD_BASE, FIELD_FLOATING_PAD, FIELD_INVALID } from \"./field-base\";\nimport { cn } from \"../lib/cn\";\nimport { useDropdown } from \"./dropdown\";\nimport { takeEscape, useDismissLayer } from \"../hooks/use-dismiss\";\nimport { isImeEnter } from \"../lib/ime\";\nimport { isQuietFocus } from \"../lib/quiet-focus\";\nimport { usePhoneLayout } from \"../hooks/use-breakpoint\";\nimport { PickerSheet, SHEET_ROW_CLASS } from \"./picker-sheet\";\nimport { ComboboxFieldLabel, endHintRowProps, GROUP_HEADING_STICKY, useActiveOptionScroll } from \"./combobox-core\";\nimport { useKitLocale } from \"../i18n/kit-labels\";\nimport { rankMatch } from \"../lib/text-match\";\nimport {\n EndHintRow,\n FieldCaption,\n LABEL_IN_ROW,\n LockedReason,\n mergeDescribedBy,\n StaticLabelRow,\n useFieldError,\n useFieldHint,\n useLockReason,\n type DisabledReasonDisplay,\n type FieldHelpProps,\n} from \"./field-parts\";\nimport type { CommitScope } from \"./write-lock\";\nimport { lockedKeyDown, rowClass, SuggestionList, usePrimaryPressOnly } from \"./combobox-suggestions\";\n// The id-keyed sibling lives in inline-entity-combobox.tsx (MOD-9), the list both share\n// in combobox-suggestions.tsx; its public names are still this module's.\nexport { InlineEntityCombobox } from \"./inline-entity-combobox\";\nexport type { InlineEntityComboboxProps } from \"./inline-entity-combobox\";\n\n/**\n * Four of the div's own attributes are omitted because this component already owns\n * the name, with a different meaning: `id` is the INPUT's (a caller labels or\n * automates the field, not the box around it), and `onChange`/`onBlur`/`onSubmit`\n * are the field's — a value, a departure, and \"I mean what I typed\" — rather than\n * the DOM events of the wrapper. Everything else a wrapper needs reaches the root.\n */\nexport interface ComboboxProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"id\" | \"onChange\" | \"onBlur\" | \"onSubmit\">,\n FieldHelpProps {\n value: string;\n onChange: (v: string) => void;\n /** Suggestion pool (e.g. existing payee names). */\n options: string[];\n /** The visible label, a `<label for>` above the field: a ReactNode, as on every kit\n * field (a string until 0.34, refactor audit 2026-10, API-9). Without one, name the\n * field with `aria-label`. */\n label?: ReactNode;\n id?: string;\n placeholder?: string;\n className?: string;\n /** Required and unanswered — see {@link Input}'s `invalid`. Set on the `<input>`\n * itself rather than on the wrapper, which is what let Keksdose's account picker\n * delete the `[&_input]:…` copy of {@link FIELD_INVALID} it had been carrying\n * because this component had no `invalid` of its own. */\n invalid?: boolean;\n /** What is wrong with the value, as {@link Input}'s `error`: rendered under the\n * field, on the `<input>`'s `aria-describedby`, and implies `invalid` (lenkbank's\n * scope fields, which moved here off `<Input list>` + `<datalist>`). */\n error?: ReactNode;\n /**\n * Standing advice for the field — {@link Input}'s `hint`, so the combobox family\n * reads like every other field (keksdose K4: the family had `error` and no `hint`, so\n * the app's pickers carried their captions outside the component, attached to\n * nothing). Plain TEXT is a caption under the field on the input's\n * `aria-describedby`, before any error; a {@link FieldHint} \"?\" rides the label line,\n * or with no label sits at the field's end edge, outside the box.\n */\n hint?: ReactNode;\n /** As `<input disabled>`: no focus, no list, the field's settled look. The chevron\n * stops toggling with it — it is a mouse target the input's own `disabled` does\n * not reach. */\n disabled?: boolean;\n /**\n * Why the value cannot be changed — {@link Button}'s `disabledReason`, for a field\n * that SAVES itself (an inline editor whose blur writes). The input stays focusable\n * and `aria-disabled`, is `readOnly`, opens no list and calls neither `onChange` nor\n * `onSubmit`; the reason is in the kit {@link Tooltip} and on its `aria-describedby`.\n * Wins over `disabled`. The family's lock (keksdose G2) — see {@link InlineEntityCombobox}.\n */\n disabledReason?: ReactNode;\n /** This field COMMITS. Under a locked {@link WriteLockProvider} it is locked the\n * `disabledReason` way with the lock's reason; inside a form with its own Save, leave\n * it off and put `commit` on the Save. No provider, or an unlocked one: no effect. */\n commit?: CommitScope;\n /** Where the reason shows — {@link Button}'s `disabledReasonDisplay`: a line under the\n * field at Large and on a touch screen by default, the tooltip otherwise (DUP-3). */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /** Heading an option belongs under. Supplying it makes this list read exactly\n * like {@link InlineEntityCombobox}'s — one heading per group with its rows\n * indented beneath — instead of a flat list (feedback #136 rework: the payee\n * field sat next to the newly-grouped category field and no longer matched).\n * Omit for a plain list. */\n groupBy?: (option: string) => string;\n /**\n * Something to show at the far end of an option's row — a badge saying what the\n * option IS, as distinct from what it is called.\n *\n * Keksdose's category-name field is the case: its proposals carry per-locale\n * names, so picking one stores a category that follows the UI language, and\n * picking a look-alike custom name does not. That difference is invisible in the\n * label and decides what the row DOES, so the row has to show it. Returning\n * `null` for an option renders nothing and costs no layout.\n *\n * Not rendered in the create row, which by definition names nothing in the pool.\n */\n optionAdornment?: (option: string) => ReactNode;\n /** Focus on mount, the way `<input autoFocus>` does — and, through `onFocus`, open\n * the list with it. A click-the-value inline editor needs it: the cell the user\n * clicked names the field the caret should land in. {@link InlineEntityCombobox}\n * has had it since live #218. */\n autoFocus?: boolean;\n /** Focus genuinely LEFT the field. Not fired by picking a row — the rows suppress\n * `mousedown`, so the input never blurs — which is what makes it usable as a\n * \"close the inline editor\" signal. */\n onBlur?: () => void;\n /** Enter pressed with no row highlighted, i.e. \"I mean what I typed\". The list\n * closes either way; this is for a caller whose Enter also submits a row editor. */\n onSubmit?: () => void;\n /** Rows to offer when the field is empty. 8 on a dropdown, where that is all\n * that fits; the phone sheet asks for more because it has a screen. */\n maxSuggestions?: number;\n searchPlaceholder?: string;\n closeLabel?: string;\n /**\n * The phone sheet's heading — and, as a string, the dialog's accessible name — for a\n * field whose label is drawn by someone else: a bound field's label above it,\n * which `RhfTextCombobox` hands over here (0.24). Default: `label`. Without either, the\n * full-screen sheet opened untitled and unnamed, the one screen on a phone that has to\n * say what it is asking for (live #200).\n */\n sheetTitle?: ReactNode;\n /**\n * Label for the row that COMMITS a value the list does not contain — e.g.\n * `(v) => \\`Add \"${v}\" as payee\\``. Supplying it turns the free text into\n * something you confirm rather than something you leave behind.\n *\n * Keksdose live #212: *\"For the payee input have an apply button, when input is\n * placed like 'add xxx as payee' to confirm. Now it can be put in and closed with\n * the right top X, which seems not intuitive.\"* On the phone sheet the search box\n * IS the value, so typing a brand-new name and dismissing the sheet did commit it —\n * but the only control on offer was the close X, which reads as \"discard\". A named\n * affordance says what the typing did.\n *\n * Omit and the row is not rendered, which is the right default for a list whose\n * values are all supposed to already exist.\n */\n createLabel?: (value: string) => string;\n /**\n * The `<input>` — the control a reader types in and the one focus belongs on — as a\n * React 19 ref prop, the way {@link CountrySelect} takes its trigger's (0.24, kastlan:\n * react-hook-form's focus-on-error calls `focus()` on whatever `field.ref` is handed,\n * and a combobox with no ref inside a hand-wired `RhfField` gave it nothing, so a\n * failed submit could not take the user to it). Not the wrapper: a ref is for focus,\n * measurement and selection, and all three are the input's. `RhfTextCombobox` passes it.\n */\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * Free-text combobox that looks like the shared {@link Select} (same FIELD_BASE\n * styling, chevron and static floating label) but lets the user type a value\n * that isn't in the list — e.g. naming a brand-new payee. Picking from the\n * filtered suggestion list fills the value; typing keeps whatever was entered.\n *\n * Use this instead of an `<Input list=\"…\">` + `<datalist>` so the control is\n * visually and behaviourally consistent with the other dropdowns (feedback\n * #230 — the payee field looked/behaved differently from every other select).\n */\nexport function Combobox(props: ComboboxProps) {\n const {\n value,\n onChange,\n options,\n label,\n id,\n placeholder,\n className,\n groupBy,\n maxSuggestions,\n searchPlaceholder,\n closeLabel,\n sheetTitle,\n createLabel,\n invalid,\n error,\n hint,\n help,\n disabled,\n disabledReason,\n disabledReasonDisplay,\n commit,\n optionAdornment,\n autoFocus,\n onBlur,\n onSubmit,\n ref,\n \"aria-label\": ariaLabel,\n // Off `rest` and onto the <input>, which is the combobox a reader meets: `Field`'s\n // render-prop spreads `{ id, aria-describedby, aria-invalid, aria-required }`, and\n // on the wrapper div the hint and required state described nothing.\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n \"aria-required\": ariaRequired,\n ...rest\n } = props;\n const hintParts = useFieldHint(hint, ariaDescribedBy, { help, name: label ?? ariaLabel });\n const field = useFieldError(error, invalid, hintParts.describedBy, ariaInvalid);\n const generated = useId();\n const fieldId = id ?? generated;\n // Derived from the GENERATED id, never from `id`: a caller's id is theirs to\n // collide with, and `aria-controls` has to resolve.\n const listboxId = `${generated}-listbox`;\n const optionId = (index: number) => `${generated}-option-${index}`;\n // `backCloses` is the desktop half of live #309: the phone's list IS a\n // {@link PickerSheet}, which registers its own history entry, so registering a\n // second one here would cost two Back presses to dismiss one sheet. Its Escape\n // layer is this field's own, below — the list can be open with nothing to show.\n const isPhone = usePhoneLayout();\n const { open, setOpen, wrapperRef, panelRef } = useDropdown({ backCloses: !isPhone, escapeLayer: false });\n const primaryOnly = usePrimaryPressOnly();\n const [active, setActive] = useState(-1);\n // The lock (see `lockedKeyDown`): a lock arriving while the list is up closes it,\n // adjusted while rendering so no frame offers a row that can no longer be taken.\n const lock = useLockReason(commit, disabledReason);\n const locked = lock.locked;\n const inert = locked || Boolean(disabled);\n if (locked && open) setOpen(false);\n // A phone opens the list as a full-screen sheet with its own input, the way a\n // native <select> does — live #200: \"Paid as full screen dialog with input.\n // Similar to the account select that already appears as full screen.\" The\n // anchored list stays for pointer devices, where it is the better shape.\n const sheetInputRef = useRef<HTMLInputElement | null>(null);\n // The box the portalled list hangs off — the inner wrapper, which hugs the input,\n // not the outer one (a grid item that can be taller than the field).\n const fieldRef = useRef<HTMLDivElement>(null);\n\n /**\n * Is the text in the field a QUERY, or just what was picked last time?\n *\n * Keksdose dev#549, filed against the category-name field: *\"Currently it acts kind\n * of a filter and clicking again does not open anything since the previous text is\n * still there likely filtering all other options out.\"* A combobox whose filter is\n * its own value can only ever re-offer the answer it already has — after picking\n * \"REWE\" the list reopens holding one row, the one you are looking at, and changing\n * your mind means clearing the field by hand first.\n *\n * So the text filters only while it is being TYPED; opening the list, by focus or\n * by clicking the field again, puts the whole pool back. {@link InlineEntityCombobox}\n * below has had this since it was written (see its `typedQuery`) and the app's\n * category-name field grew its own copy to get it — this one, the payee field, was\n * the one left with the bug.\n *\n * Not derived from \"does the text exactly match an option\": a custom value that\n * happens to collide with one would then behave differently from every other, and\n * what is being tracked is what the user just did, which is not a property of the\n * string.\n */\n const [typing, setTyping] = useState(false);\n\n const query = typing ? value.trim() : \"\";\n // Folded as every kit list folds (DUP-5): \"zurich\" finds Zürich, by the locale's case.\n const locale = useKitLocale();\n const matches = useMemo(() => {\n const seen = new Set<string>();\n const uniq = options.filter((o) => o && !seen.has(o) && seen.add(o));\n let ranked: string[];\n const cap = maxSuggestions ?? (isPhone ? 50 : 8);\n if (!query) {\n ranked = uniq.slice(0, cap);\n } else {\n // The whole name, then prefix matches, then substring matches — most relevant on\n // top (`rankMatch`; a stable sort keeps the pool's order within a rank).\n ranked = uniq\n .map((o) => ({ o, rank: rankMatch(o, query, { locale }) }))\n .filter((x) => x.rank >= 0)\n .sort((a, b) => a.rank - b.rank)\n .map((x) => x.o)\n .slice(0, cap);\n }\n if (!groupBy) return ranked;\n // Keep each group contiguous so a heading appears once instead of every time\n // the ranking interleaves two groups — while preserving \"best match first\":\n // a Map keeps insertion order, so groups come out ordered by their best-ranked\n // member and members keep their rank order inside the group.\n const byGroup = new Map<string, string[]>();\n for (const o of ranked) {\n const key = groupBy(o);\n if (!byGroup.has(key)) byGroup.set(key, []);\n byGroup.get(key)!.push(o);\n }\n return [...byGroup.values()].flat();\n }, [options, query, groupBy, maxSuggestions, isPhone, locale]);\n\n /**\n * Which rows OPEN a group, and with what heading — computed once for both lists.\n *\n * The desktop list had this as `matches[i - 1]`, which is free; the sheet had it as\n * `matches[matches.indexOf(o) - 1]`, which is a scan of the list per row and another\n * per heading test. That is quadratic in the sheet's own cap of 50, on the branch\n * that runs on the slowest hardware we ship to — and it answers the wrong question\n * besides: `indexOf` finds the FIRST row with that string, so a duplicated option\n * would have compared against a neighbour it is not next to. (`matches` de-duplicates\n * today; that is a property of the memo above, not of the row being rendered.)\n */\n const groupHeadings = useMemo(() => {\n if (!groupBy) return null;\n const heads = new Map<number, string>();\n let prev: string | undefined;\n matches.forEach((o, i) => {\n const group = groupBy(o);\n if (group != null && group !== prev) heads.set(i, group);\n prev = group;\n });\n return heads;\n }, [matches, groupBy]);\n\n const take = (v: string) => {\n if (locked) return;\n onChange(v);\n setOpen(false);\n setActive(-1);\n // What is in the field is now an ANSWER, not a query — so reopening offers the\n // whole pool again rather than a one-row filter of the value just chosen.\n setTyping(false);\n };\n\n // Offered only when the typed text is genuinely NOT in the pool: an exact\n // (case-insensitive) match is an existing entry the list is already showing, and a\n // second way to pick it would be noise. Compared against `options`, not `matches` —\n // `matches` is capped, so a pool of 300 payees would otherwise offer to \"add\" one\n // that exists but fell off the end of the list.\n // What the field claims the keyboard is on. Only on a pointer device: the phone\n // renders its rows in a {@link PickerSheet} whose own search box owns focus, and a\n // field pointing at an id that is not there is worse than one pointing nowhere.\n const activeId = !isPhone && active >= 0 && active < matches.length ? optionId(active) : undefined;\n useActiveOptionScroll(activeId);\n\n // While locked the field sits in the reason's Tooltip — in a fragment with a hidden\n // copy of the reason, Button's anatomy; `block` so a full-width field stays full width.\n const withLock = (box: ReactNode) =>\n locked ? (\n <LockedReason lock={lock} display={disabledReasonDisplay} className=\"block\">\n {box}\n </LockedReason>\n ) : (\n box\n );\n\n const typed = value.trim();\n const createRow =\n createLabel && typed.length > 0 && !options.some((o) => o.toLowerCase() === typed.toLowerCase())\n ? createLabel(typed)\n : null;\n\n // The list is a layer on the Escape stack while it SHOWS (Wave 2, DUP-1): an Escape\n // over an empty \"open\" list is the dialog's, as it always was. On a phone the sheet\n // is the layer.\n const showing = !isPhone && open && !inert && (matches.length > 0 || Boolean(createRow));\n useDismissLayer(showing, () => {\n setOpen(false);\n setActive(-1);\n });\n\n return (\n // `rest` dresses the outer box — a `data-tour` anchor, a test id. Not the NAME,\n // description, invalid or required state: those belong on the <input> below,\n // which is the combobox a reader meets. Spread FIRST, so the field's ARIA and the\n // handlers carrying live #309 and dev#549 cannot be replaced from outside.\n <div {...rest} ref={wrapperRef} className={cn(\"relative\", className)}>\n {/* A real <label for> since lenkbank's tests met a field `getByLabelText` could\n not find: it used to be a <span>, with the text copied onto `aria-label`. The\n name a reader hears is the same words either way. With a \"?\" it moves into a\n row after the field, below. */}\n {label !== undefined && hintParts.labelHint === undefined && (\n <ComboboxFieldLabel htmlFor={fieldId} className={inert ? \"opacity-50\" : undefined}>\n {label}\n </ComboboxFieldLabel>\n )}\n <EndHintRow {...endHintRowProps(\"hint\" in props, label !== undefined, hintParts.labelHint)}>\n {withLock(\n /* The chevron centers against this inner wrapper, which hugs the input.\n The outer div can be taller than the input (as a grid item it\n stretches to the row height, e.g. next to the editor's category cell\n with its split button), which used to drag a top-1/2 chevron down to\n the input's bottom edge (feedback #248).\n Dimmed as a whole when disabled (or locked), the way EntityCombobox dims its\n trigger. FIELD_BASE's grey alone left a disabled picker looking like a\n filled-in one beside the pickers that do dim (the label is not the input's\n `peer`, so it is dimmed by hand above). */\n <div ref={fieldRef} className={cn(\"relative\", inert && \"cursor-not-allowed opacity-50\")}>\n <input\n ref={ref}\n id={fieldId}\n value={value}\n placeholder={placeholder}\n // The caller's name, over the <label for> above — which is what names the\n // field otherwise (dev#477: a field with neither announces only its text).\n aria-label={ariaLabel}\n role=\"combobox\"\n aria-expanded={open}\n // The list this field is the mouth of. Required by the role, and the half\n // that was missing: the field said it was expanded and never said what it\n // had expanded, so a reader had no way from the box to the options\n // (ESLint's `role-has-required-aria-props`, the audit's §a11y).\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-invalid={field.isInvalid || undefined}\n aria-describedby={mergeDescribedBy(field.describedBy, locked && lock.reasonId)}\n aria-required={ariaRequired}\n autoComplete=\"off\"\n // Locked: focusable, `readOnly`, `aria-disabled` — see `lockedKeyDown`.\n disabled={locked ? undefined : disabled}\n readOnly={locked || undefined}\n aria-disabled={locked || undefined}\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 onBlur={onBlur}\n onMouseDown={primaryOnly.onMouseDown}\n onFocus={(e) => {\n // A back/forward mouse button focuses this field on its way to\n // navigating; it is not a request to open anything (live #309 rework).\n // A locked field takes focus to say why, and opens nothing.\n if (primaryOnly.fromAuxButton() || locked) return;\n // The tour's focus on arrival (§11.8) opens nothing: the list would cover\n // its card (0.50.1). The click handler below still opens on a click.\n if (isQuietFocus(e.currentTarget)) return;\n setOpen(true);\n setTyping(false);\n // The sheet carries its own input, so the field behind it must not also\n // pull up the keyboard and scroll the page under the dialog.\n if (isPhone) sheetInputRef.current?.focus();\n }}\n // A CLICK as well as focus — the other half of dev#549. Picking a suggestion\n // closes the list without moving focus (the rows suppress `mousedown` on\n // purpose, so the input never blurred), which means clicking the field again\n // fires no `focus` event at all and the list stayed shut. \"Does not open\n // anything\" was literally true.\n onClick={() => {\n if (locked) return;\n setOpen(true);\n setTyping(false);\n }}\n // `inputMode=\"none\"` rather than readOnly: the field must not look\n // uneditable (FIELD_BASE greys a read-only field since dev#468) and must\n // still take focus — it just has no keyboard of its own, the same trick\n // the amount field uses for the numpad.\n inputMode={isPhone ? \"none\" : undefined}\n onChange={(e) => {\n if (locked) return;\n onChange(e.target.value);\n setOpen(true);\n setActive(-1);\n setTyping(true);\n }}\n onKeyDown={(e) => {\n if (locked) return lockedKeyDown(e);\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n setActive((i) => Math.min(i + 1, matches.length - 1));\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setActive((i) => Math.max(i - 1, 0));\n } else if (e.key === \"Enter\") {\n // The Enter that confirms an IME composition is the IME's: it picks no\n // row and submits nothing (BUG-9).\n if (isImeEnter(e)) return;\n if (open && active >= 0 && active < matches.length) {\n e.preventDefault();\n take(matches[active]);\n } else {\n // No row highlighted: the typed text is the answer. `preventDefault`\n // only when a caller is taking Enter, so a plain form submit is\n // otherwise left alone.\n if (onSubmit) e.preventDefault();\n setOpen(false);\n onSubmit?.();\n }\n } else if (e.key === \"Escape\") {\n // A list that is SHOWING is the top of the Escape stack, and the key\n // closes it and stops here: a Modal or FullBleedDialog around the field\n // otherwise closed with it, form and all (round 0.34 BUG-1). With no\n // list on screen the key goes on to whoever wants it.\n if (showing && takeEscape(e)) return;\n setOpen(false);\n setActive(-1);\n } else if (e.key === \"Tab\") {\n // Closes, and lets the browser take the Tab: focus is in THIS input,\n // which is staying, so there is nothing to catch — unlike the pickers\n // whose focus sits inside a portalled panel.\n setOpen(false);\n setActive(-1);\n }\n // Home/End are deliberately absent. The APG gives them to the list only\n // where the combobox is not editable; here the text IS the value, a\n // payee name is long enough to want the caret moved to its start, and\n // the desktop list is capped at 8 rows — so jumping it would be worth\n // almost nothing and would cost the one gesture that field is used with.\n }}\n className={cn(\n FIELD_BASE,\n label !== undefined && FIELD_FLOATING_PAD,\n \"pe-9\",\n field.isInvalid && FIELD_INVALID,\n )}\n />\n <ChevronDown\n aria-hidden\n onMouseDown={(e) => {\n // Toggle on the chevron without stealing focus from the input.\n e.preventDefault();\n if (!inert) setOpen((o) => !o);\n }}\n className={cn(\n \"absolute end-2.5 top-1/2 size-4 -translate-y-1/2 text-placeholder\",\n // The box above does the dimming; dimming here too would halve it again.\n !inert && \"cursor-pointer\",\n )}\n />\n </div>,\n )}\n </EndHintRow>\n {/* The label and its \"?\" share the top strip — after the field in the DOM, so the\n \"?\" follows the control in the tab order, as it does on Input and Select. */}\n {label !== undefined && hintParts.labelHint !== undefined && (\n <StaticLabelRow hint={hintParts.labelHint}>\n <ComboboxFieldLabel htmlFor={fieldId} className={cn(LABEL_IN_ROW, inert && \"opacity-50\")}>\n {label}\n </ComboboxFieldLabel>\n </StaticLabelRow>\n )}\n <FieldCaption parts={hintParts} />\n {field.errorEl}\n {isPhone && (\n <PickerSheet\n open={open && !inert}\n onClose={() => setOpen(false)}\n title={sheetTitle ?? label}\n // The sheet's input IS the field: this is a free-text control, so what is\n // typed here is the value (a brand-new payee is just a name nothing\n // matches), and the list below narrows as it changes.\n query={value}\n onQueryChange={(v) => {\n onChange(v);\n setTyping(true);\n }}\n searchPlaceholder={searchPlaceholder ?? placeholder}\n inputRef={sheetInputRef}\n closeLabel={closeLabel}\n >\n <ul id={listboxId} role=\"listbox\">\n {createRow && (\n // `role=\"option\"` rides the BUTTON, not the <li> around it: an option\n // may not contain a separately focusable control, and the button is\n // what a pointer presses. Same shape `CommandPalette` has always had.\n <li role=\"presentation\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={false}\n onClick={() => take(typed)}\n className={cn(SHEET_ROW_CLASS, \"font-medium text-brand\")}\n >\n {createRow}\n </button>\n </li>\n )}\n {matches.map((o, i) => {\n const group = groupHeadings?.get(i);\n return (\n <Fragment key={o}>\n {group !== undefined && (\n <li\n role=\"presentation\"\n className={cn(\n GROUP_HEADING_STICKY,\n \"px-4 pb-0.5 pt-3 text-caption font-semibold uppercase tracking-wide text-muted\",\n )}\n >\n {group}\n </li>\n )}\n <li role=\"presentation\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={o === value}\n onClick={() => take(o)}\n className={cn(\n SHEET_ROW_CLASS,\n optionAdornment && \"flex items-center justify-between gap-2\",\n )}\n >\n {optionAdornment ? <span className=\"truncate-until-large\">{o}</span> : o}\n {optionAdornment?.(o)}\n </button>\n </li>\n </Fragment>\n );\n })}\n </ul>\n </PickerSheet>\n )}\n {showing && (\n <SuggestionList id={listboxId} anchorRef={fieldRef} panelRef={panelRef}>\n {createRow && (\n <li role=\"presentation\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={false}\n tabIndex={-1}\n onMouseDown={(e) => {\n // mousedown, like the rows below: the input's blur would otherwise\n // close the list before the click landed.\n e.preventDefault();\n take(typed);\n }}\n className={cn(rowClass(false), \"font-medium text-brand\")}\n >\n {createRow}\n </button>\n </li>\n )}\n {matches.map((o, i) => {\n // Heading at each group boundary only — `matches` is group-contiguous, so\n // the boundaries are a property of the list rather than of the branch\n // drawing it. See `groupHeadings`.\n const group = groupHeadings?.get(i);\n return (\n <Fragment key={o}>\n {group !== undefined && (\n <li\n role=\"presentation\"\n className={cn(\n GROUP_HEADING_STICKY,\n \"px-3 pb-0.5 pt-2 text-caption font-semibold uppercase tracking-wide text-muted first:pt-1\",\n )}\n >\n {group}\n </li>\n )}\n <li role=\"presentation\">\n <button\n type=\"button\"\n id={optionId(i)}\n role=\"option\"\n // CHOSEN, not highlighted. The row the arrows are on is named by\n // the field's `aria-activedescendant`; saying \"selected\" for it\n // would tell a reader that the row they are passing over is\n // already the answer.\n aria-selected={o === value}\n // Focus stays in the field — that is what\n // `aria-activedescendant` is for — so the rows are not tab stops.\n tabIndex={-1}\n onMouseDown={(e) => {\n // mousedown (not click) so the blur from the input firing first\n // doesn't close the list before the selection registers.\n e.preventDefault();\n take(o);\n }}\n onMouseEnter={() => setActive(i)}\n className={cn(\n rowClass(i === active),\n group != null && \"ps-6\",\n // A row with a badge is a flex row so the label truncates and the\n // badge keeps its width; without one it stays the plain block the\n // other lists render, so nothing shifts for callers that pass none.\n // From Large up the label wraps instead (`truncate-until-large`,\n // text size §10.17, round 0.34 T1), as the badge-less row does.\n optionAdornment && \"flex items-center justify-between gap-2\",\n )}\n >\n {optionAdornment ? <span className=\"truncate-until-large\">{o}</span> : o}\n {optionAdornment?.(o)}\n </button>\n </li>\n </Fragment>\n );\n })}\n </SuggestionList>\n )}\n </div>\n );\n}\n"],"mappings":";AA0VM,cAgDI,YAhDJ;AA1VN,SAAS,UAAU,OAAO,SAAS,QAAQ,gBAAgB;AAE3D,SAAS,mBAAmB;AAC5B,SAAS,YAAY,oBAAoB,qBAAqB;AAC9D,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,YAAY,uBAAuB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,oB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;AAAA;AAAA,YACtB,GACF;AAAA,eA9Ca,CA+Cf;AAAA,QAEJ,CAAC;AAAA,SACH;AAAA,OAEJ;AAAA;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
1
  import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
2
- import { type FieldHelpProps } from "./field-parts.js";
2
+ import { type DisabledReasonDisplay, type FieldHelpProps } from "./field-parts.js";
3
+ import type { CommitScope } from "./write-lock.js";
3
4
  import { CURRENCIES, CurrencyFlag, currencyName, getCurrency, type CurrencyFlagProps, type CurrencyOption } from "./currency-option-list.js";
4
5
  export { CURRENCIES, CurrencyFlag, currencyName, getCurrency };
5
6
  export type { CurrencyFlagProps, CurrencyOption };
@@ -66,9 +67,34 @@ export interface CurrencySelectProps extends Omit<ComponentPropsWithoutRef<"div"
66
67
  * filter that only matches the hidden English name is worse than no filter.
67
68
  */
68
69
  currencyNames?: Record<string, string>;
70
+ /** As {@link Select}'s: no focus, no list, the settled look, no chevron. */
71
+ disabled?: boolean;
72
+ /**
73
+ * Why the currency cannot be changed — {@link Select}'s `disabledReason` (keksdose,
74
+ * 2026-10-23: a budget's currency for a guest or a viewer, and while offline, which
75
+ * keksdose drew as a one-option `Select` to keep the reason and lost the flag). The
76
+ * trigger stays focusable and `aria-disabled` (never the `disabled` attribute), keeps
77
+ * its flag and code, opens nothing, and `onChange` is never called; the reason is a
78
+ * line under the field at Large and on a touch screen, else in the kit
79
+ * {@link Tooltip} (`disabledReasonDisplay`), and on the trigger's `aria-describedby`
80
+ * (after a caption, before an error). It wears the settled look of a disabled field
81
+ * and drops its chevron, as a locked Select does. It wins over `disabled`.
82
+ */
83
+ disabledReason?: ReactNode;
84
+ /** Where the reason shows — {@link Select}'s `disabledReasonDisplay`: a line under the
85
+ * field at Large and on a touch screen by default, the tooltip otherwise. */
86
+ disabledReasonDisplay?: DisabledReasonDisplay;
87
+ /**
88
+ * This picker COMMITS — choosing saves. Under a locked {@link WriteLockProvider} it is
89
+ * locked the `disabledReason` way with the lock's reason (which wins over its own).
90
+ * No provider, or an unlocked one: no effect. {@link Select}'s `commit`. A currency
91
+ * field inside a form with its own Save stays editable under the lock — leave this off
92
+ * there, and put `commit` on the Save.
93
+ */
94
+ commit?: CommitScope;
69
95
  /** The TRIGGER — the focusable `<button>` — as a React 19 ref prop, as on
70
96
  * {@link MultiSelect} and {@link CountrySelect}: react-hook-form's focus-on-error
71
97
  * calls `focus()` on it (0.34, API-3, refactor audit 2026-10). Not the wrapper. */
72
98
  ref?: Ref<HTMLButtonElement>;
73
99
  }
74
- export declare function CurrencySelect({ value, onChange, placeholder, className, label, options, invalid, error, hint, help, labels, currencyNames, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ref, ...rest }: CurrencySelectProps): import("react").JSX.Element;
100
+ export declare function CurrencySelect({ value, onChange, placeholder, className, label, options, invalid, error, hint, help, labels, currencyNames, disabled, disabledReason, disabledReasonDisplay, commit, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ref, ...rest }: CurrencySelectProps): import("react").JSX.Element;
@@ -3,7 +3,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useId } from "react";
4
4
  import { FieldChevron, FIELD_TRIGGER, FIELD_INVALID, FIELD_FLOATING_PAD } from "./field-base.js";
5
5
  import { FieldLabel } from "./field-parts.js";
6
- import { assignRef, EndHintRow, useFieldMessages } from "./field-parts.js";
6
+ import {
7
+ assignRef,
8
+ EndHintRow,
9
+ LockedReason,
10
+ useFieldMessages,
11
+ useLockReason
12
+ } from "./field-parts.js";
7
13
  import { cn } from "../lib/cn.js";
8
14
  import { useComboboxCore } from "./combobox-core.js";
9
15
  import {
@@ -32,6 +38,10 @@ function CurrencySelect({
32
38
  help,
33
39
  labels,
34
40
  currencyNames,
41
+ disabled,
42
+ disabledReason,
43
+ disabledReasonDisplay,
44
+ commit,
35
45
  "aria-label": ariaLabel,
36
46
  "aria-describedby": ariaDescribedBy,
37
47
  "aria-invalid": ariaInvalid,
@@ -51,6 +61,10 @@ function CurrencySelect({
51
61
  const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
52
62
  const locale = useKitLocale();
53
63
  const selected = getCurrency(value);
64
+ const lock = useLockReason(commit, disabledReason);
65
+ const locked = lock.locked;
66
+ const inert = locked || Boolean(disabled);
67
+ if (inert && open) setOpen(false);
54
68
  const listboxId = `${useId()}-listbox`;
55
69
  const field = useFieldMessages({
56
70
  hint,
@@ -59,7 +73,9 @@ function CurrencySelect({
59
73
  error,
60
74
  invalid,
61
75
  describedBy: ariaDescribedBy,
62
- ariaInvalid
76
+ ariaInvalid,
77
+ // A lock's reason sits between the caption and the error, as on Select.
78
+ reasonId: locked && lock.reasonId
63
79
  });
64
80
  const { labelHint, describedBy, isInvalid } = field;
65
81
  const fieldName = typeof label === "string" ? label : text.currency;
@@ -70,8 +86,17 @@ function CurrencySelect({
70
86
  ref: setTrigger,
71
87
  type: "button",
72
88
  "aria-label": name,
73
- onClick: () => setOpen((v) => !v),
89
+ disabled: locked ? void 0 : disabled,
90
+ "aria-disabled": locked || void 0,
91
+ onClick: (e) => {
92
+ if (inert) {
93
+ e.preventDefault();
94
+ return;
95
+ }
96
+ setOpen((v) => !v);
97
+ },
74
98
  onKeyDown: (e) => {
99
+ if (inert) return;
75
100
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
76
101
  e.preventDefault();
77
102
  setOpen(true);
@@ -83,16 +108,36 @@ function CurrencySelect({
83
108
  "aria-expanded": open,
84
109
  "aria-invalid": isInvalid || void 0,
85
110
  "aria-describedby": describedBy,
86
- className: cn(FIELD_TRIGGER, "pe-9", label !== void 0 && FIELD_FLOATING_PAD, isInvalid && FIELD_INVALID),
111
+ className: cn(
112
+ FIELD_TRIGGER,
113
+ "pe-9",
114
+ label !== void 0 && FIELD_FLOATING_PAD,
115
+ // FIELD_BASE's `disabled:` look, for a trigger locked without being `disabled`
116
+ // (the `:disabled` variants cannot match it) — Select's FIELD_LOCKED. No hover:
117
+ // nothing here answers a press.
118
+ locked && "cursor-not-allowed bg-surface-2 text-muted hover:bg-surface-2",
119
+ isInvalid && FIELD_INVALID
120
+ ),
87
121
  children: [
88
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center gap-2 min-w-0", selected ? "text-primary" : "text-placeholder"), children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
89
- /* @__PURE__ */ jsx(CurrencyFlag, { country: selected.country }),
90
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: selected.code })
91
- ] }) : placeholder ?? text.currency }),
92
- /* @__PURE__ */ jsx(FieldChevron, {})
122
+ /* @__PURE__ */ jsx(
123
+ "span",
124
+ {
125
+ className: cn(
126
+ "flex items-center gap-2 min-w-0",
127
+ // The settled look reaches the code too: `text-primary` here would outweigh it.
128
+ !selected ? "text-placeholder" : inert ? "text-muted" : "text-primary"
129
+ ),
130
+ children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
131
+ /* @__PURE__ */ jsx(CurrencyFlag, { country: selected.country }),
132
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: selected.code })
133
+ ] }) : placeholder ?? text.currency
134
+ }
135
+ ),
136
+ !inert && /* @__PURE__ */ jsx(FieldChevron, {})
93
137
  ]
94
138
  }
95
139
  );
140
+ const control = locked ? /* @__PURE__ */ jsx(LockedReason, { lock, display: disabledReasonDisplay, className: "flex w-full items-stretch", children: trigger }) : trigger;
96
141
  return (
97
142
  // The wrapper takes `rest`; the trigger takes the name. This field's label is a
98
143
  // floating <span> rather than a <label for>, so a caller who wants the control to
@@ -108,7 +153,7 @@ function CurrencySelect({
108
153
  /* @__PURE__ */ jsx("span", { className: "pointer-events-auto flex shrink-0 items-center", children: labelHint })
109
154
  ] })
110
155
  )),
111
- /* @__PURE__ */ jsx(EndHintRow, { hint: label === void 0 ? labelHint : void 0, children: trigger }),
156
+ /* @__PURE__ */ jsx(EndHintRow, { hint: label === void 0 ? labelHint : void 0, children: control }),
112
157
  field.below,
113
158
  /* @__PURE__ */ jsx(
114
159
  CurrencyOptionList,
@@ -122,6 +167,7 @@ function CurrencySelect({
122
167
  searchPlaceholder: text.search,
123
168
  sheetTitle: label ?? text.currency,
124
169
  onChoose: (code) => {
170
+ if (inert) return;
125
171
  onChange(code);
126
172
  closeToTrigger();
127
173
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/currency-select.tsx"],"sourcesContent":["import { useCallback, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { FieldChevron, FIELD_TRIGGER, FIELD_INVALID, FIELD_FLOATING_PAD } from \"./field-base\";\nimport { FieldLabel } from \"./field-parts\";\nimport { assignRef, EndHintRow, useFieldMessages, type FieldHelpProps } from \"./field-parts\";\nimport { cn } from \"../lib/cn\";\nimport { useComboboxCore } from \"./combobox-core\";\nimport {\n CURRENCIES,\n CurrencyFlag,\n CurrencyOptionList,\n currencyName,\n getCurrency,\n type CurrencyFlagProps,\n type CurrencyOption,\n} from \"./currency-option-list\";\nimport {\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n useKitLabels,\n useKitLocale,\n} from \"../i18n/kit-labels\";\n\n// The data and the flag are declared beside the one list both currency pickers render\n// (./currency-option-list, round 0.34 Wave 2, DUP-4) and are this module's exports, as\n// they always were.\nexport { CURRENCIES, CurrencyFlag, currencyName, getCurrency };\nexport type { CurrencyFlagProps, CurrencyOption };\n\n/** `onChange` is the kit's — \"a currency was picked\", carrying the code — rather\n * than the div's form event. */\nexport interface CurrencySelectProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\">, FieldHelpProps {\n value: string;\n onChange: (code: string) => void;\n placeholder?: string;\n label?: ReactNode;\n /**\n * Restrict the pickable currencies to these ISO codes (e.g. only the\n * currencies actually present in a budget). Order is preserved. Defaults to\n * the full {@link CURRENCIES} list.\n */\n options?: string[];\n /** Required and unanswered — {@link FIELD_INVALID}, the same rose border the\n * native `Select` has worn since feedback #235. Every field-styled control in\n * this package carries it now, so a form can mark any of its fields rather than\n * only the one that happened to have it first. */\n invalid?: boolean;\n /**\n * What is wrong with the choice, in the caller's own words — {@link Input}'s `error`\n * (keksdose K4: of the kit's pickers this one had neither a message nor a caption, so\n * \"the account is in EUR\" sat in a loose `<p>` beside it that nothing pointed at).\n * Rendered under the field, after a text `hint`; merged into the trigger's\n * `aria-describedby`; implies `invalid`. `null`, `false` and `\"\"` are no message.\n */\n error?: ReactNode;\n /**\n * {@link Select}'s `hint`, the same rule (keksdose K4). A {@link FieldHint} \"?\" rides\n * the label's line; on an unlabelled picker it sits at the field's end edge, outside\n * the box. Plain TEXT (a string or a number) is a caption UNDER the field, attached\n * to the trigger through `aria-describedby` — the label line has no room for a\n * sentence.\n */\n hint?: ReactNode;\n /** Every user-facing string this control owns, shaped like `AmountInput`'s\n * `labels` so the two currency pickers in the kit are configured the same way.\n *\n * `search` exists because `placeholder` used to do BOTH jobs: it named the empty\n * field and, for want of anything else, it was also handed to the search box —\n * so a caller who wrote \"Currency\" got \"Currency\" as the prompt for typing a\n * filter, and a caller who wanted to name the filter had to rename the field.\n * `placeholder` still wins for the trigger, so nothing moves for the callers\n * that set it; what changes is that the search box no longer borrows it. */\n labels?: {\n /** The empty trigger, when `placeholder` is not given. */\n currency?: string;\n /** The filter box inside the open panel. */\n search?: string;\n };\n /**\n * Translated currency names, keyed by ISO code — `{ CHF: \"Schweizer Franken\" }`.\n *\n * {@link CURRENCIES} is data the package ships, so its 27 names were the one\n * string in the row a consumer could not translate: the code and the symbol are\n * language-neutral, and the name beside them stayed English in a German UI. This\n * is a sparse OVERRIDE rather than a replacement list, so an app translates the\n * eight currencies it actually uses and keeps the rest; forking `CURRENCIES` to\n * get there would also fork the flags and symbols, which nobody wants to maintain.\n *\n * The search matches what is SHOWN — type \"Franken\" and you find CHF — because a\n * filter that only matches the hidden English name is worse than no filter.\n */\n currencyNames?: Record<string, string>;\n /** The TRIGGER — the focusable `<button>` — as a React 19 ref prop, as on\n * {@link MultiSelect} and {@link CountrySelect}: react-hook-form's focus-on-error\n * calls `focus()` on it (0.34, API-3, refactor audit 2026-10). Not the wrapper. */\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport function CurrencySelect({\n value,\n onChange,\n placeholder,\n className,\n label,\n options,\n invalid,\n error,\n hint,\n help,\n labels,\n currencyNames,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n ref,\n ...rest\n}: CurrencySelectProps) {\n // The picker family's foundation (round 0.34 Wave 2, DUP-4): open state, the query,\n // the highlighted row, portal anchoring, outside press, Escape on the kit's stack and\n // Back — what `useDropdownSearch` gave it, and the rest it did not. `filter: false`:\n // the list's own currency filter hands the panel its rows.\n const core = useComboboxCore<string>({ filter: false, backCloses: true });\n const { open, setOpen, triggerRef, closeToTrigger } = core;\n // The core anchors the panel to the trigger and hands focus back to it; the caller's\n // `ref` wants the same element. One callback feeds both, as on MultiSelect.\n const setTrigger = useCallback(\n (el: HTMLButtonElement | null) => {\n triggerRef.current = el;\n assignRef(ref, el);\n },\n [ref, triggerRef],\n );\n // `labels` > `currency` from the provider > English.\n const text = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, labels);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale();\n\n const selected = getCurrency(value);\n\n const listboxId = `${useId()}-listbox`;\n // Text is a caption under the field; anything else (a FieldHint) rides the label\n // line — and a FieldHint is that caption at Large and on touch (§4). See `hint`. On\n // the TRIGGER, which is the control with a role: a caller's description used to land\n // on the wrapper `<div>` through the spread, where nothing reads it. The caller's ids\n // first, then the caption, then the error — Select's order, through useFieldMessages\n // since 0.34 (DUP-2, DUP-8).\n const field = useFieldMessages({\n hint,\n help,\n name: label ?? ariaLabel,\n error,\n invalid,\n describedBy: ariaDescribedBy,\n ariaInvalid,\n });\n const { labelHint, describedBy, isInvalid } = field;\n\n // The trigger's NAME. A combobox does not take its name from its content, and the\n // floating label is a <span>, not a <label for> — so without `aria-label` from the\n // caller this trigger had no name at all (keksdose's test suite, 0.5.0). Composed the\n // way MultiSelect and the entity comboboxes compose theirs, \"label: value\", with the\n // `currency` word standing in for a missing label so it is never nameless.\n const fieldName = typeof label === \"string\" ? label : text.currency;\n const name = ariaLabel ?? common.fieldValue(fieldName, selected ? selected.code : (placeholder ?? text.currency));\n\n const trigger = (\n <button\n // Where Escape on the open list hands focus back to (round 0.34 BUG-1).\n ref={setTrigger}\n type=\"button\"\n aria-label={name}\n onClick={() => setOpen((v) => !v)}\n // Down/Up opens the list from the closed trigger, per the APG; Enter and Space\n // already do through the button's own click.\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n // The implicit `button` role supports neither `aria-expanded` nor\n // `aria-invalid`, so this trigger previously wore a red border and announced\n // nothing about being invalid or about there being a list behind it. The role\n // that DESCRIBES it is the one that also supports the attributes — the same\n // treatment its siblings (MultiSelect, the entity comboboxes) now carry, so a\n // form row of pickers reads the same way throughout. And since Wave 2 the popup\n // IS the listbox it promises, of options with the chosen one selected (BUG-12).\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-controls={listboxId}\n aria-expanded={open}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n className={cn(FIELD_TRIGGER, \"pe-9\", label !== undefined && FIELD_FLOATING_PAD, isInvalid && FIELD_INVALID)}\n >\n {/* The trigger stays COMPACT — flag + code only — so it never clips in a\n narrow field; the full names live in the (wider) popup (feedback\n #308). */}\n <span className={cn(\"flex items-center gap-2 min-w-0\", selected ? \"text-primary\" : \"text-placeholder\")}>\n {selected ? (\n <>\n <CurrencyFlag country={selected.country} />\n <span className=\"font-medium\">{selected.code}</span>\n </>\n ) : (\n placeholder ?? text.currency\n )}\n </span>\n <FieldChevron />\n </button>\n );\n\n return (\n // The wrapper takes `rest`; the trigger takes the name. This field's label is a\n // floating <span> rather than a <label for>, so a caller who wants the control to\n // announce more than the code inside it has nowhere else to put it.\n <div {...rest} className={cn(\"relative\", className)}>\n {label !== undefined &&\n (labelHint === undefined ? (\n <FieldLabel>{label}</FieldLabel>\n ) : (\n // The label and its \"?\" as one row on the label's line, as FloatingField lays\n // out a static label with a hint: the row places both, the label truncates\n // and the hint keeps its width. `z-10` like FieldLabel's own: the trigger is\n // `relative` and comes later, so it would paint over the strip.\n <div className=\"pointer-events-none absolute inset-x-3 top-1 z-10 flex items-center gap-1\">\n <FieldLabel className=\"static z-auto min-w-0 max-w-none\">{label}</FieldLabel>\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{labelHint}</span>\n </div>\n ))}\n {/* No label line to ride: at the field's end edge, outside the box, as an\n unlabelled Select places its FieldHint. */}\n <EndHintRow hint={label === undefined ? labelHint : undefined}>{trigger}</EndHintRow>\n {field.below}\n {/* Portalled to <body> and anchored to the trigger (dev#548), so where it stands\n in the flow no longer moves it. */}\n <CurrencyOptionList\n core={core}\n listboxId={listboxId}\n value={value}\n codes={options}\n currencyNames={currencyNames}\n locale={locale}\n searchPlaceholder={text.search}\n // On a phone the list is a full-screen sheet, which needs the field's own name\n // to say what it asks for (live #200).\n sheetTitle={label ?? text.currency}\n onChoose={(code) => {\n onChange(code);\n // Back to the trigger: the panel holding focus is about to unmount, and a\n // keyboard user who has answered the field should stand on it, ready to Tab on.\n closeToTrigger();\n }}\n />\n </div>\n );\n}\n"],"mappings":";AAwMU,mBACE,KADF;AAxMV,SAAS,aAAa,aAAa;AAEnC,SAAS,cAAc,eAAe,eAAe,0BAA0B;AAC/E,SAAS,kBAAkB;AAC3B,SAAS,WAAW,YAAY,wBAA6C;AAC7E,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6EA,SA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} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { FieldChevron, FIELD_TRIGGER, FIELD_INVALID, FIELD_FLOATING_PAD } from \"./field-base\";\nimport { FieldLabel } from \"./field-parts\";\nimport {\n assignRef,\n EndHintRow,\n LockedReason,\n useFieldMessages,\n useLockReason,\n type DisabledReasonDisplay,\n type FieldHelpProps,\n} from \"./field-parts\";\nimport type { CommitScope } from \"./write-lock\";\nimport { cn } from \"../lib/cn\";\nimport { useComboboxCore } from \"./combobox-core\";\nimport {\n CURRENCIES,\n CurrencyFlag,\n CurrencyOptionList,\n currencyName,\n getCurrency,\n type CurrencyFlagProps,\n type CurrencyOption,\n} from \"./currency-option-list\";\nimport {\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n useKitLabels,\n useKitLocale,\n} from \"../i18n/kit-labels\";\n\n// The data and the flag are declared beside the one list both currency pickers render\n// (./currency-option-list, round 0.34 Wave 2, DUP-4) and are this module's exports, as\n// they always were.\nexport { CURRENCIES, CurrencyFlag, currencyName, getCurrency };\nexport type { CurrencyFlagProps, CurrencyOption };\n\n/** `onChange` is the kit's — \"a currency was picked\", carrying the code — rather\n * than the div's form event. */\nexport interface CurrencySelectProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\">, FieldHelpProps {\n value: string;\n onChange: (code: string) => void;\n placeholder?: string;\n label?: ReactNode;\n /**\n * Restrict the pickable currencies to these ISO codes (e.g. only the\n * currencies actually present in a budget). Order is preserved. Defaults to\n * the full {@link CURRENCIES} list.\n */\n options?: string[];\n /** Required and unanswered — {@link FIELD_INVALID}, the same rose border the\n * native `Select` has worn since feedback #235. Every field-styled control in\n * this package carries it now, so a form can mark any of its fields rather than\n * only the one that happened to have it first. */\n invalid?: boolean;\n /**\n * What is wrong with the choice, in the caller's own words — {@link Input}'s `error`\n * (keksdose K4: of the kit's pickers this one had neither a message nor a caption, so\n * \"the account is in EUR\" sat in a loose `<p>` beside it that nothing pointed at).\n * Rendered under the field, after a text `hint`; merged into the trigger's\n * `aria-describedby`; implies `invalid`. `null`, `false` and `\"\"` are no message.\n */\n error?: ReactNode;\n /**\n * {@link Select}'s `hint`, the same rule (keksdose K4). A {@link FieldHint} \"?\" rides\n * the label's line; on an unlabelled picker it sits at the field's end edge, outside\n * the box. Plain TEXT (a string or a number) is a caption UNDER the field, attached\n * to the trigger through `aria-describedby` — the label line has no room for a\n * sentence.\n */\n hint?: ReactNode;\n /** Every user-facing string this control owns, shaped like `AmountInput`'s\n * `labels` so the two currency pickers in the kit are configured the same way.\n *\n * `search` exists because `placeholder` used to do BOTH jobs: it named the empty\n * field and, for want of anything else, it was also handed to the search box —\n * so a caller who wrote \"Currency\" got \"Currency\" as the prompt for typing a\n * filter, and a caller who wanted to name the filter had to rename the field.\n * `placeholder` still wins for the trigger, so nothing moves for the callers\n * that set it; what changes is that the search box no longer borrows it. */\n labels?: {\n /** The empty trigger, when `placeholder` is not given. */\n currency?: string;\n /** The filter box inside the open panel. */\n search?: string;\n };\n /**\n * Translated currency names, keyed by ISO code — `{ CHF: \"Schweizer Franken\" }`.\n *\n * {@link CURRENCIES} is data the package ships, so its 27 names were the one\n * string in the row a consumer could not translate: the code and the symbol are\n * language-neutral, and the name beside them stayed English in a German UI. This\n * is a sparse OVERRIDE rather than a replacement list, so an app translates the\n * eight currencies it actually uses and keeps the rest; forking `CURRENCIES` to\n * get there would also fork the flags and symbols, which nobody wants to maintain.\n *\n * The search matches what is SHOWN — type \"Franken\" and you find CHF — because a\n * filter that only matches the hidden English name is worse than no filter.\n */\n currencyNames?: Record<string, string>;\n /** As {@link Select}'s: no focus, no list, the settled look, no chevron. */\n disabled?: boolean;\n /**\n * Why the currency cannot be changed — {@link Select}'s `disabledReason` (keksdose,\n * 2026-10-23: a budget's currency for a guest or a viewer, and while offline, which\n * keksdose drew as a one-option `Select` to keep the reason and lost the flag). The\n * trigger stays focusable and `aria-disabled` (never the `disabled` attribute), keeps\n * its flag and code, opens nothing, and `onChange` is never called; the reason is a\n * line under the field at Large and on a touch screen, else in the kit\n * {@link Tooltip} (`disabledReasonDisplay`), and on the trigger's `aria-describedby`\n * (after a caption, before an error). It wears the settled look of a disabled field\n * and drops its chevron, as a locked Select does. It wins over `disabled`.\n */\n disabledReason?: ReactNode;\n /** Where the reason shows — {@link Select}'s `disabledReasonDisplay`: a line under the\n * field at Large and on a touch screen by default, the tooltip otherwise. */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /**\n * This picker COMMITS — choosing saves. Under a locked {@link WriteLockProvider} it is\n * locked the `disabledReason` way with the lock's reason (which wins over its own).\n * No provider, or an unlocked one: no effect. {@link Select}'s `commit`. A currency\n * field inside a form with its own Save stays editable under the lock — leave this off\n * there, and put `commit` on the Save.\n */\n commit?: CommitScope;\n /** The TRIGGER — the focusable `<button>` — as a React 19 ref prop, as on\n * {@link MultiSelect} and {@link CountrySelect}: react-hook-form's focus-on-error\n * calls `focus()` on it (0.34, API-3, refactor audit 2026-10). Not the wrapper. */\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport function CurrencySelect({\n value,\n onChange,\n placeholder,\n className,\n label,\n options,\n invalid,\n error,\n hint,\n help,\n labels,\n currencyNames,\n disabled,\n disabledReason,\n disabledReasonDisplay,\n commit,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n ref,\n ...rest\n}: CurrencySelectProps) {\n // The picker family's foundation (round 0.34 Wave 2, DUP-4): open state, the query,\n // the highlighted row, portal anchoring, outside press, Escape on the kit's stack and\n // Back — what `useDropdownSearch` gave it, and the rest it did not. `filter: false`:\n // the list's own currency filter hands the panel its rows.\n const core = useComboboxCore<string>({ filter: false, backCloses: true });\n const { open, setOpen, triggerRef, closeToTrigger } = core;\n // The core anchors the panel to the trigger and hands focus back to it; the caller's\n // `ref` wants the same element. One callback feeds both, as on MultiSelect.\n const setTrigger = useCallback(\n (el: HTMLButtonElement | null) => {\n triggerRef.current = el;\n assignRef(ref, el);\n },\n [ref, triggerRef],\n );\n // `labels` > `currency` from the provider > English.\n const text = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, labels);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale();\n\n const selected = getCurrency(value);\n\n // The lock — Select's (`useLockReason`): the WriteLock's reason under `commit`, else\n // the caller's own. Locked or `disabled`, nothing opens the list or picks a value.\n const lock = useLockReason(commit, disabledReason);\n const locked = lock.locked;\n const inert = locked || Boolean(disabled);\n // A lock (or `disabled`) arriving while the list is up closes it — adjusted while\n // rendering, as CountrySelect does, so no frame shows a list that cannot be used.\n if (inert && open) setOpen(false);\n\n const listboxId = `${useId()}-listbox`;\n // Text is a caption under the field; anything else (a FieldHint) rides the label\n // line — and a FieldHint is that caption at Large and on touch (§4). See `hint`. On\n // the TRIGGER, which is the control with a role: a caller's description used to land\n // on the wrapper `<div>` through the spread, where nothing reads it. The caller's ids\n // first, then the caption, then the error — Select's order, through useFieldMessages\n // since 0.34 (DUP-2, DUP-8).\n const field = useFieldMessages({\n hint,\n help,\n name: label ?? ariaLabel,\n error,\n invalid,\n describedBy: ariaDescribedBy,\n ariaInvalid,\n // A lock's reason sits between the caption and the error, as on Select.\n reasonId: locked && lock.reasonId,\n });\n const { labelHint, describedBy, isInvalid } = field;\n\n // The trigger's NAME. A combobox does not take its name from its content, and the\n // floating label is a <span>, not a <label for> — so without `aria-label` from the\n // caller this trigger had no name at all (keksdose's test suite, 0.5.0). Composed the\n // way MultiSelect and the entity comboboxes compose theirs, \"label: value\", with the\n // `currency` word standing in for a missing label so it is never nameless.\n const fieldName = typeof label === \"string\" ? label : text.currency;\n const name = ariaLabel ?? common.fieldValue(fieldName, selected ? selected.code : (placeholder ?? text.currency));\n\n const trigger = (\n <button\n // Where Escape on the open list hands focus back to (round 0.34 BUG-1).\n ref={setTrigger}\n type=\"button\"\n aria-label={name}\n // The focusable kind of disabled while locked (Select's rule): native `disabled`\n // would take the field out of the tab order, and the reason with it.\n disabled={locked ? undefined : disabled}\n aria-disabled={locked || undefined}\n onClick={(e) => {\n if (inert) {\n e.preventDefault();\n return;\n }\n setOpen((v) => !v);\n }}\n // Down/Up opens the list from the closed trigger, per the APG; Enter and Space\n // already do through the button's own click.\n onKeyDown={(e) => {\n if (inert) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n // The implicit `button` role supports neither `aria-expanded` nor\n // `aria-invalid`, so this trigger previously wore a red border and announced\n // nothing about being invalid or about there being a list behind it. The role\n // that DESCRIBES it is the one that also supports the attributes — the same\n // treatment its siblings (MultiSelect, the entity comboboxes) now carry, so a\n // form row of pickers reads the same way throughout. And since Wave 2 the popup\n // IS the listbox it promises, of options with the chosen one selected (BUG-12).\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-controls={listboxId}\n aria-expanded={open}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n className={cn(\n FIELD_TRIGGER,\n \"pe-9\",\n label !== undefined && FIELD_FLOATING_PAD,\n // FIELD_BASE's `disabled:` look, for a trigger locked without being `disabled`\n // (the `:disabled` variants cannot match it) — Select's FIELD_LOCKED. No hover:\n // nothing here answers a press.\n locked && \"cursor-not-allowed bg-surface-2 text-muted hover:bg-surface-2\",\n isInvalid && FIELD_INVALID,\n )}\n >\n {/* The trigger stays COMPACT — flag + code only — so it never clips in a\n narrow field; the full names live in the (wider) popup (feedback\n #308). */}\n <span\n className={cn(\n \"flex items-center gap-2 min-w-0\",\n // The settled look reaches the code too: `text-primary` here would outweigh it.\n !selected ? \"text-placeholder\" : inert ? \"text-muted\" : \"text-primary\",\n )}\n >\n {selected ? (\n <>\n <CurrencyFlag country={selected.country} />\n <span className=\"font-medium\">{selected.code}</span>\n </>\n ) : (\n placeholder ?? text.currency\n )}\n </span>\n {/* No menu to drop while disabled or locked, so no chevron — the arrow is the one\n thing on the control that promises a choice (dev#474, as on Select). */}\n {!inert && <FieldChevron />}\n </button>\n );\n\n // Select's frame: the line under the trigger, or the Tooltip with a hidden copy for\n // `aria-describedby`. The wrapper `<div>` keeps `className`, so the layout holds.\n // `flex w-full items-stretch`: the trigger keeps the field's full width in it.\n const control = locked ? (\n <LockedReason lock={lock} display={disabledReasonDisplay} className=\"flex w-full items-stretch\">\n {trigger}\n </LockedReason>\n ) : (\n trigger\n );\n\n return (\n // The wrapper takes `rest`; the trigger takes the name. This field's label is a\n // floating <span> rather than a <label for>, so a caller who wants the control to\n // announce more than the code inside it has nowhere else to put it.\n <div {...rest} className={cn(\"relative\", className)}>\n {label !== undefined &&\n (labelHint === undefined ? (\n <FieldLabel>{label}</FieldLabel>\n ) : (\n // The label and its \"?\" as one row on the label's line, as FloatingField lays\n // out a static label with a hint: the row places both, the label truncates\n // and the hint keeps its width. `z-10` like FieldLabel's own: the trigger is\n // `relative` and comes later, so it would paint over the strip.\n <div className=\"pointer-events-none absolute inset-x-3 top-1 z-10 flex items-center gap-1\">\n <FieldLabel className=\"static z-auto min-w-0 max-w-none\">{label}</FieldLabel>\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{labelHint}</span>\n </div>\n ))}\n {/* No label line to ride: at the field's end edge, outside the box, as an\n unlabelled Select places its FieldHint. */}\n <EndHintRow hint={label === undefined ? labelHint : undefined}>{control}</EndHintRow>\n {field.below}\n {/* Portalled to <body> and anchored to the trigger (dev#548), so where it stands\n in the flow no longer moves it. */}\n <CurrencyOptionList\n core={core}\n listboxId={listboxId}\n value={value}\n codes={options}\n currencyNames={currencyNames}\n locale={locale}\n searchPlaceholder={text.search}\n // On a phone the list is a full-screen sheet, which needs the field's own name\n // to say what it asks for (live #200).\n sheetTitle={label ?? text.currency}\n onChoose={(code) => {\n if (inert) return;\n onChange(code);\n // Back to the trigger: the panel holding focus is about to unmount, and a\n // keyboard user who has answered the field should stand on it, ready to Tab on.\n closeToTrigger();\n }}\n />\n </div>\n );\n}\n"],"mappings":";AAmRU,mBACE,KADF;AAnRV,S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A,eAC/C,IAEA,eAAe,KAAK;AAAA;AAAA,QAExB;AAAA,QAGC,CAAC,SAAS,oBAAC,gBAAa;AAAA;AAAA;AAAA,EAC3B;AAMF,QAAM,UAAU,SACd,oBAAC,gBAAa,MAAY,SAAS,uBAAuB,WAAU,6BACjE,mBACH,IAEA;AAGF;AAAA;AAAA;AAAA;AAAA,IAIE,qBAAC,SAAK,GAAG,MAAM,WAAW,GAAG,YAAY,SAAS,GAC/C;AAAA,gBAAU,WACR,cAAc,SACb,oBAAC,cAAY,iBAAM;AAAA;AAAA;AAAA;AAAA;AAAA,QAMnB,qBAAC,SAAI,WAAU,6EACb;AAAA,8BAAC,cAAW,WAAU,oCAAoC,iBAAM;AAAA,UAChE,oBAAC,UAAK,WAAU,kDAAkD,qBAAU;AAAA,WAC9E;AAAA;AAAA,MAIJ,oBAAC,cAAW,MAAM,UAAU,SAAY,YAAY,QAAY,mBAAQ;AAAA,MACvE,MAAM;AAAA,MAGP;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA,mBAAmB,KAAK;AAAA,UAGxB,YAAY,SAAS,KAAK;AAAA,UAC1B,UAAU,CAAC,SAAS;AAClB,gBAAI,MAAO;AACX,qBAAS,IAAI;AAGb,2BAAe;AAAA,UACjB;AAAA;AAAA,MACF;AAAA,OACF;AAAA;AAEJ;","names":[]}
@@ -11,10 +11,12 @@ import type { DataTableColumn, DataTableProps, FilterState, MobileSwipeActions }
11
11
  * BETWEEN facts rather than between a label and its own value. `relative` holds a
12
12
  * header's `sr-only` text (an actions column's), as every kit container must.
13
13
  */
14
- export declare function StackedFields<T>({ columns, row, compact }: {
14
+ export declare function StackedFields<T>({ columns, row, compact, liftOwnClicks, }: {
15
15
  columns: DataTableColumn<T>[];
16
16
  row: T;
17
17
  compact: boolean;
18
+ /** On a stretched card (0.50 K4): lift the own-click fields above its title link. */
19
+ liftOwnClicks?: boolean;
18
20
  }): import("react").JSX.Element | null;
19
21
  /** The most fields the default phone card shows under its title (0.49 KIT-7). */
20
22
  export declare const MOBILE_CARD_FIELDS = 3;
@@ -105,6 +107,13 @@ export interface MobileRowProps<T> {
105
107
  mobileDir: Direction;
106
108
  /** No column the card renders owns a link, so the card itself may be one. */
107
109
  mobileCardLinkable: boolean;
110
+ /**
111
+ * The card draws cells that keep their own clicks, so it cannot be one control (0.50
112
+ * K4): its TITLE is the row's link (`rowHref`) or button (`onRowClick`), stretched over
113
+ * the card, and those cells sit above it. Only for the default card, never a
114
+ * `mobileCard`, and never when the title itself keeps its own clicks.
115
+ */
116
+ mobileCardStretched: boolean;
108
117
  mobileCard: DataTableProps<T>["mobileCard"];
109
118
  mobilePrimaryCol: DataTableColumn<T> | null;
110
119
  /** The `role: "status"` columns, drawn as chips beside the title (0.49 KIT-7). */
@@ -132,7 +141,7 @@ export interface MobileRowSelect {
132
141
  }
133
142
  /** One mobile card. Shared by the flat list and the grouped list, so both draw
134
143
  * identical row markup. */
135
- export declare function MobileRow<T>({ row, isExpanded, openedRowContent, opensRow, rowClassName, rowAttributes, onRowClick, rowHref, swipeActionsFor, mobileDir, mobileCardLinkable, mobileCard, mobilePrimaryCol, mobileStatusColumns, mobileSecondaryColumns, mobileActionColumns, mobileExpandAsDialog, compact, large, select, }: MobileRowProps<T>): import("react").JSX.Element;
144
+ export declare function MobileRow<T>({ row, isExpanded, openedRowContent, opensRow, rowClassName, rowAttributes, onRowClick, rowHref, swipeActionsFor, mobileDir, mobileCardLinkable, mobileCardStretched, mobileCard, mobilePrimaryCol, mobileStatusColumns, mobileSecondaryColumns, mobileActionColumns, mobileExpandAsDialog, compact, large, select, }: MobileRowProps<T>): import("react").JSX.Element;
136
145
  /**
137
146
  * The card list's way into and out of selection mode for a keyboard and a screen
138
147
  * reader — the long press is a touch gesture, and a gesture alone is no path at all.