@mortenbrudvik/waveui 0.9.0 → 0.11.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 (264) hide show
  1. package/README.md +758 -152
  2. package/dist/components/button/Toolbar.cjs +1 -1
  3. package/dist/components/button/Toolbar.cjs.map +1 -1
  4. package/dist/components/button/Toolbar.mjs +25 -30
  5. package/dist/components/button/Toolbar.mjs.map +1 -1
  6. package/dist/components/button/Toolbar.navigation.cjs +2 -0
  7. package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
  8. package/dist/components/button/Toolbar.navigation.mjs +17 -0
  9. package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
  10. package/dist/components/data-display/Avatar.cjs +1 -1
  11. package/dist/components/data-display/Avatar.cjs.map +1 -1
  12. package/dist/components/data-display/Avatar.context.cjs +2 -0
  13. package/dist/components/data-display/Avatar.context.cjs.map +1 -0
  14. package/dist/components/data-display/Avatar.context.mjs +9 -0
  15. package/dist/components/data-display/Avatar.context.mjs.map +1 -0
  16. package/dist/components/data-display/Avatar.mjs +66 -61
  17. package/dist/components/data-display/Avatar.mjs.map +1 -1
  18. package/dist/components/data-display/InteractionTag.cjs +2 -0
  19. package/dist/components/data-display/InteractionTag.cjs.map +1 -0
  20. package/dist/components/data-display/InteractionTag.mjs +234 -0
  21. package/dist/components/data-display/InteractionTag.mjs.map +1 -0
  22. package/dist/components/data-display/Tag.cjs +1 -1
  23. package/dist/components/data-display/Tag.cjs.map +1 -1
  24. package/dist/components/data-display/Tag.mjs +222 -90
  25. package/dist/components/data-display/Tag.mjs.map +1 -1
  26. package/dist/components/data-display/TagGroup.cjs +2 -0
  27. package/dist/components/data-display/TagGroup.cjs.map +1 -0
  28. package/dist/components/data-display/TagGroup.context.cjs +2 -0
  29. package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
  30. package/dist/components/data-display/TagGroup.context.mjs +113 -0
  31. package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
  32. package/dist/components/data-display/TagGroup.mjs +149 -0
  33. package/dist/components/data-display/TagGroup.mjs.map +1 -0
  34. package/dist/components/data-display/tagStyles.cjs +2 -0
  35. package/dist/components/data-display/tagStyles.cjs.map +1 -0
  36. package/dist/components/data-display/tagStyles.mjs +108 -0
  37. package/dist/components/data-display/tagStyles.mjs.map +1 -0
  38. package/dist/components/feedback/Toaster.cjs +1 -1
  39. package/dist/components/feedback/Toaster.cjs.map +1 -1
  40. package/dist/components/feedback/Toaster.mjs +213 -181
  41. package/dist/components/feedback/Toaster.mjs.map +1 -1
  42. package/dist/components/input/Calendar.cjs +2 -0
  43. package/dist/components/input/Calendar.cjs.map +1 -0
  44. package/dist/components/input/Calendar.mjs +352 -0
  45. package/dist/components/input/Calendar.mjs.map +1 -0
  46. package/dist/components/input/Calendar.views.cjs +2 -0
  47. package/dist/components/input/Calendar.views.cjs.map +1 -0
  48. package/dist/components/input/Calendar.views.mjs +194 -0
  49. package/dist/components/input/Calendar.views.mjs.map +1 -0
  50. package/dist/components/input/ColorArea.cjs +1 -1
  51. package/dist/components/input/ColorArea.cjs.map +1 -1
  52. package/dist/components/input/ColorArea.mjs +18 -18
  53. package/dist/components/input/ColorArea.mjs.map +1 -1
  54. package/dist/components/input/Combobox.cjs +1 -1
  55. package/dist/components/input/Combobox.cjs.map +1 -1
  56. package/dist/components/input/Combobox.expand.cjs +1 -1
  57. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  58. package/dist/components/input/Combobox.expand.mjs +7 -7
  59. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  60. package/dist/components/input/Combobox.mjs +232 -156
  61. package/dist/components/input/Combobox.mjs.map +1 -1
  62. package/dist/components/input/Combobox.text.cjs +2 -0
  63. package/dist/components/input/Combobox.text.cjs.map +1 -0
  64. package/dist/components/input/Combobox.text.mjs +24 -0
  65. package/dist/components/input/Combobox.text.mjs.map +1 -0
  66. package/dist/components/input/DatePicker.cjs +1 -1
  67. package/dist/components/input/DatePicker.cjs.map +1 -1
  68. package/dist/components/input/DatePicker.mjs +203 -288
  69. package/dist/components/input/DatePicker.mjs.map +1 -1
  70. package/dist/components/input/Dropdown.cjs +1 -1
  71. package/dist/components/input/Dropdown.cjs.map +1 -1
  72. package/dist/components/input/Dropdown.mjs +135 -109
  73. package/dist/components/input/Dropdown.mjs.map +1 -1
  74. package/dist/components/input/Listbox.cjs +2 -0
  75. package/dist/components/input/Listbox.cjs.map +1 -0
  76. package/dist/components/input/Listbox.mjs +134 -0
  77. package/dist/components/input/Listbox.mjs.map +1 -0
  78. package/dist/components/input/Option.cjs +1 -1
  79. package/dist/components/input/Option.cjs.map +1 -1
  80. package/dist/components/input/Option.mjs +163 -97
  81. package/dist/components/input/Option.mjs.map +1 -1
  82. package/dist/components/input/SwatchPicker.cjs +1 -1
  83. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  84. package/dist/components/input/SwatchPicker.context.cjs +2 -0
  85. package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
  86. package/dist/components/input/SwatchPicker.context.mjs +35 -0
  87. package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
  88. package/dist/components/input/SwatchPicker.mjs +131 -103
  89. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  90. package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
  91. package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
  92. package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
  93. package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
  94. package/dist/components/input/TagPicker.cjs +1 -1
  95. package/dist/components/input/TagPicker.cjs.map +1 -1
  96. package/dist/components/input/TagPicker.context.cjs +2 -0
  97. package/dist/components/input/TagPicker.context.cjs.map +1 -0
  98. package/dist/components/input/TagPicker.context.mjs +20 -0
  99. package/dist/components/input/TagPicker.context.mjs.map +1 -0
  100. package/dist/components/input/TagPicker.create.cjs +2 -0
  101. package/dist/components/input/TagPicker.create.cjs.map +1 -0
  102. package/dist/components/input/TagPicker.create.mjs +24 -0
  103. package/dist/components/input/TagPicker.create.mjs.map +1 -0
  104. package/dist/components/input/TagPicker.mjs +13 -274
  105. package/dist/components/input/TagPicker.mjs.map +1 -1
  106. package/dist/components/input/TagPicker.option.cjs +2 -0
  107. package/dist/components/input/TagPicker.option.cjs.map +1 -0
  108. package/dist/components/input/TagPicker.option.mjs +45 -0
  109. package/dist/components/input/TagPicker.option.mjs.map +1 -0
  110. package/dist/components/input/TagPicker.overflow.cjs +2 -0
  111. package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
  112. package/dist/components/input/TagPicker.overflow.mjs +153 -0
  113. package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
  114. package/dist/components/input/TagPicker.parts.cjs +2 -0
  115. package/dist/components/input/TagPicker.parts.cjs.map +1 -0
  116. package/dist/components/input/TagPicker.parts.mjs +425 -0
  117. package/dist/components/input/TagPicker.parts.mjs.map +1 -0
  118. package/dist/components/input/TagPicker.root.cjs +2 -0
  119. package/dist/components/input/TagPicker.root.cjs.map +1 -0
  120. package/dist/components/input/TagPicker.root.mjs +416 -0
  121. package/dist/components/input/TagPicker.root.mjs.map +1 -0
  122. package/dist/components/input/TimePicker.cjs +1 -1
  123. package/dist/components/input/TimePicker.cjs.map +1 -1
  124. package/dist/components/input/TimePicker.mjs +77 -77
  125. package/dist/components/input/TimePicker.mjs.map +1 -1
  126. package/dist/components/input/dateUtils.cjs +1 -1
  127. package/dist/components/input/dateUtils.cjs.map +1 -1
  128. package/dist/components/input/dateUtils.mjs +114 -96
  129. package/dist/components/input/dateUtils.mjs.map +1 -1
  130. package/dist/components/input/pickerLabels.cjs +2 -0
  131. package/dist/components/input/pickerLabels.cjs.map +1 -0
  132. package/dist/components/input/pickerLabels.mjs +16 -0
  133. package/dist/components/input/pickerLabels.mjs.map +1 -0
  134. package/dist/components/input/pickerValues.cjs +2 -0
  135. package/dist/components/input/pickerValues.cjs.map +1 -0
  136. package/dist/components/input/pickerValues.mjs +24 -0
  137. package/dist/components/input/pickerValues.mjs.map +1 -0
  138. package/dist/components/layout/Accordion.cjs.map +1 -1
  139. package/dist/components/layout/Accordion.mjs.map +1 -1
  140. package/dist/components/navigation/Hamburger.cjs +2 -0
  141. package/dist/components/navigation/Hamburger.cjs.map +1 -0
  142. package/dist/components/navigation/Hamburger.mjs +54 -0
  143. package/dist/components/navigation/Hamburger.mjs.map +1 -0
  144. package/dist/components/navigation/Nav.cjs +1 -1
  145. package/dist/components/navigation/Nav.cjs.map +1 -1
  146. package/dist/components/navigation/Nav.context.cjs +2 -0
  147. package/dist/components/navigation/Nav.context.cjs.map +1 -0
  148. package/dist/components/navigation/Nav.context.mjs +137 -0
  149. package/dist/components/navigation/Nav.context.mjs.map +1 -0
  150. package/dist/components/navigation/Nav.mjs +151 -258
  151. package/dist/components/navigation/Nav.mjs.map +1 -1
  152. package/dist/components/navigation/Nav.parts.cjs +2 -0
  153. package/dist/components/navigation/Nav.parts.cjs.map +1 -0
  154. package/dist/components/navigation/Nav.parts.mjs +77 -0
  155. package/dist/components/navigation/Nav.parts.mjs.map +1 -0
  156. package/dist/components/navigation/Nav.root.cjs +2 -0
  157. package/dist/components/navigation/Nav.root.cjs.map +1 -0
  158. package/dist/components/navigation/Nav.root.mjs +78 -0
  159. package/dist/components/navigation/Nav.root.mjs.map +1 -0
  160. package/dist/components/navigation/NavDrawer.cjs +2 -0
  161. package/dist/components/navigation/NavDrawer.cjs.map +1 -0
  162. package/dist/components/navigation/NavDrawer.context.cjs +2 -0
  163. package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
  164. package/dist/components/navigation/NavDrawer.context.mjs +11 -0
  165. package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
  166. package/dist/components/navigation/NavDrawer.mjs +179 -0
  167. package/dist/components/navigation/NavDrawer.mjs.map +1 -0
  168. package/dist/components/overlays/Dialog.cjs +1 -1
  169. package/dist/components/overlays/Dialog.cjs.map +1 -1
  170. package/dist/components/overlays/Dialog.mjs +190 -125
  171. package/dist/components/overlays/Dialog.mjs.map +1 -1
  172. package/dist/components/overlays/Dialog.shared.cjs +1 -1
  173. package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
  174. package/dist/components/overlays/Dialog.shared.mjs +157 -81
  175. package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
  176. package/dist/components/overlays/Dialog.slots.cjs +2 -0
  177. package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
  178. package/dist/components/overlays/Dialog.slots.mjs +129 -0
  179. package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
  180. package/dist/components/overlays/Drawer.cjs +1 -1
  181. package/dist/components/overlays/Drawer.cjs.map +1 -1
  182. package/dist/components/overlays/Drawer.context.cjs +2 -0
  183. package/dist/components/overlays/Drawer.context.cjs.map +1 -0
  184. package/dist/components/overlays/Drawer.context.mjs +29 -0
  185. package/dist/components/overlays/Drawer.context.mjs.map +1 -0
  186. package/dist/components/overlays/Drawer.mjs +12 -187
  187. package/dist/components/overlays/Drawer.mjs.map +1 -1
  188. package/dist/components/overlays/Drawer.panel.cjs +2 -0
  189. package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
  190. package/dist/components/overlays/Drawer.panel.mjs +159 -0
  191. package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
  192. package/dist/components/overlays/Drawer.parts.cjs +2 -0
  193. package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
  194. package/dist/components/overlays/Drawer.parts.mjs +152 -0
  195. package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
  196. package/dist/components/overlays/Drawer.root.cjs +2 -0
  197. package/dist/components/overlays/Drawer.root.cjs.map +1 -0
  198. package/dist/components/overlays/Drawer.root.mjs +207 -0
  199. package/dist/components/overlays/Drawer.root.mjs.map +1 -0
  200. package/dist/components/overlays/Drawer.scroll.cjs +2 -0
  201. package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
  202. package/dist/components/overlays/Drawer.scroll.mjs +42 -0
  203. package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
  204. package/dist/components/table/useGridNavigation.cjs +1 -1
  205. package/dist/components/table/useGridNavigation.cjs.map +1 -1
  206. package/dist/components/table/useGridNavigation.mjs +67 -70
  207. package/dist/components/table/useGridNavigation.mjs.map +1 -1
  208. package/dist/hooks/useActiveDescendant.cjs +2 -0
  209. package/dist/hooks/useActiveDescendant.cjs.map +1 -0
  210. package/dist/hooks/useActiveDescendant.mjs +56 -0
  211. package/dist/hooks/useActiveDescendant.mjs.map +1 -0
  212. package/dist/hooks/useDismiss.cjs.map +1 -1
  213. package/dist/hooks/useDismiss.mjs.map +1 -1
  214. package/dist/hooks/useFocusTrap.cjs +1 -1
  215. package/dist/hooks/useFocusTrap.cjs.map +1 -1
  216. package/dist/hooks/useFocusTrap.mjs +115 -98
  217. package/dist/hooks/useFocusTrap.mjs.map +1 -1
  218. package/dist/hooks/useListbox.cjs +1 -1
  219. package/dist/hooks/useListbox.cjs.map +1 -1
  220. package/dist/hooks/useListbox.mjs +250 -210
  221. package/dist/hooks/useListbox.mjs.map +1 -1
  222. package/dist/hooks/useModalLayer.cjs +1 -1
  223. package/dist/hooks/useModalLayer.cjs.map +1 -1
  224. package/dist/hooks/useModalLayer.mjs +35 -22
  225. package/dist/hooks/useModalLayer.mjs.map +1 -1
  226. package/dist/hooks/useRestoreFocus.cjs +1 -1
  227. package/dist/hooks/useRestoreFocus.cjs.map +1 -1
  228. package/dist/hooks/useRestoreFocus.mjs +91 -78
  229. package/dist/hooks/useRestoreFocus.mjs.map +1 -1
  230. package/dist/hooks/useRovingGrid.cjs +2 -0
  231. package/dist/hooks/useRovingGrid.cjs.map +1 -0
  232. package/dist/hooks/useRovingGrid.mjs +69 -0
  233. package/dist/hooks/useRovingGrid.mjs.map +1 -0
  234. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  235. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  236. package/dist/hooks/useRovingTabIndex.mjs +102 -78
  237. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  238. package/dist/index.cjs +1 -1
  239. package/dist/index.d.cts +4391 -394
  240. package/dist/index.d.ts +4391 -394
  241. package/dist/index.mjs +115 -101
  242. package/dist/lib/classNames.cjs +1 -1
  243. package/dist/lib/classNames.cjs.map +1 -1
  244. package/dist/lib/classNames.mjs +170 -74
  245. package/dist/lib/classNames.mjs.map +1 -1
  246. package/dist/lib/date.cjs +2 -0
  247. package/dist/lib/date.cjs.map +1 -0
  248. package/dist/lib/date.mjs +44 -0
  249. package/dist/lib/date.mjs.map +1 -0
  250. package/dist/lib/focus.cjs +1 -1
  251. package/dist/lib/focus.cjs.map +1 -1
  252. package/dist/lib/focus.mjs +5 -2
  253. package/dist/lib/focus.mjs.map +1 -1
  254. package/dist/lib/icons.cjs +1 -1
  255. package/dist/lib/icons.cjs.map +1 -1
  256. package/dist/lib/icons.mjs +13 -6
  257. package/dist/lib/icons.mjs.map +1 -1
  258. package/dist/lib/layers.cjs +1 -1
  259. package/dist/lib/layers.cjs.map +1 -1
  260. package/dist/lib/layers.mjs +53 -47
  261. package/dist/lib/layers.mjs.map +1 -1
  262. package/dist/styles.css +1 -1
  263. package/package.json +1 -1
  264. package/src/styles/tokens.css +25 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TagPicker.root.mjs","names":["useId","_Fragment","useId$1","React","TAG_PICKER_SIZES","EMPTY_OPTIONS","EMPTY_LABELS","TAG_SIZE","defaultRemoveLabel","label","defaultSummaryLabel","labels","defaultCreateLabel","text","defaultOverflowCountLabel","count","matchesText","item","triggerMessage","ALLOW_CREATE_BUTTON_MESSAGE","LIST_PLACEMENT_MESSAGE","findList","children","flattenChildren","isElementOfType","node","TagPickerList","TagPickerRoot","valueProp","openProp","queryProp","sizeProp","appearanceProp","overflowProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onChange","warnDeprecated","overflow","field","useFieldContext","validates","required","readOnly","triggerId","triggerLabel","triggerLabelledBy","triggerDescribedBy","triggerInvalid","triggerRequired","useFieldControl","invalidLook","isInvalidLook","useInputLook","coreSize","size","tagSize","tagAppearance","appearance","selected","setSelected","useControllable","defaultValue","EMPTY_VALUES","list","next","onValueChange","selectedSet","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","isClient","useIsClient","open","triggersRef","triggerKind","setTriggerKind","registerTrigger","token","triggers","firstKind","kind","listCountRef","registerList","warnOnce","isButtonTrigger","queryState","setQuery","defaultQuery","onQueryChange","query","lock","setLock","lockedOpen","useAnnounce","rootRef","triggerRef","controlElementRef","groupRef","chipRef","summaryId","createValue","allowCreate","listElement","listChildren","registration","collected","collectOptionLabels","optionByValue","map","option","options","resolvedLabels","offersCreate","dataCreateText","createOptionText","items","available","listFilter","matches","filter","addTag","value","announceToggle","commitCreate","listbox","useListbox","details","getItem","labelOf","createText","listed","showCreate","expanded","noMatchesText","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","initial","sameValues","current","form","trackFocus","trackBlur","useFocusWithin","collapsed","focusWithin","tagLabels","hiddenValues","useTagOverflow","focusTrigger","useEventCallback","toggleOpen","removeTag","v","clear","editText","candidates","findExactMatch","focusLastTagControl","group","last","tagListControls","setOpenStable","entryOf","triggerProps","tabIndex","autoFocus","inputProps","autoComplete","autoCapitalize","autoCorrect","maxLength","inputMode","spellCheck","enterKeyHint","onFocus","onBlur","onKeyDown","onKeyUp","controlRef","listLabelledBy","listLabel","hasSummary","context","placeholder","layerId","surfaceRef","floatingProps","setReference","expandIcon","clearable","parts","Fragment","TagPickerControl","cn","tagPickerClassNames","className","TagPickerContext","HiddenInput"],"sources":["../../../src/components/input/TagPicker.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { tagPickerClassNames } from '../../lib/classNames';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport type { Slot } from '../../lib/slot';\nimport type { CoreSize, InputAppearance, Size, TagAppearance, TagSize } from '../../lib/types';\nimport { useAnnounce } from '../../hooks/useAnnounce';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport { useListboxPopup } from './Option';\nimport { announceToggle } from './pickerLabels';\nimport { EMPTY_VALUES, sameValues } from './pickerValues';\nimport type { RoutedHandlers } from './routedHandlers';\nimport { TagPickerContext } from './TagPicker.context';\nimport type {\n ResolvedTagPickerLabels,\n TagPickerContextValue,\n TagPickerInputOnlyProps,\n TagPickerTriggerKind,\n TagPickerTriggerProps,\n} from './TagPicker.context';\nimport { createOptionText, findExactMatch } from './TagPicker.create';\nimport type { ExactMatchCandidate } from './TagPicker.create';\nimport type { TagPickerOption } from './TagPicker.option';\nimport { useFocusWithin, useTagOverflow } from './TagPicker.overflow';\nimport { TagPickerControl, TagPickerList, tagListControls } from './TagPicker.parts';\n\n/**\n * The TagPicker's built-in names, descriptions and announcements, for localization. Each member is\n * optional and falls back to its English default.\n */\nexport interface TagPickerLabels {\n /** Name of a tag's remove button.\n * @default (label) => `Remove ${label}`\n */\n remove?: (label: string) => string;\n /** Name of the list of selected tags.\n * @default 'Selected'\n */\n selected?: string;\n /** Description of the input that sums up the selected tags (their labels, in order).\n * @default (labels) => `Selected: ${labels.join(', ')}`\n */\n summary?: (labels: string[]) => string;\n /** Announcement when a tag is added; `count` is the number of tags after the change.\n * @default (label, count) => `${label} added, ${count} selected`\n */\n added?: (label: string, count: number) => string;\n /** Announcement when a tag is removed; `count` is the number of tags after the change.\n * @default (label, count) => `${label} removed, ${count} selected`\n */\n removed?: (label: string, count: number) => string;\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /**\n * Text and name of the create option (`allowCreate`), from the trimmed typed text.\n * @default (text) => `Create \"${text}\"`\n */\n create?: (text: string) => string;\n /** Name of the clear button (`clearable`). @default 'Clear selection' */\n clear?: string;\n /** Name of the expand button at the end of the field. @default 'Show options' */\n expand?: string;\n /**\n * The \"+N\" text of the single-line layout (`overflow=\"count\"`); hidden from assistive\n * technology, which hears the input's summary of every tag.\n * @default (count) => `+${count}`\n */\n overflowCount?: (count: number) => string;\n}\n\n/** Sizes of TagPicker (Fluent's): medium (the 0.7 look), large and extra-large. */\nexport type TagPickerSize = Extract<Size, 'medium' | 'large' | 'extra-large'>;\n\n/** Properties for the TagPicker component. */\nexport interface TagPickerProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /**\n * The options, the array form (`{ value, label, media?, secondaryContent? }`). With parts whose\n * `TagPicker.List` has children it only names values (tags, announcements). Changed in 0.11:\n * optional.\n */\n options?: readonly TagPickerOption[];\n /**\n * The parts: `TagPicker.Control` and `TagPicker.List`, directly inside TagPicker (a Fragment is\n * fine). Without children TagPicker renders both with their defaults; without a\n * `TagPicker.List` it renders the default list after the children.\n */\n children?: React.ReactNode;\n /**\n * Controlled array of selected option values (`[]` for none). Fluent's `selectedOptions`.\n */\n value?: readonly string[];\n /**\n * Initial selected values for uncontrolled usage; a form reset restores them.\n * @default []\n */\n defaultValue?: readonly string[];\n /**\n * Called with the new selection when it changes: a tag is added (an option, or a created tag)\n * or removed, or a form reset restores different tags. Fluent's `onOptionSelect`.\n */\n onValueChange?: (value: string[]) => void;\n /**\n * Called with the new selection when it changes: a tag is added or removed, or a form reset\n * restores different tags.\n * @deprecated Use `onValueChange`.\n */\n onChange?: (value: string[]) => void;\n /**\n * Controlled open state of the option list. The list renders only in the browser: an open\n * picker is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A picker that starts disabled or read-only starts\n * closed. The list renders only in the browser: it is closed in the server HTML and opens once\n * the picker has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the option list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Shown by TagPicker.Input or TagPicker.Button while no tag is selected; the part's own\n * `placeholder` wins.\n * @default 'Select...'\n */\n placeholder?: string;\n /**\n * Whether an option matches the typed text (the query). Called with every listed option, also\n * the options of `TagPicker.List`'s children (its `value`, `label` and `textValue`), and the\n * text whenever the text is not empty, never with a selected option or the create option; an\n * option it returns `false` for is filtered out. It may keep options that do not contain the\n * text: `filter={() => true}` with `query` and `onQueryChange` leaves the matching to you (a\n * server-side search that replaces `options`); for a create entry, use `allowCreate`. With a\n * server-side search, keep the selected options in `options` (they are never listed): a\n * selected value without an option shows its raw value as the tag label, with a development\n * warning (the \"Async search\" story does this).\n * @default a case-insensitive substring match on the option's `textValue ?? label`\n */\n filter?: (option: ListboxItem, query: string) => boolean;\n /**\n * Controlled query: the text typed since the last tag was added, which filters the options and\n * shows in the input (hidden while `disabled` or `readOnly`). Not used with TagPicker.Button.\n */\n query?: string;\n /**\n * Initial query for uncontrolled usage. A TagPicker that starts disabled or read-only starts\n * without it (as it starts closed). Not used with TagPicker.Button.\n * @default ''\n */\n defaultQuery?: string;\n /**\n * Called with the new query when it changes: as the user types, and with `''` when it resets (a\n * tag added or created, Escape on the closed list, the clear button, a form reset, or `disabled`\n * or `readOnly` turned on while text is typed). A blur or a close keeps the text. A TagPicker\n * that mounts disabled or read-only reports nothing: it keeps a controlled query, which shows\n * once it unlocks. Not used with TagPicker.Button.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Whether the tag picker is disabled: nothing can be added or removed, the remove buttons leave\n * the tab order, and the expand and clear buttons are disabled. The field dims once.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the tags and the field: `medium` (the 0.7 look), `large` or `extra-large` (Fluent's\n * union; TagPicker has no `small`). Default: the surrounding Field's `size`, else `WaveProvider\n * inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too. Its\n * tags are one Tag size smaller: medium → extra-small, large → small, extra-large → medium. The\n * option list keeps its size.\n */\n size?: TagPickerSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`. The tags are\n * filled, outlined on `filled-darker`.\n */\n appearance?: InputAppearance;\n /** Name of the values in form submissions (one hidden input per value). */\n name?: string;\n /** Id of the form the values belong to, when the TagPicker is outside it. */\n form?: string;\n /**\n * At least one tag is required to submit the form (native constraint validation). Like a native\n * readonly input, a `readOnly` TagPicker does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of TagPicker.Input's `<input role=\"combobox\">`. Browser autofill\n * is off unless you set it (for example `'on'`). With TagPicker.Button, not used.\n * @default 'off'\n */\n autoComplete?: string;\n /**\n * The maximum length of the typed text (`maxlength` of TagPicker.Input's `<input>`). With\n * TagPicker.Button, not used.\n */\n maxLength?: number;\n /**\n * The selection cannot be changed: the trigger is read-only, the tags have no remove buttons,\n * the expand button is disabled and the clear button hidden, and the option list neither opens\n * (click, keyboard, a controlled `open`) nor adds tags; Escape is left to the page. Turning it\n * (or `disabled`) on while the list is open closes it (`onOpenChange(false)`); a focused remove\n * button hands focus to the trigger.\n */\n readOnly?: boolean;\n /**\n * Lets the user add a tag of their own text: while the trimmed text matches no option label\n * and no selected value (ignoring case) and no option value, the list ends with a create option\n * (`labels.create`); Enter on it or a click adds the text as a tag, calls `onOptionCreate`, and\n * clears the text. Needs `TagPicker.Input` (not `TagPicker.Button`). WaveUI-only: Fluent's\n * TagPicker has no free tagging.\n * @default false\n */\n allowCreate?: boolean;\n /**\n * Called with the trimmed text when the user creates a tag, before `onValueChange` reports the\n * new value. Add an option for it if you keep options: until then the tag shows the raw text.\n * WaveUI-only (see `allowCreate`).\n */\n onOptionCreate?: (text: string) => void;\n /**\n * Shows a clear button at the end of the field while a tag is selected (not while `readOnly`;\n * disabled while `disabled`): it removes every tag (`onValueChange([])`), clears the typed\n * text, closes the list and focuses the trigger (the input, or `TagPicker.Button`). A Tab stop\n * after the trigger. The name of Fluent's Combobox and Dropdown prop.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the field (default: a chevron). The button\n * opens and closes the list, keeps focus on the trigger and is not a Tab stop. `null` or\n * `undefined` keep the chevron; `false`, or a value that renders nothing, hides the button.\n * Decorative: a `<button>` passed here is unwrapped. `TagPicker.Control`'s `expandIcon` wins.\n */\n expandIcon?: Slot<'span'>;\n /**\n * `'wrap'`: the tags wrap onto more lines. `'count'`: while focus is outside the picker and its\n * list is closed, the tags stay on one line and the ones that do not fit give way to \"+N\"\n * (`labels.overflowCount`); focusing the picker shows them all. The tags are measured by\n * position: your own Tags in `TagPicker.Group` render in `value` order. WaveUI-only: Fluent's\n * single-line layout is a story, not a prop.\n * @default 'wrap'\n */\n overflow?: 'wrap' | 'count';\n /**\n * Names of the remove buttons and the tag list, the summary that describes the trigger, the\n * announcements, the \"No matches\" text, the create option, the clear and expand buttons and the\n * \"+N\" count, for localization. Unset members keep their English defaults.\n */\n labels?: TagPickerLabels;\n /**\n * Called when TagPicker.Input's `<input role=\"combobox\">` receives focus (the root keeps other\n * handlers). With TagPicker.Button, pass it (and `ref`) on the Button.\n */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when TagPicker.Input's `<input>` loses focus. With TagPicker.Button, pass it on the Button. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in TagPicker.Input's `<input>`, after the Input's own `onKeyDown` and\n * before the built-in listbox and tag keys; `event.preventDefault()` skips them. With\n * TagPicker.Button, pass it on the Button.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in TagPicker.Input's `<input>`. With TagPicker.Button, pass it on the Button. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /**\n * Ref to TagPicker.Input's `<input role=\"combobox\">` (the focusable element). With\n * TagPicker.Button, pass `ref` on the Button.\n */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * How the picker came to be locked (`disabled` or `readOnly`): not at all, by a change while\n * mounted, or since it mounted.\n */\ntype LockState = 'unlocked' | 'locked' | 'mounted-locked';\n\nconst TAG_PICKER_SIZES: readonly TagPickerSize[] = ['medium', 'large', 'extra-large'];\nconst EMPTY_OPTIONS: readonly TagPickerOption[] = [];\nconst EMPTY_LABELS: ReadonlyMap<string, string> = new Map();\n\n/** The tag size of each picker size (Fluent's mapping, D54). */\nconst TAG_SIZE: Readonly<Record<TagPickerSize, TagSize>> = {\n medium: 'extra-small',\n large: 'small',\n 'extra-large': 'medium',\n};\n\nconst defaultRemoveLabel = (label: string) => `Remove ${label}`;\nconst defaultSummaryLabel = (labels: string[]) => `Selected: ${labels.join(', ')}`;\nconst defaultCreateLabel = (text: string) => `Create \"${text}\"`;\nconst defaultOverflowCountLabel = (count: number) => `+${count}`;\n\n/** The default `filter` (Phase 5 D13): a case-insensitive substring of `textValue ?? label`. */\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nfunction triggerMessage(count: number): string {\n return `TagPicker: render exactly one trigger, \\`TagPicker.Input\\` or \\`TagPicker.Button\\`, inside \\`TagPicker.Control\\` (found ${count}).`;\n}\n\nconst ALLOW_CREATE_BUTTON_MESSAGE =\n 'TagPicker: `allowCreate` needs `TagPicker.Input`: `TagPicker.Button` has no text to create a tag from, so no create option is offered.';\n\nconst LIST_PLACEMENT_MESSAGE =\n 'TagPicker.List: render one TagPicker.List, directly inside TagPicker (a Fragment is fine). A second list, or one inside a component of your own, splits the options over two lists.';\n\n/** The `TagPicker.List` among the direct children and Fragments, if any (D50). */\nfunction findList(\n children: React.ReactNode,\n): React.ReactElement<{ children?: React.ReactNode }> | undefined {\n if (children === null || children === undefined) return undefined;\n for (const { node } of flattenChildren(children)) {\n if (isElementOfType<{ children?: React.ReactNode }>(node, TagPickerList)) return node;\n }\n return undefined;\n}\n\nexport const TagPickerRoot = (props: TagPickerProps) => {\n const {\n options = EMPTY_OPTIONS,\n children,\n value: valueProp,\n defaultValue,\n onValueChange,\n onChange,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder = 'Select...',\n filter,\n query: queryProp,\n defaultQuery,\n onQueryChange,\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly = false,\n allowCreate = false,\n onOptionCreate,\n clearable = false,\n expandIcon,\n overflow: overflowProp = 'wrap',\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n } = props;\n\n if (onChange !== undefined) warnDeprecated('TagPicker', 'onChange', 'onValueChange');\n const overflow = overflowProp === 'count' ? 'count' : 'wrap';\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n // Like a native readonly input, a read-only TagPicker is barred from constraint validation (the\n // user could not fix it); its values are still submitted.\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n const {\n id: triggerId,\n 'aria-label': triggerLabel,\n 'aria-labelledby': triggerLabelledBy,\n 'aria-describedby': triggerDescribedBy,\n 'aria-invalid': triggerInvalid,\n 'aria-required': triggerRequired,\n } = fieldProps;\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, triggerInvalid);\n const { size, appearance } = useInputLook(sizeProp, appearanceProp, {\n sizes: TAG_PICKER_SIZES,\n defaultSize: 'medium',\n });\n const coreSize: CoreSize = size === 'medium' ? 'medium' : 'large';\n const tagSize = TAG_SIZE[size];\n // A muted tag would barely show on the darker fill: outlined there (D54).\n const tagAppearance: TagAppearance = appearance === 'filled-darker' ? 'outline' : 'filled';\n\n const [selected, setSelected] = useControllable<readonly string[]>(\n valueProp,\n defaultValue ?? EMPTY_VALUES,\n (next) => {\n // The props are read only; the callbacks receive an array of their own.\n const list = [...next];\n onValueChange?.(list);\n onChange?.(list);\n },\n );\n const selectedSet = React.useMemo(() => new Set(selected), [selected]);\n const interactive = !disabled && !readOnly;\n // A picker that starts disabled or read-only never shows its list, so it starts closed (no close\n // to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n // The open list lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the picker shows the closed inline list and reports it closed, so\n // aria-controls and aria-activedescendant never name a missing element.\n const isClient = useIsClient();\n const open = openState && interactive && isClient;\n // The trigger parts (D63): their kind decides the listbox mode; the server HTML and the first\n // render use the editable mode of `TagPicker.Input`.\n const triggersRef = React.useRef(new Map<object, TagPickerTriggerKind>());\n const [triggerKind, setTriggerKind] = React.useState<TagPickerTriggerKind>('input');\n const registerTrigger = React.useCallback((kind: TagPickerTriggerKind) => {\n const token = {};\n const triggers = triggersRef.current;\n const firstKind = () => triggers.values().next().value ?? 'input';\n triggers.set(token, kind);\n setTriggerKind(firstKind());\n return () => {\n triggers.delete(token);\n setTriggerKind(firstKind());\n };\n }, []);\n const listCountRef = React.useRef(0);\n const registerList = React.useCallback(() => {\n listCountRef.current += 1;\n return () => {\n listCountRef.current -= 1;\n };\n }, []);\n // After every commit (every part's layout effect has run): exactly one trigger and one List.\n React.useEffect(() => {\n const triggers = triggersRef.current.size;\n if (triggers !== 1) warnOnce('TagPicker:trigger', triggerMessage(triggers));\n if (listCountRef.current > 1) warnOnce('TagPicker.List:placement', LIST_PLACEMENT_MESSAGE);\n });\n const isButtonTrigger = triggerKind === 'button';\n\n // The query (D12): the text typed since the last tag was added, which filters the options. A\n // picker that starts locked starts without a query, as it starts closed.\n const [queryState, setQuery] = useControllable(\n queryProp,\n interactive ? (defaultQuery ?? '') : '',\n onQueryChange,\n );\n // Locking the control (readOnly/disabled) while typing drops the typed text: hidden during\n // render here, and the reset reported from an effect, since `onQueryChange` never runs during\n // render (D12). `lock` is how the picker came to be locked (previous-value pattern, C-HOOKS):\n // `'locked'` by a change while mounted, whose reset is reported once, or `'mounted-locked'`\n // since it mounted, which reports nothing and keeps a controlled query, hidden until the picker\n // unlocks (R20).\n // `TagPicker.Button` has no text entry, so no query filters its list (D63).\n const query = interactive && !isButtonTrigger ? queryState : '';\n const [lock, setLock] = React.useState<LockState>(interactive ? 'unlocked' : 'mounted-locked');\n if (interactive && lock !== 'unlocked') setLock('unlocked');\n else if (!interactive && lock === 'unlocked') setLock('locked');\n React.useEffect(() => {\n if (lock === 'locked') setQuery('');\n }, [lock, setQuery]);\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n // Keeps the shared live regions alive while mounted: every addition and removal is announced\n // (`announceToggle`).\n useAnnounce();\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const controlElementRef = React.useRef<HTMLDivElement | null>(null);\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const chipRef = React.useRef<HTMLSpanElement | null>(null);\n const summaryId = useId('tagpicker-summary');\n const createValue = useId('tagpicker-create');\n\n React.useEffect(() => {\n if (allowCreate && isButtonTrigger) {\n warnOnce('TagPicker:allowCreate-button', ALLOW_CREATE_BUTTON_MESSAGE);\n }\n }, [allowCreate, isButtonTrigger]);\n\n // The parts form (D50): a List among the direct children with children of its own switches the\n // listbox to registration mode; `options` then only names values.\n const listElement = findList(children);\n const listChildren = listElement?.props.children;\n const registration = listChildren !== undefined && listChildren !== null;\n const collected = React.useMemo(\n () => (registration ? collectOptionLabels(listChildren) : EMPTY_LABELS),\n [registration, listChildren],\n );\n\n const optionByValue = React.useMemo(() => {\n const map = new Map<string, TagPickerOption>();\n for (const option of options) if (!map.has(option.value)) map.set(option.value, option);\n return map;\n }, [options]);\n\n const resolvedLabels = React.useMemo<ResolvedTagPickerLabels>(\n () => ({\n remove: labels?.remove ?? defaultRemoveLabel,\n selected: labels?.selected ?? 'Selected',\n create: labels?.create ?? defaultCreateLabel,\n clear: labels?.clear ?? 'Clear selection',\n expand: labels?.expand ?? 'Show options',\n overflowCount: labels?.overflowCount ?? defaultOverflowCountLabel,\n noMatches: labels?.noMatches ?? 'No matches',\n }),\n [labels],\n );\n\n // The create option (D59) needs the text input, an interactive picker and an open list.\n const offersCreate =\n allowCreate && interactive && !isButtonTrigger && open && query.trim() !== '';\n // Data mode: the duplicate check reads every `options` entry, before the listbox, since the\n // create item is one of its items.\n const dataCreateText =\n offersCreate && !registration\n ? createOptionText(query, {\n labels: options.map((option) => option.label),\n values: options.map((option) => option.value),\n selected,\n })\n : null;\n\n const items = React.useMemo<ListboxItem[] | undefined>(() => {\n if (registration) return undefined;\n const available: ListboxItem[] = options\n .filter((option) => !selectedSet.has(option.value))\n .map((option) => ({ value: option.value, label: option.label }));\n if (dataCreateText !== null) {\n available.push({ value: createValue, label: resolvedLabels.create(dataCreateText) });\n }\n return available;\n }, [registration, options, selectedSet, dataCreateText, createValue, resolvedLabels]);\n\n // useListbox's navigability predicate (D58): the create option always, never a selected option,\n // and `filter` (else the default) bound to the typed text while there is any.\n const listFilter = React.useMemo(() => {\n if (!registration && !query) return undefined;\n const matches = filter ?? matchesText;\n return (item: ListboxItem) =>\n item.value === createValue ||\n (!selectedSet.has(item.value) && (query === '' || matches(item, query)));\n }, [registration, query, filter, selectedSet, createValue]);\n\n // Adds a listed option (`label`: the committed item's).\n const addTag = (value: string, label: string) => {\n if (!interactive || selected.includes(value)) return;\n const next = [...selected, value];\n setSelected(next);\n setQuery('');\n announceToggle(labels, label, true, next.length);\n };\n\n // Creates a tag of the trimmed text (D59): the create option was offered for it.\n const commitCreate = () => {\n const text = query.trim();\n if (!interactive || text === '') return;\n onOptionCreate?.(text);\n const next = [...selected, text];\n setSelected(next);\n setQuery('');\n announceToggle(labels, text, true, next.length);\n };\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => setOpen(next),\n mode: isButtonTrigger ? 'select-only' : 'editable',\n multiselect: true,\n selectedValues: selected,\n onSelect: (value, details) => {\n if (value === createValue) commitCreate();\n else addTag(value, details?.item.label ?? value);\n },\n items,\n filter: listFilter,\n // Typing a filter makes its first match active (as in Combobox), so Enter adds what the list\n // shows instead of submitting the form. Nothing is active on open or with the text cleared.\n // The Button trigger starts on the first listed option, as Dropdown does.\n autoHighlight: isButtonTrigger ? 'selected' : query ? 'first' : false,\n idPrefix: 'tagpicker-listbox',\n onClearDraft: query && !isButtonTrigger ? () => setQuery('') : undefined,\n });\n\n // A value's label (D58): its registered option's, else the List children's (the server and the\n // first render), else the `options` entry's, else the raw value.\n const getItem = listbox.getItem;\n const labelOf = React.useCallback(\n (value: string): string =>\n (registration ? getItem(value)?.label : undefined) ??\n collected.get(value) ??\n optionByValue.get(value)?.label ??\n value,\n [registration, getItem, collected, optionByValue],\n );\n\n // Registration mode: the create option is a rendered Option, so the duplicate check runs after\n // the listbox, over the labels it lists in this render and those of the selected values.\n let createText: string | null = dataCreateText;\n if (offersCreate && registration) {\n const listed = listbox.items.filter((item) => item.value !== createValue);\n createText = createOptionText(query, {\n labels: [\n ...options.map((option) => option.label),\n ...collected.values(),\n ...listed.map((item) => item.label),\n ...selected.map(labelOf),\n ],\n values: [\n ...options.map((option) => option.value),\n ...collected.keys(),\n ...listed.map((item) => item.value),\n ],\n selected,\n });\n }\n const showCreate = createText !== null;\n\n // aria-expanded only while a listbox with options (or the create option) is shown\n // (input-pickers#21).\n const expanded = open && (listbox.items.length > 0 || showCreate);\n const noMatchesText = resolvedLabels.noMatches;\n // The popup shows the options, or \"No matches\" for a query.\n const surfaceOpen = open && (expanded || query !== '');\n const noMatches = surfaceOpen && !expanded && !showCreate;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: () => setOpen(false),\n rootRef,\n anchorRef: triggerRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n\n useFormReset(\n rootRef,\n () => {\n // Compared by content (C-FORMS): an inline default is a new array on every render, and a\n // reset that keeps the same tags reports nothing.\n const initial = defaultValue ?? EMPTY_VALUES;\n setSelected((current) => (sameValues(current, initial) ? current : [...initial]));\n setQuery('');\n },\n form,\n );\n\n // The single-line layout (D62): collapsed while focus is outside the root and the list closed.\n const {\n focusWithin,\n onFocus: trackFocus,\n onBlur: trackBlur,\n } = useFocusWithin(overflow === 'count');\n const collapsed = overflow === 'count' && !focusWithin && !open;\n const tagLabels = React.useMemo(() => selected.map(labelOf), [selected, labelOf]);\n const hiddenValues = useTagOverflow({\n active: collapsed,\n values: selected,\n labels: tagLabels,\n control: controlElementRef,\n group: groupRef,\n chip: chipRef,\n trigger: triggerRef,\n });\n\n const focusTrigger = useEventCallback(() => {\n triggerRef.current?.focus();\n });\n const toggleOpen = useEventCallback(() => {\n if (interactive) setOpen(!open);\n });\n const removeTag = useEventCallback((value: string) => {\n if (!interactive || !selected.includes(value)) return;\n const next = selected.filter((v) => v !== value);\n setSelected(next);\n announceToggle(labels, labelOf(value), false, next.length);\n });\n const clear = useEventCallback(() => {\n focusTrigger();\n if (!interactive) return;\n if (selected.length > 0) setSelected([]);\n setQuery('');\n setOpen(false);\n });\n const editText = useEventCallback((text: string) => {\n if (!interactive) return;\n setQuery(text);\n if (!open) setOpen(true);\n // The option whose label equals the typed text becomes active (D60); a user edit only.\n const candidates: Iterable<ExactMatchCandidate> = registration\n ? Array.from(collected, ([value, label]) => ({ value, label }))\n : options;\n listbox.setActiveValue(findExactMatch(text, candidates, selectedSet));\n });\n const focusLastTagControl = useEventCallback(() => {\n const group = groupRef.current;\n const last = group ? tagListControls(group).at(-1) : undefined;\n last?.focus();\n return last !== undefined;\n });\n const setOpenStable = useEventCallback((next: boolean) => setOpen(next));\n const entryOf = React.useCallback((value: string) => optionByValue.get(value), [optionByValue]);\n\n const triggerProps = React.useMemo<TagPickerTriggerProps>(\n () => ({\n id: triggerId,\n 'aria-label': triggerLabel,\n 'aria-labelledby': triggerLabelledBy,\n 'aria-describedby': triggerDescribedBy,\n 'aria-invalid': triggerInvalid,\n 'aria-required': triggerRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n tabIndex,\n autoFocus,\n }),\n [\n triggerId,\n triggerLabel,\n triggerLabelledBy,\n triggerDescribedBy,\n triggerInvalid,\n triggerRequired,\n ariaErrorMessage,\n ariaDetails,\n tabIndex,\n autoFocus,\n ],\n );\n const inputProps = React.useMemo<TagPickerInputOnlyProps>(\n () => ({\n autoComplete,\n autoCapitalize,\n autoCorrect,\n maxLength,\n inputMode,\n spellCheck,\n enterKeyHint,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n }),\n [\n autoComplete,\n autoCapitalize,\n autoCorrect,\n maxLength,\n inputMode,\n spellCheck,\n enterKeyHint,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n ],\n );\n const listLabelledBy =\n triggerLabel === undefined ? (triggerLabelledBy ?? field?.labelId) : triggerLabelledBy;\n const listLabel = React.useMemo(\n () => ({ 'aria-label': triggerLabel, 'aria-labelledby': listLabelledBy }),\n [triggerLabel, listLabelledBy],\n );\n\n const hasSummary = selected.length > 0;\n const context = React.useMemo<TagPickerContextValue>(\n () => ({\n size,\n appearance,\n coreSize,\n tagSize,\n tagAppearance,\n disabled,\n readOnly,\n interactive,\n invalidLook,\n selected,\n labelOf,\n entryOf,\n labels: resolvedLabels,\n placeholder,\n options,\n warnsUnknownValues: !registration && !allowCreate,\n dataMode: !registration,\n listbox,\n open,\n expanded,\n query,\n surfaceOpen,\n showCreate,\n createText: createText ?? '',\n createValue,\n emptyContent: query !== '' && !showCreate,\n layerId,\n surfaceRef,\n floatingProps,\n listLabel,\n triggerProps,\n inputProps,\n summaryId: hasSummary ? summaryId : undefined,\n triggerRef,\n setReference,\n controlRef: controlElementRef,\n groupRef,\n chipRef,\n registerTrigger,\n registerList,\n triggerKind,\n setOpen: setOpenStable,\n toggleOpen,\n focusTrigger,\n removeTag,\n clear,\n editText,\n focusLastTagControl,\n expandIcon,\n clearable,\n overflow,\n collapsed,\n hiddenValues,\n }),\n [\n size,\n appearance,\n coreSize,\n tagSize,\n tagAppearance,\n disabled,\n readOnly,\n interactive,\n invalidLook,\n selected,\n labelOf,\n entryOf,\n resolvedLabels,\n placeholder,\n options,\n registration,\n allowCreate,\n listbox,\n open,\n expanded,\n query,\n surfaceOpen,\n showCreate,\n createText,\n createValue,\n layerId,\n surfaceRef,\n floatingProps,\n listLabel,\n triggerProps,\n inputProps,\n hasSummary,\n summaryId,\n setReference,\n registerTrigger,\n registerList,\n triggerKind,\n setOpenStable,\n toggleOpen,\n focusTrigger,\n removeTag,\n clear,\n editText,\n focusLastTagControl,\n expandIcon,\n clearable,\n overflow,\n collapsed,\n hiddenValues,\n ],\n );\n\n const parts =\n children === undefined || children === null ? (\n <>\n <TagPickerControl />\n <TagPickerList />\n </>\n ) : (\n <>\n {children}\n {/* A parts form without a List still has its listbox, so aria-controls never dangles. */}\n {listElement === undefined && <TagPickerList />}\n </>\n );\n\n return (\n <div\n data-size={size}\n data-appearance={appearance}\n data-overflow={overflow}\n data-collapsed={collapsed ? '' : undefined}\n {...rest}\n ref={rootMergedRef}\n className={cn(tagPickerClassNames.root, 'relative', className)}\n // Focus inside the root (DOM containment) expands the single-line layout.\n onFocus={trackFocus}\n onBlur={trackBlur}\n >\n <TagPickerContext.Provider value={context}>{parts}</TagPickerContext.Provider>\n {hasSummary && (\n // Describes the trigger. The list itself would read every \"Remove …\" button name too.\n <span id={summaryId} hidden>\n {(labels?.summary ?? defaultSummaryLabel)(selected.map(labelOf))}\n </span>\n )}\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={selected}\n type=\"text\"\n required={validates}\n onInvalid={focusTrigger}\n />\n </div>\n );\n};\nTagPickerRoot.displayName = 'TagPicker';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2SA,IAAMI,KAA6C;CAAC;CAAU;CAAS;AAAa,GAC9EC,KAA4C,CAAC,GAC7CC,qBAA4C,IAAI,IAAI,GAGpDC,KAAqD;CACzD,QAAQ;CACR,OAAO;CACP,eAAe;AACjB,GAEMC,MAAsB,MAAkB,UAAUC,KAClDC,MAAuB,MAAqB,aAAaC,EAAO,KAAK,IAAI,KACzEC,MAAsB,MAAiB,WAAWC,EAAK,IACvDC,MAA6B,MAAkB,IAAIC;AAGzD,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EAAK,aAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASJ,EAAK,YAAY,CAAC;AACjF;AAEA,SAASK,GAAe,GAAuB;CAC7C,OAAO,2HAA2HH,EAAM;AAC1I;AAE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;CACF,CACF,GACMC,KAAalL,EAAM,eAChB;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACEmL;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;CACF,CACF,GACMC,KACJ9I,MAAiB,KAAA,IAAaC,KAAqBP,IAAO,UAAWO,GACjE8I,KAAYhM,EAAM,eACf;EAAE,cAAciD;EAAc,mBAAmB8I;CAAe,IACvE,CAAC9I,GAAc8I,EAAc,CAC/B,GAEME,KAAalI,EAAS,SAAS,GAC/BmI,KAAUlM,EAAM,eACb;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQuH;EACR;EACA;EACA,oBAAoB,CAACP,KAAgB,CAACH;EACtC,UAAU,CAACG;EACX;EACA;EACA;EACA;EACA;EACA;EACA,YAAYyB,KAAc;EAC1B;EACA,cAAcxC,MAAU,MAAM,CAAC0C;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA,WAAWsD,KAAatF,IAAY,KAAA;EACpC;EACA;EACA,YAAYH;EACZ;EACA;EACA;EACA;EACA;EACA,SAASqE;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACElH;EACAG;EACAJ;EACAE;EACAC;EACAY;EACA1B;EACAyB;EACAjB;EACAQ;EACAyE;EACAsC;EACAvD;EACA4E;EACA7E;EACAN;EACAH;EACAuB;EACApD;EACA4D;EACA3C;EACA6C;EACAH;EACAF;EACA7B;EACAwF;EACAC;EACAC;EACAN;EACAjB;EACAG;EACAe;EACAtF;EACA4F;EACAnH;EACAM;EACAR;EACA2F;EACAX;EACAF;EACAG;EACAE;EACAC;EACAG;EACA+B;EACAC;EACA/J;EACAiH;EACAG;CACF,CACF,GAEM4C,KACJvL,KAAuC,OACrC,kBAAArB,IAAA,EAAA,UAAA,CACE,kBAAC8M,IAAD,CAAmB,CAAA,GACnB,kBAACrL,GAAD,CAAgB,CAAA,CAChB,EAAA,CAAA,IAEF,kBAAAzB,IAAA,EAAA,UAAA,CACGqB,GAEA2F,OAAgB,KAAA,KAAa,kBAACvF,GAAD,CAAgB,CAAA,CAC9C,EAAA,CAAA;CAGN,OACE,kBAAC,OAAD;EACE,aAAWoC;EACX,mBAAiBG;EACjB,iBAAepB;EACf,kBAAgBiH,IAAY,KAAK,KAAA;EACjC,GAAIrH;EACJ,KAAK2G;EACL,WAAW4D,EAAGC,GAAoB,MAAM,YAAYC,EAAS;EAE7D,SAASvD;EACT,QAAQC;EAVV,UAAA;GAYE,kBAACuD,GAAiB,UAAlB;IAA2B,OAAOd;IAAU,UAAAQ;GAAiC,CAAA;GAC5ET,MAEC,kBAAC,QAAD;IAAM,IAAItF;IAAW,QAAA;IACjB,WAAAnG,GAAQ,WAAWD,GAAA,CAAqBwD,EAAS,IAAIyE,CAAO,CAAC;GAC3D,CAAA;GAIR,kBAAC,QAAD;IAAM,MAAK;IAAS,WAAU;IAC3B,UAAAO,MAAaF;GACV,CAAA;GACN,kBAACoE,IAAD;IACQ;IACA;IACI;IACV,OAAOlJ;IACP,MAAK;IACL,UAAUlB;IACV,WAAWmH;GACZ,CAAA;EACE;;AAET;AACA,EAAc,cAAc"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useControllable.cjs"),ee=require("../../hooks/useId.cjs"),o=require("../../hooks/useMergedRefs.cjs"),te=require("../../hooks/useIsClient.cjs"),ne=require("../../lib/aria.cjs"),re=require("../../hooks/useFieldControl.cjs"),ie=require("../../hooks/useDismiss.cjs"),ae=require("../portal/Portal.cjs"),s=require("../../lib/styles.cjs"),c=require("../../lib/icons.cjs"),oe=require("./inputLook.cjs"),se=require("./Input.cjs"),ce=require("../../hooks/useFormReset.cjs"),le=require("../internal/HiddenInput.cjs"),l=require("../../hooks/useListbox.cjs"),u=require("./pickerStyles.cjs"),ue=require("./Combobox.expand.cjs"),de=require("../../hooks/usePopupPosition.cjs"),d=require("./dateUtils.cjs");let f=require("react");f=e.__toESM(f,1);let p=require("react/jsx-runtime"),fe=require("react-dom");var pe=`flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold`,me=f.memo(function({value:e,label:n}){let{selected:r,optionProps:a}=l.useListboxOption({value:e,label:n});return(0,p.jsxs)(`li`,{...a,className:t.cn(i.timePickerClassNames.option,pe,r&&s.forcedColors.selectedContainer),children:[(0,p.jsx)(`span`,{className:t.cn(i.timePickerClassNames.checkIcon,`flex h-4 w-4 shrink-0 items-center justify-center`),children:r?(0,p.jsx)(c.CheckIcon,{size:12}):null}),n]})});me.displayName=`TimePickerOption`;var he=e=>`Enter a time in the format ${e}.`,ge=(e,t)=>e!==void 0&&t!==void 0?`Enter a time between ${e} and ${t}.`:e===void 0?`Enter a time on or before ${t}.`:`Enter a time on or after ${e}.`;function m(e,t){let n=d.timeToMinutes(e);return Number.isNaN(n)?e:d.minutesToTime(n,t)}function _e(e,t){return e.label.toLowerCase().includes(t)||e.value.includes(t)}function ve(e,t){return e.label.toLowerCase().startsWith(t)||e.value.startsWith(t)}var h=e=>{let{value:pe,defaultValue:h,onValueChange:ye,onChange:be,format:g=`12h`,step:_=30,minTime:v=`00:00`,maxTime:y=`23:59`,placeholder:xe=`Select a time`,disabled:b=!1,size:Se,appearance:Ce,readOnly:x,clearable:we=!1,expandIcon:Te,open:Ee,defaultOpen:De,onOpenChange:Oe,onInvalidInput:ke,labels:S,name:Ae,form:C,required:je,autoComplete:Me=`off`,autoCapitalize:Ne,autoCorrect:Pe,maxLength:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":We,"aria-invalid":Ge,"aria-required":Ke,"aria-errormessage":qe,"aria-details":Je,onFocus:Ye,onBlur:Xe,onKeyDown:Ze,onKeyUp:Qe,controlRef:$e,className:et,ref:tt,...nt}=e;be!==void 0&&n.warnDeprecated(`TimePicker`,`onChange`,`onValueChange`);let{size:w,appearance:T}=oe.useInputLook(Se,Ce),[E,rt]=a.useControllable(pe,h??``,e=>{ye?.(e),be?.(e)}),it=d.normalizeTimeStep(_).valid,D=d.timeToMinutes(v),O=d.timeToMinutes(y),k=!Number.isNaN(D)&&!Number.isNaN(O)&&D<=O,A=f.useMemo(()=>d.generateTimeOptions(_,v,y,g),[_,v,y,g]);f.useEffect(()=>{it||n.warnOnce(`TimePicker:step:${String(_)}`,`TimePicker: \`step\` must be a positive number of minutes (received ${String(_)}); using 30.`)},[_,it]),f.useEffect(()=>{k||n.warnOnce(`TimePicker:bounds:${v}|${y}`,`TimePicker: \`minTime\`/\`maxTime\` must be times such as "09:00", "09:00:00" or "9:00 AM" with minTime <= maxTime (received "${v}" / "${y}"); no times are available.`)},[v,y,k]);let j=!b&&!x,[M,N,at]=a.useControllable(Ee,(De??!1)&&j,Oe),ot=te.useIsClient(),P=M&&j&&ot;f.useEffect(()=>{!j&&M&&!at&&N(!1)},[j,M,at,N]);let[F,I]=f.useState(null),[L,R]=f.useState(null),[st,ct]=f.useState(j);st!==j&&(ct(j),j||(I(null),R(null)));let[lt,ut]=f.useState(E);lt!==E&&(ut(E),L!==null&&(I(null),R(null)));let dt=F??``,ft=()=>{j&&!P&&N(!0)},z=()=>N(!1),B=f.useMemo(()=>{let e=dt.trim().toLowerCase();if(!e)return;let t=d.timeToMinutes(e),n=Number.isNaN(t)?null:d.minutesToValue(t);return t=>t.value===n||_e(t,e)},[dt]),pt=e=>{let t=e.trim().toLowerCase();if(!t)return null;let n=d.timeToMinutes(e);if(!Number.isNaN(n)){let e=d.minutesToValue(n);return A.some(t=>t.value===e)?e:null}return(A.find(e=>ve(e,t))??A.find(e=>_e(e,t)))?.value??null},mt=E!==``&&A.some(e=>e.value===E),ht=f.useMemo(()=>E?[E]:[],[E]),V=e=>{rt(e),I(null),R(null)},H=e=>{if(!e.trim())return V(``),null;let t=d.timeToMinutes(e);return Number.isNaN(t)?`unparseable`:!k||t<D||t>O?`out-of-range`:(V(d.minutesToValue(t)),null)},gt=(e,t)=>{R(t),ke?.(e,t)},U=()=>{I(null),R(null)},W=f.useMemo(()=>B?A.some(B):A.length>0,[A,B]),G=P&&W,K=l.useListbox({open:G,onOpenChange:e=>e?ft():z(),mode:`editable`,selectedValues:ht,onSelect:e=>V(e),items:A,filter:B,autoHighlight:F===null&&mt?`selected`:!1,idPrefix:`timepicker-listbox`,onClearDraft:F===null?void 0:()=>{U(),z()}}),_t=E?K.getItem(E)?.label??m(E,g):``,q=we&&!x&&E!==``,vt=P&&!W?A.length===0?S?.noTimes??`No times available`:S?.noMatches??`No matching times`:``,yt=f.useRef(null),J=f.useRef(null),bt=f.useRef(null),xt=o.useMergedRefs(tt,yt),St=o.useMergedRefs($e,J),{layerId:Ct}=ie.useDismiss({open:P,onDismiss:z,refs:[bt,yt],anchorRef:J,kind:`listbox`,focusOutside:!0}),{setReference:wt,setFloating:Tt,floatingProps:Et}=de.usePopupPosition({open:P,side:`bottom`,align:`start`,matchReferenceWidth:!0,fitViewport:!0}),Dt=o.useMergedRefs(bt,Tt),Y=re.useFieldContext(),Ot=(je??Y?.required??!1)&&!x,kt=ee.useId(`timepicker-error`),X=L!==null&&!Y?.hasErrorMessage,At=re.useFieldControl({id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":ne.joinIds(We,X?kt:void 0),"aria-invalid":L!==null||Ge,"aria-required":Ke??je}),jt=se.isInvalidLook(!1,At[`aria-invalid`]);ce.useFormReset(J,()=>{rt(h??``),U(),z()},C);let Mt=e=>{if(!j)return;let t=e.target.value;I(t),R(null),P||N(!0),K.setActiveValue(pt(t))},Nt=r.composeEventHandlers(Ze,e=>{if(j&&(K.onKeyDown(e),!(e.defaultPrevented||e.nativeEvent.isComposing))){if(e.key===`Escape`&&F===``&&_t!==``){e.preventDefault(),U(),z();return}if(e.key===`Enter`&&F!==null){e.preventDefault();let t=H(F);z(),t!==null&&gt(F,t)}e.key===`Tab`&&!e.shiftKey&&q&&F!==null&&!F.trim()&&(0,fe.flushSync)(()=>H(F)),e.key===`Tab`&&P&&!G&&z()}}),Pt=r.composeEventHandlers(Qe,K.onKeyUp),Ft=()=>{j&&!P&&(ft(),F!==null&&K.setActiveValue(pt(F)))},It=r.composeEventHandlers(Xe,()=>{if(!j||F===null)return;let e=L===null?H(F):null;z(),e!==null&&gt(F,e)}),Lt=()=>{j&&(P?z():Ft(),J.current?.focus())},Rt=()=>{j&&(V(``),J.current?.focus())},zt=ne.joinIds(Ue,Y?.labelId),Z=e=>(0,p.jsx)(`ul`,{...K.getListboxProps(),"aria-labelledby":zt,"aria-label":zt?void 0:He??S?.list??`Times`,hidden:e||void 0,className:t.cn(i.timePickerClassNames.listbox,`max-h-60 min-h-0 overflow-auto py-1 focus:outline-hidden`),children:K.items.map(e=>(0,p.jsx)(me,{value:e.value,label:e.label},e.value))}),Q=ue.showsExpandButton(Te),$=``;X&&L===`unparseable`?$=(S?.invalidTime??he)(g===`24h`?`HH:mm`:`h:mm AM`):X&&($=(S?.outOfRange??ge)(e.minTime===void 0?void 0:m(v,g),e.maxTime===void 0?void 0:m(y,g)));let Bt=P?W:A.length>0;return(0,p.jsx)(l.ListboxContext.Provider,{value:K.context,children:(0,p.jsxs)(`div`,{"data-size":w,"data-appearance":T,...nt,ref:xt,className:t.cn(i.timePickerClassNames.root,`relative inline-flex flex-col`,et),children:[(0,p.jsxs)(`div`,{ref:wt,className:`relative flex items-center`,children:[(0,p.jsx)(`input`,{ref:St,type:`text`,...K.getComboboxProps(),"aria-controls":Bt?K.listboxId:void 0,...At,"aria-errormessage":qe,"aria-details":Je,value:F??_t,onChange:Mt,onClick:Ft,onFocus:Ye,onBlur:It,onKeyDown:Nt,onKeyUp:Pt,placeholder:xe,disabled:b,readOnly:x,autoComplete:Me,autoCapitalize:Ne,autoCorrect:Pe,maxLength:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,className:t.cn(i.timePickerClassNames.input,s.inputHeightClasses[w],`w-full`,s.inputPaddingClasses[w],s.inputTextClasses[w],s.inputAppearanceClasses[T],`text-foreground placeholder:text-muted-foreground`,s.inputFocus,s.disabledStyles,jt&&`border-destructive`,u.pickerEndPadding(Number(q)+Number(Q),w))}),q&&(0,p.jsx)(`button`,{type:`button`,"aria-label":S?.clear??`Clear time`,disabled:b,onMouseDown:e=>e.preventDefault(),onClick:Rt,className:t.cn(i.timePickerClassNames.clearButton,u.pickerIconButtonClasses(w,T),u.pickerButtonOffset(w,Q?2:1),`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,p.jsx)(c.DismissIcon,{size:u.pickerGlyphSize(w,`icon`)})}),Q&&(0,p.jsx)(ue.PickerExpandButton,{component:`TimePicker`,expandIcon:Te,label:S?.expand??`Show times`,expanded:G,listboxId:K.listboxId,disabled:b||!!x,onToggle:Lt,size:w,appearance:T,className:i.timePickerClassNames.expandButton,iconClassName:i.timePickerClassNames.expandIcon})]}),X&&(0,p.jsx)(`p`,{id:kt,role:`alert`,className:t.cn(i.timePickerClassNames.errorMessage,`mt-1 text-caption-1 text-error`),children:$}),!P&&A.length>0&&Z(!0),(0,p.jsx)(`span`,{role:`status`,className:`sr-only`,children:vt}),(0,p.jsx)(le.HiddenInput,{name:Ae,form:C,disabled:b,value:E,type:`text`,required:Ot,onInvalid:()=>J.current?.focus()}),P&&(0,p.jsx)(ae.Portal,{layerId:Ct,children:(0,p.jsx)(`div`,{ref:Dt,...Et,"data-state":`open`,className:t.cn(i.timePickerClassNames.surface,`flex flex-col overflow-hidden rounded border border-border bg-background shadow-8`),children:W?Z(!1):(0,p.jsx)(`div`,{"aria-hidden":`true`,className:t.cn(i.timePickerClassNames.emptyMessage,`px-3 py-1.5 text-body-1 text-muted-foreground`),children:vt})})})]})})};h.displayName=`TimePicker`,exports.TimePicker=h;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useControllable.cjs"),ee=require("../../hooks/useId.cjs"),o=require("../../hooks/useMergedRefs.cjs"),te=require("../../hooks/useIsClient.cjs"),ne=require("../../lib/aria.cjs"),re=require("../../hooks/useFieldControl.cjs"),s=require("../../hooks/useListbox.cjs"),ie=require("../../hooks/useDismiss.cjs"),ae=require("../portal/Portal.cjs"),c=require("../../lib/styles.cjs"),oe=require("../../lib/icons.cjs"),se=require("./inputLook.cjs"),ce=require("./Input.cjs"),le=require("../../hooks/useFormReset.cjs"),ue=require("../internal/HiddenInput.cjs"),l=require("./pickerStyles.cjs"),de=require("./Combobox.expand.cjs"),fe=require("../../hooks/usePopupPosition.cjs"),u=require("./dateUtils.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime"),pe=require("react-dom");var me=`flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold`,he=d.memo(function({value:e,label:n}){let{selected:r,optionProps:a}=s.useListboxOption({value:e,label:n});return(0,f.jsxs)(`li`,{...a,className:t.cn(i.timePickerClassNames.option,me,r&&c.forcedColors.selectedContainer),children:[(0,f.jsx)(`span`,{className:t.cn(i.timePickerClassNames.checkIcon,`flex h-4 w-4 shrink-0 items-center justify-center`),children:r?(0,f.jsx)(oe.CheckIcon,{size:12}):null}),n]})});he.displayName=`TimePickerOption`;var ge=e=>`Enter a time in the format ${e}.`,_e=(e,t)=>e!==void 0&&t!==void 0?`Enter a time between ${e} and ${t}.`:e===void 0?`Enter a time on or before ${t}.`:`Enter a time on or after ${e}.`;function p(e,t){let n=u.timeToMinutes(e);return Number.isNaN(n)?e:u.minutesToTime(n,t)}function ve(e,t){return e.label.toLowerCase().includes(t)||e.value.includes(t)}function ye(e,t){return e.label.toLowerCase().startsWith(t)||e.value.startsWith(t)}var m=e=>{let{value:me,defaultValue:m,onValueChange:be,onChange:xe,format:h=`12h`,step:g=30,minTime:_=`00:00`,maxTime:v=`23:59`,placeholder:Se=`Select a time`,disabled:y=!1,size:Ce,appearance:we,readOnly:b,clearable:Te=!1,expandIcon:Ee,open:De,defaultOpen:Oe,onOpenChange:ke,onInvalidInput:Ae,labels:x,name:je,form:S,required:Me,autoComplete:Ne=`off`,autoCapitalize:Pe,autoCorrect:Fe,maxLength:Ie,enterKeyHint:Le,inputMode:Re,spellCheck:ze,autoFocus:Be,tabIndex:Ve,id:He,"aria-label":Ue,"aria-labelledby":We,"aria-describedby":Ge,"aria-invalid":Ke,"aria-required":qe,"aria-errormessage":Je,"aria-details":Ye,onFocus:Xe,onBlur:Ze,onKeyDown:Qe,onKeyUp:$e,controlRef:et,className:tt,ref:nt,...rt}=e;xe!==void 0&&n.warnDeprecated(`TimePicker`,`onChange`,`onValueChange`);let{size:C,appearance:w}=se.useInputLook(Ce,we),[T,it]=a.useControllable(me,m??``,e=>{be?.(e),xe?.(e)}),at=u.normalizeTimeStep(g).valid,E=u.timeToMinutes(_),D=u.timeToMinutes(v),O=!Number.isNaN(E)&&!Number.isNaN(D)&&E<=D,k=d.useMemo(()=>u.generateTimeOptions(g,_,v,h),[g,_,v,h]);d.useEffect(()=>{at||n.warnOnce(`TimePicker:step:${String(g)}`,`TimePicker: \`step\` must be a positive number of minutes (received ${String(g)}); using 30.`)},[g,at]),d.useEffect(()=>{O||n.warnOnce(`TimePicker:bounds:${_}|${v}`,`TimePicker: \`minTime\`/\`maxTime\` must be times such as "09:00", "09:00:00" or "9:00 AM" with minTime <= maxTime (received "${_}" / "${v}"); no times are available.`)},[_,v,O]);let A=!y&&!b,[j,M,ot]=a.useControllable(De,(Oe??!1)&&A,ke),st=te.useIsClient(),N=j&&A&&st;d.useEffect(()=>{!A&&j&&!ot&&M(!1)},[A,j,ot,M]);let[P,F]=d.useState(null),[I,L]=d.useState(null),[ct,lt]=d.useState(A);ct!==A&&(lt(A),A||(F(null),L(null)));let[ut,dt]=d.useState(T);ut!==T&&(dt(T),I!==null&&(F(null),L(null)));let ft=P??``,pt=()=>{A&&!N&&M(!0)},R=()=>M(!1),z=d.useMemo(()=>{let e=ft.trim().toLowerCase();if(!e)return;let t=u.timeToMinutes(e),n=Number.isNaN(t)?null:u.minutesToValue(t);return t=>t.value===n||ve(t,e)},[ft]),mt=e=>{let t=e.trim().toLowerCase();if(!t)return null;let n=u.timeToMinutes(e);if(!Number.isNaN(n)){let e=u.minutesToValue(n);return k.some(t=>t.value===e)?e:null}return(k.find(e=>ye(e,t))??k.find(e=>ve(e,t)))?.value??null},ht=T!==``&&k.some(e=>e.value===T),gt=d.useMemo(()=>T?[T]:[],[T]),B=e=>{it(e),F(null),L(null)},V=e=>{if(!e.trim())return B(``),null;let t=u.timeToMinutes(e);return Number.isNaN(t)?`unparseable`:!O||t<E||t>D?`out-of-range`:(B(u.minutesToValue(t)),null)},_t=(e,t)=>{L(t),Ae?.(e,t)},H=()=>{F(null),L(null)},U=d.useMemo(()=>z?k.some(z):k.length>0,[k,z]),W=N&&U,G=s.useListbox({open:W,onOpenChange:e=>e?pt():R(),mode:`editable`,selectedValues:gt,onSelect:e=>B(e),items:k,filter:z,autoHighlight:P===null&&ht?`selected`:!1,idPrefix:`timepicker-listbox`,onClearDraft:P===null?void 0:()=>{H(),R()}}),vt=T?G.getItem(T)?.label??p(T,h):``,K=Te&&!b&&T!==``,yt=N&&!U?k.length===0?x?.noTimes??`No times available`:x?.noMatches??`No matching times`:``,bt=d.useRef(null),q=d.useRef(null),xt=d.useRef(null),St=o.useMergedRefs(nt,bt),Ct=o.useMergedRefs(et,q),{layerId:wt}=ie.useDismiss({open:N,onDismiss:R,refs:[xt,bt],anchorRef:q,kind:`listbox`,focusOutside:!0}),{setReference:Tt,setFloating:Et,floatingProps:Dt}=fe.usePopupPosition({open:N,side:`bottom`,align:`start`,matchReferenceWidth:!0,fitViewport:!0}),Ot=o.useMergedRefs(xt,Et),J=re.useFieldContext(),kt=(Me??J?.required??!1)&&!b,At=ee.useId(`timepicker-error`),Y=I!==null&&!J?.hasErrorMessage,jt=re.useFieldControl({id:He,"aria-label":Ue,"aria-labelledby":We,"aria-describedby":ne.joinIds(Ge,Y?At:void 0),"aria-invalid":I!==null||Ke,"aria-required":qe??Me}),Mt=ce.isInvalidLook(!1,jt[`aria-invalid`]);le.useFormReset(q,()=>{it(m??``),H(),R()},S);let Nt=e=>{if(!A)return;let t=e.target.value;F(t),L(null),N||M(!0),G.setActiveValue(mt(t))},Pt=r.composeEventHandlers(Qe,e=>{if(A&&(G.onKeyDown(e),!(e.defaultPrevented||e.nativeEvent.isComposing))){if(e.key===`Escape`&&P===``&&vt!==``){e.preventDefault(),H(),R();return}if(e.key===`Enter`&&P!==null){e.preventDefault();let t=V(P);R(),t!==null&&_t(P,t)}e.key===`Tab`&&!e.shiftKey&&K&&P!==null&&!P.trim()&&(0,pe.flushSync)(()=>V(P)),e.key===`Tab`&&N&&!W&&R()}}),Ft=r.composeEventHandlers($e,G.onKeyUp),X=()=>{A&&!N&&(pt(),P!==null&&G.setActiveValue(mt(P)))},It=r.composeEventHandlers(Ze,()=>{if(!A||P===null)return;let e=I===null?V(P):null;R(),e!==null&&_t(P,e)}),Lt=()=>{A&&(N?R():X(),q.current?.focus())},Rt=()=>{A&&(B(``),q.current?.focus())},zt=ne.joinIds(We,J?.labelId),Z=e=>(0,f.jsx)(`ul`,{...G.getListboxProps(),"aria-labelledby":zt,"aria-label":zt?void 0:Ue??x?.list??`Times`,hidden:e||void 0,className:t.cn(i.timePickerClassNames.listbox,`max-h-60 min-h-0 overflow-auto py-1 focus:outline-hidden`),children:G.items.map(e=>(0,f.jsx)(he,{value:e.value,label:e.label},e.value))}),Q=de.showsExpandButton(Ee),$=``;Y&&I===`unparseable`?$=(x?.invalidTime??ge)(h===`24h`?`HH:mm`:`h:mm AM`):Y&&($=(x?.outOfRange??_e)(e.minTime===void 0?void 0:p(_,h),e.maxTime===void 0?void 0:p(v,h)));let Bt=N?U:k.length>0;return(0,f.jsx)(s.ListboxContext.Provider,{value:G.context,children:(0,f.jsxs)(`div`,{"data-size":C,"data-appearance":w,...rt,ref:St,className:t.cn(i.timePickerClassNames.root,`relative inline-flex flex-col`,tt),children:[(0,f.jsxs)(`div`,{ref:Tt,className:`relative flex items-center`,children:[(0,f.jsx)(`input`,{ref:Ct,type:`text`,...G.getComboboxProps(),"aria-controls":Bt?G.listboxId:void 0,...jt,"aria-errormessage":Je,"aria-details":Ye,value:P??vt,onChange:Nt,onClick:X,onFocus:Xe,onBlur:It,onKeyDown:Pt,onKeyUp:Ft,placeholder:Se,disabled:y,readOnly:b,autoComplete:Ne,autoCapitalize:Pe,autoCorrect:Fe,maxLength:Ie,enterKeyHint:Le,inputMode:Re,spellCheck:ze,autoFocus:Be,tabIndex:Ve,className:t.cn(i.timePickerClassNames.input,c.inputHeightClasses[C],`w-full`,c.inputPaddingClasses[C],c.inputTextClasses[C],c.inputAppearanceClasses[w],`text-foreground placeholder:text-muted-foreground`,c.inputFocus,c.disabledStyles,Mt&&`border-destructive`,l.pickerEndPadding(Number(K)+Number(Q),C))}),K&&(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.clear??`Clear time`,disabled:y,onMouseDown:e=>e.preventDefault(),onClick:Rt,className:t.cn(i.timePickerClassNames.clearButton,l.pickerIconButtonClasses(C,w),l.pickerButtonOffset(C,Q?2:1),`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(oe.DismissIcon,{size:l.pickerGlyphSize(C,`icon`)})}),Q&&(0,f.jsx)(de.PickerExpandButton,{component:`TimePicker`,expandIcon:Ee,label:x?.expand??`Show times`,expanded:W,listboxId:G.listboxId,disabled:y||!!b,onToggle:Lt,size:C,appearance:w,className:i.timePickerClassNames.expandButton,iconClassName:i.timePickerClassNames.expandIcon})]}),Y&&(0,f.jsx)(`p`,{id:At,role:`alert`,className:t.cn(i.timePickerClassNames.errorMessage,`mt-1 text-caption-1 text-error`),children:$}),!N&&k.length>0&&Z(!0),(0,f.jsx)(`span`,{role:`status`,className:`sr-only`,children:yt}),(0,f.jsx)(ue.HiddenInput,{name:je,form:S,disabled:y,value:T,type:`text`,required:kt,onInvalid:()=>q.current?.focus()}),N&&(0,f.jsx)(ae.Portal,{layerId:wt,children:(0,f.jsx)(`div`,{ref:Ot,...Dt,"data-state":`open`,className:t.cn(i.timePickerClassNames.surface,`flex flex-col overflow-hidden rounded border border-border bg-background shadow-8`),children:U?Z(!1):(0,f.jsx)(`div`,{"aria-hidden":`true`,className:t.cn(i.timePickerClassNames.emptyMessage,`px-3 py-1.5 text-body-1 text-muted-foreground`),children:yt})})})]})})};m.displayName=`TimePicker`,exports.TimePicker=m;
2
2
  //# sourceMappingURL=TimePicker.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimePicker.cjs","names":["React","useListboxOption","cn","timePickerClassNames","forcedColors","CheckIcon","timeToMinutes","minutesToTime","useInputLook","useControllable","normalizeTimeStep","generateTimeOptions","useIsClient","minutesToValue","useListbox","useMergedRefs","useDismiss","usePopupPosition","useFieldContext","useId","useFieldControl","joinIds","isInvalidLook","composeEventHandlers","showsExpandButton","ListboxContext","inputHeightClasses","inputPaddingClasses","inputTextClasses","inputAppearanceClasses","inputFocus","disabledStyles","pickerEndPadding","pickerIconButtonClasses","pickerButtonOffset","DismissIcon","pickerGlyphSize","PickerExpandButton","HiddenInput","Portal","require_runtime","require_cn","require_dev","require_composeEventHandlers","require_classNames","require_useControllable","require_useId","require_useMergedRefs","require_useIsClient","require_aria","require_useFieldControl","require_useDismiss","require_Portal","require_styles","require_icons","require_inputLook","require_Input","require_useFormReset","require_HiddenInput","require_useListbox","require_pickerStyles","require_Combobox_expand","require_usePopupPosition","require_dateUtils","react","react_jsx_runtime","react_dom","OPTION_CLASSES","TimePickerOption","optionProps","selected","label","defaultInvalidTimeLabel","format","defaultOutOfRangeLabel","min","max","displayTime","minutes","value","matchesQuery","item","text","startsWithQuery","TimePicker","valueProp","sizeProp","appearanceProp","openProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onChange","selectedValue","setSelectedValue","defaultValue","onValueChange","next","stepValid","step","minMinutes","minTime","maxMinutes","maxTime","boundsValid","allOptions","interactive","disabled","readOnly","openState","setOpen","openControlled","defaultOpen","onOpenChange","isClient","open","draft","setDraft","invalid","setInvalid","wasInteractive","setWasInteractive","seenValue","setSeenValue","query","openList","closeList","filter","exact","getTypedActiveValue","needle","selectedInList","selectedValues","commitValue","commitDraft","rejectDraft","reason","onInvalidInput","clearDraft","hasMatches","expanded","lb","displayLabel","showClear","clearable","statusMessage","labels","rootRef","inputRef","surfaceRef","rootRefs","ref","inputRefs","controlRef","surfaceRefs","setFloating","field","validates","required","errorId","showOwnError","fieldProps","invalidLook","form","handleInputChange","event","handleKeyDown","onKeyDown","handleKeyUp","onKeyUp","handleInputClick","handleBlur","onBlur","handleExpandClick","handleClear","listboxLabelledBy","renderListbox","hidden","showExpand","expandIcon","errorMessage","listboxMounted","size","appearance","className","setReference","floatingProps"],"sources":["../../../src/components/input/TimePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flushSync } from 'react-dom';\nimport { cn } from '../../lib/cn';\nimport { joinIds } from '../../lib/aria';\nimport { timePickerClassNames } from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport { CheckIcon, DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport {\n disabledStyles,\n focusRing,\n forcedColors,\n inputAppearanceClasses,\n inputFocus,\n inputHeightClasses,\n inputInvalid,\n inputPaddingClasses,\n inputTextClasses,\n} from '../../lib/styles';\nimport type { CoreSize, InputAppearance } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { ListboxContext, useListbox, useListboxOption } from '../../hooks/useListbox';\nimport type { ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { Portal } from '../portal/Portal';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport {\n DEFAULT_TIME_STEP,\n generateTimeOptions,\n minutesToTime,\n minutesToValue,\n normalizeTimeStep,\n timeToMinutes,\n} from './dateUtils';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport {\n pickerButtonOffset,\n pickerEndPadding,\n pickerGlyphSize,\n pickerIconButtonClasses,\n} from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\n/* ------------------------------------------------------------------ */\n/* Option */\n/* ------------------------------------------------------------------ */\n\nconst OPTION_CLASSES =\n 'flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold';\n\ninterface TimePickerOptionProps {\n value: string;\n label: string;\n}\n\n/**\n * One time option. Memoized: it re-renders only when its own active/selected state changes (read\n * from the listbox store), so moving the highlight renders two options, not the whole list.\n */\nconst TimePickerOption = React.memo(function TimePickerOption({\n value,\n label,\n}: TimePickerOptionProps) {\n const { selected, optionProps } = useListboxOption<HTMLLIElement>({ value, label });\n return (\n <li\n {...optionProps}\n className={cn(\n timePickerClassNames.option,\n OPTION_CLASSES,\n selected && forcedColors.selectedContainer,\n )}\n >\n <span\n className={cn(\n timePickerClassNames.checkIcon,\n 'flex h-4 w-4 shrink-0 items-center justify-center',\n )}\n >\n {selected ? <CheckIcon size={12} /> : null}\n </span>\n {label}\n </li>\n );\n});\nTimePickerOption.displayName = 'TimePickerOption';\n\n/* ------------------------------------------------------------------ */\n/* TimePicker */\n/* ------------------------------------------------------------------ */\n\n/** Why typed text was not accepted (see {@link TimePickerProps.onInvalidInput}). */\nexport type TimePickerInvalidReason = 'unparseable' | 'out-of-range';\n\n/**\n * The TimePicker's built-in texts, for localization. Each member is optional and falls back to its\n * English default. The times themselves follow `format`.\n */\nexport interface TimePickerLabels {\n /** Name of the clear button.\n * @default 'Clear time'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show times'\n */\n expand?: string;\n /** Name of the list of times when the picker has no `aria-label`, `aria-labelledby` or Field\n * label to lend it.\n * @default 'Times'\n */\n list?: string;\n /** Status text (announced and shown in the open list) when `minTime`/`maxTime` leave no times.\n * @default 'No times available'\n */\n noTimes?: string;\n /** Status text (announced and shown in the open list) when the typed text matches no time.\n * @default 'No matching times'\n */\n noMatches?: string;\n /**\n * Message for text that is not a time. `format` is the display pattern (`'HH:mm'` or\n * `'h:mm AM'`).\n * @default (format) => `Enter a time in the format ${format}.`\n */\n invalidTime?: (format: string) => string;\n /**\n * Message for a time outside `minTime`/`maxTime`. The bounds are passed as the input shows times\n * (`format`); a bound that is not set is `undefined`.\n * @default (min, max) => `Enter a time between ${min} and ${max}.` (only `min`: `Enter a time on\n * or after ${min}.`; only `max`: `Enter a time on or before ${max}.`)\n */\n outOfRange?: (min: string | undefined, max: string | undefined) => string;\n}\n\nconst defaultInvalidTimeLabel = (format: string) => `Enter a time in the format ${format}.`;\n\nconst defaultOutOfRangeLabel = (min: string | undefined, max: string | undefined) => {\n if (min !== undefined && max !== undefined) return `Enter a time between ${min} and ${max}.`;\n if (min !== undefined) return `Enter a time on or after ${min}.`;\n return `Enter a time on or before ${max}.`;\n};\n\n/** Properties for the TimePicker component. */\nexport interface TimePickerProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | 'placeholder' | RoutedHandlers\n> {\n /** Controlled selected time in `HH:mm` (24-hour) format; `''` for no time. */\n value?: string;\n /**\n * Initial time for uncontrolled usage (`HH:mm`).\n * @default ''\n */\n defaultValue?: string;\n /** Called with the new `HH:mm` value (`''` when cleared) whenever the selected time changes. */\n onValueChange?: (value: string) => void;\n /**\n * @deprecated Use `onValueChange`. Still called with the new value (warns once in development).\n */\n onChange?: (value: string) => void;\n /**\n * Time display format of the input and the options.\n * @default '12h'\n */\n format?: '12h' | '24h';\n /**\n * Minutes between options. A non-finite or non-positive value falls back to 30 (development\n * warning); fractions are floored.\n * @default 30\n */\n step?: number;\n /**\n * Earliest time (inclusive): `HH:mm`, `HH:mm:ss` or `h:mm AM`.\n * @default '00:00'\n */\n minTime?: string;\n /**\n * Latest time (inclusive): `HH:mm`, `HH:mm:ss` or `h:mm AM`. Invalid or reversed bounds give no\n * options (development warning, \"No times available\", see `labels`).\n * @default '23:59'\n */\n maxTime?: string;\n /**\n * Placeholder text shown when no time is selected.\n * @default 'Select a time'\n */\n placeholder?: string;\n /**\n * Whether the time picker is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the\n * surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The time\n * list keeps its size.\n */\n size?: CoreSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.\n */\n appearance?: InputAppearance;\n /**\n * Makes the input read-only: the list does not open and the value cannot change. Turning it (or\n * `disabled`) on while the user is typing drops the typed text.\n */\n readOnly?: boolean;\n /**\n * Whether to show a clear button when a time is selected (not shown while `readOnly`; shown\n * disabled while `disabled`). It is a tab stop after the input. Tab from erased text clears the\n * value before focus moves, so focus goes on past the clear button that disappears with it.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * Controlled open state of the list (never shown while `disabled` or `readOnly`). The list\n * renders only in the browser: an open picker is closed in the server HTML and opens once it has\n * hydrated.\n */\n open?: boolean;\n /**\n * Initial open state of the list for uncontrolled usage. A picker that starts disabled or\n * read-only starts closed. The list renders only in the browser: it is closed in the server HTML\n * and opens once the picker has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the list opens or closes (only when the state changes). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when edited text is not accepted on Enter or blur (once per edit): it is not a time\n * (`'unparseable'`) or lies outside `minTime`/`maxTime` (`'out-of-range'`). The text stays in the\n * input, which is marked `aria-invalid` and described by an error message (left to the\n * surrounding `Field` when it shows an error); Enter and leaving the input also close the list,\n * so it does not cover the message. Enter reports it again when pressed again.\n */\n onInvalidInput?: (text: string, reason: TimePickerInvalidReason) => void;\n /**\n * Names of the clear and expand buttons and of the list, the status texts of an empty list and\n * the error messages of rejected text, for localization. Unset members keep their English\n * defaults.\n */\n labels?: TimePickerLabels;\n /** Form field name: the `HH:mm` value is submitted under it (hidden input). */\n name?: string;\n /** Id of the `<form>` the value belongs to, when the picker is outside it. */\n form?: string;\n /**\n * Blocks form submission while no time is selected; sets `aria-required` on the input. Like a\n * native readonly input, a `readOnly` TimePicker does not block submission.\n */\n required?: boolean;\n /** Native `autocomplete` of the input. @default 'off' */\n autoComplete?: string;\n /** Native `maxlength` of the input. */\n maxLength?: number;\n /** Focus handler of the text input (the root keeps the other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Blur handler of the text input. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /** Key handler of the text input; `preventDefault()` skips the picker's own keys. */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Key handler of the text input. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the text input (the `role=\"combobox\"` element); `ref` stays on the root. */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction displayTime(value: string, format: '12h' | '24h'): string {\n const minutes = timeToMinutes(value);\n return Number.isNaN(minutes) ? value : minutesToTime(minutes, format);\n}\n\n/** Whether an option matches the (trimmed, lower-case) typed text: by label or `HH:mm` value. */\nfunction matchesQuery(item: ListboxItem, text: string): boolean {\n return item.label.toLowerCase().includes(text) || item.value.includes(text);\n}\n\n/** Whether an option's label or `HH:mm` value starts with the (trimmed, lower-case) typed text. */\nfunction startsWithQuery(item: ListboxItem, text: string): boolean {\n return item.label.toLowerCase().startsWith(text) || item.value.startsWith(text);\n}\n\n/**\n * A time input with a filterable list of times (APG editable combobox with list autocomplete).\n *\n * - Type to filter (by label or `HH:mm` value). A complete typed time (`2:00 PM`, `14:00`) makes\n * its own option active — not an earlier one that merely contains the text, such as `12:00 PM`\n * — and partial text makes the first option that starts with it active (`2:00 p` -> `2:00 PM`),\n * else the first one that contains it; Enter commits the active option. Enter or leaving the\n * field also commits a complete typed time that is not in the list (`9:15 AM`, `14:45`) when it\n * lies within `minTime`/`maxTime`, and erased text clears the value (as the clear button does);\n * Enter never submits the form with edited text, and both close the list. Other typed text is\n * kept: the input is marked invalid and an error message describes it (`onInvalidInput`,\n * reported once per edit) until the text is edited or replaced (an option, the clear button,\n * Escape, a form reset, a new value from the parent). Escape on a closed list reverts any edit,\n * erased text included, to the selected time.\n * - Click the input or the expand button at its end (a chevron, see `expandIcon`; not a tab stop,\n * and it leaves focus in the input), press ArrowDown/ArrowUp or type to open; the list opens\n * with every option and the selected one (when it is in the list) active and scrolled into\n * view. Without one, no option is active until ArrowDown/ArrowUp or typing, so Enter lets the\n * surrounding form submit. Escape, Tab, an outside press or focus leaving closes it. Typed text\n * kept after Escape closed the list still filters it when it reopens: a click resumes the option\n * typing made active, ArrowDown/ArrowUp start at the first/last match.\n * - `open`/`defaultOpen`/`onOpenChange` control the list. It closes when the picker becomes\n * disabled or read-only (uncontrolled `open`: it stays closed when the picker is enabled again),\n * and the text typed until then is dropped.\n * - Keys of an IME composition (its confirming Enter included) are left to the IME.\n * - `clearable` shows a clear button while a time is selected (not while read-only), a tab stop\n * after the input. Tab from erased text clears the value first, so focus moves on past the\n * picker instead of to the clear button that disappears.\n * - The value is `HH:mm` (24-hour) whatever the display `format`; values off the `step` grid or\n * outside the bounds are still displayed in `format`.\n * - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s\n * `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own\n * prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as\n * `data-size` and `data-appearance` on the root `<div>`. The time list keeps its size.\n * - The input (`controlRef`) receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`,\n * `autoFocus`, `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes\n * `autoComplete`, `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and\n * `enterKeyHint`. `ref`, `className`, `style`, other `aria-*` attributes and the remaining props\n * stay on the root `<div>`. Inside a `Field`, the input is labelled and described by it.\n * - `name`/`required` add a hidden input for native forms (`HH:mm`); the value resets with its form.\n * - The built-in names, status texts and error messages are English; `labels` localizes them.\n * - The open list renders only in the browser: an open list (`defaultOpen`, `open`) is closed in\n * the server HTML and opens once the picker has hydrated.\n */\nexport const TimePicker = (props: TimePickerProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onChange,\n format = '12h',\n step = DEFAULT_TIME_STEP,\n minTime = '00:00',\n maxTime = '23:59',\n placeholder = 'Select a time',\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n readOnly,\n clearable = false,\n expandIcon,\n open: openProp,\n defaultOpen,\n onOpenChange,\n onInvalidInput,\n labels,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n enterKeyHint,\n inputMode,\n spellCheck,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n } = props;\n\n if (onChange !== undefined) warnDeprecated('TimePicker', 'onChange', 'onValueChange');\n\n const { size, appearance } = useInputLook(sizeProp, appearanceProp);\n\n const [selectedValue, setSelectedValue] = useControllable<string>(\n valueProp,\n defaultValue ?? '',\n (next) => {\n onValueChange?.(next);\n onChange?.(next);\n },\n );\n\n /* ---- options, step and bounds ---------------------------------- */\n\n const stepValid = normalizeTimeStep(step).valid;\n const minMinutes = timeToMinutes(minTime);\n const maxMinutes = timeToMinutes(maxTime);\n const boundsValid =\n !Number.isNaN(minMinutes) && !Number.isNaN(maxMinutes) && minMinutes <= maxMinutes;\n const allOptions = React.useMemo(\n () => generateTimeOptions(step, minTime, maxTime, format),\n [step, minTime, maxTime, format],\n );\n\n // Once per invalid value and page (C-DEV), not once per instance and effect run.\n React.useEffect(() => {\n if (!stepValid) {\n warnOnce(\n `TimePicker:step:${String(step)}`,\n `TimePicker: \\`step\\` must be a positive number of minutes (received ${String(step)}); ` +\n `using ${DEFAULT_TIME_STEP}.`,\n );\n }\n }, [step, stepValid]);\n\n React.useEffect(() => {\n if (!boundsValid) {\n warnOnce(\n `TimePicker:bounds:${minTime}|${maxTime}`,\n `TimePicker: \\`minTime\\`/\\`maxTime\\` must be times such as \"09:00\", \"09:00:00\" or ` +\n `\"9:00 AM\" with minTime <= maxTime (received \"${minTime}\" / \"${maxTime}\"); no times are available.`,\n );\n }\n }, [minTime, maxTime, boundsValid]);\n\n /* ---- open state, draft text and query -------------------------- */\n\n const interactive = !disabled && !readOnly;\n const [openState, setOpen, openControlled] = useControllable<boolean>(\n openProp,\n // A picker that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n // The open list lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the picker shows the closed inline list and reports it closed, so\n // aria-controls and aria-activedescendant never name a missing element.\n const isClient = useIsClient();\n const open = openState && interactive && isClient;\n // A list hidden because the picker became disabled or read-only is closed for good\n // (uncontrolled), so enabling the picker again does not bring it back; onOpenChange(false)\n // reports it (a consumer callback, so from an effect). A controlled `open` stays the parent's.\n React.useEffect(() => {\n if (!interactive && openState && !openControlled) setOpen(false);\n }, [interactive, openState, openControlled, setOpen]);\n /** Typed text; `null` shows the selected time's label (draft model). */\n const [draft, setDraft] = React.useState<string | null>(null);\n /** Why the typed text was rejected (it is kept and flagged); `null` while it is not. */\n const [invalid, setInvalid] = React.useState<TimePickerInvalidReason | null>(null);\n // Locking the picker while the user types drops the typed text and its error, so no later blur\n // commits it (adjusted during render, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) {\n setDraft(null);\n setInvalid(null);\n }\n }\n // A new value from the parent replaces rejected text (the picker's own commits clear it\n // themselves), so the input never shows an error next to a valid value. Text the user is still\n // typing stays.\n const [seenValue, setSeenValue] = React.useState(selectedValue);\n if (seenValue !== selectedValue) {\n setSeenValue(selectedValue);\n if (invalid !== null) {\n setDraft(null);\n setInvalid(null);\n }\n }\n /**\n * Filter text: the typed text only, never the selected time's label, so opening without an edit\n * shows every option. Typed text kept while the list is closed (Escape) keeps filtering it, so\n * a reopened list shows what the input says.\n */\n const query = draft ?? '';\n\n const openList = () => {\n if (!interactive || open) return;\n setOpen(true);\n };\n const closeList = () => setOpen(false);\n\n // A complete time in any spelling the commit accepts (`2:00pm`, `09:00 AM`, `14:00:00`) keeps its\n // own option, so it stays listed and active, as Enter and blur commit it.\n const filter = React.useMemo(() => {\n const text = query.trim().toLowerCase();\n if (!text) return undefined;\n const minutes = timeToMinutes(text);\n const exact = Number.isNaN(minutes) ? null : minutesToValue(minutes);\n return (item: ListboxItem) => item.value === exact || matchesQuery(item, text);\n }, [query]);\n\n /**\n * The option that typing `text` makes active. A complete time (`2:00 PM`, `14:00`) activates its\n * own option, never another one that merely contains the text (`12:00 PM`); when it is not in\n * the list (off-grid or out of bounds) nothing is active, so Enter commits the typed time or\n * nothing. Partial text activates the first option whose label or value starts with it (`2:00 p`\n * -> `2:00 PM`, `2` -> `2:00 AM`, not `12:00 AM`), else the first option that contains it.\n */\n const getTypedActiveValue = (text: string): string | null => {\n const needle = text.trim().toLowerCase();\n if (!needle) return null;\n const minutes = timeToMinutes(text);\n if (!Number.isNaN(minutes)) {\n const exact = minutesToValue(minutes);\n return allOptions.some((item) => item.value === exact) ? exact : null;\n }\n const match =\n allOptions.find((item) => startsWithQuery(item, needle)) ??\n allOptions.find((item) => matchesQuery(item, needle));\n return match?.value ?? null;\n };\n\n // Opening without typing activates the selected option only when it is in the list. An empty,\n // off-grid or out-of-range value activates nothing (ArrowDown/ArrowUp start at the first/last\n // option), so Enter on a freshly opened list commits nothing and the surrounding form submits.\n const selectedInList =\n selectedValue !== '' && allOptions.some((item) => item.value === selectedValue);\n\n const selectedValues = React.useMemo(\n () => (selectedValue ? [selectedValue] : []),\n [selectedValue],\n );\n\n const commitValue = (next: string) => {\n setSelectedValue(next);\n setDraft(null);\n setInvalid(null);\n };\n\n /**\n * Commits the typed text: erased text clears the value, a complete time within the bounds selects\n * it. Returns why any other text is not accepted (it is kept), else `null`.\n */\n const commitDraft = (text: string): TimePickerInvalidReason | null => {\n if (!text.trim()) {\n commitValue('');\n return null;\n }\n const minutes = timeToMinutes(text);\n if (Number.isNaN(minutes)) return 'unparseable';\n if (!boundsValid || minutes < minMinutes || minutes > maxMinutes) return 'out-of-range';\n commitValue(minutesToValue(minutes));\n return null;\n };\n\n /** Keeps rejected text, flags it and reports it. */\n const rejectDraft = (text: string, reason: TimePickerInvalidReason) => {\n setInvalid(reason);\n onInvalidInput?.(text, reason);\n };\n\n const clearDraft = () => {\n setDraft(null);\n setInvalid(null);\n };\n\n // The listbox counts as open only while it shows options: with no match nothing is displayed,\n // so `aria-expanded` is false and Escape reverts the typed text instead of closing an empty list.\n const hasMatches = React.useMemo(\n () => (filter ? allOptions.some(filter) : allOptions.length > 0),\n [allOptions, filter],\n );\n const expanded = open && hasMatches;\n\n const lb = useListbox({\n open: expanded,\n onOpenChange: (next) => (next ? openList() : closeList()),\n mode: 'editable',\n selectedValues,\n onSelect: (next) => commitValue(next),\n items: allOptions,\n filter,\n // Typing sets the active option itself (getTypedActiveValue in handleInputChange), so an exact\n // typed time wins over an earlier substring match; highlightOnFilter would force the first one.\n autoHighlight: draft === null && selectedInList ? 'selected' : false,\n idPrefix: 'timepicker-listbox',\n // Escape on a closed list reverts typed text (erased text: handleKeyDown); without a draft it is\n // left to enclosing layers.\n onClearDraft:\n draft !== null\n ? () => {\n clearDraft();\n closeList();\n }\n : undefined,\n });\n\n const displayLabel = selectedValue\n ? (lb.getItem(selectedValue)?.label ?? displayTime(selectedValue, format))\n : '';\n // Read-only pickers offer no clear action (the value cannot change).\n const showClear = clearable && !readOnly && selectedValue !== '';\n const statusMessage =\n open && !hasMatches\n ? allOptions.length === 0\n ? (labels?.noTimes ?? 'No times available')\n : (labels?.noMatches ?? 'No matching times')\n : '';\n\n /* ---- elements, dismissal, positioning --------------------------- */\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const surfaceRef = React.useRef<HTMLDivElement | null>(null);\n const rootRefs = useMergedRefs<HTMLDivElement>(ref, rootRef);\n const inputRefs = useMergedRefs<HTMLInputElement>(controlRef, inputRef);\n\n const { layerId } = useDismiss({\n open,\n onDismiss: closeList,\n refs: [surfaceRef, rootRef],\n anchorRef: inputRef,\n kind: 'listbox',\n focusOutside: true,\n });\n\n const { setReference, setFloating, floatingProps } = usePopupPosition({\n open,\n side: 'bottom',\n align: 'start',\n matchReferenceWidth: true,\n fitViewport: true,\n });\n const surfaceRefs = useMergedRefs<HTMLDivElement>(surfaceRef, setFloating);\n\n /* ---- forms and Field ------------------------------------------- */\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n // Like a native readonly input, a read-only picker is barred from constraint validation (the\n // user could not fix it); its value is still submitted.\n const validates = isRequired && !readOnly;\n const errorId = useId('timepicker-error');\n // A Field that shows an error describes the input itself (its message is not repeated).\n const showOwnError = invalid !== null && !field?.hasErrorMessage;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': joinIds(ariaDescribedBy, showOwnError ? errorId : undefined),\n 'aria-invalid': invalid !== null ? true : ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n useFormReset(\n inputRef,\n () => {\n setSelectedValue(defaultValue ?? '');\n clearDraft();\n closeList();\n },\n form,\n );\n\n /* ---- handlers --------------------------------------------------- */\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (!interactive) return;\n const text = event.target.value;\n setDraft(text);\n setInvalid(null);\n if (!open) setOpen(true);\n // Every edit re-ranks the highlight (it opens the list in the same update when closed).\n lb.setActiveValue(getTypedActiveValue(text));\n };\n\n const handleKeyDown = composeEventHandlers(\n onKeyDown,\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!interactive) return;\n // Enter commits the active option: the exact typed time, the first match of partial text,\n // or the option moved to with the arrow keys.\n lb.onKeyDown(event);\n // Keys that belong to an IME composition (its confirming Enter) are left to the IME, as\n // useListbox leaves them.\n if (event.defaultPrevented || event.nativeEvent.isComposing) return;\n if (event.key === 'Escape' && draft === '' && displayLabel !== '') {\n // Erased text: useListbox calls onClearDraft only while the input has text, so Escape on a\n // closed list restores the selected time here (an open list was closed above). With nothing\n // to restore, Escape is left to enclosing layers.\n event.preventDefault();\n clearDraft();\n closeList();\n return;\n }\n if (event.key === 'Enter' && draft !== null) {\n // Edited text is committed (a complete time within the bounds; erased text clears) or kept\n // and flagged (reported on every Enter), never submitted with the form; untouched text\n // lets Enter submit. The list closes either way, so it does not cover the error message.\n event.preventDefault();\n const reason = commitDraft(draft);\n closeList();\n if (reason !== null) rejectDraft(draft, reason);\n }\n if (event.key === 'Tab' && !event.shiftKey && showClear && draft !== null && !draft.trim()) {\n // Erased text clears the value, and with it the clear button, the next tab stop. It is\n // settled before Tab moves focus (the blur would settle it while focus moves to that\n // button), so focus moves on to the tab stop after the picker instead of dropping to\n // <body> with the button (C-DISABLED).\n flushSync(() => commitDraft(draft));\n }\n if (event.key === 'Tab' && open && !expanded) {\n // useListbox closes the list on Tab only while it shows options. The status text shown\n // instead ('No matching times', 'No times available') closes too: the clear button, the\n // next tab stop, is inside the picker, so focus moving there does not dismiss it.\n closeList();\n }\n },\n );\n const handleKeyUp = composeEventHandlers(onKeyUp, lb.onKeyUp);\n\n const handleInputClick = () => {\n if (!interactive || open) return;\n openList();\n // Typed text kept after Escape resumes where typing left it: its matches (the filter) and the\n // option typing made active, so Enter commits the same time as before the list closed.\n if (draft !== null) lb.setActiveValue(getTypedActiveValue(draft));\n };\n\n const handleBlur = composeEventHandlers(onBlur, () => {\n if (!interactive || draft === null) return;\n // Leaving the input settles the edit as Enter does: rejected text is kept (text that was\n // already rejected is not reported again) and the list closes either way, so it does not cover\n // the error message.\n const reason = invalid === null ? commitDraft(draft) : null;\n closeList();\n if (reason !== null) rejectDraft(draft, reason);\n });\n\n // The expand button opens the list as a click in the input does (typed text kept after Escape\n // resumes its matches) and closes it; focus stays in (or returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) closeList();\n else handleInputClick();\n inputRef.current?.focus();\n };\n\n const handleClear = () => {\n if (!interactive) return;\n commitValue('');\n inputRef.current?.focus();\n };\n\n /* ---- render ---------------------------------------------------- */\n\n const listboxLabelledBy = joinIds(ariaLabelledBy, field?.labelId);\n const renderListbox = (hidden: boolean) => (\n <ul\n {...lb.getListboxProps()}\n aria-labelledby={listboxLabelledBy}\n aria-label={listboxLabelledBy ? undefined : (ariaLabel ?? labels?.list ?? 'Times')}\n hidden={hidden || undefined}\n className={cn(\n timePickerClassNames.listbox,\n 'max-h-60 min-h-0 overflow-auto py-1 focus:outline-hidden',\n )}\n >\n {lb.items.map((item) => (\n <TimePickerOption key={item.value} value={item.value} label={item.label} />\n ))}\n </ul>\n );\n\n const showExpand = showsExpandButton(expandIcon);\n\n let errorMessage = '';\n if (showOwnError && invalid === 'unparseable') {\n errorMessage = (labels?.invalidTime ?? defaultInvalidTimeLabel)(\n format === '24h' ? 'HH:mm' : 'h:mm AM',\n );\n } else if (showOwnError) {\n // Bounds the consumer did not set are `undefined`, not the defaults.\n errorMessage = (labels?.outOfRange ?? defaultOutOfRangeLabel)(\n props.minTime === undefined ? undefined : displayTime(minTime, format),\n props.maxTime === undefined ? undefined : displayTime(maxTime, format),\n );\n }\n // aria-controls must name a listbox that is actually mounted. The closed list is inline only\n // while options exist; the open list is mounted only while something matches.\n const listboxMounted = open ? hasMatches : allOptions.length > 0;\n\n return (\n <ListboxContext.Provider value={lb.context}>\n <div\n data-size={size}\n data-appearance={appearance}\n {...rest}\n ref={rootRefs}\n className={cn(timePickerClassNames.root, 'relative inline-flex flex-col', className)}\n >\n <div ref={setReference} className=\"relative flex items-center\">\n <input\n ref={inputRefs}\n type=\"text\"\n {...lb.getComboboxProps()}\n aria-controls={listboxMounted ? lb.listboxId : undefined}\n {...fieldProps}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n value={draft ?? displayLabel}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onFocus={onFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n enterKeyHint={enterKeyHint}\n inputMode={inputMode}\n spellCheck={spellCheck}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n className={cn(\n timePickerClassNames.input,\n inputHeightClasses[size],\n 'w-full',\n inputPaddingClasses[size],\n inputTextClasses[size],\n inputAppearanceClasses[appearance],\n 'text-foreground placeholder:text-muted-foreground',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand), size),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear time'}\n disabled={disabled}\n // Keeps focus (and an open list) on the input while the pointer clears it.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n timePickerClassNames.clearButton,\n pickerIconButtonClasses(size, appearance),\n pickerButtonOffset(size, showExpand ? 2 : 1),\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon size={pickerGlyphSize(size, 'icon')} />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"TimePicker\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show times'}\n expanded={expanded}\n listboxId={lb.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n size={size}\n appearance={appearance}\n className={timePickerClassNames.expandButton}\n iconClassName={timePickerClassNames.expandIcon}\n />\n )}\n </div>\n {showOwnError && (\n <p\n id={errorId}\n role=\"alert\"\n className={cn(timePickerClassNames.errorMessage, 'mt-1 text-caption-1 text-error')}\n >\n {errorMessage}\n </p>\n )}\n {!open && allOptions.length > 0 && renderListbox(true)}\n <span role=\"status\" className=\"sr-only\">\n {statusMessage}\n </span>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={selectedValue}\n type=\"text\"\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n {open && (\n <Portal layerId={layerId}>\n <div\n ref={surfaceRefs}\n {...floatingProps}\n data-state=\"open\"\n className={cn(\n timePickerClassNames.surface,\n 'flex flex-col overflow-hidden rounded border border-border bg-background shadow-8',\n )}\n >\n {hasMatches ? (\n renderListbox(false)\n ) : (\n <div\n aria-hidden=\"true\"\n className={cn(\n timePickerClassNames.emptyMessage,\n 'px-3 py-1.5 text-body-1 text-muted-foreground',\n )}\n >\n {statusMessage}\n </div>\n )}\n </div>\n </Portal>\n )}\n </div>\n </ListboxContext.Provider>\n );\n};\n\nTimePicker.displayName = 'TimePicker';\n"],"mappings":"ogCAwDA,IAAMmE,GACJ,yRAWIC,GAAmBpE,EAAM,KAAK,SAA0B,CAC5D,QACA,SACwB,CACxB,GAAM,CAAE,WAAU,eAAgBC,EAAAA,iBAAgC,CAAE,QAAO,OAAM,CAAC,EAClF,OACE,EAAAgE,EAAA,KAAA,CAAC,KAAD,CACE,GAAII,EACJ,UAAWnE,EAAAA,GACTC,EAAAA,qBAAqB,OACrBgE,GACAG,GAAYlE,EAAAA,aA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AWL,EAAG,UACd,SAAUlC,GAAY,CAAC,CAACC,EACxB,SAAUiE,GACJ,OACM,aACZ,UAAWhL,EAAAA,qBAAqB,aAChC,cAAeA,EAAAA,qBAAqB,UACrC,CAAA,CAEA,IACJmK,IACC,EAAArG,EAAA,IAAA,CAAC,IAAD,CACE,GAAIoG,GACJ,KAAK,QACL,UAAWnK,EAAAA,GAAGC,EAAAA,qBAAqB,aAAc,gCAAgC,EAEhF,SAAAuL,CACA,CAAA,EAEJ,CAACjE,GAAQV,EAAW,OAAS,GAAKuE,EAAc,EAAI,GACrD,EAAArH,EAAA,IAAA,CAAC,OAAD,CAAM,KAAK,SAAS,UAAU,UAC3B,SAAAsF,EACG,CAAA,GACN,EAAAtF,EAAA,IAAA,CAAC3B,GAAAA,YAAD,CACQ,QACA,OACI,WACV,MAAO6D,EACP,KAAK,OACL,SAAUgE,GACV,cAAiBT,EAAS,SAAS,MAAM,CAC1C,CAAA,EACAjC,IACC,EAAAxD,EAAA,IAAA,CAAC1B,GAAAA,OAAD,CAAiB,WACf,UAAA,EAAA0B,EAAA,IAAA,CAAC,MAAD,CACE,IAAK+F,GACL,GAAIgC,GACJ,aAAW,OACX,UAAW9L,EAAAA,GACTC,EAAAA,qBAAqB,QACrB,mFACF,EAEC,SAAA8I,EACCqC,EAAc,EAAK,GAEnB,EAAArH,EAAA,IAAA,CAAC,MAAD,CACE,cAAY,OACZ,UAAW/D,EAAAA,GACTC,EAAAA,qBAAqB,aACrB,+CACF,EAEC,SAAAoJ,EACE,CAAA,CAEJ,CAAA,CACC,CAAA,CAEP,GACkB,CAAA,CAE7B,EAEA,EAAW,YAAc"}
1
+ {"version":3,"file":"TimePicker.cjs","names":["React","useListboxOption","cn","timePickerClassNames","forcedColors","CheckIcon","timeToMinutes","minutesToTime","useInputLook","useControllable","normalizeTimeStep","generateTimeOptions","useIsClient","minutesToValue","useListbox","useMergedRefs","useDismiss","usePopupPosition","useFieldContext","useId","useFieldControl","joinIds","isInvalidLook","composeEventHandlers","showsExpandButton","ListboxContext","inputHeightClasses","inputPaddingClasses","inputTextClasses","inputAppearanceClasses","inputFocus","disabledStyles","pickerEndPadding","pickerIconButtonClasses","pickerButtonOffset","DismissIcon","pickerGlyphSize","PickerExpandButton","HiddenInput","Portal","require_runtime","require_cn","require_dev","require_composeEventHandlers","require_classNames","require_useControllable","require_useId","require_useMergedRefs","require_useIsClient","require_aria","require_useFieldControl","require_useListbox","require_useDismiss","require_Portal","require_styles","require_icons","require_inputLook","require_Input","require_useFormReset","require_HiddenInput","require_pickerStyles","require_Combobox_expand","require_usePopupPosition","require_dateUtils","react","react_jsx_runtime","react_dom","OPTION_CLASSES","TimePickerOption","optionProps","selected","label","defaultInvalidTimeLabel","format","defaultOutOfRangeLabel","min","max","displayTime","minutes","value","matchesQuery","item","text","startsWithQuery","TimePicker","valueProp","sizeProp","appearanceProp","openProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onChange","selectedValue","setSelectedValue","defaultValue","onValueChange","next","stepValid","step","minMinutes","minTime","maxMinutes","maxTime","boundsValid","allOptions","interactive","disabled","readOnly","openState","setOpen","openControlled","defaultOpen","onOpenChange","isClient","open","draft","setDraft","invalid","setInvalid","wasInteractive","setWasInteractive","seenValue","setSeenValue","query","openList","closeList","filter","exact","getTypedActiveValue","needle","selectedInList","selectedValues","commitValue","commitDraft","rejectDraft","reason","onInvalidInput","clearDraft","hasMatches","expanded","lb","displayLabel","showClear","clearable","statusMessage","labels","rootRef","inputRef","surfaceRef","rootRefs","ref","inputRefs","controlRef","surfaceRefs","setFloating","field","validates","required","errorId","showOwnError","fieldProps","invalidLook","form","handleInputChange","event","handleKeyDown","onKeyDown","handleKeyUp","onKeyUp","handleInputClick","handleBlur","onBlur","handleExpandClick","handleClear","listboxLabelledBy","renderListbox","hidden","showExpand","expandIcon","errorMessage","listboxMounted","size","appearance","className","setReference","floatingProps"],"sources":["../../../src/components/input/TimePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flushSync } from 'react-dom';\nimport { cn } from '../../lib/cn';\nimport { joinIds } from '../../lib/aria';\nimport { timePickerClassNames } from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport { CheckIcon, DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport {\n disabledStyles,\n focusRing,\n forcedColors,\n inputAppearanceClasses,\n inputFocus,\n inputHeightClasses,\n inputInvalid,\n inputPaddingClasses,\n inputTextClasses,\n} from '../../lib/styles';\nimport type { CoreSize, InputAppearance } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { ListboxContext, useListbox, useListboxOption } from '../../hooks/useListbox';\nimport type { ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { Portal } from '../portal/Portal';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport {\n DEFAULT_TIME_STEP,\n generateTimeOptions,\n minutesToTime,\n minutesToValue,\n normalizeTimeStep,\n timeToMinutes,\n} from './dateUtils';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport {\n pickerButtonOffset,\n pickerEndPadding,\n pickerGlyphSize,\n pickerIconButtonClasses,\n} from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\n/* ------------------------------------------------------------------ */\n/* Option */\n/* ------------------------------------------------------------------ */\n\nconst OPTION_CLASSES =\n 'flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold';\n\ninterface TimePickerOptionProps {\n value: string;\n label: string;\n}\n\n/**\n * One time option. Memoized: it re-renders only when its own active/selected state changes (read\n * from the listbox store), so moving the highlight renders two options, not the whole list.\n */\nconst TimePickerOption = React.memo(function TimePickerOption({\n value,\n label,\n}: TimePickerOptionProps) {\n const { selected, optionProps } = useListboxOption<HTMLLIElement>({ value, label });\n return (\n <li\n {...optionProps}\n className={cn(\n timePickerClassNames.option,\n OPTION_CLASSES,\n selected && forcedColors.selectedContainer,\n )}\n >\n <span\n className={cn(\n timePickerClassNames.checkIcon,\n 'flex h-4 w-4 shrink-0 items-center justify-center',\n )}\n >\n {selected ? <CheckIcon size={12} /> : null}\n </span>\n {label}\n </li>\n );\n});\nTimePickerOption.displayName = 'TimePickerOption';\n\n/* ------------------------------------------------------------------ */\n/* TimePicker */\n/* ------------------------------------------------------------------ */\n\n/** Why typed text was not accepted (see {@link TimePickerProps.onInvalidInput}). */\nexport type TimePickerInvalidReason = 'unparseable' | 'out-of-range';\n\n/**\n * The TimePicker's built-in texts, for localization. Each member is optional and falls back to its\n * English default. The times themselves follow `format`.\n */\nexport interface TimePickerLabels {\n /** Name of the clear button.\n * @default 'Clear time'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show times'\n */\n expand?: string;\n /** Name of the list of times when the picker has no `aria-label`, `aria-labelledby` or Field\n * label to lend it.\n * @default 'Times'\n */\n list?: string;\n /** Status text (announced and shown in the open list) when `minTime`/`maxTime` leave no times.\n * @default 'No times available'\n */\n noTimes?: string;\n /** Status text (announced and shown in the open list) when the typed text matches no time.\n * @default 'No matching times'\n */\n noMatches?: string;\n /**\n * Message for text that is not a time. `format` is the display pattern (`'HH:mm'` or\n * `'h:mm AM'`).\n * @default (format) => `Enter a time in the format ${format}.`\n */\n invalidTime?: (format: string) => string;\n /**\n * Message for a time outside `minTime`/`maxTime`. The bounds are passed as the input shows times\n * (`format`); a bound that is not set is `undefined`.\n * @default (min, max) => `Enter a time between ${min} and ${max}.` (only `min`: `Enter a time on\n * or after ${min}.`; only `max`: `Enter a time on or before ${max}.`)\n */\n outOfRange?: (min: string | undefined, max: string | undefined) => string;\n}\n\nconst defaultInvalidTimeLabel = (format: string) => `Enter a time in the format ${format}.`;\n\nconst defaultOutOfRangeLabel = (min: string | undefined, max: string | undefined) => {\n if (min !== undefined && max !== undefined) return `Enter a time between ${min} and ${max}.`;\n if (min !== undefined) return `Enter a time on or after ${min}.`;\n return `Enter a time on or before ${max}.`;\n};\n\n/** Properties for the TimePicker component. */\nexport interface TimePickerProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | 'placeholder' | RoutedHandlers\n> {\n /** Controlled selected time in `HH:mm` (24-hour) format; `''` for no time. */\n value?: string;\n /**\n * Initial time for uncontrolled usage (`HH:mm`).\n * @default ''\n */\n defaultValue?: string;\n /** Called with the new `HH:mm` value (`''` when cleared) whenever the selected time changes. */\n onValueChange?: (value: string) => void;\n /**\n * @deprecated Use `onValueChange`. Still called with the new value (warns once in development).\n */\n onChange?: (value: string) => void;\n /**\n * Time display format of the input and the options.\n * @default '12h'\n */\n format?: '12h' | '24h';\n /**\n * Minutes between options. A non-finite or non-positive value falls back to 30 (development\n * warning); fractions are floored.\n * @default 30\n */\n step?: number;\n /**\n * Earliest time (inclusive): `HH:mm`, `HH:mm:ss` or `h:mm AM`.\n * @default '00:00'\n */\n minTime?: string;\n /**\n * Latest time (inclusive): `HH:mm`, `HH:mm:ss` or `h:mm AM`. Invalid or reversed bounds give no\n * options (development warning, \"No times available\", see `labels`).\n * @default '23:59'\n */\n maxTime?: string;\n /**\n * Placeholder text shown when no time is selected.\n * @default 'Select a time'\n */\n placeholder?: string;\n /**\n * Whether the time picker is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the\n * surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The time\n * list keeps its size.\n */\n size?: CoreSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.\n */\n appearance?: InputAppearance;\n /**\n * Makes the input read-only: the list does not open and the value cannot change. Turning it (or\n * `disabled`) on while the user is typing drops the typed text.\n */\n readOnly?: boolean;\n /**\n * Whether to show a clear button when a time is selected (not shown while `readOnly`; shown\n * disabled while `disabled`). It is a tab stop after the input. Tab from erased text clears the\n * value before focus moves, so focus goes on past the clear button that disappears with it.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * Controlled open state of the list (never shown while `disabled` or `readOnly`). The list\n * renders only in the browser: an open picker is closed in the server HTML and opens once it has\n * hydrated.\n */\n open?: boolean;\n /**\n * Initial open state of the list for uncontrolled usage. A picker that starts disabled or\n * read-only starts closed. The list renders only in the browser: it is closed in the server HTML\n * and opens once the picker has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the list opens or closes (only when the state changes). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when edited text is not accepted on Enter or blur (once per edit): it is not a time\n * (`'unparseable'`) or lies outside `minTime`/`maxTime` (`'out-of-range'`). The text stays in the\n * input, which is marked `aria-invalid` and described by an error message (left to the\n * surrounding `Field` when it shows an error); Enter and leaving the input also close the list,\n * so it does not cover the message. Enter reports it again when pressed again.\n */\n onInvalidInput?: (text: string, reason: TimePickerInvalidReason) => void;\n /**\n * Names of the clear and expand buttons and of the list, the status texts of an empty list and\n * the error messages of rejected text, for localization. Unset members keep their English\n * defaults.\n */\n labels?: TimePickerLabels;\n /** Form field name: the `HH:mm` value is submitted under it (hidden input). */\n name?: string;\n /** Id of the `<form>` the value belongs to, when the picker is outside it. */\n form?: string;\n /**\n * Blocks form submission while no time is selected; sets `aria-required` on the input. Like a\n * native readonly input, a `readOnly` TimePicker does not block submission.\n */\n required?: boolean;\n /** Native `autocomplete` of the input. @default 'off' */\n autoComplete?: string;\n /** Native `maxlength` of the input. */\n maxLength?: number;\n /** Focus handler of the text input (the root keeps the other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Blur handler of the text input. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /** Key handler of the text input; `preventDefault()` skips the picker's own keys. */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Key handler of the text input. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the text input (the `role=\"combobox\"` element); `ref` stays on the root. */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction displayTime(value: string, format: '12h' | '24h'): string {\n const minutes = timeToMinutes(value);\n return Number.isNaN(minutes) ? value : minutesToTime(minutes, format);\n}\n\n/** Whether an option matches the (trimmed, lower-case) typed text: by label or `HH:mm` value. */\nfunction matchesQuery(item: ListboxItem, text: string): boolean {\n return item.label.toLowerCase().includes(text) || item.value.includes(text);\n}\n\n/** Whether an option's label or `HH:mm` value starts with the (trimmed, lower-case) typed text. */\nfunction startsWithQuery(item: ListboxItem, text: string): boolean {\n return item.label.toLowerCase().startsWith(text) || item.value.startsWith(text);\n}\n\n/**\n * A time input with a filterable list of times (APG editable combobox with list autocomplete).\n *\n * - Type to filter (by label or `HH:mm` value). A complete typed time (`2:00 PM`, `14:00`) makes\n * its own option active — not an earlier one that merely contains the text, such as `12:00 PM`\n * — and partial text makes the first option that starts with it active (`2:00 p` -> `2:00 PM`),\n * else the first one that contains it; Enter commits the active option. Enter or leaving the\n * field also commits a complete typed time that is not in the list (`9:15 AM`, `14:45`) when it\n * lies within `minTime`/`maxTime`, and erased text clears the value (as the clear button does);\n * Enter never submits the form with edited text, and both close the list. Other typed text is\n * kept: the input is marked invalid and an error message describes it (`onInvalidInput`,\n * reported once per edit) until the text is edited or replaced (an option, the clear button,\n * Escape, a form reset, a new value from the parent). Escape on a closed list reverts any edit,\n * erased text included, to the selected time.\n * - Click the input or the expand button at its end (a chevron, see `expandIcon`; not a tab stop,\n * and it leaves focus in the input), press ArrowDown/ArrowUp or type to open; the list opens\n * with every option and the selected one (when it is in the list) active and scrolled into\n * view. Without one, no option is active until ArrowDown/ArrowUp or typing, so Enter lets the\n * surrounding form submit. Escape, Tab, an outside press or focus leaving closes it. Typed text\n * kept after Escape closed the list still filters it when it reopens: a click resumes the option\n * typing made active, ArrowDown/ArrowUp start at the first/last match.\n * - `open`/`defaultOpen`/`onOpenChange` control the list. It closes when the picker becomes\n * disabled or read-only (uncontrolled `open`: it stays closed when the picker is enabled again),\n * and the text typed until then is dropped.\n * - Keys of an IME composition (its confirming Enter included) are left to the IME.\n * - `clearable` shows a clear button while a time is selected (not while read-only), a tab stop\n * after the input. Tab from erased text clears the value first, so focus moves on past the\n * picker instead of to the clear button that disappears.\n * - The value is `HH:mm` (24-hour) whatever the display `format`; values off the `step` grid or\n * outside the bounds are still displayed in `format`.\n * - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s\n * `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own\n * prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as\n * `data-size` and `data-appearance` on the root `<div>`. The time list keeps its size.\n * - The input (`controlRef`) receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`,\n * `autoFocus`, `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes\n * `autoComplete`, `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and\n * `enterKeyHint`. `ref`, `className`, `style`, other `aria-*` attributes and the remaining props\n * stay on the root `<div>`. Inside a `Field`, the input is labelled and described by it.\n * - `name`/`required` add a hidden input for native forms (`HH:mm`); the value resets with its form.\n * - The built-in names, status texts and error messages are English; `labels` localizes them.\n * - The open list renders only in the browser: an open list (`defaultOpen`, `open`) is closed in\n * the server HTML and opens once the picker has hydrated.\n */\nexport const TimePicker = (props: TimePickerProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onChange,\n format = '12h',\n step = DEFAULT_TIME_STEP,\n minTime = '00:00',\n maxTime = '23:59',\n placeholder = 'Select a time',\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n readOnly,\n clearable = false,\n expandIcon,\n open: openProp,\n defaultOpen,\n onOpenChange,\n onInvalidInput,\n labels,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n enterKeyHint,\n inputMode,\n spellCheck,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n } = props;\n\n if (onChange !== undefined) warnDeprecated('TimePicker', 'onChange', 'onValueChange');\n\n const { size, appearance } = useInputLook(sizeProp, appearanceProp);\n\n const [selectedValue, setSelectedValue] = useControllable<string>(\n valueProp,\n defaultValue ?? '',\n (next) => {\n onValueChange?.(next);\n onChange?.(next);\n },\n );\n\n /* ---- options, step and bounds ---------------------------------- */\n\n const stepValid = normalizeTimeStep(step).valid;\n const minMinutes = timeToMinutes(minTime);\n const maxMinutes = timeToMinutes(maxTime);\n const boundsValid =\n !Number.isNaN(minMinutes) && !Number.isNaN(maxMinutes) && minMinutes <= maxMinutes;\n const allOptions = React.useMemo(\n () => generateTimeOptions(step, minTime, maxTime, format),\n [step, minTime, maxTime, format],\n );\n\n // Once per invalid value and page (C-DEV), not once per instance and effect run.\n React.useEffect(() => {\n if (!stepValid) {\n warnOnce(\n `TimePicker:step:${String(step)}`,\n `TimePicker: \\`step\\` must be a positive number of minutes (received ${String(step)}); ` +\n `using ${DEFAULT_TIME_STEP}.`,\n );\n }\n }, [step, stepValid]);\n\n React.useEffect(() => {\n if (!boundsValid) {\n warnOnce(\n `TimePicker:bounds:${minTime}|${maxTime}`,\n `TimePicker: \\`minTime\\`/\\`maxTime\\` must be times such as \"09:00\", \"09:00:00\" or ` +\n `\"9:00 AM\" with minTime <= maxTime (received \"${minTime}\" / \"${maxTime}\"); no times are available.`,\n );\n }\n }, [minTime, maxTime, boundsValid]);\n\n /* ---- open state, draft text and query -------------------------- */\n\n const interactive = !disabled && !readOnly;\n const [openState, setOpen, openControlled] = useControllable<boolean>(\n openProp,\n // A picker that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n // The open list lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the picker shows the closed inline list and reports it closed, so\n // aria-controls and aria-activedescendant never name a missing element.\n const isClient = useIsClient();\n const open = openState && interactive && isClient;\n // A list hidden because the picker became disabled or read-only is closed for good\n // (uncontrolled), so enabling the picker again does not bring it back; onOpenChange(false)\n // reports it (a consumer callback, so from an effect). A controlled `open` stays the parent's.\n React.useEffect(() => {\n if (!interactive && openState && !openControlled) setOpen(false);\n }, [interactive, openState, openControlled, setOpen]);\n /** Typed text; `null` shows the selected time's label (draft model). */\n const [draft, setDraft] = React.useState<string | null>(null);\n /** Why the typed text was rejected (it is kept and flagged); `null` while it is not. */\n const [invalid, setInvalid] = React.useState<TimePickerInvalidReason | null>(null);\n // Locking the picker while the user types drops the typed text and its error, so no later blur\n // commits it (adjusted during render, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) {\n setDraft(null);\n setInvalid(null);\n }\n }\n // A new value from the parent replaces rejected text (the picker's own commits clear it\n // themselves), so the input never shows an error next to a valid value. Text the user is still\n // typing stays.\n const [seenValue, setSeenValue] = React.useState(selectedValue);\n if (seenValue !== selectedValue) {\n setSeenValue(selectedValue);\n if (invalid !== null) {\n setDraft(null);\n setInvalid(null);\n }\n }\n /**\n * Filter text: the typed text only, never the selected time's label, so opening without an edit\n * shows every option. Typed text kept while the list is closed (Escape) keeps filtering it, so\n * a reopened list shows what the input says.\n */\n const query = draft ?? '';\n\n const openList = () => {\n if (!interactive || open) return;\n setOpen(true);\n };\n const closeList = () => setOpen(false);\n\n // A complete time in any spelling the commit accepts (`2:00pm`, `09:00 AM`, `14:00:00`) keeps its\n // own option, so it stays listed and active, as Enter and blur commit it.\n const filter = React.useMemo(() => {\n const text = query.trim().toLowerCase();\n if (!text) return undefined;\n const minutes = timeToMinutes(text);\n const exact = Number.isNaN(minutes) ? null : minutesToValue(minutes);\n return (item: ListboxItem) => item.value === exact || matchesQuery(item, text);\n }, [query]);\n\n /**\n * The option that typing `text` makes active. A complete time (`2:00 PM`, `14:00`) activates its\n * own option, never another one that merely contains the text (`12:00 PM`); when it is not in\n * the list (off-grid or out of bounds) nothing is active, so Enter commits the typed time or\n * nothing. Partial text activates the first option whose label or value starts with it (`2:00 p`\n * -> `2:00 PM`, `2` -> `2:00 AM`, not `12:00 AM`), else the first option that contains it.\n */\n const getTypedActiveValue = (text: string): string | null => {\n const needle = text.trim().toLowerCase();\n if (!needle) return null;\n const minutes = timeToMinutes(text);\n if (!Number.isNaN(minutes)) {\n const exact = minutesToValue(minutes);\n return allOptions.some((item) => item.value === exact) ? exact : null;\n }\n const match =\n allOptions.find((item) => startsWithQuery(item, needle)) ??\n allOptions.find((item) => matchesQuery(item, needle));\n return match?.value ?? null;\n };\n\n // Opening without typing activates the selected option only when it is in the list. An empty,\n // off-grid or out-of-range value activates nothing (ArrowDown/ArrowUp start at the first/last\n // option), so Enter on a freshly opened list commits nothing and the surrounding form submits.\n const selectedInList =\n selectedValue !== '' && allOptions.some((item) => item.value === selectedValue);\n\n const selectedValues = React.useMemo(\n () => (selectedValue ? [selectedValue] : []),\n [selectedValue],\n );\n\n const commitValue = (next: string) => {\n setSelectedValue(next);\n setDraft(null);\n setInvalid(null);\n };\n\n /**\n * Commits the typed text: erased text clears the value, a complete time within the bounds selects\n * it. Returns why any other text is not accepted (it is kept), else `null`.\n */\n const commitDraft = (text: string): TimePickerInvalidReason | null => {\n if (!text.trim()) {\n commitValue('');\n return null;\n }\n const minutes = timeToMinutes(text);\n if (Number.isNaN(minutes)) return 'unparseable';\n if (!boundsValid || minutes < minMinutes || minutes > maxMinutes) return 'out-of-range';\n commitValue(minutesToValue(minutes));\n return null;\n };\n\n /** Keeps rejected text, flags it and reports it. */\n const rejectDraft = (text: string, reason: TimePickerInvalidReason) => {\n setInvalid(reason);\n onInvalidInput?.(text, reason);\n };\n\n const clearDraft = () => {\n setDraft(null);\n setInvalid(null);\n };\n\n // The listbox counts as open only while it shows options: with no match nothing is displayed,\n // so `aria-expanded` is false and Escape reverts the typed text instead of closing an empty list.\n const hasMatches = React.useMemo(\n () => (filter ? allOptions.some(filter) : allOptions.length > 0),\n [allOptions, filter],\n );\n const expanded = open && hasMatches;\n\n const lb = useListbox({\n open: expanded,\n onOpenChange: (next) => (next ? openList() : closeList()),\n mode: 'editable',\n selectedValues,\n onSelect: (next) => commitValue(next),\n items: allOptions,\n filter,\n // Typing sets the active option itself (getTypedActiveValue in handleInputChange), so an exact\n // typed time wins over an earlier substring match; highlightOnFilter would force the first one.\n autoHighlight: draft === null && selectedInList ? 'selected' : false,\n idPrefix: 'timepicker-listbox',\n // Escape on a closed list reverts typed text (erased text: handleKeyDown); without a draft it is\n // left to enclosing layers.\n onClearDraft:\n draft !== null\n ? () => {\n clearDraft();\n closeList();\n }\n : undefined,\n });\n\n const displayLabel = selectedValue\n ? (lb.getItem(selectedValue)?.label ?? displayTime(selectedValue, format))\n : '';\n // Read-only pickers offer no clear action (the value cannot change).\n const showClear = clearable && !readOnly && selectedValue !== '';\n const statusMessage =\n open && !hasMatches\n ? allOptions.length === 0\n ? (labels?.noTimes ?? 'No times available')\n : (labels?.noMatches ?? 'No matching times')\n : '';\n\n /* ---- elements, dismissal, positioning --------------------------- */\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const surfaceRef = React.useRef<HTMLDivElement | null>(null);\n const rootRefs = useMergedRefs<HTMLDivElement>(ref, rootRef);\n const inputRefs = useMergedRefs<HTMLInputElement>(controlRef, inputRef);\n\n const { layerId } = useDismiss({\n open,\n onDismiss: closeList,\n refs: [surfaceRef, rootRef],\n anchorRef: inputRef,\n kind: 'listbox',\n focusOutside: true,\n });\n\n const { setReference, setFloating, floatingProps } = usePopupPosition({\n open,\n side: 'bottom',\n align: 'start',\n matchReferenceWidth: true,\n fitViewport: true,\n });\n const surfaceRefs = useMergedRefs<HTMLDivElement>(surfaceRef, setFloating);\n\n /* ---- forms and Field ------------------------------------------- */\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n // Like a native readonly input, a read-only picker is barred from constraint validation (the\n // user could not fix it); its value is still submitted.\n const validates = isRequired && !readOnly;\n const errorId = useId('timepicker-error');\n // A Field that shows an error describes the input itself (its message is not repeated).\n const showOwnError = invalid !== null && !field?.hasErrorMessage;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': joinIds(ariaDescribedBy, showOwnError ? errorId : undefined),\n 'aria-invalid': invalid !== null ? true : ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n useFormReset(\n inputRef,\n () => {\n setSelectedValue(defaultValue ?? '');\n clearDraft();\n closeList();\n },\n form,\n );\n\n /* ---- handlers --------------------------------------------------- */\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (!interactive) return;\n const text = event.target.value;\n setDraft(text);\n setInvalid(null);\n if (!open) setOpen(true);\n // Every edit re-ranks the highlight (it opens the list in the same update when closed).\n lb.setActiveValue(getTypedActiveValue(text));\n };\n\n const handleKeyDown = composeEventHandlers(\n onKeyDown,\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!interactive) return;\n // Enter commits the active option: the exact typed time, the first match of partial text,\n // or the option moved to with the arrow keys.\n lb.onKeyDown(event);\n // Keys that belong to an IME composition (its confirming Enter) are left to the IME, as\n // useListbox leaves them.\n if (event.defaultPrevented || event.nativeEvent.isComposing) return;\n if (event.key === 'Escape' && draft === '' && displayLabel !== '') {\n // Erased text: useListbox calls onClearDraft only while the input has text, so Escape on a\n // closed list restores the selected time here (an open list was closed above). With nothing\n // to restore, Escape is left to enclosing layers.\n event.preventDefault();\n clearDraft();\n closeList();\n return;\n }\n if (event.key === 'Enter' && draft !== null) {\n // Edited text is committed (a complete time within the bounds; erased text clears) or kept\n // and flagged (reported on every Enter), never submitted with the form; untouched text\n // lets Enter submit. The list closes either way, so it does not cover the error message.\n event.preventDefault();\n const reason = commitDraft(draft);\n closeList();\n if (reason !== null) rejectDraft(draft, reason);\n }\n if (event.key === 'Tab' && !event.shiftKey && showClear && draft !== null && !draft.trim()) {\n // Erased text clears the value, and with it the clear button, the next tab stop. It is\n // settled before Tab moves focus (the blur would settle it while focus moves to that\n // button), so focus moves on to the tab stop after the picker instead of dropping to\n // <body> with the button (C-DISABLED).\n flushSync(() => commitDraft(draft));\n }\n if (event.key === 'Tab' && open && !expanded) {\n // useListbox closes the list on Tab only while it shows options. The status text shown\n // instead ('No matching times', 'No times available') closes too: the clear button, the\n // next tab stop, is inside the picker, so focus moving there does not dismiss it.\n closeList();\n }\n },\n );\n const handleKeyUp = composeEventHandlers(onKeyUp, lb.onKeyUp);\n\n const handleInputClick = () => {\n if (!interactive || open) return;\n openList();\n // Typed text kept after Escape resumes where typing left it: its matches (the filter) and the\n // option typing made active, so Enter commits the same time as before the list closed.\n if (draft !== null) lb.setActiveValue(getTypedActiveValue(draft));\n };\n\n const handleBlur = composeEventHandlers(onBlur, () => {\n if (!interactive || draft === null) return;\n // Leaving the input settles the edit as Enter does: rejected text is kept (text that was\n // already rejected is not reported again) and the list closes either way, so it does not cover\n // the error message.\n const reason = invalid === null ? commitDraft(draft) : null;\n closeList();\n if (reason !== null) rejectDraft(draft, reason);\n });\n\n // The expand button opens the list as a click in the input does (typed text kept after Escape\n // resumes its matches) and closes it; focus stays in (or returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) closeList();\n else handleInputClick();\n inputRef.current?.focus();\n };\n\n const handleClear = () => {\n if (!interactive) return;\n commitValue('');\n inputRef.current?.focus();\n };\n\n /* ---- render ---------------------------------------------------- */\n\n const listboxLabelledBy = joinIds(ariaLabelledBy, field?.labelId);\n const renderListbox = (hidden: boolean) => (\n <ul\n {...lb.getListboxProps()}\n aria-labelledby={listboxLabelledBy}\n aria-label={listboxLabelledBy ? undefined : (ariaLabel ?? labels?.list ?? 'Times')}\n hidden={hidden || undefined}\n className={cn(\n timePickerClassNames.listbox,\n 'max-h-60 min-h-0 overflow-auto py-1 focus:outline-hidden',\n )}\n >\n {lb.items.map((item) => (\n <TimePickerOption key={item.value} value={item.value} label={item.label} />\n ))}\n </ul>\n );\n\n const showExpand = showsExpandButton(expandIcon);\n\n let errorMessage = '';\n if (showOwnError && invalid === 'unparseable') {\n errorMessage = (labels?.invalidTime ?? defaultInvalidTimeLabel)(\n format === '24h' ? 'HH:mm' : 'h:mm AM',\n );\n } else if (showOwnError) {\n // Bounds the consumer did not set are `undefined`, not the defaults.\n errorMessage = (labels?.outOfRange ?? defaultOutOfRangeLabel)(\n props.minTime === undefined ? undefined : displayTime(minTime, format),\n props.maxTime === undefined ? undefined : displayTime(maxTime, format),\n );\n }\n // aria-controls must name a listbox that is actually mounted. The closed list is inline only\n // while options exist; the open list is mounted only while something matches.\n const listboxMounted = open ? hasMatches : allOptions.length > 0;\n\n return (\n <ListboxContext.Provider value={lb.context}>\n <div\n data-size={size}\n data-appearance={appearance}\n {...rest}\n ref={rootRefs}\n className={cn(timePickerClassNames.root, 'relative inline-flex flex-col', className)}\n >\n <div ref={setReference} className=\"relative flex items-center\">\n <input\n ref={inputRefs}\n type=\"text\"\n {...lb.getComboboxProps()}\n aria-controls={listboxMounted ? lb.listboxId : undefined}\n {...fieldProps}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n value={draft ?? displayLabel}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onFocus={onFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n enterKeyHint={enterKeyHint}\n inputMode={inputMode}\n spellCheck={spellCheck}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n className={cn(\n timePickerClassNames.input,\n inputHeightClasses[size],\n 'w-full',\n inputPaddingClasses[size],\n inputTextClasses[size],\n inputAppearanceClasses[appearance],\n 'text-foreground placeholder:text-muted-foreground',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand), size),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear time'}\n disabled={disabled}\n // Keeps focus (and an open list) on the input while the pointer clears it.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n timePickerClassNames.clearButton,\n pickerIconButtonClasses(size, appearance),\n pickerButtonOffset(size, showExpand ? 2 : 1),\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon size={pickerGlyphSize(size, 'icon')} />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"TimePicker\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show times'}\n expanded={expanded}\n listboxId={lb.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n size={size}\n appearance={appearance}\n className={timePickerClassNames.expandButton}\n iconClassName={timePickerClassNames.expandIcon}\n />\n )}\n </div>\n {showOwnError && (\n <p\n id={errorId}\n role=\"alert\"\n className={cn(timePickerClassNames.errorMessage, 'mt-1 text-caption-1 text-error')}\n >\n {errorMessage}\n </p>\n )}\n {!open && allOptions.length > 0 && renderListbox(true)}\n <span role=\"status\" className=\"sr-only\">\n {statusMessage}\n </span>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={selectedValue}\n type=\"text\"\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n {open && (\n <Portal layerId={layerId}>\n <div\n ref={surfaceRefs}\n {...floatingProps}\n data-state=\"open\"\n className={cn(\n timePickerClassNames.surface,\n 'flex flex-col overflow-hidden rounded border border-border bg-background shadow-8',\n )}\n >\n {hasMatches ? (\n renderListbox(false)\n ) : (\n <div\n aria-hidden=\"true\"\n className={cn(\n timePickerClassNames.emptyMessage,\n 'px-3 py-1.5 text-body-1 text-muted-foreground',\n )}\n >\n {statusMessage}\n </div>\n )}\n </div>\n </Portal>\n )}\n </div>\n </ListboxContext.Provider>\n );\n};\n\nTimePicker.displayName = 'TimePicker';\n"],"mappings":"qgCAwDA,IAAMmE,GACJ,yRAWIC,GAAmBpE,EAAM,KAAK,SAA0B,CAC5D,QACA,SACwB,CACxB,GAAM,CAAE,WAAU,eAAgBC,EAAAA,iBAAgC,CAAE,QAAO,OAAM,CAAC,EAClF,OACE,EAAAgE,EAAA,KAAA,CAAC,KAAD,CACE,GAAII,EACJ,UAAWnE,EAAAA,GAC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