@42-central/ui-react 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
  2. package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
  3. package/dist/{chunk-NLSJ6T7V.js → chunk-4D2V4JE4.js} +3 -3
  4. package/dist/{chunk-NLSJ6T7V.js.map → chunk-4D2V4JE4.js.map} +1 -1
  5. package/dist/{chunk-7B44J3CF.js → chunk-5H5YOPCF.js} +3 -3
  6. package/dist/{chunk-7B44J3CF.js.map → chunk-5H5YOPCF.js.map} +1 -1
  7. package/dist/{chunk-JFB6O7IY.js → chunk-7KFUFAVP.js} +4 -4
  8. package/dist/{chunk-JFB6O7IY.js.map → chunk-7KFUFAVP.js.map} +1 -1
  9. package/dist/{chunk-PT22KEVD.js → chunk-BGDVUC3B.js} +5 -5
  10. package/dist/{chunk-PT22KEVD.js.map → chunk-BGDVUC3B.js.map} +1 -1
  11. package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
  12. package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
  13. package/dist/{chunk-JDPVD2YE.js → chunk-HCHGERDB.js} +3 -3
  14. package/dist/{chunk-JDPVD2YE.js.map → chunk-HCHGERDB.js.map} +1 -1
  15. package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
  16. package/dist/chunk-HWBFRDX7.js.map +1 -0
  17. package/dist/{chunk-LYGOFMXJ.js → chunk-I4IJOLNA.js} +4 -4
  18. package/dist/{chunk-LYGOFMXJ.js.map → chunk-I4IJOLNA.js.map} +1 -1
  19. package/dist/{chunk-DSZF2TW6.js → chunk-IA6DCC3N.js} +6 -6
  20. package/dist/{chunk-DSZF2TW6.js.map → chunk-IA6DCC3N.js.map} +1 -1
  21. package/dist/{chunk-QEAF57ZQ.js → chunk-ISX3AM32.js} +3 -3
  22. package/dist/{chunk-QEAF57ZQ.js.map → chunk-ISX3AM32.js.map} +1 -1
  23. package/dist/{chunk-YMVUQ2L7.js → chunk-L24N5EON.js} +6 -6
  24. package/dist/chunk-L24N5EON.js.map +1 -0
  25. package/dist/{chunk-J2NW7JID.js → chunk-L5GH7LLD.js} +3 -3
  26. package/dist/{chunk-J2NW7JID.js.map → chunk-L5GH7LLD.js.map} +1 -1
  27. package/dist/{chunk-N42EFOML.js → chunk-MCRTAUSZ.js} +6 -6
  28. package/dist/chunk-MCRTAUSZ.js.map +1 -0
  29. package/dist/{chunk-276RL7FX.js → chunk-MNYY7UU2.js} +6 -6
  30. package/dist/{chunk-276RL7FX.js.map → chunk-MNYY7UU2.js.map} +1 -1
  31. package/dist/{chunk-THGJLR5S.js → chunk-NNPSBC7O.js} +5 -5
  32. package/dist/{chunk-THGJLR5S.js.map → chunk-NNPSBC7O.js.map} +1 -1
  33. package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
  34. package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
  35. package/dist/{chunk-2NTCQIRP.js → chunk-QRNQQIQM.js} +5 -5
  36. package/dist/{chunk-2NTCQIRP.js.map → chunk-QRNQQIQM.js.map} +1 -1
  37. package/dist/{chunk-E3XLWMEB.js → chunk-RKCUXOU2.js} +4 -4
  38. package/dist/{chunk-E3XLWMEB.js.map → chunk-RKCUXOU2.js.map} +1 -1
  39. package/dist/{chunk-DMI4KS32.js → chunk-SBZJGFZ6.js} +3 -3
  40. package/dist/{chunk-DMI4KS32.js.map → chunk-SBZJGFZ6.js.map} +1 -1
  41. package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
  42. package/dist/chunk-SLUOF7XW.js.map +1 -0
  43. package/dist/{chunk-2TZU4LSX.js → chunk-ULF5LOBS.js} +3 -3
  44. package/dist/{chunk-2TZU4LSX.js.map → chunk-ULF5LOBS.js.map} +1 -1
  45. package/dist/components/app-shell/index.js +4 -4
  46. package/dist/components/autocomplete/index.js +4 -4
  47. package/dist/components/calendar-heatmap/index.js +2 -2
  48. package/dist/components/camera/index.js +6 -6
  49. package/dist/components/code-block/chrome.js +5 -5
  50. package/dist/components/code-block/index.js +6 -6
  51. package/dist/components/combobox/index.js +4 -4
  52. package/dist/components/combobox-list/index.js +6 -6
  53. package/dist/components/data-table/data-table-features.d.ts +8 -0
  54. package/dist/components/data-table/data-table-features.d.ts.map +1 -1
  55. package/dist/components/data-table/data-table-group.d.ts +128 -0
  56. package/dist/components/data-table/data-table-group.d.ts.map +1 -0
  57. package/dist/components/data-table/data-table-grouping.d.ts +72 -0
  58. package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
  59. package/dist/components/data-table/data-table-icons.d.ts +4 -2
  60. package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
  61. package/dist/components/data-table/data-table-meta.d.ts +9 -0
  62. package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
  63. package/dist/components/data-table/data-table-pagination.d.ts +4 -1
  64. package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
  65. package/dist/components/data-table/data-table-schema.d.ts +4 -0
  66. package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
  67. package/dist/components/data-table/data-table-stack.d.ts +16 -3
  68. package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
  69. package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
  70. package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
  71. package/dist/components/data-table/data-table-translations.d.ts +35 -0
  72. package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
  73. package/dist/components/data-table/data-table.d.ts +55 -3
  74. package/dist/components/data-table/data-table.d.ts.map +1 -1
  75. package/dist/components/data-table/index.d.ts +3 -1
  76. package/dist/components/data-table/index.d.ts.map +1 -1
  77. package/dist/components/data-table/index.js +877 -229
  78. package/dist/components/data-table/index.js.map +1 -1
  79. package/dist/components/date-picker/index.js +7 -7
  80. package/dist/components/drawer/index.js +4 -4
  81. package/dist/components/hover-card/index.js +3 -3
  82. package/dist/components/kbd/index.js +3 -3
  83. package/dist/components/lightbox/index.js +4 -4
  84. package/dist/components/menu/index.js +4 -4
  85. package/dist/components/modal/index.js +4 -4
  86. package/dist/components/multi-combobox-list/index.js +6 -6
  87. package/dist/components/multi-select/index.js +4 -4
  88. package/dist/components/nav-link/index.js +3 -3
  89. package/dist/components/nav-link/tanstack.js +3 -3
  90. package/dist/components/notification/create-notifier.d.ts.map +1 -1
  91. package/dist/components/notification/index.js +15 -3
  92. package/dist/components/notification/index.js.map +1 -1
  93. package/dist/components/notification/types.d.ts +5 -0
  94. package/dist/components/notification/types.d.ts.map +1 -1
  95. package/dist/components/number-input/index.js +4 -4
  96. package/dist/components/overlays/index.js +5 -5
  97. package/dist/components/photo-capture/index.js +6 -6
  98. package/dist/components/popover/index.js +3 -3
  99. package/dist/components/schedule/index.js +3 -3
  100. package/dist/components/select/index.js +5 -5
  101. package/dist/components/spotlight/index.js +8 -8
  102. package/dist/components/tags-input/index.js +3 -3
  103. package/dist/components/time-input/index.js +5 -5
  104. package/dist/components/tooltip/index.js +2 -2
  105. package/dist/components/tree-multi-select/index.js +4 -4
  106. package/dist/components/tree-select/index.js +4 -4
  107. package/dist/index.js +2 -2
  108. package/dist/lib/overlay-container.d.ts.map +1 -1
  109. package/dist/lib/overlay-layer.d.ts +10 -3
  110. package/dist/lib/overlay-layer.d.ts.map +1 -1
  111. package/dist/theme.css +14 -6
  112. package/package.json +1 -1
  113. package/src/components/data-table/data-table-features.ts +11 -0
  114. package/src/components/data-table/data-table-group.test.tsx +1007 -0
  115. package/src/components/data-table/data-table-group.tsx +474 -0
  116. package/src/components/data-table/data-table-grouping.ts +160 -0
  117. package/src/components/data-table/data-table-icons.tsx +8 -1
  118. package/src/components/data-table/data-table-meta.ts +9 -0
  119. package/src/components/data-table/data-table-pagination.tsx +5 -1
  120. package/src/components/data-table/data-table-stack.tsx +165 -43
  121. package/src/components/data-table/data-table-toolbar.tsx +110 -2
  122. package/src/components/data-table/data-table-translations.ts +44 -0
  123. package/src/components/data-table/data-table.tsx +420 -150
  124. package/src/components/data-table/index.ts +4 -0
  125. package/src/components/drawer/drawer.tsx +1 -1
  126. package/src/components/modal/modal.tsx +1 -1
  127. package/src/components/notification/create-notifier.tsx +18 -2
  128. package/src/components/notification/notify-in-modal.test.tsx +128 -0
  129. package/src/components/notification/types.ts +5 -0
  130. package/src/lib/overlay-container.tsx +2 -1
  131. package/src/lib/overlay-layer.test.tsx +63 -1
  132. package/src/lib/overlay-layer.tsx +29 -6
  133. package/src/theme.css +14 -6
  134. package/src/theme.test.ts +14 -10
  135. package/dist/chunk-7P32XCEU.js.map +0 -1
  136. package/dist/chunk-H7WOMZXO.js.map +0 -1
  137. package/dist/chunk-N42EFOML.js.map +0 -1
  138. package/dist/chunk-YMVUQ2L7.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/use-hotkey.ts"],"names":[],"mappings":";;;;;AAsCA,IAAM,QAAA,GAAoD;AAAA,EACxD,GAAA,EAAK,KAAA;AAAA,EACL,IAAA,EAAM,MAAA;AAAA,EACN,GAAA,EAAK,MAAA;AAAA,EACL,OAAA,EAAS,MAAA;AAAA,EACT,IAAA,EAAM,MAAA;AAAA,EACN,OAAA,EAAS,MAAA;AAAA,EACT,GAAA,EAAK,KAAA;AAAA,EACL,MAAA,EAAQ,KAAA;AAAA,EACR,KAAA,EAAO;AACT,CAAA;AAGA,IAAM,YAAA,GAAgD;AAAA,EACpD,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,SAAA;AAAA,EACN,GAAA,EAAK,KAAA;AAAA,EACL,KAAA,EAAO;AACT,CAAA;AAGO,IAAM,kBAAkB,MAAe;AAC5C,EAAA,IAAI,OAAO,SAAA,KAAc,WAAA,EAAa,OAAO,KAAA;AAC7C,EAAA,MAAM,GAAA,GAA6D,SAAA;AAC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C,OAAA,CAAQ,KAAK,CAAA,EAAG;AACrB,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,IAAI,KAAA,CAAM,MAAA,IAAU,CAAC,MAAA,EAAQ;AAC7B,MAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,IACf,CAAA;AACA,IAAA,MAAA,CAAO,gBAAA,CAAiB,MAAM,KAAK,CAAA;AACnC,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,QAAA,CAAS,gBAAA,CAAiB,eAAe,aAAa,CAAA;AACtD,MAAA,QAAA,CAAS,gBAAA,CAAiB,cAAc,YAAY,CAAA;AAAA,IACtD;AACA,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,mBAAA,CAAoB,MAAM,KAAK,CAAA;AACtC,MAAA,QAAA,CAAS,mBAAA,CAAoB,eAAe,aAAa,CAAA;AACzD,MAAA,QAAA,CAAS,mBAAA,CAAoB,cAAc,YAAY,CAAA;AAAA,IACzD,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,SAAA,EAAW,MAAA,EAAQ,KAAA,EAAO,OAAO,KAAA,EAAO,MAAA,EAAQ,IAAA,EAAM,OAAO,CAAC,CAAA;AACpE;AAEA,IAAM,cAAA,GAAiB,MAAM,MAAM;AAAC,CAAA;AAM7B,IAAM,mBAAmB,MAC9B,oBAAA,CAAqB,cAAA,EAAgB,eAAA,EAAiB,MAAM,KAAK","file":"chunk-2CL3FKEY.js","sourcesContent":["\"use client\"\n\nimport {\n ArrowBigUp,\n ArrowDown,\n ArrowLeft,\n ArrowRight,\n ArrowRightToLine,\n ArrowUp,\n ChevronUp,\n Command,\n CornerDownLeft,\n Delete,\n type LucideIcon,\n Option,\n} from \"lucide-react\"\nimport { type RefObject, useEffect, useEffectEvent, useSyncExternalStore } from \"react\"\nimport { devWarn } from \"./dev-warn\"\nimport { useLayerCovered } from \"./overlay-layer\"\n\n/**\n * A small, platform-aware keyboard shortcut matcher: `\"mod+k\"`, `\"shift+mod+p\"`,\n * `\"alt+/\"`.\n *\n * - `mod` is ⌘ on Apple platforms and Ctrl elsewhere, the usual convention for\n * app shortcuts. `meta` / `cmd` and `ctrl` name one key explicitly.\n * - The last part is the key, compared case-insensitively with `event.key`, so\n * it follows the user's keyboard layout. The space bar is `space`. Modifiers must match exactly:\n * `mod+k` doesn't fire on ⌘⇧K.\n * - The key can be a modifier itself (`\"alt\"`, for hold-to-peek): its own flag\n * is then ignored, since pressing ⌥ sets `altKey` and releasing it clears it.\n * - An event fired while an IME is composing is ignored.\n * - A part that names no modifier (`\"ctl+k\"`) makes the hotkey match nothing,\n * rather than silently dropping it and firing on a bare `k`.\n */\n\ntype Modifiers = { meta: boolean; ctrl: boolean; alt: boolean; shift: boolean }\n\nconst MODIFIER: Record<string, keyof Modifiers | \"mod\"> = {\n mod: \"mod\",\n meta: \"meta\",\n cmd: \"meta\",\n command: \"meta\",\n ctrl: \"ctrl\",\n control: \"ctrl\",\n alt: \"alt\",\n option: \"alt\",\n shift: \"shift\",\n}\n\n/** A modifier as the key itself, spelled the way `event.key` spells it. */\nconst MODIFIER_KEY: Record<keyof Modifiers, string> = {\n meta: \"meta\",\n ctrl: \"control\",\n alt: \"alt\",\n shift: \"shift\",\n}\n\n/** Whether the user agent is an Apple platform (macOS, iOS, iPadOS): `mod` is ⌘ there. */\nexport const isApplePlatform = (): boolean => {\n if (typeof navigator === \"undefined\") return false\n const nav: Navigator & { userAgentData?: { platform?: string } } = navigator\n return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform ?? nav.platform ?? \"\")\n}\n\nexport type ParsedHotkey = Modifiers & {\n key: string\n /** Modifier parts that name no known modifier — a typo like `ctl`. */\n unknown: string[]\n}\n\ntype HotkeyEvent = Pick<\n KeyboardEvent,\n \"key\" | \"metaKey\" | \"ctrlKey\" | \"altKey\" | \"shiftKey\" | \"isComposing\"\n>\n\nconst resolveModifier = (part: string, apple: boolean): keyof Modifiers | undefined => {\n const modifier = MODIFIER[part]\n return modifier === \"mod\" ? (apple ? \"meta\" : \"ctrl\") : modifier\n}\n\n/** Parse a hotkey once: its key and the exact modifiers it needs. */\nexport const parseHotkey = (hotkey: string, apple = isApplePlatform()): ParsedHotkey => {\n const parts = hotkey\n .toLowerCase()\n .split(\"+\")\n .map((part) => part.trim())\n // A trailing \"+\" names the plus key itself: \"mod++\".\n const last = hotkey.endsWith(\"+\") ? \"+\" : (parts.at(-1) ?? \"\")\n const named = parts.slice(0, hotkey.endsWith(\"+\") ? -2 : -1)\n // A modifier as the key (`\"alt\"`, `\"mod\"`) is spelled as `event.key` has it.\n const self = resolveModifier(last, apple)\n const modifiers = named.map((part) => resolveModifier(part, apple))\n return {\n key: self ? MODIFIER_KEY[self] : last,\n meta: modifiers.includes(\"meta\"),\n ctrl: modifiers.includes(\"ctrl\"),\n alt: modifiers.includes(\"alt\"),\n shift: modifiers.includes(\"shift\"),\n unknown: named.filter((part) => MODIFIER[part] === undefined),\n }\n}\n\n/** Whether `event` is the already-parsed hotkey. */\nconst matchParsed = (parsed: ParsedHotkey, event: HotkeyEvent): boolean => {\n // `event.key` is a literal \" \" for the space bar, which a hotkey spells `space`.\n const key = event.key === \" \" ? \"space\" : event.key.toLowerCase()\n // Pressing a modifier sets its own flag (and releasing it clears it), so a\n // modifier that is the key itself is checked by `key` alone.\n const flag = (modifier: keyof Modifiers, pressed: boolean) =>\n key === MODIFIER_KEY[modifier] || pressed === parsed[modifier]\n return (\n !event.isComposing &&\n parsed.unknown.length === 0 &&\n key === parsed.key &&\n flag(\"meta\", event.metaKey) &&\n flag(\"ctrl\", event.ctrlKey) &&\n flag(\"alt\", event.altKey) &&\n flag(\"shift\", event.shiftKey)\n )\n}\n\n/** Whether `event` is `hotkey`. See the module doc for the rules. */\nexport const matchHotkey = (\n hotkey: string,\n event: HotkeyEvent,\n apple = isApplePlatform(),\n): boolean => matchParsed(parseHotkey(hotkey, apple), event)\n\n/**\n * The words a key cap reads as, keyed by the English string each replaces:\n * the word a cap shows (`ctrl`, `escape`) or the name it is spoken by (`command`,\n * `up`). Apple and the other platforms name some keys differently, so each\n * spelling has its own key: `return` / `enter`, `option` / `alt`, `delete`\n * (⌫ on a Mac) / `backspace`. `KEY_LABEL` says which key uses which; these\n * only replace the strings. `Intl` has no display names for keys, so these are\n * plain translations, English by default (`KBD_DEFAULT_TRANSLATIONS`).\n */\nexport type KbdTranslations = {\n /** ⌘, spoken on Apple. */\n command: string\n /** The Meta (Windows) key's word, off Apple. */\n meta: string\n /** ⌃, spoken on Apple. */\n control: string\n /** Ctrl's word, off Apple. \"Strg\" on a German keyboard. */\n ctrl: string\n /** ⌥, spoken on Apple. */\n option: string\n /** Alt's word, off Apple. */\n alt: string\n /** ⇧, spoken on every platform. */\n shift: string\n /** ↵, spoken on Apple. */\n return: string\n /** ↵, spoken off Apple. \"Entrée\" in French. */\n enter: string\n /** ⌫, spoken on Apple. */\n delete: string\n /** ⌫'s word, off Apple. \"Rücktaste\" in German, \"Retour arrière\" in French. */\n backspace: string\n /** ⌦, spoken on Apple. */\n forwardDelete: string\n /** ⌦'s word, off Apple. \"Suppr\" on a French keyboard, \"Entf\" on a German one. */\n del: string\n /** ⇥, spoken on every platform. */\n tab: string\n /** The arrows, spoken on every platform. */\n up: string\n down: string\n left: string\n right: string\n /** Esc's word, on every platform. \"Échap\" on a French keyboard. */\n escape: string\n /** The space bar's word, on every platform. */\n space: string\n /** Page Up and Page Down's words, on every platform. */\n pageUp: string\n pageDown: string\n}\n\n/** The English key words: what `<Kbd hotkey>`, `hotkeyKeys` and `formatHotkey`\n * read as without `translations`, and the base a partial override is merged onto. */\nexport const KBD_DEFAULT_TRANSLATIONS = {\n command: \"Command\",\n meta: \"Meta\",\n control: \"Control\",\n ctrl: \"Ctrl\",\n option: \"Option\",\n alt: \"Alt\",\n shift: \"Shift\",\n return: \"Return\",\n enter: \"Enter\",\n delete: \"Delete\",\n backspace: \"Backspace\",\n forwardDelete: \"Forward Delete\",\n del: \"Del\",\n tab: \"Tab\",\n up: \"Up Arrow\",\n down: \"Down Arrow\",\n left: \"Left Arrow\",\n right: \"Right Arrow\",\n escape: \"Esc\",\n space: \"Space\",\n pageUp: \"PgUp\",\n pageDown: \"PgDn\",\n} as const satisfies KbdTranslations\n\ntype KeyWord = keyof KbdTranslations\n\n/**\n * How a key reads on a key cap. One entry per key that doesn't read as typed:\n *\n * - `glyph`: the symbol Apple writes (⌘, ⇧, ↵), spoken there as `name` (a\n * bare `⌘` has no reliable spoken form).\n * - `text`: the word Windows and Linux write (`Ctrl`, `Shift`, `Enter`),\n * spoken there as itself.\n * - `icon`: what a `<Kbd>` cap draws for the key on every platform, so\n * Shift is the same arrow on a Mac and on a PC.\n * - `appleIcon`: an icon drawn on Apple only: the symbols only Apple uses\n * (⌘ ⌥ ⌃), and ⌫. Elsewhere those keys stay words: there is no honest icon\n * for Ctrl, Alt or the Windows key, and ⌫ reads as the Left Arrow there,\n * where the keyboard prints \"Backspace\".\n *\n * `text` and `name` are `KbdTranslations` keys, so a translation replaces the\n * word and never the key data. Apple platforms take the glyph and fall back to\n * the text; elsewhere it is the reverse, so a key with only a glyph (the\n * arrows) is a symbol everywhere and one with only a text (`Esc`) is a word\n * everywhere. Anything not listed is shown as typed, its first letter\n * upper-cased.\n */\ntype KeyLabel = {\n glyph?: string\n text?: KeyWord\n icon?: LucideIcon\n appleIcon?: LucideIcon\n name?: KeyWord\n}\n\nconst KEY_LABEL: Record<string, KeyLabel> = {\n meta: { glyph: \"⌘\", appleIcon: Command, name: \"command\", text: \"meta\" },\n control: { glyph: \"⌃\", appleIcon: ChevronUp, name: \"control\", text: \"ctrl\" },\n alt: { glyph: \"⌥\", appleIcon: Option, name: \"option\", text: \"alt\" },\n shift: { glyph: \"⇧\", icon: ArrowBigUp, name: \"shift\", text: \"shift\" },\n enter: { glyph: \"↵\", icon: CornerDownLeft, name: \"return\", text: \"enter\" },\n // An icon on Apple only: elsewhere ⌫ reads as ← (the Left Arrow), and the key\n // is printed \"Backspace\" on those keyboards.\n backspace: { glyph: \"⌫\", appleIcon: Delete, name: \"delete\", text: \"backspace\" },\n delete: { glyph: \"⌦\", name: \"forwardDelete\", text: \"del\" },\n tab: { glyph: \"⇥\", icon: ArrowRightToLine, name: \"tab\", text: \"tab\" },\n arrowup: { glyph: \"↑\", icon: ArrowUp, name: \"up\" },\n arrowdown: { glyph: \"↓\", icon: ArrowDown, name: \"down\" },\n arrowleft: { glyph: \"←\", icon: ArrowLeft, name: \"left\" },\n arrowright: { glyph: \"→\", icon: ArrowRight, name: \"right\" },\n // macOS menus spell these out too.\n escape: { text: \"escape\" },\n esc: { text: \"escape\" },\n space: { text: \"space\" },\n pageup: { text: \"pageUp\" },\n pagedown: { text: \"pageDown\" },\n}\n\n/** Apple's order for modifier glyphs (⌃⌥⇧⌘), used on every platform. */\nconst MODIFIER_ORDER: (keyof Modifiers)[] = [\"ctrl\", \"alt\", \"shift\", \"meta\"]\n\n/**\n * One key cap of a hotkey: the text it reads as (`label`), and, when the\n * key is drawn rather than written, the `icon` to draw (none for a glyph\n * with no icon, like ⌦) and the `name` to speak.\n * `id` tells caps apart (`\"ctrl\"`, `\"shift\"`, …, `\"key\"` for the last).\n */\nexport type HotkeyCap = { id: string; label: string; icon?: LucideIcon; name?: string }\n\nconst keyCap = (\n id: string,\n key: string,\n apple: boolean,\n translations: Partial<KbdTranslations> | undefined,\n): HotkeyCap => {\n const entry = KEY_LABEL[key]\n // Merged per key; a key set to `undefined` keeps its English word.\n const word = (of?: KeyWord) => of && (translations?.[of] ?? KBD_DEFAULT_TRANSLATIONS[of])\n const text = word(entry?.text)\n const spoken = word(entry?.name)\n const label =\n (apple ? (entry?.glyph ?? text) : (text ?? entry?.glyph)) ??\n key.charAt(0).toUpperCase() + key.slice(1)\n const icon = apple ? (entry?.appleIcon ?? entry?.icon) : entry?.icon\n // Spoken the platform's way: Apple's key names there (\"Return\"), the\n // word elsewhere (\"Enter\"), the arrows' names on both.\n const name = apple ? spoken : (text ?? spoken)\n // An icon, or Apple's glyph where it has none (⌦), is drawn and spoken by\n // name; a word reads as itself.\n const drawn = icon !== undefined || (label === entry?.glyph && apple)\n return drawn && name ? { id, label, name, ...(icon && { icon }) } : { id, label }\n}\n\n/**\n * The caps of a hotkey, modifiers first in Apple's order. What `<Kbd hotkey>`\n * renders; `hotkeyKeys` is its text. `translations` replaces the English key\n * words per key (see `KbdTranslations`).\n */\nexport const hotkeyCaps = (\n hotkey: string,\n apple = isApplePlatform(),\n translations?: Partial<KbdTranslations>,\n): HotkeyCap[] => {\n const parsed = parseHotkey(hotkey, apple)\n return [\n ...MODIFIER_ORDER.filter((modifier) => parsed[modifier]).map((modifier) =>\n keyCap(modifier, MODIFIER_KEY[modifier], apple, translations),\n ),\n keyCap(\"key\", parsed.key, apple, translations),\n ]\n}\n\n/**\n * The keys of a hotkey, one label per key cap, the way the platform writes\n * them: `\"mod+k\"` is `[\"⌘\", \"K\"]` on Apple platforms and `[\"Ctrl\", \"K\"]`\n * elsewhere, `\"shift+mod+p\"` is `[\"⇧\", \"⌘\", \"P\"]` / `[\"Ctrl\", \"Shift\", \"P\"]`.\n * Modifiers come in Apple's order (⌃⌥⇧⌘) whatever order the string names\n * them in. Render one `<kbd>` per label, or let `<Kbd hotkey>` do it.\n *\n * `apple` defaults to the current platform, which a server can't know: while\n * rendering, pass `useApplePlatform()` so the server markup and the first\n * client render agree. `translations` is `<Kbd>`'s, so the text and the caps\n * read the same: `{ ctrl: \"Strg\" }` gives `[\"Strg\", \"K\"]`.\n */\nexport const hotkeyKeys = (\n hotkey: string,\n apple = isApplePlatform(),\n translations?: Partial<KbdTranslations>,\n): string[] => hotkeyCaps(hotkey, apple, translations).map((cap) => cap.label)\n\n/**\n * The label for a hotkey as one string, for plain-text places (a `title`, a\n * tooltip, a menu's text): `hotkeyKeys` joined, the Apple way with no space\n * (`⌘K`, `⇧⌘P`) and with a space elsewhere (`Ctrl K`, `Ctrl Shift P`).\n * On screen, prefer `<Kbd hotkey>`, which draws one cap per key.\n *\n * `apple` defaults to the current platform, which a server can't know: while\n * rendering, pass `useApplePlatform()` so the server markup and the first\n * client render agree. `translations` is `<Kbd>`'s (`{ ctrl: \"Strg\" }` gives\n * `Strg K`).\n */\nexport const formatHotkey = (\n hotkey: string,\n apple = isApplePlatform(),\n translations?: Partial<KbdTranslations>,\n): string => hotkeyKeys(hotkey, apple, translations).join(apple ? \"\" : \" \")\n\n/** Input types where keys are commands, not text. */\nconst NON_TEXT_INPUTS = [\n \"checkbox\",\n \"radio\",\n \"range\",\n \"button\",\n \"submit\",\n \"reset\",\n \"color\",\n \"file\",\n \"image\",\n \"hidden\",\n]\n\n/** Where a keystroke types text rather than issuing a command: a text-like\n * `input`, a `textarea`, or a `contenteditable`. Not a checkbox, radio,\n * slider or file input, nor a `select` or a button: keys there are commands. */\nconst TEXT_FIELD = [\n \"textarea\",\n '[contenteditable]:not([contenteditable=\"false\"])',\n `input${NON_TEXT_INPUTS.map((type) => `:not([type=\"${type}\"])`).join(\"\")}`,\n].join(\", \")\n\nconst inTextField = (target: EventTarget | null): boolean =>\n target instanceof Element && target.closest(TEXT_FIELD) !== null\n\ntype Inputs = \"allow\" | \"ignore\" | \"only\"\n\n/** Whether `inputs` lets an event through, given whether it came from a text field. */\nconst INPUTS: Record<Inputs, (typing: boolean) => boolean> = {\n allow: () => true,\n ignore: (typing) => !typing,\n only: (typing) => typing,\n}\n\n/** The boolean form, kept from before the three modes. */\nconst LEGACY_INPUTS: Record<\"true\" | \"false\", Inputs> = { true: \"allow\", false: \"ignore\" }\n\n/** Can't type a character: it holds ⌘/Ctrl/Alt, or is a modifier itself. */\nconst chorded = (hotkey: ParsedHotkey): boolean =>\n hotkey.meta || hotkey.ctrl || hotkey.alt || Object.values(MODIFIER_KEY).includes(hotkey.key)\n\n/** The mode `inputs` resolves to for one hotkey. */\nconst inputMode = (inputs: HotkeyOptions[\"inputs\"], hotkey: ParsedHotkey): Inputs =>\n typeof inputs === \"boolean\"\n ? LEGACY_INPUTS[`${inputs}`]\n : (inputs ?? (chorded(hotkey) ? \"allow\" : \"ignore\"))\n\n/** A scope that can't take part right now: inert (a closed Collapse) or\n * hidden (an inactive Tabs panel), itself or through an ancestor. */\nconst unavailable = (scope: Element): boolean => scope.closest(\"[inert], [hidden]\") !== null\n\n/** The default `when`: skip what a component already handled. */\nconst unhandled = (event: KeyboardEvent): boolean => !event.defaultPrevented\n\nexport type HotkeyOptions = {\n /**\n * Whether the hotkey fires while typing in a text field (a text `input`,\n * `textarea` or `contenteditable`; buttons, sliders, checkboxes and selects\n * are not text fields):\n *\n * - `\"allow\"` (or `true`): anywhere, e.g. ⌘K.\n * - `\"ignore\"` (or `false`): not while typing, e.g. `/` or `?`, which would\n * otherwise swallow the character being typed (WCAG 2.1.4).\n * - `\"only\"`: only while typing, e.g. ⌘↵ to submit, Esc to clear.\n *\n * Defaults to `\"allow\"` for a hotkey holding ⌘/Ctrl/Alt (or a bare\n * modifier), which typing can't produce, and `\"ignore\"` for a bare key or a\n * `shift+` one, which would type a character. With an array, each hotkey\n * gets its own default.\n */\n inputs?: Inputs | boolean\n /** Fire only while focus is inside this element. A scope that is `inert`\n * or `hidden` (or inside one) counts as outside. */\n scope?: RefObject<Element | null>\n /** With `scope`: the pointer resting on the scope counts as being inside\n * it, no focus needed (hover a row, press `e` to archive it).\n * @default false */\n hover?: boolean\n /**\n * Yield while an overlay (Modal, Drawer, Popover, a picker's list) is open\n * above the component that bound the hotkey. A page's `j`/`k` go quiet\n * under a Modal; a Modal's own hotkey fires while it is on top and goes\n * quiet when something opens from it. Pass `false` for a hotkey that must\n * also reach the overlay it opened, like a toggle (Spotlight's ⌘K).\n * @default true\n */\n layer?: boolean\n /**\n * Also fire on the keydowns a held key auto-repeats. Off by default: a held\n * key firing an action thirty times a second (toggling fullscreen, opening\n * and closing a panel, deleting rows) is the costly surprise, while the\n * hotkeys that want it (`j`/`k` to move through a list) are few and opt in\n * with one word. A skipped repeat still has its default prevented, so a\n * held ⌘S doesn't fall through to the browser's Save dialog.\n * @default false\n */\n repeat?: boolean\n /** Fire on `keydown`, or on `keyup` for hold-and-release: a `keydown` and a\n * `keyup` hotkey on `\"alt\"` show hints while ⌥ is held.\n * @default \"keydown\" */\n event?: \"keydown\" | \"keyup\"\n /**\n * The last word on whether a matched event fires, after every option above.\n * Covers what they don't, such as yielding to a focused button or slider.\n *\n * It replaces the default, which skips an event a component already\n * handled (`event.defaultPrevented`: Select's ↵, zag's Esc). Keep that\n * check in yours unless the hotkey should run even then:\n *\n * when: (event) => !event.defaultPrevented && !isSlider(event.target)\n * when: () => true // also fire on handled events\n */\n when?: (event: KeyboardEvent) => boolean\n}\n\n/**\n * Call `handler` when one of `keys` is pressed. `false` (or `undefined`) binds\n * nothing. The matched event's default is prevented, so the browser's own\n * shortcut on the same keys doesn't also run.\n *\n * By default it fires anywhere in the document, except: in a text field for a\n * bare-key hotkey (`/`, `?`; a ⌘/Ctrl/Alt one fires there too), while an\n * overlay is open above the component that bound it, on a held key's\n * repeats, or on an event a component already handled. The options narrow or\n * widen that; see `HotkeyOptions`. A hotkey with an unknown modifier binds\n * nothing and warns in development.\n *\n * useHotkey(\"mod+k\", () => spotlight.toggle(), { layer: false })\n * useHotkey(\"/\", () => search.focus(), { inputs: \"ignore\" })\n * useHotkey([\"j\", \"arrowdown\"], next, { scope: list, repeat: true })\n */\nexport function useHotkey(\n keys: string | string[] | false | undefined,\n handler: (event: KeyboardEvent) => void,\n {\n inputs,\n scope,\n hover = false,\n layer = true,\n repeat = false,\n event: type = \"keydown\",\n when = unhandled,\n }: HotkeyOptions = {},\n): void {\n const onMatch = useEffectEvent(handler)\n const allowed = useEffectEvent(when)\n const covered = useLayerCovered()\n // One string for the deps, so an inline array doesn't rebind every render.\n // A newline can't be part of a hotkey.\n const signature = keys ? [keys].flat().join(\"\\n\") : \"\"\n useEffect(() => {\n if (!signature) return\n const hotkeys = signature.split(\"\\n\")\n const parsed = hotkeys.map((hotkey) => parseHotkey(hotkey))\n const unknown = parsed.flatMap((hotkey) => hotkey.unknown)\n if (unknown.length > 0) {\n devWarn(\n `useHotkey(\"${hotkeys.join('\", \"')}\"): unknown modifier ${unknown.map((part) => `\"${part}\"`).join(\", \")}, so nothing is bound. Use mod, meta (cmd, command), ctrl (control), alt (option) or shift, joined with \"+\", the key last: \"mod+shift+k\".`,\n )\n return\n }\n // The element under the pointer, for `hover`.\n let pointed: EventTarget | null = null\n const onPointerOver = (event: PointerEvent) => {\n pointed = event.target\n }\n const onPointerOut = (event: PointerEvent) => {\n // Out of the window: nothing is hovered any more.\n if (event.relatedTarget === null) pointed = null\n }\n const inScope = (event: KeyboardEvent): boolean => {\n if (!scope) return true\n const element = scope.current\n if (!element || unavailable(element)) return false\n const inside = (target: EventTarget | null) =>\n target instanceof Node && element.contains(target)\n return inside(event.target) || (hover && inside(pointed))\n }\n const onKey = (event: KeyboardEvent) => {\n const matched = parsed.find((hotkey) => matchParsed(hotkey, event))\n if (!matched) return\n if (layer && covered()) return\n if (!INPUTS[inputMode(inputs, matched)](inTextField(event.target))) return\n if (!inScope(event)) return\n if (!allowed(event)) return\n event.preventDefault()\n if (event.repeat && !repeat) return\n onMatch(event)\n }\n window.addEventListener(type, onKey)\n if (hover) {\n document.addEventListener(\"pointerover\", onPointerOver)\n document.addEventListener(\"pointerout\", onPointerOut)\n }\n return () => {\n window.removeEventListener(type, onKey)\n document.removeEventListener(\"pointerover\", onPointerOver)\n document.removeEventListener(\"pointerout\", onPointerOut)\n }\n }, [signature, inputs, scope, hover, layer, repeat, type, covered])\n}\n\nconst noSubscription = () => () => {}\n\n/**\n * Whether `mod` is ⌘ for this user, to label a shortcut hint (`⌘` vs `Ctrl`).\n * `false` during SSR and hydration, so the markup can't mismatch.\n */\nexport const useApplePlatform = (): boolean =>\n useSyncExternalStore(noSubscription, isApplePlatform, () => false)\n"]}
1
+ {"version":3,"sources":["../src/lib/use-hotkey.ts"],"names":[],"mappings":";;;;;AAsCA,IAAM,QAAA,GAAoD;AAAA,EACxD,GAAA,EAAK,KAAA;AAAA,EACL,IAA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ACpE;AAEA,IAAM,cAAA,GAAiB,MAAM,MAAM;AAAC,CAAA;AAM7B,IAAM,mBAAmB,MAC9B,oBAAA,CAAqB,cAAA,EAAgB,eAAA,EAAiB,MAAM,KAAK","file":"chunk-QEMXXQQO.js","sourcesContent":["\"use client\"\n\nimport {\n ArrowBigUp,\n ArrowDown,\n ArrowLeft,\n ArrowRight,\n ArrowRightToLine,\n ArrowUp,\n ChevronUp,\n Command,\n CornerDownLeft,\n Delete,\n type LucideIcon,\n Option,\n} from \"lucide-react\"\nimport { type RefObject, useEffect, useEffectEvent, useSyncExternalStore } from \"react\"\nimport { devWarn } from \"./dev-warn\"\nimport { useLayerCovered } from \"./overlay-layer\"\n\n/**\n * A small, platform-aware keyboard shortcut matcher: `\"mod+k\"`, `\"shift+mod+p\"`,\n * `\"alt+/\"`.\n *\n * - `mod` is ⌘ on Apple platforms and Ctrl elsewhere, the usual convention for\n * app shortcuts. `meta` / `cmd` and `ctrl` name one key explicitly.\n * - The last part is the key, compared case-insensitively with `event.key`, so\n * it follows the user's keyboard layout. The space bar is `space`. Modifiers must match exactly:\n * `mod+k` doesn't fire on ⌘⇧K.\n * - The key can be a modifier itself (`\"alt\"`, for hold-to-peek): its own flag\n * is then ignored, since pressing ⌥ sets `altKey` and releasing it clears it.\n * - An event fired while an IME is composing is ignored.\n * - A part that names no modifier (`\"ctl+k\"`) makes the hotkey match nothing,\n * rather than silently dropping it and firing on a bare `k`.\n */\n\ntype Modifiers = { meta: boolean; ctrl: boolean; alt: boolean; shift: boolean }\n\nconst MODIFIER: Record<string, keyof Modifiers | \"mod\"> = {\n mod: \"mod\",\n meta: \"meta\",\n cmd: \"meta\",\n command: \"meta\",\n ctrl: \"ctrl\",\n control: \"ctrl\",\n alt: \"alt\",\n option: \"alt\",\n shift: \"shift\",\n}\n\n/** A modifier as the key itself, spelled the way `event.key` spells it. */\nconst MODIFIER_KEY: Record<keyof Modifiers, string> = {\n meta: \"meta\",\n ctrl: \"control\",\n alt: \"alt\",\n shift: \"shift\",\n}\n\n/** Whether the user agent is an Apple platform (macOS, iOS, iPadOS): `mod` is ⌘ there. */\nexport const isApplePlatform = (): boolean => {\n if (typeof navigator === \"undefined\") return false\n const nav: Navigator & { userAgentData?: { platform?: string } } = navigator\n return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform ?? nav.platform ?? \"\")\n}\n\nexport type ParsedHotkey = Modifiers & {\n key: string\n /** Modifier parts that name no known modifier — a typo like `ctl`. */\n unknown: string[]\n}\n\ntype HotkeyEvent = Pick<\n KeyboardEvent,\n \"key\" | \"metaKey\" | \"ctrlKey\" | \"altKey\" | \"shiftKey\" | \"isComposing\"\n>\n\nconst resolveModifier = (part: string, apple: boolean): keyof Modifiers | undefined => {\n const modifier = MODIFIER[part]\n return modifier === \"mod\" ? (apple ? \"meta\" : \"ctrl\") : modifier\n}\n\n/** Parse a hotkey once: its key and the exact modifiers it needs. */\nexport const parseHotkey = (hotkey: string, apple = isApplePlatform()): ParsedHotkey => {\n const parts = hotkey\n .toLowerCase()\n .split(\"+\")\n .map((part) => part.trim())\n // A trailing \"+\" names the plus key itself: \"mod++\".\n const last = hotkey.endsWith(\"+\") ? \"+\" : (parts.at(-1) ?? \"\")\n const named = parts.slice(0, hotkey.endsWith(\"+\") ? -2 : -1)\n // A modifier as the key (`\"alt\"`, `\"mod\"`) is spelled as `event.key` has it.\n const self = resolveModifier(last, apple)\n const modifiers = named.map((part) => resolveModifier(part, apple))\n return {\n key: self ? MODIFIER_KEY[self] : last,\n meta: modifiers.includes(\"meta\"),\n ctrl: modifiers.includes(\"ctrl\"),\n alt: modifiers.includes(\"alt\"),\n shift: modifiers.includes(\"shift\"),\n unknown: named.filter((part) => MODIFIER[part] === undefined),\n }\n}\n\n/** Whether `event` is the already-parsed hotkey. */\nconst matchParsed = (parsed: ParsedHotkey, event: HotkeyEvent): boolean => {\n // `event.key` is a literal \" \" for the space bar, which a hotkey spells `space`.\n const key = event.key === \" \" ? \"space\" : event.key.toLowerCase()\n // Pressing a modifier sets its own flag (and releasing it clears it), so a\n // modifier that is the key itself is checked by `key` alone.\n const flag = (modifier: keyof Modifiers, pressed: boolean) =>\n key === MODIFIER_KEY[modifier] || pressed === parsed[modifier]\n return (\n !event.isComposing &&\n parsed.unknown.length === 0 &&\n key === parsed.key &&\n flag(\"meta\", event.metaKey) &&\n flag(\"ctrl\", event.ctrlKey) &&\n flag(\"alt\", event.altKey) &&\n flag(\"shift\", event.shiftKey)\n )\n}\n\n/** Whether `event` is `hotkey`. See the module doc for the rules. */\nexport const matchHotkey = (\n hotkey: string,\n event: HotkeyEvent,\n apple = isApplePlatform(),\n): boolean => matchParsed(parseHotkey(hotkey, apple), event)\n\n/**\n * The words a key cap reads as, keyed by the English string each replaces:\n * the word a cap shows (`ctrl`, `escape`) or the name it is spoken by (`command`,\n * `up`). Apple and the other platforms name some keys differently, so each\n * spelling has its own key: `return` / `enter`, `option` / `alt`, `delete`\n * (⌫ on a Mac) / `backspace`. `KEY_LABEL` says which key uses which; these\n * only replace the strings. `Intl` has no display names for keys, so these are\n * plain translations, English by default (`KBD_DEFAULT_TRANSLATIONS`).\n */\nexport type KbdTranslations = {\n /** ⌘, spoken on Apple. */\n command: string\n /** The Meta (Windows) key's word, off Apple. */\n meta: string\n /** ⌃, spoken on Apple. */\n control: string\n /** Ctrl's word, off Apple. \"Strg\" on a German keyboard. */\n ctrl: string\n /** ⌥, spoken on Apple. */\n option: string\n /** Alt's word, off Apple. */\n alt: string\n /** ⇧, spoken on every platform. */\n shift: string\n /** ↵, spoken on Apple. */\n return: string\n /** ↵, spoken off Apple. \"Entrée\" in French. */\n enter: string\n /** ⌫, spoken on Apple. */\n delete: string\n /** ⌫'s word, off Apple. \"Rücktaste\" in German, \"Retour arrière\" in French. */\n backspace: string\n /** ⌦, spoken on Apple. */\n forwardDelete: string\n /** ⌦'s word, off Apple. \"Suppr\" on a French keyboard, \"Entf\" on a German one. */\n del: string\n /** ⇥, spoken on every platform. */\n tab: string\n /** The arrows, spoken on every platform. */\n up: string\n down: string\n left: string\n right: string\n /** Esc's word, on every platform. \"Échap\" on a French keyboard. */\n escape: string\n /** The space bar's word, on every platform. */\n space: string\n /** Page Up and Page Down's words, on every platform. */\n pageUp: string\n pageDown: string\n}\n\n/** The English key words: what `<Kbd hotkey>`, `hotkeyKeys` and `formatHotkey`\n * read as without `translations`, and the base a partial override is merged onto. */\nexport const KBD_DEFAULT_TRANSLATIONS = {\n command: \"Command\",\n meta: \"Meta\",\n control: \"Control\",\n ctrl: \"Ctrl\",\n option: \"Option\",\n alt: \"Alt\",\n shift: \"Shift\",\n return: \"Return\",\n enter: \"Enter\",\n delete: \"Delete\",\n backspace: \"Backspace\",\n forwardDelete: \"Forward Delete\",\n del: \"Del\",\n tab: \"Tab\",\n up: \"Up Arrow\",\n down: \"Down Arrow\",\n left: \"Left Arrow\",\n right: \"Right Arrow\",\n escape: \"Esc\",\n space: \"Space\",\n pageUp: \"PgUp\",\n pageDown: \"PgDn\",\n} as const satisfies KbdTranslations\n\ntype KeyWord = keyof KbdTranslations\n\n/**\n * How a key reads on a key cap. One entry per key that doesn't read as typed:\n *\n * - `glyph`: the symbol Apple writes (⌘, ⇧, ↵), spoken there as `name` (a\n * bare `⌘` has no reliable spoken form).\n * - `text`: the word Windows and Linux write (`Ctrl`, `Shift`, `Enter`),\n * spoken there as itself.\n * - `icon`: what a `<Kbd>` cap draws for the key on every platform, so\n * Shift is the same arrow on a Mac and on a PC.\n * - `appleIcon`: an icon drawn on Apple only: the symbols only Apple uses\n * (⌘ ⌥ ⌃), and ⌫. Elsewhere those keys stay words: there is no honest icon\n * for Ctrl, Alt or the Windows key, and ⌫ reads as the Left Arrow there,\n * where the keyboard prints \"Backspace\".\n *\n * `text` and `name` are `KbdTranslations` keys, so a translation replaces the\n * word and never the key data. Apple platforms take the glyph and fall back to\n * the text; elsewhere it is the reverse, so a key with only a glyph (the\n * arrows) is a symbol everywhere and one with only a text (`Esc`) is a word\n * everywhere. Anything not listed is shown as typed, its first letter\n * upper-cased.\n */\ntype KeyLabel = {\n glyph?: string\n text?: KeyWord\n icon?: LucideIcon\n appleIcon?: LucideIcon\n name?: KeyWord\n}\n\nconst KEY_LABEL: Record<string, KeyLabel> = {\n meta: { glyph: \"⌘\", appleIcon: Command, name: \"command\", text: \"meta\" },\n control: { glyph: \"⌃\", appleIcon: ChevronUp, name: \"control\", text: \"ctrl\" },\n alt: { glyph: \"⌥\", appleIcon: Option, name: \"option\", text: \"alt\" },\n shift: { glyph: \"⇧\", icon: ArrowBigUp, name: \"shift\", text: \"shift\" },\n enter: { glyph: \"↵\", icon: CornerDownLeft, name: \"return\", text: \"enter\" },\n // An icon on Apple only: elsewhere ⌫ reads as ← (the Left Arrow), and the key\n // is printed \"Backspace\" on those keyboards.\n backspace: { glyph: \"⌫\", appleIcon: Delete, name: \"delete\", text: \"backspace\" },\n delete: { glyph: \"⌦\", name: \"forwardDelete\", text: \"del\" },\n tab: { glyph: \"⇥\", icon: ArrowRightToLine, name: \"tab\", text: \"tab\" },\n arrowup: { glyph: \"↑\", icon: ArrowUp, name: \"up\" },\n arrowdown: { glyph: \"↓\", icon: ArrowDown, name: \"down\" },\n arrowleft: { glyph: \"←\", icon: ArrowLeft, name: \"left\" },\n arrowright: { glyph: \"→\", icon: ArrowRight, name: \"right\" },\n // macOS menus spell these out too.\n escape: { text: \"escape\" },\n esc: { text: \"escape\" },\n space: { text: \"space\" },\n pageup: { text: \"pageUp\" },\n pagedown: { text: \"pageDown\" },\n}\n\n/** Apple's order for modifier glyphs (⌃⌥⇧⌘), used on every platform. */\nconst MODIFIER_ORDER: (keyof Modifiers)[] = [\"ctrl\", \"alt\", \"shift\", \"meta\"]\n\n/**\n * One key cap of a hotkey: the text it reads as (`label`), and, when the\n * key is drawn rather than written, the `icon` to draw (none for a glyph\n * with no icon, like ⌦) and the `name` to speak.\n * `id` tells caps apart (`\"ctrl\"`, `\"shift\"`, …, `\"key\"` for the last).\n */\nexport type HotkeyCap = { id: string; label: string; icon?: LucideIcon; name?: string }\n\nconst keyCap = (\n id: string,\n key: string,\n apple: boolean,\n translations: Partial<KbdTranslations> | undefined,\n): HotkeyCap => {\n const entry = KEY_LABEL[key]\n // Merged per key; a key set to `undefined` keeps its English word.\n const word = (of?: KeyWord) => of && (translations?.[of] ?? KBD_DEFAULT_TRANSLATIONS[of])\n const text = word(entry?.text)\n const spoken = word(entry?.name)\n const label =\n (apple ? (entry?.glyph ?? text) : (text ?? entry?.glyph)) ??\n key.charAt(0).toUpperCase() + key.slice(1)\n const icon = apple ? (entry?.appleIcon ?? entry?.icon) : entry?.icon\n // Spoken the platform's way: Apple's key names there (\"Return\"), the\n // word elsewhere (\"Enter\"), the arrows' names on both.\n const name = apple ? spoken : (text ?? spoken)\n // An icon, or Apple's glyph where it has none (⌦), is drawn and spoken by\n // name; a word reads as itself.\n const drawn = icon !== undefined || (label === entry?.glyph && apple)\n return drawn && name ? { id, label, name, ...(icon && { icon }) } : { id, label }\n}\n\n/**\n * The caps of a hotkey, modifiers first in Apple's order. What `<Kbd hotkey>`\n * renders; `hotkeyKeys` is its text. `translations` replaces the English key\n * words per key (see `KbdTranslations`).\n */\nexport const hotkeyCaps = (\n hotkey: string,\n apple = isApplePlatform(),\n translations?: Partial<KbdTranslations>,\n): HotkeyCap[] => {\n const parsed = parseHotkey(hotkey, apple)\n return [\n ...MODIFIER_ORDER.filter((modifier) => parsed[modifier]).map((modifier) =>\n keyCap(modifier, MODIFIER_KEY[modifier], apple, translations),\n ),\n keyCap(\"key\", parsed.key, apple, translations),\n ]\n}\n\n/**\n * The keys of a hotkey, one label per key cap, the way the platform writes\n * them: `\"mod+k\"` is `[\"⌘\", \"K\"]` on Apple platforms and `[\"Ctrl\", \"K\"]`\n * elsewhere, `\"shift+mod+p\"` is `[\"⇧\", \"⌘\", \"P\"]` / `[\"Ctrl\", \"Shift\", \"P\"]`.\n * Modifiers come in Apple's order (⌃⌥⇧⌘) whatever order the string names\n * them in. Render one `<kbd>` per label, or let `<Kbd hotkey>` do it.\n *\n * `apple` defaults to the current platform, which a server can't know: while\n * rendering, pass `useApplePlatform()` so the server markup and the first\n * client render agree. `translations` is `<Kbd>`'s, so the text and the caps\n * read the same: `{ ctrl: \"Strg\" }` gives `[\"Strg\", \"K\"]`.\n */\nexport const hotkeyKeys = (\n hotkey: string,\n apple = isApplePlatform(),\n translations?: Partial<KbdTranslations>,\n): string[] => hotkeyCaps(hotkey, apple, translations).map((cap) => cap.label)\n\n/**\n * The label for a hotkey as one string, for plain-text places (a `title`, a\n * tooltip, a menu's text): `hotkeyKeys` joined, the Apple way with no space\n * (`⌘K`, `⇧⌘P`) and with a space elsewhere (`Ctrl K`, `Ctrl Shift P`).\n * On screen, prefer `<Kbd hotkey>`, which draws one cap per key.\n *\n * `apple` defaults to the current platform, which a server can't know: while\n * rendering, pass `useApplePlatform()` so the server markup and the first\n * client render agree. `translations` is `<Kbd>`'s (`{ ctrl: \"Strg\" }` gives\n * `Strg K`).\n */\nexport const formatHotkey = (\n hotkey: string,\n apple = isApplePlatform(),\n translations?: Partial<KbdTranslations>,\n): string => hotkeyKeys(hotkey, apple, translations).join(apple ? \"\" : \" \")\n\n/** Input types where keys are commands, not text. */\nconst NON_TEXT_INPUTS = [\n \"checkbox\",\n \"radio\",\n \"range\",\n \"button\",\n \"submit\",\n \"reset\",\n \"color\",\n \"file\",\n \"image\",\n \"hidden\",\n]\n\n/** Where a keystroke types text rather than issuing a command: a text-like\n * `input`, a `textarea`, or a `contenteditable`. Not a checkbox, radio,\n * slider or file input, nor a `select` or a button: keys there are commands. */\nconst TEXT_FIELD = [\n \"textarea\",\n '[contenteditable]:not([contenteditable=\"false\"])',\n `input${NON_TEXT_INPUTS.map((type) => `:not([type=\"${type}\"])`).join(\"\")}`,\n].join(\", \")\n\nconst inTextField = (target: EventTarget | null): boolean =>\n target instanceof Element && target.closest(TEXT_FIELD) !== null\n\ntype Inputs = \"allow\" | \"ignore\" | \"only\"\n\n/** Whether `inputs` lets an event through, given whether it came from a text field. */\nconst INPUTS: Record<Inputs, (typing: boolean) => boolean> = {\n allow: () => true,\n ignore: (typing) => !typing,\n only: (typing) => typing,\n}\n\n/** The boolean form, kept from before the three modes. */\nconst LEGACY_INPUTS: Record<\"true\" | \"false\", Inputs> = { true: \"allow\", false: \"ignore\" }\n\n/** Can't type a character: it holds ⌘/Ctrl/Alt, or is a modifier itself. */\nconst chorded = (hotkey: ParsedHotkey): boolean =>\n hotkey.meta || hotkey.ctrl || hotkey.alt || Object.values(MODIFIER_KEY).includes(hotkey.key)\n\n/** The mode `inputs` resolves to for one hotkey. */\nconst inputMode = (inputs: HotkeyOptions[\"inputs\"], hotkey: ParsedHotkey): Inputs =>\n typeof inputs === \"boolean\"\n ? LEGACY_INPUTS[`${inputs}`]\n : (inputs ?? (chorded(hotkey) ? \"allow\" : \"ignore\"))\n\n/** A scope that can't take part right now: inert (a closed Collapse) or\n * hidden (an inactive Tabs panel), itself or through an ancestor. */\nconst unavailable = (scope: Element): boolean => scope.closest(\"[inert], [hidden]\") !== null\n\n/** The default `when`: skip what a component already handled. */\nconst unhandled = (event: KeyboardEvent): boolean => !event.defaultPrevented\n\nexport type HotkeyOptions = {\n /**\n * Whether the hotkey fires while typing in a text field (a text `input`,\n * `textarea` or `contenteditable`; buttons, sliders, checkboxes and selects\n * are not text fields):\n *\n * - `\"allow\"` (or `true`): anywhere, e.g. ⌘K.\n * - `\"ignore\"` (or `false`): not while typing, e.g. `/` or `?`, which would\n * otherwise swallow the character being typed (WCAG 2.1.4).\n * - `\"only\"`: only while typing, e.g. ⌘↵ to submit, Esc to clear.\n *\n * Defaults to `\"allow\"` for a hotkey holding ⌘/Ctrl/Alt (or a bare\n * modifier), which typing can't produce, and `\"ignore\"` for a bare key or a\n * `shift+` one, which would type a character. With an array, each hotkey\n * gets its own default.\n */\n inputs?: Inputs | boolean\n /** Fire only while focus is inside this element. A scope that is `inert`\n * or `hidden` (or inside one) counts as outside. */\n scope?: RefObject<Element | null>\n /** With `scope`: the pointer resting on the scope counts as being inside\n * it, no focus needed (hover a row, press `e` to archive it).\n * @default false */\n hover?: boolean\n /**\n * Yield while an overlay (Modal, Drawer, Popover, a picker's list) is open\n * above the component that bound the hotkey. A page's `j`/`k` go quiet\n * under a Modal; a Modal's own hotkey fires while it is on top and goes\n * quiet when something opens from it. Pass `false` for a hotkey that must\n * also reach the overlay it opened, like a toggle (Spotlight's ⌘K).\n * @default true\n */\n layer?: boolean\n /**\n * Also fire on the keydowns a held key auto-repeats. Off by default: a held\n * key firing an action thirty times a second (toggling fullscreen, opening\n * and closing a panel, deleting rows) is the costly surprise, while the\n * hotkeys that want it (`j`/`k` to move through a list) are few and opt in\n * with one word. A skipped repeat still has its default prevented, so a\n * held ⌘S doesn't fall through to the browser's Save dialog.\n * @default false\n */\n repeat?: boolean\n /** Fire on `keydown`, or on `keyup` for hold-and-release: a `keydown` and a\n * `keyup` hotkey on `\"alt\"` show hints while ⌥ is held.\n * @default \"keydown\" */\n event?: \"keydown\" | \"keyup\"\n /**\n * The last word on whether a matched event fires, after every option above.\n * Covers what they don't, such as yielding to a focused button or slider.\n *\n * It replaces the default, which skips an event a component already\n * handled (`event.defaultPrevented`: Select's ↵, zag's Esc). Keep that\n * check in yours unless the hotkey should run even then:\n *\n * when: (event) => !event.defaultPrevented && !isSlider(event.target)\n * when: () => true // also fire on handled events\n */\n when?: (event: KeyboardEvent) => boolean\n}\n\n/**\n * Call `handler` when one of `keys` is pressed. `false` (or `undefined`) binds\n * nothing. The matched event's default is prevented, so the browser's own\n * shortcut on the same keys doesn't also run.\n *\n * By default it fires anywhere in the document, except: in a text field for a\n * bare-key hotkey (`/`, `?`; a ⌘/Ctrl/Alt one fires there too), while an\n * overlay is open above the component that bound it, on a held key's\n * repeats, or on an event a component already handled. The options narrow or\n * widen that; see `HotkeyOptions`. A hotkey with an unknown modifier binds\n * nothing and warns in development.\n *\n * useHotkey(\"mod+k\", () => spotlight.toggle(), { layer: false })\n * useHotkey(\"/\", () => search.focus(), { inputs: \"ignore\" })\n * useHotkey([\"j\", \"arrowdown\"], next, { scope: list, repeat: true })\n */\nexport function useHotkey(\n keys: string | string[] | false | undefined,\n handler: (event: KeyboardEvent) => void,\n {\n inputs,\n scope,\n hover = false,\n layer = true,\n repeat = false,\n event: type = \"keydown\",\n when = unhandled,\n }: HotkeyOptions = {},\n): void {\n const onMatch = useEffectEvent(handler)\n const allowed = useEffectEvent(when)\n const covered = useLayerCovered()\n // One string for the deps, so an inline array doesn't rebind every render.\n // A newline can't be part of a hotkey.\n const signature = keys ? [keys].flat().join(\"\\n\") : \"\"\n useEffect(() => {\n if (!signature) return\n const hotkeys = signature.split(\"\\n\")\n const parsed = hotkeys.map((hotkey) => parseHotkey(hotkey))\n const unknown = parsed.flatMap((hotkey) => hotkey.unknown)\n if (unknown.length > 0) {\n devWarn(\n `useHotkey(\"${hotkeys.join('\", \"')}\"): unknown modifier ${unknown.map((part) => `\"${part}\"`).join(\", \")}, so nothing is bound. Use mod, meta (cmd, command), ctrl (control), alt (option) or shift, joined with \"+\", the key last: \"mod+shift+k\".`,\n )\n return\n }\n // The element under the pointer, for `hover`.\n let pointed: EventTarget | null = null\n const onPointerOver = (event: PointerEvent) => {\n pointed = event.target\n }\n const onPointerOut = (event: PointerEvent) => {\n // Out of the window: nothing is hovered any more.\n if (event.relatedTarget === null) pointed = null\n }\n const inScope = (event: KeyboardEvent): boolean => {\n if (!scope) return true\n const element = scope.current\n if (!element || unavailable(element)) return false\n const inside = (target: EventTarget | null) =>\n target instanceof Node && element.contains(target)\n return inside(event.target) || (hover && inside(pointed))\n }\n const onKey = (event: KeyboardEvent) => {\n const matched = parsed.find((hotkey) => matchParsed(hotkey, event))\n if (!matched) return\n if (layer && covered()) return\n if (!INPUTS[inputMode(inputs, matched)](inTextField(event.target))) return\n if (!inScope(event)) return\n if (!allowed(event)) return\n event.preventDefault()\n if (event.repeat && !repeat) return\n onMatch(event)\n }\n window.addEventListener(type, onKey)\n if (hover) {\n document.addEventListener(\"pointerover\", onPointerOver)\n document.addEventListener(\"pointerout\", onPointerOut)\n }\n return () => {\n window.removeEventListener(type, onKey)\n document.removeEventListener(\"pointerover\", onPointerOver)\n document.removeEventListener(\"pointerout\", onPointerOut)\n }\n }, [signature, inputs, scope, hover, layer, repeat, type, covered])\n}\n\nconst noSubscription = () => () => {}\n\n/**\n * Whether `mod` is ⌘ for this user, to label a shortcut hint (`⌘` vs `Ctrl`).\n * `false` during SSR and hydration, so the markup can't mismatch.\n */\nexport const useApplePlatform = (): boolean =>\n useSyncExternalStore(noSubscription, isApplePlatform, () => false)\n"]}
@@ -1,7 +1,7 @@
1
1
  import { inputSlot, inputShell, inputControlClasses } from './chunk-I4B3N3UX.js';
2
- import { scrollHighlightedIntoView, popoverChevron, popoverClearTrigger, popoverList, popoverContent, popoverIndicator, popoverOption, popoverGroupLabel, popoverEmpty } from './chunk-E3XLWMEB.js';
3
- import { useNestedLayer } from './chunk-H7WOMZXO.js';
4
- import { useOverlayContainer } from './chunk-7P32XCEU.js';
2
+ import { scrollHighlightedIntoView, popoverChevron, popoverClearTrigger, popoverList, popoverContent, popoverIndicator, popoverOption, popoverGroupLabel, popoverEmpty } from './chunk-RKCUXOU2.js';
3
+ import { useNestedLayer } from './chunk-HWBFRDX7.js';
4
+ import { useOverlayContainer } from './chunk-SLUOF7XW.js';
5
5
  import { ChevronIcon, CloseIcon, CheckIcon } from './chunk-6YNLRQ25.js';
6
6
  import { composeChildren } from './chunk-R5LYFTHA.js';
7
7
  import { props } from './chunk-WYCMIIRR.js';
@@ -181,5 +181,5 @@ var Combobox = {
181
181
  };
182
182
 
183
183
  export { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox, resolveComboboxTranslations };
184
- //# sourceMappingURL=chunk-2NTCQIRP.js.map
185
- //# sourceMappingURL=chunk-2NTCQIRP.js.map
184
+ //# sourceMappingURL=chunk-QRNQQIQM.js.map
185
+ //# sourceMappingURL=chunk-QRNQQIQM.js.map
@@ -1 +1 @@
1
- {"version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CAAA;AAAA,wBACxB,GAAA,CAACA,WAAI,aAAA,EAAJ,EAAkB,WAAW,gBAAA,EAC5B,QAAA,kBAAA,GAAA,CAAC,aAAU,CAAA,EACb;AAAA,OAAA,EACF;AAAA;AAAA,GAEJ;AAEJ,CAAA;AAQA,IAAM,QAAQ,CAAC;AAAA,EACb,KAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA,EAAS,QAAA;AAAA,EACT,GAAG;AACL,CAAA,qBACE,IAAA,CAACA,UAAA,CAAI,SAAA,EAAJ,EAAc,SAAA,EAAuB,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,MAAA,EAAQ,CAAA,EAAI,GAAG,IAAA,EAC5E,QAAA,EAAA;AAAA,EAAA,KAAA,IAAS,wBACR,GAAA,CAACA,UAAA,CAAI,gBAAJ,EAAmB,SAAA,EAAW,mBAAoB,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,EAE1D;AAAA,CAAA,EACH,CAAA;AAGF,IAAM,QAAQ,CAAC,EAAE,SAAA,EAAW,GAAG,MAAK,qBAClC,GAAA,CAACA,UAAA,CAAI,KAAA,EAAJ,EAAU,SAAA,EAAW,EAAA,CAAG,cAAc,SAAS,CAAA,EAAI,GAAG,IAAA,EAAM,CAAA;AAOxD,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,SAASA,UAAA,CAAI;AACf","file":"chunk-2NTCQIRP.js","sourcesContent":["\"use client\"\n\nimport { Combobox as Ark, useComboboxContext } from \"@ark-ui/react/combobox\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport {\n type ComponentProps,\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n useContext,\n} from \"react\"\nimport { composeChildren, type NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { ItemRenderState } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverEmpty,\n popoverGroupLabel,\n popoverIndicator,\n popoverList,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Combobox — the kit's composable search-select primitive, a thin styled layer\n * over Ark UI's Combobox parts. It's the engine `Autocomplete` and `MultiSelect`\n * build on, and the escape hatch when the data-driven components don't fit.\n *\n * Compose the parts yourself, Ark-style — pass a `collection`\n * (`createListCollection`, re-exported here), filter it on input change, and\n * render `Combobox.Item`s from it:\n *\n * const collection = createListCollection({ items });\n * <Combobox.Root collection={collection} onInputValueChange={...}>\n * <Combobox.Control>\n * <Combobox.Input />\n * <Combobox.Trigger />\n * </Combobox.Control>\n * <Combobox.Content>\n * {items.map((i) => <Combobox.Item key={i.value} item={i}>{i.label}</Combobox.Item>)}\n * <Combobox.Empty>Nothing found</Combobox.Empty>\n * </Combobox.Content>\n * </Combobox.Root>\n *\n * `Content` is the floating popover panel (Portal + Positioner + card chrome) —\n * the right choice behind a `Trigger`. For a combobox that renders permanently\n * open inside a container you already own (no trigger of its own — see\n * `ComboboxList` / `MultiComboboxList`), use `Panel` instead: same `Ark.Content`\n * + `Ark.List` wiring, no Portal/Positioner/card chrome.\n *\n * `size` / `variant` / `color` set once on `Root` flow to the control and\n * options through context. Ark owns the state machine: filtering contract,\n * keyboard nav, `multiple`, custom values, RTL, and Field wiring.\n */\n\ntype ComboboxStyle = { size: InputSize; variant: InputVariant }\nconst ComboboxStyleContext = createContext<ComboboxStyle>({\n size: \"md\",\n variant: \"default\",\n})\n\n/** The combobox family's wording — Ark's own Combobox `translations` type, derived structurally\n * rather than imported by name (`IntlTranslations` lives in `@zag-js/combobox`, a transitive\n * dependency). `triggerLabel` names the chevron toggle, `clearTriggerLabel` the clear (×)\n * button. Shared by `Combobox`, `Autocomplete`, `MultiSelect`, `ComboboxList` and\n * `MultiComboboxList`, so one translation pack covers the family. */\nexport type ComboboxTranslations = NonNullable<Ark.RootProps<Ark.CollectionItem>[\"translations\"]>\n\n/** The family's English defaults — the kit's own wording, not zag's (\"Toggle suggestions\"). */\nexport const COMBOBOX_DEFAULT_TRANSLATIONS = {\n triggerLabel: \"Show options\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies ComboboxTranslations\n\n/** Shallow per-key merge over `COMBOBOX_DEFAULT_TRANSLATIONS`. */\nexport const resolveComboboxTranslations = (overrides?: ComboboxTranslations) =>\n overrides ? { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...overrides } : COMBOBOX_DEFAULT_TRANSLATIONS\n\nexport type ComboboxRootProps<T extends Ark.CollectionItem = Ark.CollectionItem> = Omit<\n Ark.RootProps<T>,\n \"color\" | \"className\"\n> &\n WithTestId & {\n /** Control + option sizing. Flows to the parts via context. */\n size?: InputSize\n /** Control shell treatment. */\n variant?: InputVariant\n /** Focus-ring accent for the control. */\n className?: string\n }\n\n// Generic over the collection item type (like Ark's Root) so a typed\n// `ListCollection<T>` flows through without widening to `unknown`.\nconst Root = <T extends Ark.CollectionItem = Ark.CollectionItem>({\n size = \"md\",\n variant = \"default\",\n positioning,\n className,\n children,\n testId,\n translations,\n ...rest\n}: ComboboxRootProps<T>) => (\n <ComboboxStyleContext.Provider value={{ size, variant }}>\n <Ark.Root\n // Match the popover width to the control by default; callers can override.\n positioning={{ sameWidth: true, ...positioning }}\n // The popover's Content is an `overflow-hidden` clip wrapper, so the\n // machine's native auto-scroll (which needs Content to be scrollable) is a\n // no-op; route scrolling to the inner List scroller instead. Callers in\n // `rest` can still override.\n scrollToIndexFn={scrollHighlightedIntoView}\n className={cn(\"w-full\", className)}\n // The kit's English wording over zag's; a partial override keeps the other key.\n translations={resolveComboboxTranslations(translations)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ComboboxStyleContext.Provider>\n)\n\nexport type ComboboxControlProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Control>> &\n WithTestId & {\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the composed Trigger / ClearTrigger. */\n endSlot?: ReactNode\n }\n\nconst Control = ({\n startSlot,\n endSlot,\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: ComboboxControlProps) => {\n const { size, variant } = useContext(ComboboxStyleContext)\n return (\n <Ark.Control\n {...props({\n \"data-with-start-slot\": startSlot != null,\n // The composed Trigger / ClearTrigger always sits at the end.\n \"data-with-end-slot\": true,\n \"data-testid\": testId,\n })}\n className={cn(inputShell({ size, variant }), className)}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </Ark.Control>\n )\n}\n\n// `ComponentProps` (not `…WithoutRef`) so a caller's `ref` reaches the underlying\n// `<input>` — it's the focus target for the form-control contract (focus-on-error).\nconst Input = ({ className, testId, ...rest }: ComponentProps<typeof Ark.Input> & WithTestId) => (\n <Ark.Input\n className={cn(inputControlClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nconst Trigger = ({\n className,\n children,\n asChild,\n ...rest\n}: ComponentPropsWithoutRef<typeof Ark.Trigger>) => (\n <Ark.Trigger\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm\",\n \"data-[state=open]:rotate-180 disabled:cursor-not-allowed\",\n className,\n )}\n asChild={asChild}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => own ?? <ChevronIcon />)}\n </Ark.Trigger>\n)\n\nconst ClearTrigger = ({\n className,\n children,\n asChild,\n ...rest\n}: ComponentPropsWithoutRef<typeof Ark.ClearTrigger>) => (\n // zag marks the combobox clear control `tabIndex={-1}`; surface it in the tab\n // order so keyboard users can reach it (matching Select's clear and the tree\n // clears). A caller can still override via `tabIndex` in `rest`.\n <Ark.ClearTrigger\n tabIndex={0}\n className={cn(popoverClearTrigger, className)}\n asChild={asChild}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => own ?? <CloseIcon />)}\n </Ark.ClearTrigger>\n)\n\nconst Content = ({\n className,\n children,\n withPaddingTop = true,\n withinPortal = true,\n container,\n asChild: _asChild,\n ...rest\n}: NoAsChild<ComponentPropsWithoutRef<typeof Ark.Content>> & {\n withPaddingTop?: boolean\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n}) => {\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useComboboxContext().open)\n return (\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content className={cn(popoverContent, className)} {...rest}>\n <Ark.List className={popoverList({ withPaddingTop })}>{children}</Ark.List>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n )\n}\n\n/**\n * Inline alternative to `Content` — no `Portal`, no `Positioner`, no floating\n * chrome. For a combobox meant to render permanently open inside a container\n * the caller already owns (e.g. another `Popover`'s body), where the floating\n * machinery would just be dead weight and the wrong chrome (a card inside a\n * card). `getContentProps` doesn't require a Positioner to work — it's a plain\n * `hidden`-toggled element — so `Ark.Content` renders inline in normal flow.\n */\nconst Panel = ({\n className,\n children,\n withPaddingTop = true,\n asChild: _asChild,\n ...rest\n}: NoAsChild<ComponentPropsWithoutRef<typeof Ark.Content>> & { withPaddingTop?: boolean }) => {\n return (\n <Ark.Content {...rest}>\n <Ark.List className={cn(popoverList({ withPaddingTop }), className)}>{children}</Ark.List>\n </Ark.Content>\n )\n}\n\nexport type ComboboxItemProps = NoAsChild<\n Omit<ComponentPropsWithoutRef<typeof Ark.Item>, \"children\">\n> &\n WithTestId & {\n /**\n * Option content. A plain node renders as the label (the kit adds the check\n * indicator); a function takes over the whole row, receiving the item's live\n * state so it can draw its own affordance.\n */\n children?: ReactNode | ((state: ItemRenderState) => ReactNode)\n }\n\nconst Item = ({ className, children, testId, asChild: _asChild, ...rest }: ComboboxItemProps) => {\n const { size } = useContext(ComboboxStyleContext)\n return (\n <Ark.Item\n className={cn(popoverOption({ size }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {typeof children === \"function\" ? (\n <Ark.ItemContext>\n {(ctx) => children({ selected: ctx.selected, highlighted: ctx.highlighted })}\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{children}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n}\n\nexport type ComboboxGroupProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.ItemGroup>> &\n WithTestId & {\n /** Group heading rendered above the options. */\n label?: ReactNode\n }\n\nconst Group = ({\n label,\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: ComboboxGroupProps) => (\n <Ark.ItemGroup className={className} {...props({ \"data-testid\": testId })} {...rest}>\n {label != null && (\n <Ark.ItemGroupLabel className={popoverGroupLabel}>{label}</Ark.ItemGroupLabel>\n )}\n {children}\n </Ark.ItemGroup>\n)\n\nconst Empty = ({ className, ...rest }: ComponentPropsWithoutRef<typeof Ark.Empty>) => (\n <Ark.Empty className={cn(popoverEmpty, className)} {...rest} />\n)\n\n/**\n * Composable parts namespace (Ark-style). `Context` is Ark's render-prop access\n * to the live machine api (e.g. to map over the filtered collection).\n */\nexport const Combobox = {\n Root,\n Control,\n Input,\n Trigger,\n ClearTrigger,\n Content,\n Panel,\n Item,\n Group,\n Empty,\n Context: Ark.Context,\n}\n"]}
1
+ {"version":3,"sources":["../src/components/combobox/combobox.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;AAuEA,IAAM,uBAAuB,aAAA,CAA6B;AAAA,EACxD,IAAA,EAAM,IAAA;AAAA,EACN,OAAA,EAAS;AACX,CAAC,CAAA;AAUM,IAAM,6BAAA,GAAgC;AAAA,EAC3C,YAAA,EAAc,cAAA;AAAA,EACd,iBAAA,EAAmB;AACrB;AAGO,IAAM,2BAAA,GAA8B,CAAC,SAAA,KAC1C,SAAA,GAAY,EAAE,GAAG,6BAAA,EAA+B,GAAG,SAAA,EAAU,GAAI;AAiBnE,IAAM,OAAO,CAAoD;AAAA,EAC/D,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,WAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA,CAAC,qBAAqB,QAAA,EAArB,EAA8B,OAAO,EAAE,IAAA,EAAM,SAAQ,EACpD,QAAA,kBAAA,GAAA;AAAA,EAACA,UAAA,CAAI,IAAA;AAAA,EAAJ;AAAA,IAEC,WAAA,EAAa,EAAE,SAAA,EAAW,IAAA,EAAM,GAAG,WAAA,EAAY;AAAA,IAK/C,eAAA,EAAiB,yBAAA;AAAA,IACjB,SAAA,EAAW,EAAA,CAAG,QAAA,EAAU,SAAS,CAAA;AAAA,IAEjC,YAAA,EAAc,4BAA4B,YAAY,CAAA;AAAA,IACrD,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG,IAAA;AAAA,IAEH;AAAA;AACH,CAAA,EACF,CAAA;AAWF,IAAM,UAAU,CAAC;AAAA,EACf,SAAA;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as Ark, useComboboxContext } from \"@ark-ui/react/combobox\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport {\n type ComponentProps,\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n useContext,\n} from \"react\"\nimport { composeChildren, type NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { ItemRenderState } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverEmpty,\n popoverGroupLabel,\n popoverIndicator,\n popoverList,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Combobox — the kit's composable search-select primitive, a thin styled layer\n * over Ark UI's Combobox parts. It's the engine `Autocomplete` and `MultiSelect`\n * build on, and the escape hatch when the data-driven components don't fit.\n *\n * Compose the parts yourself, Ark-style — pass a `collection`\n * (`createListCollection`, re-exported here), filter it on input change, and\n * render `Combobox.Item`s from it:\n *\n * const collection = createListCollection({ items });\n * <Combobox.Root collection={collection} onInputValueChange={...}>\n * <Combobox.Control>\n * <Combobox.Input />\n * <Combobox.Trigger />\n * </Combobox.Control>\n * <Combobox.Content>\n * {items.map((i) => <Combobox.Item key={i.value} item={i}>{i.label}</Combobox.Item>)}\n * <Combobox.Empty>Nothing found</Combobox.Empty>\n * </Combobox.Content>\n * </Combobox.Root>\n *\n * `Content` is the floating popover panel (Portal + Positioner + card chrome) —\n * the right choice behind a `Trigger`. For a combobox that renders permanently\n * open inside a container you already own (no trigger of its own — see\n * `ComboboxList` / `MultiComboboxList`), use `Panel` instead: same `Ark.Content`\n * + `Ark.List` wiring, no Portal/Positioner/card chrome.\n *\n * `size` / `variant` / `color` set once on `Root` flow to the control and\n * options through context. Ark owns the state machine: filtering contract,\n * keyboard nav, `multiple`, custom values, RTL, and Field wiring.\n */\n\ntype ComboboxStyle = { size: InputSize; variant: InputVariant }\nconst ComboboxStyleContext = createContext<ComboboxStyle>({\n size: \"md\",\n variant: \"default\",\n})\n\n/** The combobox family's wording — Ark's own Combobox `translations` type, derived structurally\n * rather than imported by name (`IntlTranslations` lives in `@zag-js/combobox`, a transitive\n * dependency). `triggerLabel` names the chevron toggle, `clearTriggerLabel` the clear (×)\n * button. Shared by `Combobox`, `Autocomplete`, `MultiSelect`, `ComboboxList` and\n * `MultiComboboxList`, so one translation pack covers the family. */\nexport type ComboboxTranslations = NonNullable<Ark.RootProps<Ark.CollectionItem>[\"translations\"]>\n\n/** The family's English defaults — the kit's own wording, not zag's (\"Toggle suggestions\"). */\nexport const COMBOBOX_DEFAULT_TRANSLATIONS = {\n triggerLabel: \"Show options\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies ComboboxTranslations\n\n/** Shallow per-key merge over `COMBOBOX_DEFAULT_TRANSLATIONS`. */\nexport const resolveComboboxTranslations = (overrides?: ComboboxTranslations) =>\n overrides ? { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...overrides } : COMBOBOX_DEFAULT_TRANSLATIONS\n\nexport type ComboboxRootProps<T extends Ark.CollectionItem = Ark.CollectionItem> = Omit<\n Ark.RootProps<T>,\n \"color\" | \"className\"\n> &\n WithTestId & {\n /** Control + option sizing. Flows to the parts via context. */\n size?: InputSize\n /** Control shell treatment. */\n variant?: InputVariant\n /** Focus-ring accent for the control. */\n className?: string\n }\n\n// Generic over the collection item type (like Ark's Root) so a typed\n// `ListCollection<T>` flows through without widening to `unknown`.\nconst Root = <T extends Ark.CollectionItem = Ark.CollectionItem>({\n size = \"md\",\n variant = \"default\",\n positioning,\n className,\n children,\n testId,\n translations,\n ...rest\n}: ComboboxRootProps<T>) => (\n <ComboboxStyleContext.Provider value={{ size, variant }}>\n <Ark.Root\n // Match the popover width to the control by default; callers can override.\n positioning={{ sameWidth: true, ...positioning }}\n // The popover's Content is an `overflow-hidden` clip wrapper, so the\n // machine's native auto-scroll (which needs Content to be scrollable) is a\n // no-op; route scrolling to the inner List scroller instead. Callers in\n // `rest` can still override.\n scrollToIndexFn={scrollHighlightedIntoView}\n className={cn(\"w-full\", className)}\n // The kit's English wording over zag's; a partial override keeps the other key.\n translations={resolveComboboxTranslations(translations)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ComboboxStyleContext.Provider>\n)\n\nexport type ComboboxControlProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Control>> &\n WithTestId & {\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the composed Trigger / ClearTrigger. */\n endSlot?: ReactNode\n }\n\nconst Control = ({\n startSlot,\n endSlot,\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: ComboboxControlProps) => {\n const { size, variant } = useContext(ComboboxStyleContext)\n return (\n <Ark.Control\n {...props({\n \"data-with-start-slot\": startSlot != null,\n // The composed Trigger / ClearTrigger always sits at the end.\n \"data-with-end-slot\": true,\n \"data-testid\": testId,\n })}\n className={cn(inputShell({ size, variant }), className)}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </Ark.Control>\n )\n}\n\n// `ComponentProps` (not `…WithoutRef`) so a caller's `ref` reaches the underlying\n// `<input>` — it's the focus target for the form-control contract (focus-on-error).\nconst Input = ({ className, testId, ...rest }: ComponentProps<typeof Ark.Input> & WithTestId) => (\n <Ark.Input\n className={cn(inputControlClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nconst Trigger = ({\n className,\n children,\n asChild,\n ...rest\n}: ComponentPropsWithoutRef<typeof Ark.Trigger>) => (\n <Ark.Trigger\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm\",\n \"data-[state=open]:rotate-180 disabled:cursor-not-allowed\",\n className,\n )}\n asChild={asChild}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => own ?? <ChevronIcon />)}\n </Ark.Trigger>\n)\n\nconst ClearTrigger = ({\n className,\n children,\n asChild,\n ...rest\n}: ComponentPropsWithoutRef<typeof Ark.ClearTrigger>) => (\n // zag marks the combobox clear control `tabIndex={-1}`; surface it in the tab\n // order so keyboard users can reach it (matching Select's clear and the tree\n // clears). A caller can still override via `tabIndex` in `rest`.\n <Ark.ClearTrigger\n tabIndex={0}\n className={cn(popoverClearTrigger, className)}\n asChild={asChild}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => own ?? <CloseIcon />)}\n </Ark.ClearTrigger>\n)\n\nconst Content = ({\n className,\n children,\n withPaddingTop = true,\n withinPortal = true,\n container,\n asChild: _asChild,\n ...rest\n}: NoAsChild<ComponentPropsWithoutRef<typeof Ark.Content>> & {\n withPaddingTop?: boolean\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n}) => {\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useComboboxContext().open)\n return (\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content className={cn(popoverContent, className)} {...rest}>\n <Ark.List className={popoverList({ withPaddingTop })}>{children}</Ark.List>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n )\n}\n\n/**\n * Inline alternative to `Content` — no `Portal`, no `Positioner`, no floating\n * chrome. For a combobox meant to render permanently open inside a container\n * the caller already owns (e.g. another `Popover`'s body), where the floating\n * machinery would just be dead weight and the wrong chrome (a card inside a\n * card). `getContentProps` doesn't require a Positioner to work — it's a plain\n * `hidden`-toggled element — so `Ark.Content` renders inline in normal flow.\n */\nconst Panel = ({\n className,\n children,\n withPaddingTop = true,\n asChild: _asChild,\n ...rest\n}: NoAsChild<ComponentPropsWithoutRef<typeof Ark.Content>> & { withPaddingTop?: boolean }) => {\n return (\n <Ark.Content {...rest}>\n <Ark.List className={cn(popoverList({ withPaddingTop }), className)}>{children}</Ark.List>\n </Ark.Content>\n )\n}\n\nexport type ComboboxItemProps = NoAsChild<\n Omit<ComponentPropsWithoutRef<typeof Ark.Item>, \"children\">\n> &\n WithTestId & {\n /**\n * Option content. A plain node renders as the label (the kit adds the check\n * indicator); a function takes over the whole row, receiving the item's live\n * state so it can draw its own affordance.\n */\n children?: ReactNode | ((state: ItemRenderState) => ReactNode)\n }\n\nconst Item = ({ className, children, testId, asChild: _asChild, ...rest }: ComboboxItemProps) => {\n const { size } = useContext(ComboboxStyleContext)\n return (\n <Ark.Item\n className={cn(popoverOption({ size }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {typeof children === \"function\" ? (\n <Ark.ItemContext>\n {(ctx) => children({ selected: ctx.selected, highlighted: ctx.highlighted })}\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{children}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n}\n\nexport type ComboboxGroupProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.ItemGroup>> &\n WithTestId & {\n /** Group heading rendered above the options. */\n label?: ReactNode\n }\n\nconst Group = ({\n label,\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: ComboboxGroupProps) => (\n <Ark.ItemGroup className={className} {...props({ \"data-testid\": testId })} {...rest}>\n {label != null && (\n <Ark.ItemGroupLabel className={popoverGroupLabel}>{label}</Ark.ItemGroupLabel>\n )}\n {children}\n </Ark.ItemGroup>\n)\n\nconst Empty = ({ className, ...rest }: ComponentPropsWithoutRef<typeof Ark.Empty>) => (\n <Ark.Empty className={cn(popoverEmpty, className)} {...rest} />\n)\n\n/**\n * Composable parts namespace (Ark-style). `Context` is Ark's render-prop access\n * to the live machine api (e.g. to map over the filtered collection).\n */\nexport const Combobox = {\n Root,\n Control,\n Input,\n Trigger,\n ClearTrigger,\n Content,\n Panel,\n Item,\n Group,\n Empty,\n Context: Ark.Context,\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { useNestedLayer, OverlayLayerProvider, useLayerGuard } from './chunk-H7WOMZXO.js';
1
+ import { useNestedLayer, OverlayLayerProvider, useLayerGuard } from './chunk-HWBFRDX7.js';
2
2
  import { toPositioning } from './chunk-V6PY7C6S.js';
3
- import { useOverlayContainer } from './chunk-7P32XCEU.js';
3
+ import { useOverlayContainer } from './chunk-SLUOF7XW.js';
4
4
  import { useUncontrolled } from './chunk-PMUCGFY5.js';
5
5
  import { props } from './chunk-WYCMIIRR.js';
6
6
  import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
@@ -429,5 +429,5 @@ var Popover = {
429
429
  };
430
430
 
431
431
  export { Popover, activeGroupContent, popoverChevron, popoverChrome, popoverClearTrigger, popoverContent, popoverEmpty, popoverGroupLabel, popoverIndicator, popoverList, popoverOption, popoverPanel, scrollHighlightedIntoView, slideStyle, splitGroupChildren, useSlideAfterPlaced };
432
- //# sourceMappingURL=chunk-E3XLWMEB.js.map
433
- //# sourceMappingURL=chunk-E3XLWMEB.js.map
432
+ //# sourceMappingURL=chunk-RKCUXOU2.js.map
433
+ //# sourceMappingURL=chunk-RKCUXOU2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/slide-on-switch.ts","../src/components/popover/popover.tsx"],"names":["useState","useRef","ArkPopover","api","props"],"mappings":";;;;;;;;;;;;;;AAiCO,IAAM,UAAA,GAAa;AAAA,EACxB,kBAAA,EAAoB,WAAA;AAAA,EACpB,kBAAA,EAAoB,OAAA;AAAA,EACp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GAAG;AAAA;AACN,CAAA;AAKK,IAAM,OAAA,GAAU;AAAA,EACrB,IAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQA,SAAA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-E3XLWMEB.js","sourcesContent":["import {\n Children,\n cloneElement,\n type ElementType,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useRef,\n useState,\n} from \"react\"\nimport type { Positioning } from \"./placement\"\n\n/**\n * Shared by `HoverCard.Group` and `Popover.Group`: several named triggers on\n * one Ark machine, one panel that slides from the active trigger to the next.\n */\n\n/** Slide transition for a group's shared positioner. Ark sets the\n * positioner's `transform: translate3d(var(--x), var(--y), 0)` inline\n * (`@zag-js/popper`); animating `transform` itself makes the browser\n * interpolate that translate between two trigger anchors when the group's\n * active trigger changes. Passed as `style` (not a class) so it merges with,\n * rather than replaces, Ark's own inline `transform`/`position` (Ark's\n * `mergeProps` shallow-merges style objects); the same override-the-real-style\n * technique `Tabs.Indicator` / `SegmentGroup` use for their sliding pill.\n *\n * Only applied once `useSlideAfterPlaced` reports `sliding`, never on an\n * open's first placement: before it, the positioner sits at its unplaced\n * origin (far off the trigger), and animating *that* jump reads as the panel\n * flying in across the page instead of just appearing. A standalone `Root`\n * never gets this at all: it also repositions on scroll/resize\n * (`autoUpdate`), where an animated `transform` would look laggy rather than\n * responsive. */\nexport const slideStyle = {\n transitionProperty: \"transform\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.32, 0.72, 0, 1)\",\n} as const\n\ntype UpdatePosition = NonNullable<Positioning[\"updatePosition\"]>\n\n/**\n * `sliding` turns true once an open's first placement has been applied, and\n * false on every close. Waiting for the placement itself, not a frame count:\n * the first one after an open can take several frames (the panel mounts,\n * zag defers to the next frame, floating-ui computes asynchronously), and a\n * transition switched on before it lands slides the panel in from its\n * unplaced origin.\n *\n * Feed every open change to `onOpenChange`, and pass `updatePosition(...)`\n * as the machine's `positioning.updatePosition` — zag calls it for every\n * placement, with its own `updatePosition` to run. A consumer's own\n * `updatePosition`, if any, is wrapped rather than replaced.\n */\nexport const useSlideAfterPlaced = () => {\n const [sliding, setSliding] = useState(false)\n // Read by placements zag finishes asynchronously, after a close may have\n // landed — one of those must not re-arm the slide for the next open.\n const open = useRef(false)\n const onOpenChange = (next: boolean) => {\n open.current = next\n if (!next) setSliding(false)\n }\n const updatePosition =\n (custom?: UpdatePosition): UpdatePosition =>\n async (data) => {\n await (custom ? custom(data) : data.updatePosition())\n if (open.current) setSliding(true)\n }\n return { sliding, onOpenChange, updatePosition }\n}\n\n/** Split a group's children into its `Content` parts (matched by `type`)\n * and everything else (the triggers), one level deep. */\nexport const splitGroupChildren = <P extends { value?: string }>(\n children: ReactNode,\n content: ElementType<P>,\n) => {\n const items = Children.toArray(children)\n const isContent = (node: ReactNode): node is ReactElement<P> =>\n isValidElement(node) && node.type === content\n return { contents: items.filter(isContent), triggers: items.filter((item) => !isContent(item)) }\n}\n\n/** The `Content` whose `value` matches the active trigger, under one forced,\n * stable `key` — overriding whatever each was authored with (e.g.\n * `key={person.handle}` in a `.map()`). The slot only ever renders one at a\n * time, but a *different* key switching in reads to React as a different\n * component, unmounting the real Positioner/Content DOM tree and mounting a\n * fresh one instead of updating it in place. That fresh mount breaks the\n * \"one shared, sliding panel\" contract: its position starts unset again, so\n * every switch would look like the panel jumping in from the top. */\nexport const activeGroupContent = (\n contents: ReactElement<{ value?: string }>[],\n triggerValue: string | null,\n) => {\n const active = contents.find((content) => content.props.value === triggerValue)\n return active ? cloneElement(active, { key: \"group-content\" }) : null\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport {\n type LogicalPosition,\n type Placement,\n type PlacementProps,\n toPositioning,\n} from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport {\n activeGroupContent,\n slideStyle,\n splitGroupChildren,\n useSlideAfterPlaced,\n} from \"../../lib/slide-on-switch\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron = \"shrink-0 text-black/50 transition-transform dark:text-white/50\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-black/50 transition-colors hover:text-brand-900/70 dark:text-white/50 dark:hover:text-white/80\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel = cn(\n \"px-2 py-1.5 text-xs font-medium select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty = cn(\n \"px-2 py-6 text-center text-sm select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type PopoverPosition = LogicalPosition<Placement>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. `value` is the entered\n * trigger's, inside `Popover.Group`; the panel passes none. */\n onPointerEnter: (event: PointerEvent, value?: string) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so whatever Ark answers it with (a close, or a switch to another\n * trigger) becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n /** `Popover.Group`'s shared panel, past its open's first placement —\n * gates the slide between triggers (see `useSlideAfterPlaced`). */\n sliding: boolean\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n sliding: false,\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = Omit<ArkPopover.RootProps, \"positioning\"> &\n PopoverModeProps &\n PlacementProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Render the panel in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\n/** Ark's live Popover API, for the hover path to send zag events through. */\ntype PopoverApi = ReturnType<typeof usePopoverContext>\n\n/** `Popover.Group`'s link into the Ark root, rendered inside it: keeps `api`\n * pointing at the machine's current API for the hover hook (which runs\n * above the root), and re-anchors the panel whenever the active trigger\n * changes. zag's trigger switch does reposition, but in the same action,\n * against the render it was sent from — still the old trigger — so on its\n * own the panel would swap content in place. (HoverCard's machine gets\n * away with it because its switch re-enters the open state.) */\nconst GroupBridge = ({ api }: { api: RefObject<PopoverApi | null> }) => {\n const live = usePopoverContext()\n useEffect(() => {\n api.current = live\n })\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the active trigger only; `live` is a new object every render.\n useEffect(() => {\n if (live.open) live.reposition()\n }, [live.triggerValue])\n return null\n}\n\ntype UsePopoverHoverOptions = {\n /** The machine's API (see `GroupBridge`); set once the Ark root mounts. */\n api: RefObject<PopoverApi | null>\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n *\n * Inside `Popover.Group`, hovering a trigger also makes it the active one,\n * through zag's own `setTriggerValue` — the one path that re-anchors the\n * panel too (zag repositions in the same action, reading the value it just\n * set; a controlled `triggerValue` prop would still hold the old one there).\n * So zag owns the value, and the hook never mirrors it. Over an open preview\n * that switch is immediate (the panel slides, no delay replays); a pinned\n * panel ignores hover and stays on its trigger. A click on an open preview\n * pins it whichever answer zag gives: a close for the active trigger, a\n * switch for another one. Which comes is zag's call, so the hook never\n * predicts it — by the time a click lands, a hover may have moved the\n * trigger already.\n */\nconst usePopoverHover = ({\n api,\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close or switch Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event, value) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (value !== undefined && api.current && api.current.triggerValue !== value)\n api.current.setTriggerValue(value)\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return {\n open: isOpen,\n press: source === \"press\",\n hover,\n onArkOpenChange,\n /** zag switched triggers — pins it if a click on a preview caused it. */\n onArkTriggerValueChange: () => {\n const trigger = upgrading.current\n upgrading.current = null\n if (!trigger) return\n clear()\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n },\n }\n}\n\n/** `Root` and `Group` — one machine; `group` swaps plain children for\n * `Trigger`s plus the active trigger's `Content`. */\nconst Machine = ({\n group,\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n triggerValue,\n defaultTriggerValue,\n onTriggerValueChange,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps & { group: boolean }) => {\n const { dir } = useLocaleContext()\n const guard = useLayerGuard(onPointerDownOutside)\n const slide = useSlideAfterPlaced()\n const api = useRef<PopoverApi | null>(null)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (group) slide.onOpenChange(details.open)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n api,\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n const parts = group ? splitGroupChildren(children, Content) : undefined\n return (\n <PopoverContext.Provider\n value={{\n width,\n withinPortal,\n container,\n layers: guard.layers,\n hover,\n sliding: group && slide.sliding,\n }}\n >\n <ArkPopover.Root\n // A group's panel mounts on each open, like HoverCard's, so its first\n // frame never inherits a stale position to slide from.\n lazyMount={group}\n unmountOnExit={group}\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={toPositioning(\n {\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning: group\n ? {\n ...positioning,\n updatePosition: slide.updatePosition(positioning?.updatePosition),\n }\n : positioning,\n },\n dir,\n width,\n )}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n triggerValue={triggerValue}\n defaultTriggerValue={defaultTriggerValue}\n onTriggerValueChange={(details) => {\n onTriggerValueChange?.(details)\n hovering.onArkTriggerValueChange()\n }}\n {...state}\n {...rest}\n >\n {parts ? (\n <>\n <GroupBridge api={api} />\n {parts.triggers}\n <ArkPopover.Context>\n {(api) => activeGroupContent(parts.contents, api.triggerValue)}\n </ArkPopover.Context>\n </>\n ) : (\n children\n )}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nconst Root = (props: PopoverProps) => <Machine group={false} {...props} />\n\nexport type PopoverGroupProps = PopoverProps\n\n/**\n * One shared panel across several triggers (e.g. a row of avatars) — the\n * same `Popover.Trigger` / `Popover.Content` parts `Popover.Root` uses, just\n * several of each, matched by a shared `value`. The Popover counterpart of\n * `HoverCard.Group`, with the same contract, for cards people act on:\n *\n * <Popover.Group mode=\"hover\" width=\"auto\">\n * <Popover.Trigger value=\"ada\"><Avatar name=\"Ada Lovelace\" /></Popover.Trigger>\n * <Popover.Trigger value=\"grace\"><Avatar name=\"Grace Hopper\" /></Popover.Trigger>\n *\n * <Popover.Content value=\"ada\">Ada's card</Popover.Content>\n * <Popover.Content value=\"grace\">Grace's card</Popover.Content>\n * </Popover.Group>\n *\n * zag's Popover supports several named triggers on one machine: clicking\n * another trigger while the panel is open moves it there instead of closing\n * it, and only the active trigger gets `aria-expanded`. In `mode=\"hover\"`,\n * hovering another trigger while the preview is open moves it too, with no\n * delay replay; a click, tap or Enter on any trigger, or a press or focus in\n * the panel, pins it exactly like a single `mode=\"hover\"` Popover. Either\n * way the panel slides between triggers (`slideStyle`), never on the first\n * open.\n *\n * `triggerValue` / `defaultTriggerValue` / `onTriggerValueChange` read and\n * drive the active trigger. `Trigger`/`Content` must be `Group`'s own direct\n * children (it scans one level, like `HoverCard.Group`); `Group` renders no\n * DOM node, so wrap it from the outside for row layout (`Avatar.Group`).\n */\nconst Group = (props: PopoverGroupProps) => <Machine group {...props} />\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps & WithTestId\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n testId,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event, rest.value)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> &\n WithTestId & {\n /** Which `Popover.Group` trigger this content belongs to — only\n * meaningful inside `Popover.Group`, where `Group` renders the one whose\n * `value` matches the active trigger. Never forwarded to the DOM. */\n value?: string\n }\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n value: _value,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover, sliding } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner style={sliding ? slideStyle : undefined}>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. Unlike `Header`, it draws no divider: a footer of\n * actions (Apply / Cancel, a time row) reads as part of the panel, the way `Modal` and\n * `Drawer` footers do. `slotEdge` still sets the hairline colour, so a consumer who wants\n * one adds only `className=\"border-t\"`. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Group,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/slide-on-switch.ts","../src/components/popover/popover.tsx"],"names":["useState","useRef","ArkPopover","api","props"],"mappings":";;;;;;;;;;;;;;AAiCO,IAAM,UAAA,GAAa;AAAA,EACxB,kBAAA,EAAoB,WA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M,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAKK,IAAM,OAAA,GAAU;AAAA,EACrB,IAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQA,SAAA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-RKCUXOU2.js","sourcesContent":["import {\n Children,\n cloneElement,\n type ElementType,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useRef,\n useState,\n} from \"react\"\nimport type { Positioning } from \"./placement\"\n\n/**\n * Shared by `HoverCard.Group` and `Popover.Group`: several named triggers on\n * one Ark machine, one panel that slides from the active trigger to the next.\n */\n\n/** Slide transition for a group's shared positioner. Ark sets the\n * positioner's `transform: translate3d(var(--x), var(--y), 0)` inline\n * (`@zag-js/popper`); animating `transform` itself makes the browser\n * interpolate that translate between two trigger anchors when the group's\n * active trigger changes. Passed as `style` (not a class) so it merges with,\n * rather than replaces, Ark's own inline `transform`/`position` (Ark's\n * `mergeProps` shallow-merges style objects); the same override-the-real-style\n * technique `Tabs.Indicator` / `SegmentGroup` use for their sliding pill.\n *\n * Only applied once `useSlideAfterPlaced` reports `sliding`, never on an\n * open's first placement: before it, the positioner sits at its unplaced\n * origin (far off the trigger), and animating *that* jump reads as the panel\n * flying in across the page instead of just appearing. A standalone `Root`\n * never gets this at all: it also repositions on scroll/resize\n * (`autoUpdate`), where an animated `transform` would look laggy rather than\n * responsive. */\nexport const slideStyle = {\n transitionProperty: \"transform\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.32, 0.72, 0, 1)\",\n} as const\n\ntype UpdatePosition = NonNullable<Positioning[\"updatePosition\"]>\n\n/**\n * `sliding` turns true once an open's first placement has been applied, and\n * false on every close. Waiting for the placement itself, not a frame count:\n * the first one after an open can take several frames (the panel mounts,\n * zag defers to the next frame, floating-ui computes asynchronously), and a\n * transition switched on before it lands slides the panel in from its\n * unplaced origin.\n *\n * Feed every open change to `onOpenChange`, and pass `updatePosition(...)`\n * as the machine's `positioning.updatePosition` — zag calls it for every\n * placement, with its own `updatePosition` to run. A consumer's own\n * `updatePosition`, if any, is wrapped rather than replaced.\n */\nexport const useSlideAfterPlaced = () => {\n const [sliding, setSliding] = useState(false)\n // Read by placements zag finishes asynchronously, after a close may have\n // landed — one of those must not re-arm the slide for the next open.\n const open = useRef(false)\n const onOpenChange = (next: boolean) => {\n open.current = next\n if (!next) setSliding(false)\n }\n const updatePosition =\n (custom?: UpdatePosition): UpdatePosition =>\n async (data) => {\n await (custom ? custom(data) : data.updatePosition())\n if (open.current) setSliding(true)\n }\n return { sliding, onOpenChange, updatePosition }\n}\n\n/** Split a group's children into its `Content` parts (matched by `type`)\n * and everything else (the triggers), one level deep. */\nexport const splitGroupChildren = <P extends { value?: string }>(\n children: ReactNode,\n content: ElementType<P>,\n) => {\n const items = Children.toArray(children)\n const isContent = (node: ReactNode): node is ReactElement<P> =>\n isValidElement(node) && node.type === content\n return { contents: items.filter(isContent), triggers: items.filter((item) => !isContent(item)) }\n}\n\n/** The `Content` whose `value` matches the active trigger, under one forced,\n * stable `key` — overriding whatever each was authored with (e.g.\n * `key={person.handle}` in a `.map()`). The slot only ever renders one at a\n * time, but a *different* key switching in reads to React as a different\n * component, unmounting the real Positioner/Content DOM tree and mounting a\n * fresh one instead of updating it in place. That fresh mount breaks the\n * \"one shared, sliding panel\" contract: its position starts unset again, so\n * every switch would look like the panel jumping in from the top. */\nexport const activeGroupContent = (\n contents: ReactElement<{ value?: string }>[],\n triggerValue: string | null,\n) => {\n const active = contents.find((content) => content.props.value === triggerValue)\n return active ? cloneElement(active, { key: \"group-content\" }) : null\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport {\n type LogicalPosition,\n type Placement,\n type PlacementProps,\n toPositioning,\n} from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport {\n activeGroupContent,\n slideStyle,\n splitGroupChildren,\n useSlideAfterPlaced,\n} from \"../../lib/slide-on-switch\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron = \"shrink-0 text-black/50 transition-transform dark:text-white/50\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-black/50 transition-colors hover:text-brand-900/70 dark:text-white/50 dark:hover:text-white/80\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel = cn(\n \"px-2 py-1.5 text-xs font-medium select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty = cn(\n \"px-2 py-6 text-center text-sm select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type PopoverPosition = LogicalPosition<Placement>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. `value` is the entered\n * trigger's, inside `Popover.Group`; the panel passes none. */\n onPointerEnter: (event: PointerEvent, value?: string) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so whatever Ark answers it with (a close, or a switch to another\n * trigger) becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n /** `Popover.Group`'s shared panel, past its open's first placement —\n * gates the slide between triggers (see `useSlideAfterPlaced`). */\n sliding: boolean\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n sliding: false,\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = Omit<ArkPopover.RootProps, \"positioning\"> &\n PopoverModeProps &\n PlacementProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Render the panel in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\n/** Ark's live Popover API, for the hover path to send zag events through. */\ntype PopoverApi = ReturnType<typeof usePopoverContext>\n\n/** `Popover.Group`'s link into the Ark root, rendered inside it: keeps `api`\n * pointing at the machine's current API for the hover hook (which runs\n * above the root), and re-anchors the panel whenever the active trigger\n * changes. zag's trigger switch does reposition, but in the same action,\n * against the render it was sent from — still the old trigger — so on its\n * own the panel would swap content in place. (HoverCard's machine gets\n * away with it because its switch re-enters the open state.) */\nconst GroupBridge = ({ api }: { api: RefObject<PopoverApi | null> }) => {\n const live = usePopoverContext()\n useEffect(() => {\n api.current = live\n })\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the active trigger only; `live` is a new object every render.\n useEffect(() => {\n if (live.open) live.reposition()\n }, [live.triggerValue])\n return null\n}\n\ntype UsePopoverHoverOptions = {\n /** The machine's API (see `GroupBridge`); set once the Ark root mounts. */\n api: RefObject<PopoverApi | null>\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n *\n * Inside `Popover.Group`, hovering a trigger also makes it the active one,\n * through zag's own `setTriggerValue` — the one path that re-anchors the\n * panel too (zag repositions in the same action, reading the value it just\n * set; a controlled `triggerValue` prop would still hold the old one there).\n * So zag owns the value, and the hook never mirrors it. Over an open preview\n * that switch is immediate (the panel slides, no delay replays); a pinned\n * panel ignores hover and stays on its trigger. A click on an open preview\n * pins it whichever answer zag gives: a close for the active trigger, a\n * switch for another one. Which comes is zag's call, so the hook never\n * predicts it — by the time a click lands, a hover may have moved the\n * trigger already.\n */\nconst usePopoverHover = ({\n api,\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close or switch Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event, value) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (value !== undefined && api.current && api.current.triggerValue !== value)\n api.current.setTriggerValue(value)\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return {\n open: isOpen,\n press: source === \"press\",\n hover,\n onArkOpenChange,\n /** zag switched triggers — pins it if a click on a preview caused it. */\n onArkTriggerValueChange: () => {\n const trigger = upgrading.current\n upgrading.current = null\n if (!trigger) return\n clear()\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n },\n }\n}\n\n/** `Root` and `Group` — one machine; `group` swaps plain children for\n * `Trigger`s plus the active trigger's `Content`. */\nconst Machine = ({\n group,\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n triggerValue,\n defaultTriggerValue,\n onTriggerValueChange,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps & { group: boolean }) => {\n const { dir } = useLocaleContext()\n const guard = useLayerGuard(onPointerDownOutside)\n const slide = useSlideAfterPlaced()\n const api = useRef<PopoverApi | null>(null)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (group) slide.onOpenChange(details.open)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n api,\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n const parts = group ? splitGroupChildren(children, Content) : undefined\n return (\n <PopoverContext.Provider\n value={{\n width,\n withinPortal,\n container,\n layers: guard.layers,\n hover,\n sliding: group && slide.sliding,\n }}\n >\n <ArkPopover.Root\n // A group's panel mounts on each open, like HoverCard's, so its first\n // frame never inherits a stale position to slide from.\n lazyMount={group}\n unmountOnExit={group}\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={toPositioning(\n {\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning: group\n ? {\n ...positioning,\n updatePosition: slide.updatePosition(positioning?.updatePosition),\n }\n : positioning,\n },\n dir,\n width,\n )}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n triggerValue={triggerValue}\n defaultTriggerValue={defaultTriggerValue}\n onTriggerValueChange={(details) => {\n onTriggerValueChange?.(details)\n hovering.onArkTriggerValueChange()\n }}\n {...state}\n {...rest}\n >\n {parts ? (\n <>\n <GroupBridge api={api} />\n {parts.triggers}\n <ArkPopover.Context>\n {(api) => activeGroupContent(parts.contents, api.triggerValue)}\n </ArkPopover.Context>\n </>\n ) : (\n children\n )}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nconst Root = (props: PopoverProps) => <Machine group={false} {...props} />\n\nexport type PopoverGroupProps = PopoverProps\n\n/**\n * One shared panel across several triggers (e.g. a row of avatars) — the\n * same `Popover.Trigger` / `Popover.Content` parts `Popover.Root` uses, just\n * several of each, matched by a shared `value`. The Popover counterpart of\n * `HoverCard.Group`, with the same contract, for cards people act on:\n *\n * <Popover.Group mode=\"hover\" width=\"auto\">\n * <Popover.Trigger value=\"ada\"><Avatar name=\"Ada Lovelace\" /></Popover.Trigger>\n * <Popover.Trigger value=\"grace\"><Avatar name=\"Grace Hopper\" /></Popover.Trigger>\n *\n * <Popover.Content value=\"ada\">Ada's card</Popover.Content>\n * <Popover.Content value=\"grace\">Grace's card</Popover.Content>\n * </Popover.Group>\n *\n * zag's Popover supports several named triggers on one machine: clicking\n * another trigger while the panel is open moves it there instead of closing\n * it, and only the active trigger gets `aria-expanded`. In `mode=\"hover\"`,\n * hovering another trigger while the preview is open moves it too, with no\n * delay replay; a click, tap or Enter on any trigger, or a press or focus in\n * the panel, pins it exactly like a single `mode=\"hover\"` Popover. Either\n * way the panel slides between triggers (`slideStyle`), never on the first\n * open.\n *\n * `triggerValue` / `defaultTriggerValue` / `onTriggerValueChange` read and\n * drive the active trigger. `Trigger`/`Content` must be `Group`'s own direct\n * children (it scans one level, like `HoverCard.Group`); `Group` renders no\n * DOM node, so wrap it from the outside for row layout (`Avatar.Group`).\n */\nconst Group = (props: PopoverGroupProps) => <Machine group {...props} />\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps & WithTestId\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n testId,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event, rest.value)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> &\n WithTestId & {\n /** Which `Popover.Group` trigger this content belongs to — only\n * meaningful inside `Popover.Group`, where `Group` renders the one whose\n * `value` matches the active trigger. Never forwarded to the DOM. */\n value?: string\n }\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n value: _value,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover, sliding } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner style={sliding ? slideStyle : undefined}>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. Unlike `Header`, it draws no divider: a footer of\n * actions (Apply / Cancel, a time row) reads as part of the panel, the way `Modal` and\n * `Drawer` footers do. `slotEdge` still sets the hairline colour, so a consumer who wants\n * one adds only `className=\"border-t\"`. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Group,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { InputBase, inputControlClasses, inputSlot } from './chunk-I4B3N3UX.js';
2
2
  import { FieldShell, fieldA11yProps } from './chunk-X6DESK37.js';
3
3
  import { useMergedRefs } from './chunk-HBWV5EPU.js';
4
- import { popoverClearTrigger } from './chunk-E3XLWMEB.js';
4
+ import { popoverClearTrigger } from './chunk-RKCUXOU2.js';
5
5
  import { CloseIcon } from './chunk-6YNLRQ25.js';
6
6
  import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
7
7
  import { props } from './chunk-WYCMIIRR.js';
@@ -230,5 +230,5 @@ var NumberInput = ({
230
230
  };
231
231
 
232
232
  export { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput };
233
- //# sourceMappingURL=chunk-DMI4KS32.js.map
234
- //# sourceMappingURL=chunk-DMI4KS32.js.map
233
+ //# sourceMappingURL=chunk-SBZJGFZ6.js.map
234
+ //# sourceMappingURL=chunk-SBZJGFZ6.js.map