@mieweb/ui 0.6.1-dev.174 → 0.6.1-dev.175

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 (104) hide show
  1. package/dist/{chunk-O6MBLWAI.js → chunk-35VBGVMB.js} +3 -3
  2. package/dist/{chunk-O6MBLWAI.js.map → chunk-35VBGVMB.js.map} +1 -1
  3. package/dist/{chunk-CDMWZBDD.cjs → chunk-372IIHUA.cjs} +5 -5
  4. package/dist/{chunk-CDMWZBDD.cjs.map → chunk-372IIHUA.cjs.map} +1 -1
  5. package/dist/{chunk-X7J45FU5.cjs → chunk-4GXECTPS.cjs} +2 -2
  6. package/dist/{chunk-X7J45FU5.cjs.map → chunk-4GXECTPS.cjs.map} +1 -1
  7. package/dist/chunk-62ZOA6PX.js +31 -0
  8. package/dist/chunk-62ZOA6PX.js.map +1 -0
  9. package/dist/{chunk-ROXYP3BZ.cjs → chunk-AES2BKEW.cjs} +71 -56
  10. package/dist/chunk-AES2BKEW.cjs.map +1 -0
  11. package/dist/{chunk-GBRPZGSI.cjs → chunk-BLPCYP4D.cjs} +7 -7
  12. package/dist/{chunk-GBRPZGSI.cjs.map → chunk-BLPCYP4D.cjs.map} +1 -1
  13. package/dist/{chunk-YWHSQH7S.cjs → chunk-DAPZPT5N.cjs} +24 -55
  14. package/dist/chunk-DAPZPT5N.cjs.map +1 -0
  15. package/dist/{chunk-FJG7KUDJ.js → chunk-FJH7P5WG.js} +3 -3
  16. package/dist/{chunk-FJG7KUDJ.js.map → chunk-FJH7P5WG.js.map} +1 -1
  17. package/dist/chunk-FSGEDDF2.cjs +33 -0
  18. package/dist/chunk-FSGEDDF2.cjs.map +1 -0
  19. package/dist/{chunk-DZIUSGUF.js → chunk-HRS6W74P.js} +3 -3
  20. package/dist/{chunk-DZIUSGUF.js.map → chunk-HRS6W74P.js.map} +1 -1
  21. package/dist/{chunk-6Y727LPG.js → chunk-J7Z7467B.js} +24 -55
  22. package/dist/chunk-J7Z7467B.js.map +1 -0
  23. package/dist/{chunk-ETGZ5DSA.js → chunk-JHYFHEHS.js} +3 -3
  24. package/dist/{chunk-ETGZ5DSA.js.map → chunk-JHYFHEHS.js.map} +1 -1
  25. package/dist/{chunk-QPOTSLY6.cjs → chunk-JTBQNOSL.cjs} +4 -4
  26. package/dist/{chunk-QPOTSLY6.cjs.map → chunk-JTBQNOSL.cjs.map} +1 -1
  27. package/dist/{chunk-CB4JX5EJ.cjs → chunk-MAMY5HTT.cjs} +117 -93
  28. package/dist/chunk-MAMY5HTT.cjs.map +1 -0
  29. package/dist/{chunk-WFS6R2F5.js → chunk-MKWGKASO.js} +114 -101
  30. package/dist/chunk-MKWGKASO.js.map +1 -0
  31. package/dist/{chunk-2JQBPU3Y.cjs → chunk-MZPF2QGM.cjs} +95 -77
  32. package/dist/chunk-MZPF2QGM.cjs.map +1 -0
  33. package/dist/{chunk-5INNPOZZ.cjs → chunk-NAQ3ZALI.cjs} +5 -5
  34. package/dist/{chunk-5INNPOZZ.cjs.map → chunk-NAQ3ZALI.cjs.map} +1 -1
  35. package/dist/chunk-QA6ZDHFP.js +117 -0
  36. package/dist/chunk-QA6ZDHFP.js.map +1 -0
  37. package/dist/{chunk-7QZSJFYT.js → chunk-UM6NA7HL.js} +117 -93
  38. package/dist/chunk-UM6NA7HL.js.map +1 -0
  39. package/dist/{chunk-7BARESXI.cjs → chunk-VPNURIAY.cjs} +114 -101
  40. package/dist/chunk-VPNURIAY.cjs.map +1 -0
  41. package/dist/{chunk-GSOOPTGM.js → chunk-YZT62IMX.js} +95 -77
  42. package/dist/chunk-YZT62IMX.js.map +1 -0
  43. package/dist/{chunk-PI3KOYAT.js → chunk-ZAIEQWRA.js} +71 -56
  44. package/dist/chunk-ZAIEQWRA.js.map +1 -0
  45. package/dist/chunk-ZDEYV373.cjs +139 -0
  46. package/dist/chunk-ZDEYV373.cjs.map +1 -0
  47. package/dist/{chunk-6VGXX6L6.js → chunk-ZGSC2CB2.js} +2 -2
  48. package/dist/{chunk-6VGXX6L6.js.map → chunk-ZGSC2CB2.js.map} +1 -1
  49. package/dist/components/Autocomplete/index.cjs +4 -3
  50. package/dist/components/Autocomplete/index.js +3 -2
  51. package/dist/components/CountryCodeDropdown/index.cjs +6 -5
  52. package/dist/components/CountryCodeDropdown/index.js +3 -2
  53. package/dist/components/Dropdown/index.cjs +9 -8
  54. package/dist/components/Dropdown/index.d.cts +2 -1
  55. package/dist/components/Dropdown/index.d.ts +2 -1
  56. package/dist/components/Dropdown/index.js +3 -2
  57. package/dist/components/MediaEditor/index.cjs +9 -7
  58. package/dist/components/MediaEditor/index.js +4 -2
  59. package/dist/components/RichTextEditor/index.cjs +7 -6
  60. package/dist/components/RichTextEditor/index.js +4 -3
  61. package/dist/components/Select/index.cjs +5 -3
  62. package/dist/components/Select/index.js +3 -1
  63. package/dist/components/Sheet/index.d.cts +1 -1
  64. package/dist/components/Sheet/index.d.ts +1 -1
  65. package/dist/components/SuperChat/index.cjs +9 -8
  66. package/dist/components/SuperChat/index.cjs.map +1 -1
  67. package/dist/components/SuperChat/index.js +4 -3
  68. package/dist/components/SuperChat/index.js.map +1 -1
  69. package/dist/components/SuperChat/plugins/index.cjs +4 -3
  70. package/dist/components/SuperChat/plugins/index.cjs.map +1 -1
  71. package/dist/components/SuperChat/plugins/index.js +3 -2
  72. package/dist/components/SuperChat/plugins/index.js.map +1 -1
  73. package/dist/esheet.cjs +7 -5
  74. package/dist/esheet.cjs.map +1 -1
  75. package/dist/esheet.js +4 -2
  76. package/dist/esheet.js.map +1 -1
  77. package/dist/hooks/index.cjs +21 -16
  78. package/dist/hooks/index.d.cts +2 -1
  79. package/dist/hooks/index.d.ts +2 -1
  80. package/dist/hooks/index.js +3 -2
  81. package/dist/index.cjs +1072 -983
  82. package/dist/index.cjs.map +1 -1
  83. package/dist/index.d.cts +1 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.js +941 -855
  86. package/dist/index.js.map +1 -1
  87. package/dist/styles.css +1 -1
  88. package/dist/useAnchoredPosition-nXdSFKHf.d.cts +65 -0
  89. package/dist/useAnchoredPosition-nXdSFKHf.d.ts +65 -0
  90. package/package.json +1 -1
  91. package/dist/chunk-2JQBPU3Y.cjs.map +0 -1
  92. package/dist/chunk-6Y727LPG.js.map +0 -1
  93. package/dist/chunk-7BARESXI.cjs.map +0 -1
  94. package/dist/chunk-7QZSJFYT.js.map +0 -1
  95. package/dist/chunk-CB4JX5EJ.cjs.map +0 -1
  96. package/dist/chunk-GSOOPTGM.js.map +0 -1
  97. package/dist/chunk-IKMR2ADM.cjs +0 -25
  98. package/dist/chunk-IKMR2ADM.cjs.map +0 -1
  99. package/dist/chunk-OKBR6PX4.js +0 -23
  100. package/dist/chunk-OKBR6PX4.js.map +0 -1
  101. package/dist/chunk-PI3KOYAT.js.map +0 -1
  102. package/dist/chunk-ROXYP3BZ.cjs.map +0 -1
  103. package/dist/chunk-WFS6R2F5.js.map +0 -1
  104. package/dist/chunk-YWHSQH7S.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -26,10 +26,10 @@ import { Spinner, SpinnerWithLabel } from './chunk-VCO2IZOG.js';
26
26
  export { FullPageSpinner, Spinner, SpinnerWithLabel, spinnerVariants } from './chunk-VCO2IZOG.js';
27
27
  import { SparklesIcon, RefreshIcon, CloseIcon, AIMessageDisplay } from './chunk-NQME7MCK.js';
28
28
  export { AILogoIcon, AIMessageDisplay, AITypingIndicator, ChatBubble, ChevronIcon, CloseIcon, MCPToolCallDisplay, MessageAvatar, RefreshIcon, ResourceLink, SendIcon, SparklesIcon, SpinnerIcon, ToolStatusIcon, getToolIcon } from './chunk-NQME7MCK.js';
29
- import { EmptyState } from './chunk-ETGZ5DSA.js';
30
- export { AttachmentPreview, ConversationHeader, ConversationListItem, ConversationListSkeleton, DateSeparator, EmptyState, LightboxModal, LoadMoreButton, MessageBubble, MessageList, MessageStatusIcon, MessageThread, MessagingSplitView, ReadReceiptIndicator, SkeletonMessage, TypingIndicator, bubbleVariants, formatDateLabel, formatFileSize, formatLastSeen, getConversationSubtitle, getConversationTitle, groupMessagesByDate, headerVariants, isSameSenderGroup, useMessageScroll, useMessages, useReadReceipts, useTypingIndicator } from './chunk-ETGZ5DSA.js';
31
- import { MessageComposer } from './chunk-7QZSJFYT.js';
32
- export { AttachmentPicker, AttachmentPreviewItem, CameraButton, CharacterCounter, DragDropZone, MessageComposer, SendButton, generateAttachmentId, getFileType, sendButtonVariants, validateFile } from './chunk-7QZSJFYT.js';
29
+ import { EmptyState } from './chunk-JHYFHEHS.js';
30
+ export { AttachmentPreview, ConversationHeader, ConversationListItem, ConversationListSkeleton, DateSeparator, EmptyState, LightboxModal, LoadMoreButton, MessageBubble, MessageList, MessageStatusIcon, MessageThread, MessagingSplitView, ReadReceiptIndicator, SkeletonMessage, TypingIndicator, bubbleVariants, formatDateLabel, formatFileSize, formatLastSeen, getConversationSubtitle, getConversationTitle, groupMessagesByDate, headerVariants, isSameSenderGroup, useMessageScroll, useMessages, useReadReceipts, useTypingIndicator } from './chunk-JHYFHEHS.js';
31
+ import { MessageComposer } from './chunk-UM6NA7HL.js';
32
+ export { AttachmentPicker, AttachmentPreviewItem, CameraButton, CharacterCounter, DragDropZone, MessageComposer, SendButton, generateAttachmentId, getFileType, sendButtonVariants, validateFile } from './chunk-UM6NA7HL.js';
33
33
  import { Switch, switchThumbVariants, switchTrackVariants } from './chunk-43GBCUSQ.js';
34
34
  export { Switch, switchThumbVariants, switchTrackVariants } from './chunk-43GBCUSQ.js';
35
35
  import { Progress } from './chunk-IYIYL2SQ.js';
@@ -37,7 +37,7 @@ export { CircularProgress, Progress, circularProgressVariants, progressBarFillVa
37
37
  export { QuickAction, QuickActionGroup, QuickActionIcons, quickActionIconVariants, quickActionVariants } from './chunk-3CJBUAJ4.js';
38
38
  import { RecordButton } from './chunk-STPK44AU.js';
39
39
  export { RecordButton, formatDuration, recordButtonVariants } from './chunk-STPK44AU.js';
40
- export { RichTextEditor, convertAngleBracketsToMustache, processDictation } from './chunk-FJG7KUDJ.js';
40
+ export { RichTextEditor, convertAngleBracketsToMustache, processDictation } from './chunk-FJH7P5WG.js';
41
41
  export { Separator, separatorVariants } from './chunk-BX6BTDTR.js';
42
42
  export { DateButton, DatePicker, RadioOption, SchedulePicker, TimeButton, TimePicker, dateButtonVariants, radioOptionVariants, timeButtonVariants } from './chunk-4DMZAVB2.js';
43
43
  export { ScrollArea, scrollAreaVariants } from './chunk-BIT27PPD.js';
@@ -47,7 +47,7 @@ export { HtmlPreviewBlock } from './chunk-NCRYCG5G.js';
47
47
  export { MermaidBlock } from './chunk-WGC3KOP7.js';
48
48
  export { SurveyBlock } from './chunk-CPJIOOBM.js';
49
49
  export { FenceBlock } from './chunk-MHJMUKLA.js';
50
- export { FillerWordsModal, MediaEditor, SilenceSettingsModal, SpeedMarkerMenu, WordEditorModal } from './chunk-O6MBLWAI.js';
50
+ export { FillerWordsModal, MediaEditor, SilenceSettingsModal, SpeedMarkerMenu, WordEditorModal } from './chunk-35VBGVMB.js';
51
51
  export { PLAYBACK_SPEEDS } from './chunk-J7KWQJOB.js';
52
52
  export { Slider, sliderRangeVariants, sliderThumbVariants, sliderTrackVariants } from './chunk-JBB25LFB.js';
53
53
  import './chunk-RISZWWEQ.js';
@@ -58,9 +58,9 @@ import './chunk-OF7NTZ2I.js';
58
58
  import { Checkbox } from './chunk-XCLQZ4FV.js';
59
59
  export { Checkbox, CheckboxGroup, checkboxVariants } from './chunk-XCLQZ4FV.js';
60
60
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './chunk-T3C4RNJ4.js';
61
- export { CountryCodeDropdown, formatE164, validatePhoneNumber } from './chunk-WFS6R2F5.js';
62
- import { Dropdown, DropdownItem, DropdownSeparator, DropdownHeader } from './chunk-GSOOPTGM.js';
63
- export { Dropdown, DropdownContent, DropdownHeader, DropdownItem, DropdownLabel, DropdownSeparator } from './chunk-GSOOPTGM.js';
61
+ export { CountryCodeDropdown, formatE164, validatePhoneNumber } from './chunk-MKWGKASO.js';
62
+ import { Dropdown, DropdownItem, DropdownSeparator, DropdownHeader } from './chunk-YZT62IMX.js';
63
+ export { Dropdown, DropdownContent, DropdownHeader, DropdownItem, DropdownLabel, DropdownSeparator } from './chunk-YZT62IMX.js';
64
64
  export { FloatingWindow, MinimizedWindow } from './chunk-C2544GKZ.js';
65
65
  import { Alert, AlertTitle, AlertDescription } from './chunk-MV3MTHWQ.js';
66
66
  export { Alert, AlertDescription, AlertTitle, alertVariants } from './chunk-MV3MTHWQ.js';
@@ -68,15 +68,15 @@ import { AlertDialog } from './chunk-6AHYYWVB.js';
68
68
  export { AlertDialog } from './chunk-6AHYYWVB.js';
69
69
  export { AudioPlayer, ProgressBar, audioPlayerVariants, formatTime as formatAudioTime, playButtonVariants } from './chunk-KAKH2UZA.js';
70
70
  export { AudioRecorder, audioRecorderVariants, controlButtonVariants, formatTime, waveformContainerVariants } from './chunk-TRZXK57D.js';
71
- export { Autocomplete } from './chunk-PI3KOYAT.js';
71
+ export { Autocomplete } from './chunk-ZAIEQWRA.js';
72
72
  import { Avatar } from './chunk-WO5CAOAN.js';
73
73
  export { Avatar, AvatarGroup, avatarVariants, getInitials } from './chunk-WO5CAOAN.js';
74
74
  import './chunk-IQ4KQJAO.js';
75
75
  export { Breadcrumb, BreadcrumbSlash } from './chunk-HEH3QXOQ.js';
76
76
  import { evaluateDue, completedKeys, normalizeOrders } from './chunk-Y5KEFV5O.js';
77
77
  export { buildChartOrderRows, buildEncounterOrderRows, dueForOrder, evaluateDue, evaluateProgram, isApplicable } from './chunk-Y5KEFV5O.js';
78
- import { useCodeLookupConfig, RowActionToolbar, RowIconButton, toolbarKeyNav, parseSig, labelToMedicationFields, MedicationEditor } from './chunk-DZIUSGUF.js';
79
- export { ALLERGY_TYPE_LABELS, AllergyList, AllergyManager, CodeLookupProvider, MEDICATION_STATUS_LABELS, MedicationEditor, MedicationList, MedicationReconciliation, RowActionToolbar, RowIconButton, labelToMedicationFields, lookupToMedicationFields, parseMedicationLabel, parseSig, toolbarKeyNav, useCodeLookupConfig } from './chunk-DZIUSGUF.js';
78
+ import { useCodeLookupConfig, RowActionToolbar, RowIconButton, toolbarKeyNav, parseSig, labelToMedicationFields, MedicationEditor } from './chunk-HRS6W74P.js';
79
+ export { ALLERGY_TYPE_LABELS, AllergyList, AllergyManager, CodeLookupProvider, MEDICATION_STATUS_LABELS, MedicationEditor, MedicationList, MedicationReconciliation, RowActionToolbar, RowIconButton, labelToMedicationFields, lookupToMedicationFields, parseMedicationLabel, parseSig, toolbarKeyNav, useCodeLookupConfig } from './chunk-HRS6W74P.js';
80
80
  import { Textarea } from './chunk-6LFG4JFF.js';
81
81
  export { Textarea, textareaVariants } from './chunk-6LFG4JFF.js';
82
82
  import { Tooltip } from './chunk-FZJBFJJR.js';
@@ -85,8 +85,8 @@ import { RadioGroup, Radio } from './chunk-EZKRAW2X.js';
85
85
  export { Radio, RadioGroup, radioVariants } from './chunk-EZKRAW2X.js';
86
86
  import { Label } from './chunk-DUPR6FEL.js';
87
87
  export { Label, labelVariants } from './chunk-DUPR6FEL.js';
88
- import { Select } from './chunk-6Y727LPG.js';
89
- export { Select, selectTriggerVariants } from './chunk-6Y727LPG.js';
88
+ import { Select } from './chunk-J7Z7467B.js';
89
+ export { Select, selectTriggerVariants } from './chunk-J7Z7467B.js';
90
90
  import { Card, CardHeader, CardContent, CardTitle } from './chunk-5BQE6BEL.js';
91
91
  export { Card, CardActions, CardBadge, CardCollapsible, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, CardMedia, CardStat, CardTitle, cardAccentVariants, cardVariants } from './chunk-5BQE6BEL.js';
92
92
  import { DateInput } from './chunk-LIH3IZYK.js';
@@ -100,13 +100,11 @@ import { Button, buttonVariants } from './chunk-ZVSW2KS6.js';
100
100
  export { Button, buttonVariants } from './chunk-ZVSW2KS6.js';
101
101
  import { Badge } from './chunk-T42BCIUA.js';
102
102
  export { Badge, badgeVariants } from './chunk-T42BCIUA.js';
103
- import { useCommandK, useIsMobile, useMediaQuery, useScrollSpy } from './chunk-6VGXX6L6.js';
104
- export { useCommandK, useIsDesktop, useIsLargeDesktop, useIsMobile, useIsMobileOrTablet, useIsSmallTablet, useIsTablet, useKeyboardShortcut, useMediaQuery, useScrollSpy } from './chunk-6VGXX6L6.js';
103
+ import { useCommandK, useIsMobile, useMediaQuery, useScrollSpy } from './chunk-ZGSC2CB2.js';
104
+ export { useCommandK, useIsDesktop, useIsLargeDesktop, useIsMobile, useIsMobileOrTablet, useIsSmallTablet, useIsTablet, useKeyboardShortcut, useMediaQuery, useScrollSpy } from './chunk-ZGSC2CB2.js';
105
105
  export { useTheme } from './chunk-KJZNEVYM.js';
106
106
  export { DEFAULT_FILLER_WORDS, DEFAULT_MIN_SILENCE_MS, DEFAULT_NL_SILENCE_MS, buildPlaybackSegments, getSpeedAtIndex, initEditableWords, insertSilences, useTranscriptEdits } from './chunk-NTYGCBCL.js';
107
107
  export { useMediaTransport } from './chunk-SQHMGT4W.js';
108
- import { useClickOutside } from './chunk-OKBR6PX4.js';
109
- export { useClickOutside } from './chunk-OKBR6PX4.js';
110
108
  import { useLiveAnnouncement, useDragReorder, dragIndicatorClasses, reorderIds } from './chunk-7ZVTLTJF.js';
111
109
  export { dragIndicatorClasses, reorderIds, useDragReorder, useLiveAnnouncement } from './chunk-7ZVTLTJF.js';
112
110
  export { usePrefersReducedMotion } from './chunk-HB7C7NB5.js';
@@ -114,6 +112,10 @@ import { useFocusTrap } from './chunk-4SMSH4OY.js';
114
112
  export { useFocusTrap } from './chunk-4SMSH4OY.js';
115
113
  import { useEscapeKey } from './chunk-T4ME7QCT.js';
116
114
  export { useEscapeKey } from './chunk-T4ME7QCT.js';
115
+ import { useClickOutside } from './chunk-62ZOA6PX.js';
116
+ export { useClickOutside } from './chunk-62ZOA6PX.js';
117
+ import { useAnchoredPosition } from './chunk-QA6ZDHFP.js';
118
+ export { useAnchoredPosition } from './chunk-QA6ZDHFP.js';
117
119
  import './chunk-7XUN3OQT.js';
118
120
  export { isHtmlEmpty, stripHtmlTags } from './chunk-ERLPVXOV.js';
119
121
  export { formatPhoneNumber, isPhoneNumberEmpty, isValidPhoneNumber, unformatPhoneNumber } from './chunk-ZVPJ2MH6.js';
@@ -8902,15 +8904,12 @@ function ServiceSelect({
8902
8904
  }) {
8903
8905
  const [isOpen, setIsOpen] = React10.useState(false);
8904
8906
  const dropdownRef = React10.useRef(null);
8905
- React10.useEffect(() => {
8906
- function handleClickOutside(event) {
8907
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
8908
- setIsOpen(false);
8909
- }
8910
- }
8911
- document.addEventListener("mousedown", handleClickOutside);
8912
- return () => document.removeEventListener("mousedown", handleClickOutside);
8913
- }, []);
8907
+ const { anchorRef, floatingRef, style } = useAnchoredPosition({ open: isOpen, matchWidth: true, maxHeight: 240 });
8908
+ const outsideRefs = React10.useMemo(
8909
+ () => [dropdownRef, floatingRef],
8910
+ [floatingRef]
8911
+ );
8912
+ useClickOutside(outsideRefs, () => setIsOpen(false), isOpen);
8914
8913
  const toggleService = (serviceSlug) => {
8915
8914
  if (selectedServices.includes(serviceSlug)) {
8916
8915
  onChange(selectedServices.filter((s) => s !== serviceSlug));
@@ -8922,7 +8921,10 @@ function ServiceSelect({
8922
8921
  return /* @__PURE__ */ jsxs(
8923
8922
  "div",
8924
8923
  {
8925
- ref: dropdownRef,
8924
+ ref: (node) => {
8925
+ dropdownRef.current = node;
8926
+ anchorRef.current = node;
8927
+ },
8926
8928
  className: cn("relative", className),
8927
8929
  "data-slot": "service-select",
8928
8930
  children: [
@@ -8960,35 +8962,40 @@ function ServiceSelect({
8960
8962
  ]
8961
8963
  }
8962
8964
  ),
8963
- isOpen && /* @__PURE__ */ jsxs(
8964
- "div",
8965
- {
8966
- className: "border-border bg-card absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border shadow-lg",
8967
- "data-slot": "service-select-dropdown",
8968
- children: [
8969
- services.map((service) => /* @__PURE__ */ jsxs(
8970
- "label",
8971
- {
8972
- "data-slot": "service-select-option",
8973
- className: "hover:bg-muted flex cursor-pointer items-center gap-3 px-4 py-3",
8974
- children: [
8975
- /* @__PURE__ */ jsx(
8976
- "input",
8977
- {
8978
- type: "checkbox",
8979
- checked: selectedServices.includes(service.slug),
8980
- onChange: () => toggleService(service.slug),
8981
- className: "text-primary-800 focus:ring-primary-500 border-input h-4 w-4 rounded"
8982
- }
8983
- ),
8984
- /* @__PURE__ */ jsx("span", { className: "text-foreground", children: service.name })
8985
- ]
8986
- },
8987
- service.slug
8988
- )),
8989
- services.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-4 py-3 text-center", children: "No services available" })
8990
- ]
8991
- }
8965
+ isOpen && createPortal(
8966
+ /* @__PURE__ */ jsxs(
8967
+ "div",
8968
+ {
8969
+ ref: floatingRef,
8970
+ style,
8971
+ className: "border-border bg-card overflow-auto rounded-lg border shadow-lg",
8972
+ "data-slot": "service-select-dropdown",
8973
+ children: [
8974
+ services.map((service) => /* @__PURE__ */ jsxs(
8975
+ "label",
8976
+ {
8977
+ "data-slot": "service-select-option",
8978
+ className: "hover:bg-muted flex cursor-pointer items-center gap-3 px-4 py-3",
8979
+ children: [
8980
+ /* @__PURE__ */ jsx(
8981
+ "input",
8982
+ {
8983
+ type: "checkbox",
8984
+ checked: selectedServices.includes(service.slug),
8985
+ onChange: () => toggleService(service.slug),
8986
+ className: "text-primary-800 focus:ring-primary-500 border-input h-4 w-4 rounded"
8987
+ }
8988
+ ),
8989
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: service.name })
8990
+ ]
8991
+ },
8992
+ service.slug
8993
+ )),
8994
+ services.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-4 py-3 text-center", children: "No services available" })
8995
+ ]
8996
+ }
8997
+ ),
8998
+ document.body
8992
8999
  ),
8993
9000
  error && /* @__PURE__ */ jsx(
8994
9001
  "p",
@@ -10361,44 +10368,44 @@ function BusinessHoursEditor({
10361
10368
  }
10362
10369
  ),
10363
10370
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
10364
- hours.length > 0 && /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
10365
- /* @__PURE__ */ jsxs(
10366
- Button,
10367
- {
10368
- type: "button",
10369
- variant: "ghost",
10370
- size: "sm",
10371
- disabled,
10372
- className: "text-xs",
10373
- children: [
10374
- /* @__PURE__ */ jsx(CopyIcon, { className: "mr-1 h-3 w-3" }),
10375
- "Copy"
10376
- ]
10377
- }
10378
- ),
10379
- /* @__PURE__ */ jsxs("div", { className: "invisible absolute top-full right-0 z-10 mt-1 rounded-md border border-gray-200 bg-white opacity-0 shadow-lg transition-all group-hover:visible group-hover:opacity-100 dark:border-gray-700 dark:bg-gray-800", children: [
10380
- /* @__PURE__ */ jsx(
10381
- "button",
10371
+ hours.length > 0 && /* @__PURE__ */ jsxs(
10372
+ Dropdown,
10373
+ {
10374
+ placement: "bottom-end",
10375
+ trigger: /* @__PURE__ */ jsxs(
10376
+ Button,
10382
10377
  {
10383
10378
  type: "button",
10384
- className: "block w-full px-3 py-2 text-left text-xs whitespace-nowrap hover:bg-gray-100 dark:hover:bg-gray-700",
10385
- onClick: () => handleCopyToAll(dayIndex),
10379
+ variant: "ghost",
10380
+ size: "sm",
10386
10381
  disabled,
10387
- children: "Copy to all days"
10382
+ className: "text-xs",
10383
+ children: [
10384
+ /* @__PURE__ */ jsx(CopyIcon, { className: "mr-1 h-3 w-3" }),
10385
+ "Copy"
10386
+ ]
10388
10387
  }
10389
10388
  ),
10390
- /* @__PURE__ */ jsx(
10391
- "button",
10392
- {
10393
- type: "button",
10394
- className: "block w-full px-3 py-2 text-left text-xs whitespace-nowrap hover:bg-gray-100 dark:hover:bg-gray-700",
10395
- onClick: () => handleCopyToWeekdays(dayIndex),
10396
- disabled,
10397
- children: "Copy to weekdays"
10398
- }
10399
- )
10400
- ] })
10401
- ] }),
10389
+ children: [
10390
+ /* @__PURE__ */ jsx(
10391
+ DropdownItem,
10392
+ {
10393
+ onClick: () => handleCopyToAll(dayIndex),
10394
+ disabled,
10395
+ children: "Copy to all days"
10396
+ }
10397
+ ),
10398
+ /* @__PURE__ */ jsx(
10399
+ DropdownItem,
10400
+ {
10401
+ onClick: () => handleCopyToWeekdays(dayIndex),
10402
+ disabled,
10403
+ children: "Copy to weekdays"
10404
+ }
10405
+ )
10406
+ ]
10407
+ }
10408
+ ),
10402
10409
  /* @__PURE__ */ jsxs(
10403
10410
  Button,
10404
10411
  {
@@ -12809,16 +12816,8 @@ function RowActionMenu({
12809
12816
  const [open, setOpen] = React10.useState(false);
12810
12817
  const menuRef = React10.useRef(null);
12811
12818
  const buttonRef = React10.useRef(null);
12812
- React10.useEffect(() => {
12813
- if (!open) return;
12814
- function handleClick(e) {
12815
- if (menuRef.current && !menuRef.current.contains(e.target) && buttonRef.current && !buttonRef.current.contains(e.target)) {
12816
- setOpen(false);
12817
- }
12818
- }
12819
- document.addEventListener("mousedown", handleClick);
12820
- return () => document.removeEventListener("mousedown", handleClick);
12821
- }, [open]);
12819
+ const outsideRefs = React10.useMemo(() => [menuRef, buttonRef], []);
12820
+ useClickOutside(outsideRefs, () => setOpen(false), open);
12822
12821
  React10.useEffect(() => {
12823
12822
  if (!open) return;
12824
12823
  function handleKey(e) {
@@ -12908,7 +12907,9 @@ function RowActionMenu({
12908
12907
  function HoverMenu({
12909
12908
  items,
12910
12909
  actions,
12911
- variant
12910
+ variant,
12911
+ floatingRef,
12912
+ style
12912
12913
  }) {
12913
12914
  const headerBg = {
12914
12915
  default: "bg-neutral-50 dark:bg-neutral-800",
@@ -12923,11 +12924,13 @@ function HoverMenu({
12923
12924
  /* @__PURE__ */ jsxs(
12924
12925
  "div",
12925
12926
  {
12927
+ ref: floatingRef,
12928
+ style,
12926
12929
  "data-slot": "count-badge-menu",
12927
12930
  className: cn(
12928
- "absolute top-full right-0 z-50 mt-2",
12929
12931
  "w-[320px] rounded-lg border border-neutral-200 bg-white shadow-xl",
12930
12932
  "dark:border-neutral-700 dark:bg-neutral-800",
12933
+ "flex flex-col overflow-hidden",
12931
12934
  "animate-in fade-in slide-in-from-top-1 duration-150"
12932
12935
  ),
12933
12936
  onMouseDown: (e) => e.stopPropagation(),
@@ -12936,7 +12939,7 @@ function HoverMenu({
12936
12939
  "div",
12937
12940
  {
12938
12941
  className: cn(
12939
- "rounded-t-lg border-b border-neutral-200 px-3 py-2 dark:border-neutral-700",
12942
+ "shrink-0 rounded-t-lg border-b border-neutral-200 px-3 py-2 dark:border-neutral-700",
12940
12943
  headerBg[variant ?? "default"]
12941
12944
  ),
12942
12945
  children: /* @__PURE__ */ jsxs("span", { className: "text-xs font-semibold text-neutral-600 dark:text-neutral-300", children: [
@@ -12950,7 +12953,7 @@ function HoverMenu({
12950
12953
  "div",
12951
12954
  {
12952
12955
  "data-slot": "count-badge-menu-scroll",
12953
- className: "max-h-[240px] overflow-y-auto",
12956
+ className: "max-h-[240px] min-h-0 overflow-y-auto",
12954
12957
  children: /* @__PURE__ */ jsxs("table", { className: "w-full text-left text-xs", children: [
12955
12958
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-neutral-100 dark:border-neutral-700", children: [
12956
12959
  /* @__PURE__ */ jsx("th", { className: "text-muted-foreground px-3 py-1.5 font-medium", children: "#" }),
@@ -13013,117 +13016,133 @@ function ViewModalActions({
13013
13016
  }) {
13014
13017
  const [shareOpen, setShareOpen] = React10.useState(false);
13015
13018
  const shareRef = React10.useRef(null);
13016
- React10.useEffect(() => {
13017
- if (!shareOpen) return;
13018
- const handleClick = (e) => {
13019
- if (shareRef.current && !shareRef.current.contains(e.target)) {
13020
- setShareOpen(false);
13021
- }
13022
- };
13023
- document.addEventListener("mousedown", handleClick);
13024
- return () => document.removeEventListener("mousedown", handleClick);
13025
- }, [shareOpen]);
13019
+ const {
13020
+ anchorRef: shareAnchorRef,
13021
+ floatingRef: shareFloatingRef,
13022
+ style: shareStyle
13023
+ } = useAnchoredPosition({
13024
+ open: shareOpen
13025
+ });
13026
+ const shareOutsideRefs = React10.useMemo(
13027
+ () => [shareRef, shareFloatingRef],
13028
+ [shareFloatingRef]
13029
+ );
13030
+ useClickOutside(shareOutsideRefs, () => setShareOpen(false), shareOpen);
13026
13031
  return /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center gap-1 border-b border-neutral-200 pb-3 dark:border-neutral-700", children: [
13027
- /* @__PURE__ */ jsxs("div", { ref: shareRef, className: "relative", children: [
13028
- /* @__PURE__ */ jsxs(
13029
- Button,
13030
- {
13031
- variant: "ghost",
13032
- size: "sm",
13033
- onClick: () => setShareOpen((v) => !v),
13034
- "aria-expanded": shareOpen,
13035
- "aria-haspopup": "menu",
13036
- children: [
13037
- /* @__PURE__ */ jsx(Share, { size: 14, className: "mr-1.5" }),
13038
- "Share",
13039
- /* @__PURE__ */ jsx(
13040
- ChevronDown,
13041
- {
13042
- size: 12,
13043
- className: cn(
13044
- "ml-1 transition-transform duration-150",
13045
- shareOpen && "rotate-180"
13032
+ /* @__PURE__ */ jsxs(
13033
+ "div",
13034
+ {
13035
+ ref: (node) => {
13036
+ shareRef.current = node;
13037
+ shareAnchorRef.current = node;
13038
+ },
13039
+ className: "relative",
13040
+ children: [
13041
+ /* @__PURE__ */ jsxs(
13042
+ Button,
13043
+ {
13044
+ variant: "ghost",
13045
+ size: "sm",
13046
+ onClick: () => setShareOpen((v) => !v),
13047
+ "aria-expanded": shareOpen,
13048
+ "aria-haspopup": "menu",
13049
+ children: [
13050
+ /* @__PURE__ */ jsx(Share, { size: 14, className: "mr-1.5" }),
13051
+ "Share",
13052
+ /* @__PURE__ */ jsx(
13053
+ ChevronDown,
13054
+ {
13055
+ size: 12,
13056
+ className: cn(
13057
+ "ml-1 transition-transform duration-150",
13058
+ shareOpen && "rotate-180"
13059
+ )
13060
+ }
13046
13061
  )
13047
- }
13048
- )
13049
- ]
13050
- }
13051
- ),
13052
- shareOpen && /* @__PURE__ */ jsxs(
13053
- "div",
13054
- {
13055
- role: "menu",
13056
- className: cn(
13057
- "absolute top-full left-0 z-50 mt-1",
13058
- "min-w-[10rem] rounded-lg border border-neutral-200 bg-white py-1 shadow-lg",
13059
- "dark:border-neutral-700 dark:bg-neutral-800",
13060
- "animate-in fade-in zoom-in-95 duration-100"
13062
+ ]
13063
+ }
13061
13064
  ),
13062
- children: [
13063
- /* @__PURE__ */ jsxs(
13064
- "button",
13065
- {
13066
- role: "menuitem",
13067
- type: "button",
13068
- className: cn(
13069
- "flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm",
13070
- "text-neutral-700 hover:bg-neutral-100",
13071
- "dark:text-neutral-300 dark:hover:bg-neutral-700"
13072
- ),
13073
- onClick: () => {
13074
- console.warn("Share with physician", viewTarget);
13075
- setShareOpen(false);
13076
- },
13077
- children: [
13078
- /* @__PURE__ */ jsx(Stethoscope, { size: 14 }),
13079
- "Physician"
13080
- ]
13081
- }
13082
- ),
13065
+ shareOpen && ReactDOM.createPortal(
13083
13066
  /* @__PURE__ */ jsxs(
13084
- "button",
13067
+ "div",
13085
13068
  {
13086
- role: "menuitem",
13087
- type: "button",
13069
+ ref: shareFloatingRef,
13070
+ style: shareStyle,
13071
+ role: "menu",
13088
13072
  className: cn(
13089
- "flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm",
13090
- "text-neutral-700 hover:bg-neutral-100",
13091
- "dark:text-neutral-300 dark:hover:bg-neutral-700"
13073
+ "min-w-[10rem] overflow-auto rounded-lg border border-neutral-200 bg-white py-1 shadow-lg",
13074
+ "dark:border-neutral-700 dark:bg-neutral-800",
13075
+ "animate-in fade-in zoom-in-95 duration-100"
13092
13076
  ),
13093
- onClick: () => {
13094
- console.warn("Share with patient", viewTarget);
13095
- setShareOpen(false);
13096
- },
13097
13077
  children: [
13098
- /* @__PURE__ */ jsx(User, { size: 14 }),
13099
- "Patient"
13078
+ /* @__PURE__ */ jsxs(
13079
+ "button",
13080
+ {
13081
+ role: "menuitem",
13082
+ type: "button",
13083
+ className: cn(
13084
+ "flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm",
13085
+ "text-neutral-700 hover:bg-neutral-100",
13086
+ "dark:text-neutral-300 dark:hover:bg-neutral-700"
13087
+ ),
13088
+ onClick: () => {
13089
+ console.warn("Share with physician", viewTarget);
13090
+ setShareOpen(false);
13091
+ },
13092
+ children: [
13093
+ /* @__PURE__ */ jsx(Stethoscope, { size: 14 }),
13094
+ "Physician"
13095
+ ]
13096
+ }
13097
+ ),
13098
+ /* @__PURE__ */ jsxs(
13099
+ "button",
13100
+ {
13101
+ role: "menuitem",
13102
+ type: "button",
13103
+ className: cn(
13104
+ "flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm",
13105
+ "text-neutral-700 hover:bg-neutral-100",
13106
+ "dark:text-neutral-300 dark:hover:bg-neutral-700"
13107
+ ),
13108
+ onClick: () => {
13109
+ console.warn("Share with patient", viewTarget);
13110
+ setShareOpen(false);
13111
+ },
13112
+ children: [
13113
+ /* @__PURE__ */ jsx(User, { size: 14 }),
13114
+ "Patient"
13115
+ ]
13116
+ }
13117
+ ),
13118
+ /* @__PURE__ */ jsxs(
13119
+ "button",
13120
+ {
13121
+ role: "menuitem",
13122
+ type: "button",
13123
+ className: cn(
13124
+ "flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm",
13125
+ "text-neutral-700 hover:bg-neutral-100",
13126
+ "dark:text-neutral-300 dark:hover:bg-neutral-700"
13127
+ ),
13128
+ onClick: () => {
13129
+ console.warn("Share via email", viewTarget);
13130
+ setShareOpen(false);
13131
+ },
13132
+ children: [
13133
+ /* @__PURE__ */ jsx(Mail, { size: 14 }),
13134
+ "Email"
13135
+ ]
13136
+ }
13137
+ )
13100
13138
  ]
13101
13139
  }
13102
13140
  ),
13103
- /* @__PURE__ */ jsxs(
13104
- "button",
13105
- {
13106
- role: "menuitem",
13107
- type: "button",
13108
- className: cn(
13109
- "flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm",
13110
- "text-neutral-700 hover:bg-neutral-100",
13111
- "dark:text-neutral-300 dark:hover:bg-neutral-700"
13112
- ),
13113
- onClick: () => {
13114
- console.warn("Share via email", viewTarget);
13115
- setShareOpen(false);
13116
- },
13117
- children: [
13118
- /* @__PURE__ */ jsx(Mail, { size: 14 }),
13119
- "Email"
13120
- ]
13121
- }
13122
- )
13123
- ]
13124
- }
13125
- )
13126
- ] }),
13141
+ document.body
13142
+ )
13143
+ ]
13144
+ }
13145
+ ),
13127
13146
  /* @__PURE__ */ jsxs(
13128
13147
  Button,
13129
13148
  {
@@ -13177,16 +13196,20 @@ var CountBadge = React10.forwardRef(
13177
13196
  null
13178
13197
  );
13179
13198
  const showMenu = items && items.length > 0;
13180
- React10.useEffect(() => {
13181
- if (!open) return;
13182
- const handleClickOutside = (e) => {
13183
- if (containerRef.current && !containerRef.current.contains(e.target)) {
13184
- setOpen(false);
13185
- }
13186
- };
13187
- document.addEventListener("mousedown", handleClickOutside);
13188
- return () => document.removeEventListener("mousedown", handleClickOutside);
13189
- }, [open]);
13199
+ const {
13200
+ anchorRef,
13201
+ floatingRef,
13202
+ style: menuStyle
13203
+ } = useAnchoredPosition({
13204
+ open: Boolean(showMenu && open),
13205
+ placement: "bottom-end",
13206
+ offset: 8
13207
+ });
13208
+ const outsideRefs = React10.useMemo(
13209
+ () => [containerRef, floatingRef],
13210
+ [floatingRef]
13211
+ );
13212
+ useClickOutside(outsideRefs, () => setOpen(false), open);
13190
13213
  React10.useEffect(() => {
13191
13214
  if (!open) return;
13192
13215
  const handleEscape = (e) => {
@@ -13219,62 +13242,77 @@ var CountBadge = React10.forwardRef(
13219
13242
  );
13220
13243
  const entityLabel = deleteLabel ?? "item";
13221
13244
  return /* @__PURE__ */ jsxs(Fragment, { children: [
13222
- /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative inline-flex", children: [
13223
- /* @__PURE__ */ jsxs(
13224
- "button",
13225
- {
13226
- ref,
13227
- type: "button",
13228
- "data-slot": "count-badge",
13229
- "data-count-badge": "",
13230
- className: cn(countBadgeVariants({ variant }), className),
13231
- onClick: (e) => {
13232
- if (showMenu) {
13233
- setOpen((prev) => !prev);
13234
- }
13235
- props.onClick?.(e);
13236
- },
13237
- "aria-expanded": showMenu ? open : void 0,
13238
- ...props,
13239
- children: [
13240
- icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: icon }),
13241
- /* @__PURE__ */ jsx("span", { children: label }),
13242
- /* @__PURE__ */ jsx(
13243
- "span",
13244
- {
13245
- "data-slot": "count-chip",
13246
- className: cn(
13247
- countChipVariants({ variant: countVariant ?? variant })
13248
- ),
13249
- children: count
13250
- }
13251
- )
13252
- ]
13253
- }
13254
- ),
13255
- showMenu && open && /* @__PURE__ */ jsx(
13256
- HoverMenu,
13257
- {
13258
- items,
13259
- actions: resolvedActions,
13260
- variant
13261
- }
13262
- )
13263
- ] }),
13264
13245
  /* @__PURE__ */ jsxs(
13265
- Modal,
13246
+ "div",
13266
13247
  {
13267
- open: !!deleteTarget,
13268
- onOpenChange: (isOpen) => {
13269
- if (!isOpen) setDeleteTarget(null);
13248
+ ref: (node) => {
13249
+ containerRef.current = node;
13250
+ anchorRef.current = node;
13270
13251
  },
13271
- size: "sm",
13252
+ className: "relative inline-flex",
13272
13253
  children: [
13273
- /* @__PURE__ */ jsxs(ModalHeader, { children: [
13274
- /* @__PURE__ */ jsxs(ModalTitle, { children: [
13275
- "Delete ",
13276
- entityLabel
13277
- ] }),
13254
+ /* @__PURE__ */ jsxs(
13255
+ "button",
13256
+ {
13257
+ ref,
13258
+ type: "button",
13259
+ "data-slot": "count-badge",
13260
+ "data-count-badge": "",
13261
+ className: cn(countBadgeVariants({ variant }), className),
13262
+ onClick: (e) => {
13263
+ if (showMenu) {
13264
+ setOpen((prev) => !prev);
13265
+ }
13266
+ props.onClick?.(e);
13267
+ },
13268
+ "aria-expanded": showMenu ? open : void 0,
13269
+ ...props,
13270
+ children: [
13271
+ icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: icon }),
13272
+ /* @__PURE__ */ jsx("span", { children: label }),
13273
+ /* @__PURE__ */ jsx(
13274
+ "span",
13275
+ {
13276
+ "data-slot": "count-chip",
13277
+ className: cn(
13278
+ countChipVariants({ variant: countVariant ?? variant })
13279
+ ),
13280
+ children: count
13281
+ }
13282
+ )
13283
+ ]
13284
+ }
13285
+ ),
13286
+ showMenu && open && ReactDOM.createPortal(
13287
+ /* @__PURE__ */ jsx(
13288
+ HoverMenu,
13289
+ {
13290
+ items,
13291
+ actions: resolvedActions,
13292
+ variant,
13293
+ floatingRef,
13294
+ style: menuStyle
13295
+ }
13296
+ ),
13297
+ document.body
13298
+ )
13299
+ ]
13300
+ }
13301
+ ),
13302
+ /* @__PURE__ */ jsxs(
13303
+ Modal,
13304
+ {
13305
+ open: !!deleteTarget,
13306
+ onOpenChange: (isOpen) => {
13307
+ if (!isOpen) setDeleteTarget(null);
13308
+ },
13309
+ size: "sm",
13310
+ children: [
13311
+ /* @__PURE__ */ jsxs(ModalHeader, { children: [
13312
+ /* @__PURE__ */ jsxs(ModalTitle, { children: [
13313
+ "Delete ",
13314
+ entityLabel
13315
+ ] }),
13278
13316
  /* @__PURE__ */ jsx(ModalClose, {})
13279
13317
  ] }),
13280
13318
  /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground", children: [
@@ -14927,11 +14965,21 @@ function DateRangePicker({
14927
14965
  setRangeEnd(value.end ?? null);
14928
14966
  }, [value]);
14929
14967
  const wrapperRef = React10.useRef(null);
14930
- useClickOutside(wrapperRef, () => {
14931
- if (isCalendarOpen) {
14968
+ const outsideRefs = React10.useMemo(
14969
+ () => [wrapperRef, calendarRef],
14970
+ [calendarRef]
14971
+ );
14972
+ useClickOutside(
14973
+ outsideRefs,
14974
+ () => {
14932
14975
  setIsCalendarOpen(false);
14933
14976
  setSelectingEnd(false);
14934
- }
14977
+ },
14978
+ isCalendarOpen
14979
+ );
14980
+ const { anchorRef, floatingRef, style } = useAnchoredPosition({
14981
+ open: !isMobileVariant && isCalendarOpen,
14982
+ placement: resolvedAlign === "end" ? "bottom-end" : "bottom-start"
14935
14983
  });
14936
14984
  useEscapeKey(() => {
14937
14985
  setIsCalendarOpen(false);
@@ -15156,7 +15204,10 @@ function DateRangePicker({
15156
15204
  return /* @__PURE__ */ jsxs(
15157
15205
  "div",
15158
15206
  {
15159
- ref: wrapperRef,
15207
+ ref: (node) => {
15208
+ wrapperRef.current = node;
15209
+ anchorRef.current = node;
15210
+ },
15160
15211
  className: cn("relative inline-block", className),
15161
15212
  "data-slot": "date-range-picker",
15162
15213
  children: [
@@ -15298,147 +15349,153 @@ function DateRangePicker({
15298
15349
  )
15299
15350
  }
15300
15351
  ),
15301
- !isMobileVariant && isCalendarOpen && /* @__PURE__ */ jsx(
15302
- "div",
15303
- {
15304
- ref: calendarRef,
15305
- className: cn(
15306
- "absolute top-full z-50 mt-1",
15307
- resolvedAlign === "end" ? "right-0" : "left-0",
15308
- "bg-background border-border rounded-lg border shadow-lg"
15309
- ),
15310
- role: "dialog",
15311
- "aria-label": "Choose date range",
15312
- "data-slot": "date-range-popup",
15313
- children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
15314
- showPresets && /* @__PURE__ */ jsx(
15315
- "div",
15316
- {
15317
- className: cn(
15318
- "border-border flex w-[200px] shrink-0 flex-col gap-0.5 border-r p-3",
15319
- isResponsive && "hidden md:flex"
15320
- ),
15321
- "data-slot": "date-range-presets",
15322
- children: finalPresets.map((preset) => /* @__PURE__ */ jsx(
15323
- "button",
15324
- {
15325
- type: "button",
15326
- onClick: () => handlePresetSelect(preset.key),
15327
- "data-slot": "date-range-preset",
15328
- className: cn(
15329
- "rounded-md px-3 py-1.5 text-left text-sm transition-colors",
15330
- "hover:bg-muted",
15331
- activePreset === preset.key && "bg-primary-800 text-white"
15332
- ),
15333
- children: preset.label
15334
- },
15335
- preset.key
15336
- ))
15337
- }
15352
+ !isMobileVariant && isCalendarOpen && createPortal(
15353
+ /* @__PURE__ */ jsx(
15354
+ "div",
15355
+ {
15356
+ ref: (node) => {
15357
+ calendarRef.current = node;
15358
+ floatingRef.current = node;
15359
+ },
15360
+ style,
15361
+ className: cn(
15362
+ "overflow-auto",
15363
+ "bg-background border-border rounded-lg border shadow-lg"
15338
15364
  ),
15339
- /* @__PURE__ */ jsxs("div", { className: "p-4", "data-slot": "date-range-calendar", children: [
15340
- /* @__PURE__ */ jsx(
15341
- "p",
15342
- {
15343
- className: "text-muted-foreground mb-4 text-sm",
15344
- "data-slot": "date-range-subtitle",
15345
- children: "Select a start and end date from the calendar."
15346
- }
15347
- ),
15348
- /* @__PURE__ */ jsxs(
15365
+ role: "dialog",
15366
+ "aria-label": "Choose date range",
15367
+ "data-slot": "date-range-popup",
15368
+ children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
15369
+ showPresets && /* @__PURE__ */ jsx(
15349
15370
  "div",
15350
15371
  {
15351
- className: "flex gap-8",
15352
- onMouseLeave: () => setHoverDate(null),
15353
- "data-slot": "date-range-calendars",
15354
- children: [
15355
- /* @__PURE__ */ jsxs("div", { children: [
15356
- /* @__PURE__ */ jsxs(
15357
- "div",
15358
- {
15359
- className: "mb-3 flex items-center",
15360
- "data-slot": "date-range-month-header",
15361
- children: [
15362
- /* @__PURE__ */ jsx(
15363
- "button",
15364
- {
15365
- type: "button",
15366
- onClick: goToPrevMonth,
15367
- className: "hover:bg-muted rounded-md p-1 transition-colors",
15368
- "aria-label": "Previous month",
15369
- "data-slot": "date-range-nav",
15370
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
15371
- }
15372
- ),
15373
- /* @__PURE__ */ jsxs(
15374
- "div",
15375
- {
15376
- className: "flex-1 text-center text-sm font-medium",
15377
- "data-slot": "date-range-month-label",
15378
- children: [
15379
- monthNames[leftMonth],
15380
- " ",
15381
- leftYear
15382
- ]
15383
- }
15384
- ),
15385
- isResponsive && /* @__PURE__ */ jsx(
15386
- "button",
15387
- {
15388
- type: "button",
15389
- onClick: goToNextMonth,
15390
- className: "hover:bg-muted rounded-md p-1 transition-colors md:hidden",
15391
- "aria-label": "Next month",
15392
- "data-slot": "date-range-nav",
15393
- children: /* @__PURE__ */ jsx(ChevronRight$1, { className: "h-4 w-4" })
15394
- }
15395
- )
15396
- ]
15397
- }
15398
- ),
15399
- renderMonthGrid(leftMonth, leftYear)
15400
- ] }),
15401
- /* @__PURE__ */ jsxs("div", { className: cn(isResponsive && "hidden md:block"), children: [
15402
- /* @__PURE__ */ jsxs(
15403
- "div",
15404
- {
15405
- className: "mb-3 flex items-center",
15406
- "data-slot": "date-range-month-header",
15407
- children: [
15408
- /* @__PURE__ */ jsxs(
15409
- "div",
15410
- {
15411
- className: "flex-1 text-center text-sm font-medium",
15412
- "data-slot": "date-range-month-label",
15413
- children: [
15414
- monthNames[rightMonth],
15415
- " ",
15416
- rightYear
15417
- ]
15418
- }
15419
- ),
15420
- /* @__PURE__ */ jsx(
15421
- "button",
15422
- {
15423
- type: "button",
15424
- onClick: goToNextMonth,
15425
- className: "hover:bg-muted rounded-md p-1 transition-colors",
15426
- "aria-label": "Next month",
15427
- "data-slot": "date-range-nav",
15428
- children: /* @__PURE__ */ jsx(ChevronRight$1, { className: "h-4 w-4" })
15429
- }
15430
- )
15431
- ]
15432
- }
15372
+ className: cn(
15373
+ "border-border flex w-[200px] shrink-0 flex-col gap-0.5 border-r p-3",
15374
+ isResponsive && "hidden md:flex"
15375
+ ),
15376
+ "data-slot": "date-range-presets",
15377
+ children: finalPresets.map((preset) => /* @__PURE__ */ jsx(
15378
+ "button",
15379
+ {
15380
+ type: "button",
15381
+ onClick: () => handlePresetSelect(preset.key),
15382
+ "data-slot": "date-range-preset",
15383
+ className: cn(
15384
+ "rounded-md px-3 py-1.5 text-left text-sm transition-colors",
15385
+ "hover:bg-muted",
15386
+ activePreset === preset.key && "bg-primary-800 text-white"
15433
15387
  ),
15434
- renderMonthGrid(rightMonth, rightYear)
15435
- ] })
15436
- ]
15388
+ children: preset.label
15389
+ },
15390
+ preset.key
15391
+ ))
15437
15392
  }
15438
- )
15393
+ ),
15394
+ /* @__PURE__ */ jsxs("div", { className: "p-4", "data-slot": "date-range-calendar", children: [
15395
+ /* @__PURE__ */ jsx(
15396
+ "p",
15397
+ {
15398
+ className: "text-muted-foreground mb-4 text-sm",
15399
+ "data-slot": "date-range-subtitle",
15400
+ children: "Select a start and end date from the calendar."
15401
+ }
15402
+ ),
15403
+ /* @__PURE__ */ jsxs(
15404
+ "div",
15405
+ {
15406
+ className: "flex gap-8",
15407
+ onMouseLeave: () => setHoverDate(null),
15408
+ "data-slot": "date-range-calendars",
15409
+ children: [
15410
+ /* @__PURE__ */ jsxs("div", { children: [
15411
+ /* @__PURE__ */ jsxs(
15412
+ "div",
15413
+ {
15414
+ className: "mb-3 flex items-center",
15415
+ "data-slot": "date-range-month-header",
15416
+ children: [
15417
+ /* @__PURE__ */ jsx(
15418
+ "button",
15419
+ {
15420
+ type: "button",
15421
+ onClick: goToPrevMonth,
15422
+ className: "hover:bg-muted rounded-md p-1 transition-colors",
15423
+ "aria-label": "Previous month",
15424
+ "data-slot": "date-range-nav",
15425
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
15426
+ }
15427
+ ),
15428
+ /* @__PURE__ */ jsxs(
15429
+ "div",
15430
+ {
15431
+ className: "flex-1 text-center text-sm font-medium",
15432
+ "data-slot": "date-range-month-label",
15433
+ children: [
15434
+ monthNames[leftMonth],
15435
+ " ",
15436
+ leftYear
15437
+ ]
15438
+ }
15439
+ ),
15440
+ isResponsive && /* @__PURE__ */ jsx(
15441
+ "button",
15442
+ {
15443
+ type: "button",
15444
+ onClick: goToNextMonth,
15445
+ className: "hover:bg-muted rounded-md p-1 transition-colors md:hidden",
15446
+ "aria-label": "Next month",
15447
+ "data-slot": "date-range-nav",
15448
+ children: /* @__PURE__ */ jsx(ChevronRight$1, { className: "h-4 w-4" })
15449
+ }
15450
+ )
15451
+ ]
15452
+ }
15453
+ ),
15454
+ renderMonthGrid(leftMonth, leftYear)
15455
+ ] }),
15456
+ /* @__PURE__ */ jsxs("div", { className: cn(isResponsive && "hidden md:block"), children: [
15457
+ /* @__PURE__ */ jsxs(
15458
+ "div",
15459
+ {
15460
+ className: "mb-3 flex items-center",
15461
+ "data-slot": "date-range-month-header",
15462
+ children: [
15463
+ /* @__PURE__ */ jsxs(
15464
+ "div",
15465
+ {
15466
+ className: "flex-1 text-center text-sm font-medium",
15467
+ "data-slot": "date-range-month-label",
15468
+ children: [
15469
+ monthNames[rightMonth],
15470
+ " ",
15471
+ rightYear
15472
+ ]
15473
+ }
15474
+ ),
15475
+ /* @__PURE__ */ jsx(
15476
+ "button",
15477
+ {
15478
+ type: "button",
15479
+ onClick: goToNextMonth,
15480
+ className: "hover:bg-muted rounded-md p-1 transition-colors",
15481
+ "aria-label": "Next month",
15482
+ "data-slot": "date-range-nav",
15483
+ children: /* @__PURE__ */ jsx(ChevronRight$1, { className: "h-4 w-4" })
15484
+ }
15485
+ )
15486
+ ]
15487
+ }
15488
+ ),
15489
+ renderMonthGrid(rightMonth, rightYear)
15490
+ ] })
15491
+ ]
15492
+ }
15493
+ )
15494
+ ] })
15439
15495
  ] })
15440
- ] })
15441
- }
15496
+ }
15497
+ ),
15498
+ document.body
15442
15499
  )
15443
15500
  ]
15444
15501
  }
@@ -23955,16 +24012,13 @@ function LanguageSelector({
23955
24012
  }) {
23956
24013
  const [isOpen, setIsOpen] = React10.useState(false);
23957
24014
  const containerRef = React10.useRef(null);
24015
+ const { anchorRef, floatingRef, style } = useAnchoredPosition({ open: isOpen, matchMinWidth: true, maxHeight: 240 });
23958
24016
  const selectedLanguage = languages.find((l) => l.code === value);
23959
- React10.useEffect(() => {
23960
- const handleClickOutside = (e) => {
23961
- if (containerRef.current && !containerRef.current.contains(e.target)) {
23962
- setIsOpen(false);
23963
- }
23964
- };
23965
- document.addEventListener("mousedown", handleClickOutside);
23966
- return () => document.removeEventListener("mousedown", handleClickOutside);
23967
- }, []);
24017
+ const outsideRefs = React10.useMemo(
24018
+ () => [containerRef, floatingRef],
24019
+ [floatingRef]
24020
+ );
24021
+ useClickOutside(outsideRefs, () => setIsOpen(false), isOpen);
23968
24022
  React10.useEffect(() => {
23969
24023
  const handleEscape = (e) => {
23970
24024
  if (e.key === "Escape") setIsOpen(false);
@@ -23979,7 +24033,10 @@ function LanguageSelector({
23979
24033
  return /* @__PURE__ */ jsxs(
23980
24034
  "div",
23981
24035
  {
23982
- ref: containerRef,
24036
+ ref: (node) => {
24037
+ containerRef.current = node;
24038
+ anchorRef.current = node;
24039
+ },
23983
24040
  "data-slot": "language-selector",
23984
24041
  className: cn(selectorVariants({ size }), className),
23985
24042
  children: [
@@ -24015,44 +24072,41 @@ function LanguageSelector({
24015
24072
  ]
24016
24073
  }
24017
24074
  ),
24018
- isOpen && /* @__PURE__ */ jsx(
24019
- "div",
24020
- {
24021
- "data-slot": "language-selector-dropdown",
24022
- className: cn(
24023
- "absolute z-50 mt-1 w-full min-w-[180px] rounded-lg border border-gray-200 bg-white shadow-lg",
24024
- "dark:border-gray-700 dark:bg-gray-800",
24025
- "animate-in fade-in slide-in-from-top-1 duration-150"
24026
- ),
24027
- children: /* @__PURE__ */ jsx(
24028
- "ul",
24029
- {
24030
- role: "listbox",
24031
- "aria-label": label,
24032
- className: "max-h-60 overflow-auto py-1",
24033
- children: languages.map((language) => /* @__PURE__ */ jsxs(
24034
- "li",
24035
- {
24036
- role: "option",
24037
- "aria-selected": language.code === value,
24038
- onClick: () => handleSelect(language),
24039
- onKeyDown: (e) => e.key === "Enter" && handleSelect(language),
24040
- "data-slot": "language-selector-option",
24041
- className: cn(
24042
- "flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition-colors",
24043
- language.code === value ? "bg-primary-50 text-primary-700 dark:bg-primary-900/20 dark:text-primary-400" : "text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"
24044
- ),
24045
- children: [
24046
- showFlags && language.flag && /* @__PURE__ */ jsx("span", { className: "text-base", children: language.flag }),
24047
- /* @__PURE__ */ jsx("span", { className: "flex-1", children: language.name }),
24048
- language.code === value && /* @__PURE__ */ jsx(CheckIcon2, { className: "text-primary-800 dark:text-primary-400 h-4 w-4" })
24049
- ]
24050
- },
24051
- language.code
24052
- ))
24053
- }
24054
- )
24055
- }
24075
+ isOpen && createPortal(
24076
+ /* @__PURE__ */ jsx(
24077
+ "div",
24078
+ {
24079
+ ref: floatingRef,
24080
+ style,
24081
+ "data-slot": "language-selector-dropdown",
24082
+ className: cn(
24083
+ "min-w-[180px] overflow-auto rounded-lg border border-gray-200 bg-white shadow-lg",
24084
+ "dark:border-gray-700 dark:bg-gray-800",
24085
+ "animate-in fade-in slide-in-from-top-1 duration-150"
24086
+ ),
24087
+ children: /* @__PURE__ */ jsx("ul", { role: "listbox", "aria-label": label, className: "py-1", children: languages.map((language) => /* @__PURE__ */ jsxs(
24088
+ "li",
24089
+ {
24090
+ role: "option",
24091
+ "aria-selected": language.code === value,
24092
+ onClick: () => handleSelect(language),
24093
+ onKeyDown: (e) => e.key === "Enter" && handleSelect(language),
24094
+ "data-slot": "language-selector-option",
24095
+ className: cn(
24096
+ "flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition-colors",
24097
+ language.code === value ? "bg-primary-50 text-primary-700 dark:bg-primary-900/20 dark:text-primary-400" : "text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"
24098
+ ),
24099
+ children: [
24100
+ showFlags && language.flag && /* @__PURE__ */ jsx("span", { className: "text-base", children: language.flag }),
24101
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: language.name }),
24102
+ language.code === value && /* @__PURE__ */ jsx(CheckIcon2, { className: "text-primary-800 dark:text-primary-400 h-4 w-4" })
24103
+ ]
24104
+ },
24105
+ language.code
24106
+ )) })
24107
+ }
24108
+ ),
24109
+ document.body
24056
24110
  )
24057
24111
  ]
24058
24112
  }
@@ -27077,9 +27131,15 @@ function PatientOverflowMenu({
27077
27131
  }) {
27078
27132
  const [open, setOpen] = React10.useState(false);
27079
27133
  const menuRef = React10.useRef(null);
27134
+ const { anchorRef, floatingRef, style } = useAnchoredPosition({ open, placement: "bottom-end" });
27135
+ const outsideRefs = React10.useMemo(
27136
+ () => [menuRef, floatingRef],
27137
+ [floatingRef]
27138
+ );
27080
27139
  useClickOutside(
27081
- menuRef,
27082
- React10.useCallback(() => setOpen(false), [])
27140
+ outsideRefs,
27141
+ React10.useCallback(() => setOpen(false), []),
27142
+ open
27083
27143
  );
27084
27144
  useEscapeKey(
27085
27145
  React10.useCallback(() => setOpen(false), []),
@@ -27089,174 +27149,188 @@ function PatientOverflowMenu({
27089
27149
  onAction?.(action);
27090
27150
  setOpen(false);
27091
27151
  };
27092
- return /* @__PURE__ */ jsxs("div", { className: "relative", ref: menuRef, children: [
27093
- /* @__PURE__ */ jsx(
27094
- Button,
27095
- {
27096
- variant: "ghost",
27097
- size: "icon",
27098
- onClick: () => setOpen(!open),
27099
- "aria-label": "Patient actions menu",
27100
- "aria-haspopup": "menu",
27101
- "aria-expanded": open,
27102
- className: "h-8 w-8",
27103
- children: /* @__PURE__ */ jsx(MoreVertical, { size: 18 })
27104
- }
27105
- ),
27106
- open && /* @__PURE__ */ jsx(
27107
- "div",
27108
- {
27109
- role: "menu",
27110
- "aria-label": "Patient actions",
27111
- className: cn(
27112
- "absolute top-full right-0 z-50 mt-1",
27113
- "w-[calc(100vw_-_2rem)] md:w-auto",
27114
- "border-border bg-card rounded-xl border py-1 shadow-lg",
27115
- "max-h-[calc(100vh_-_3rem)] overflow-y-auto md:max-h-[calc(100vh_-_4rem)]",
27116
- "motion-safe:animate-fade-in"
27152
+ return /* @__PURE__ */ jsxs(
27153
+ "div",
27154
+ {
27155
+ className: "relative",
27156
+ ref: (node) => {
27157
+ menuRef.current = node;
27158
+ anchorRef.current = node;
27159
+ },
27160
+ children: [
27161
+ /* @__PURE__ */ jsx(
27162
+ Button,
27163
+ {
27164
+ variant: "ghost",
27165
+ size: "icon",
27166
+ onClick: () => setOpen(!open),
27167
+ "aria-label": "Patient actions menu",
27168
+ "aria-haspopup": "menu",
27169
+ "aria-expanded": open,
27170
+ className: "h-8 w-8",
27171
+ children: /* @__PURE__ */ jsx(MoreVertical, { size: 18 })
27172
+ }
27117
27173
  ),
27118
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row", children: [
27119
- /* @__PURE__ */ jsxs("div", { className: "min-w-[13rem]", children: [
27120
- /* @__PURE__ */ jsx("div", { className: "px-3 py-1.5", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-[11px] font-semibold tracking-wide uppercase", children: "Quick Actions" }) }),
27121
- /* @__PURE__ */ jsx(
27122
- OverflowMenuItem,
27123
- {
27124
- icon: /* @__PURE__ */ jsx(Pencil, { size: 15 }),
27125
- label: "Edit Patient",
27126
- onClick: () => handleAction("edit-patient")
27127
- }
27128
- ),
27129
- /* @__PURE__ */ jsx(
27130
- OverflowMenuItem,
27131
- {
27132
- icon: /* @__PURE__ */ jsx(Phone, { size: 15 }),
27133
- label: "Contact",
27134
- onClick: () => handleAction("contact")
27135
- }
27136
- ),
27137
- /* @__PURE__ */ jsx(
27138
- OverflowMenuItem,
27139
- {
27140
- icon: /* @__PURE__ */ jsx(Send, { size: 15 }),
27141
- label: "Send Message",
27142
- onClick: () => handleAction("send-message")
27143
- }
27144
- ),
27145
- /* @__PURE__ */ jsx(
27146
- OverflowMenuItem,
27147
- {
27148
- icon: /* @__PURE__ */ jsx(Calendar, { size: 15 }),
27149
- label: "Schedule Appointment",
27150
- onClick: () => handleAction("schedule-appointment")
27151
- }
27152
- ),
27153
- /* @__PURE__ */ jsx(
27154
- OverflowMenuItem,
27155
- {
27156
- icon: /* @__PURE__ */ jsx(Printer, { size: 15 }),
27157
- label: "Print Summary",
27158
- onClick: () => handleAction("print-summary")
27159
- }
27160
- ),
27161
- /* @__PURE__ */ jsx(
27162
- OverflowMenuItem,
27163
- {
27164
- icon: /* @__PURE__ */ jsx(Download, { size: 15 }),
27165
- label: "Export Record",
27166
- onClick: () => handleAction("export-record")
27167
- }
27168
- )
27169
- ] }),
27170
- /* @__PURE__ */ jsx("div", { className: "border-border my-1 border-t md:my-0 md:border-t-0 md:border-l" }),
27171
- /* @__PURE__ */ jsxs("div", { className: "md:min-w-[26rem]", children: [
27172
- /* @__PURE__ */ jsx("div", { className: "px-3 py-1.5", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-[11px] font-semibold tracking-wide uppercase", children: "Add" }) }),
27173
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-1 md:grid-cols-2 md:gap-2", children: [
27174
- /* @__PURE__ */ jsx(
27175
- OverflowMenuItem,
27176
- {
27177
- icon: /* @__PURE__ */ jsx(ClipboardPlus, { size: 15 }),
27178
- label: "Task",
27179
- onClick: () => handleAction("add-task")
27180
- }
27181
- ),
27182
- /* @__PURE__ */ jsx(
27183
- OverflowMenuItem,
27184
- {
27185
- icon: /* @__PURE__ */ jsx(Stethoscope, { size: 15 }),
27186
- label: "Encounter",
27187
- onClick: () => handleAction("add-encounter")
27188
- }
27189
- ),
27190
- /* @__PURE__ */ jsx(
27191
- OverflowMenuItem,
27192
- {
27193
- icon: /* @__PURE__ */ jsx(ClipboardCheck, { size: 15 }),
27194
- label: "Due List Item",
27195
- onClick: () => handleAction("add-due-list")
27196
- }
27197
- ),
27198
- /* @__PURE__ */ jsx(
27199
- OverflowMenuItem,
27200
- {
27201
- icon: /* @__PURE__ */ jsx(FilePlus, { size: 15 }),
27202
- label: "Order Request",
27203
- onClick: () => handleAction("add-order")
27204
- }
27205
- ),
27206
- /* @__PURE__ */ jsx(
27207
- OverflowMenuItem,
27208
- {
27209
- icon: /* @__PURE__ */ jsx(FileCheck, { size: 15 }),
27210
- label: "eSign Request",
27211
- onClick: () => handleAction("add-esign")
27212
- }
27213
- ),
27214
- /* @__PURE__ */ jsx(
27215
- OverflowMenuItem,
27216
- {
27217
- icon: /* @__PURE__ */ jsx(Wheat, { size: 15 }),
27218
- label: "Allergy",
27219
- onClick: () => handleAction("add-allergy")
27220
- }
27221
- ),
27222
- /* @__PURE__ */ jsx(
27223
- OverflowMenuItem,
27224
- {
27225
- icon: /* @__PURE__ */ jsx(Pill, { size: 15 }),
27226
- label: "Medication",
27227
- onClick: () => handleAction("add-medication")
27228
- }
27229
- ),
27230
- /* @__PURE__ */ jsx(
27231
- OverflowMenuItem,
27232
- {
27233
- icon: /* @__PURE__ */ jsx(Bell, { size: 15 }),
27234
- label: "Alert",
27235
- onClick: () => handleAction("add-alert")
27236
- }
27237
- ),
27238
- /* @__PURE__ */ jsx(
27239
- OverflowMenuItem,
27240
- {
27241
- icon: /* @__PURE__ */ jsx(FileHeart, { size: 15 }),
27242
- label: "Condition",
27243
- onClick: () => handleAction("add-condition")
27244
- }
27174
+ open && createPortal(
27175
+ /* @__PURE__ */ jsx(
27176
+ "div",
27177
+ {
27178
+ ref: floatingRef,
27179
+ style,
27180
+ role: "menu",
27181
+ "aria-label": "Patient actions",
27182
+ className: cn(
27183
+ "w-[calc(100vw_-_2rem)] md:w-auto",
27184
+ "border-border bg-card rounded-xl border py-1 shadow-lg",
27185
+ "overflow-y-auto",
27186
+ "motion-safe:animate-fade-in"
27245
27187
  ),
27246
- /* @__PURE__ */ jsx(
27247
- OverflowMenuItem,
27248
- {
27249
- icon: /* @__PURE__ */ jsx(HeartPulse, { size: 15 }),
27250
- label: "Vitals",
27251
- onClick: () => handleAction("add-vitals")
27252
- }
27253
- )
27254
- ] })
27255
- ] })
27256
- ] })
27257
- }
27258
- )
27259
- ] });
27188
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row", children: [
27189
+ /* @__PURE__ */ jsxs("div", { className: "min-w-[13rem]", children: [
27190
+ /* @__PURE__ */ jsx("div", { className: "px-3 py-1.5", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-[11px] font-semibold tracking-wide uppercase", children: "Quick Actions" }) }),
27191
+ /* @__PURE__ */ jsx(
27192
+ OverflowMenuItem,
27193
+ {
27194
+ icon: /* @__PURE__ */ jsx(Pencil, { size: 15 }),
27195
+ label: "Edit Patient",
27196
+ onClick: () => handleAction("edit-patient")
27197
+ }
27198
+ ),
27199
+ /* @__PURE__ */ jsx(
27200
+ OverflowMenuItem,
27201
+ {
27202
+ icon: /* @__PURE__ */ jsx(Phone, { size: 15 }),
27203
+ label: "Contact",
27204
+ onClick: () => handleAction("contact")
27205
+ }
27206
+ ),
27207
+ /* @__PURE__ */ jsx(
27208
+ OverflowMenuItem,
27209
+ {
27210
+ icon: /* @__PURE__ */ jsx(Send, { size: 15 }),
27211
+ label: "Send Message",
27212
+ onClick: () => handleAction("send-message")
27213
+ }
27214
+ ),
27215
+ /* @__PURE__ */ jsx(
27216
+ OverflowMenuItem,
27217
+ {
27218
+ icon: /* @__PURE__ */ jsx(Calendar, { size: 15 }),
27219
+ label: "Schedule Appointment",
27220
+ onClick: () => handleAction("schedule-appointment")
27221
+ }
27222
+ ),
27223
+ /* @__PURE__ */ jsx(
27224
+ OverflowMenuItem,
27225
+ {
27226
+ icon: /* @__PURE__ */ jsx(Printer, { size: 15 }),
27227
+ label: "Print Summary",
27228
+ onClick: () => handleAction("print-summary")
27229
+ }
27230
+ ),
27231
+ /* @__PURE__ */ jsx(
27232
+ OverflowMenuItem,
27233
+ {
27234
+ icon: /* @__PURE__ */ jsx(Download, { size: 15 }),
27235
+ label: "Export Record",
27236
+ onClick: () => handleAction("export-record")
27237
+ }
27238
+ )
27239
+ ] }),
27240
+ /* @__PURE__ */ jsx("div", { className: "border-border my-1 border-t md:my-0 md:border-t-0 md:border-l" }),
27241
+ /* @__PURE__ */ jsxs("div", { className: "md:min-w-[26rem]", children: [
27242
+ /* @__PURE__ */ jsx("div", { className: "px-3 py-1.5", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-[11px] font-semibold tracking-wide uppercase", children: "Add" }) }),
27243
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-1 md:grid-cols-2 md:gap-2", children: [
27244
+ /* @__PURE__ */ jsx(
27245
+ OverflowMenuItem,
27246
+ {
27247
+ icon: /* @__PURE__ */ jsx(ClipboardPlus, { size: 15 }),
27248
+ label: "Task",
27249
+ onClick: () => handleAction("add-task")
27250
+ }
27251
+ ),
27252
+ /* @__PURE__ */ jsx(
27253
+ OverflowMenuItem,
27254
+ {
27255
+ icon: /* @__PURE__ */ jsx(Stethoscope, { size: 15 }),
27256
+ label: "Encounter",
27257
+ onClick: () => handleAction("add-encounter")
27258
+ }
27259
+ ),
27260
+ /* @__PURE__ */ jsx(
27261
+ OverflowMenuItem,
27262
+ {
27263
+ icon: /* @__PURE__ */ jsx(ClipboardCheck, { size: 15 }),
27264
+ label: "Due List Item",
27265
+ onClick: () => handleAction("add-due-list")
27266
+ }
27267
+ ),
27268
+ /* @__PURE__ */ jsx(
27269
+ OverflowMenuItem,
27270
+ {
27271
+ icon: /* @__PURE__ */ jsx(FilePlus, { size: 15 }),
27272
+ label: "Order Request",
27273
+ onClick: () => handleAction("add-order")
27274
+ }
27275
+ ),
27276
+ /* @__PURE__ */ jsx(
27277
+ OverflowMenuItem,
27278
+ {
27279
+ icon: /* @__PURE__ */ jsx(FileCheck, { size: 15 }),
27280
+ label: "eSign Request",
27281
+ onClick: () => handleAction("add-esign")
27282
+ }
27283
+ ),
27284
+ /* @__PURE__ */ jsx(
27285
+ OverflowMenuItem,
27286
+ {
27287
+ icon: /* @__PURE__ */ jsx(Wheat, { size: 15 }),
27288
+ label: "Allergy",
27289
+ onClick: () => handleAction("add-allergy")
27290
+ }
27291
+ ),
27292
+ /* @__PURE__ */ jsx(
27293
+ OverflowMenuItem,
27294
+ {
27295
+ icon: /* @__PURE__ */ jsx(Pill, { size: 15 }),
27296
+ label: "Medication",
27297
+ onClick: () => handleAction("add-medication")
27298
+ }
27299
+ ),
27300
+ /* @__PURE__ */ jsx(
27301
+ OverflowMenuItem,
27302
+ {
27303
+ icon: /* @__PURE__ */ jsx(Bell, { size: 15 }),
27304
+ label: "Alert",
27305
+ onClick: () => handleAction("add-alert")
27306
+ }
27307
+ ),
27308
+ /* @__PURE__ */ jsx(
27309
+ OverflowMenuItem,
27310
+ {
27311
+ icon: /* @__PURE__ */ jsx(FileHeart, { size: 15 }),
27312
+ label: "Condition",
27313
+ onClick: () => handleAction("add-condition")
27314
+ }
27315
+ ),
27316
+ /* @__PURE__ */ jsx(
27317
+ OverflowMenuItem,
27318
+ {
27319
+ icon: /* @__PURE__ */ jsx(HeartPulse, { size: 15 }),
27320
+ label: "Vitals",
27321
+ onClick: () => handleAction("add-vitals")
27322
+ }
27323
+ )
27324
+ ] })
27325
+ ] })
27326
+ ] })
27327
+ }
27328
+ ),
27329
+ document.body
27330
+ )
27331
+ ]
27332
+ }
27333
+ );
27260
27334
  }
27261
27335
  function AlertRow({ comments }) {
27262
27336
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -31992,15 +32066,12 @@ function ServiceMultiSelect({
31992
32066
  const containerRef = React10.useRef(null);
31993
32067
  const inputRef = React10.useRef(null);
31994
32068
  const listboxId = React10.useId();
31995
- React10.useEffect(() => {
31996
- function handleClickOutside(event) {
31997
- if (containerRef.current && !containerRef.current.contains(event.target)) {
31998
- setIsOpen(false);
31999
- }
32000
- }
32001
- document.addEventListener("mousedown", handleClickOutside);
32002
- return () => document.removeEventListener("mousedown", handleClickOutside);
32003
- }, []);
32069
+ const { anchorRef, floatingRef, style } = useAnchoredPosition({ open: isOpen, matchWidth: true, maxHeight: 240 });
32070
+ const outsideRefs = React10.useMemo(
32071
+ () => [containerRef, floatingRef],
32072
+ [floatingRef]
32073
+ );
32074
+ useClickOutside(outsideRefs, () => setIsOpen(false), isOpen);
32004
32075
  const filteredServices = React10.useMemo(() => {
32005
32076
  if (!searchTerm) return services;
32006
32077
  const lowerSearch = searchTerm.toLowerCase();
@@ -32041,7 +32112,10 @@ function ServiceMultiSelect({
32041
32112
  return /* @__PURE__ */ jsxs(
32042
32113
  "div",
32043
32114
  {
32044
- ref: containerRef,
32115
+ ref: (node) => {
32116
+ containerRef.current = node;
32117
+ anchorRef.current = node;
32118
+ },
32045
32119
  className: "relative",
32046
32120
  "data-slot": "provider-service-select",
32047
32121
  children: [
@@ -32073,99 +32147,106 @@ function ServiceMultiSelect({
32073
32147
  children: selectedServices.length > 0 ? `${selectedServices.length} service${selectedServices.length > 1 ? "s" : ""} selected` : placeholder
32074
32148
  }
32075
32149
  ) }),
32076
- isOpen && /* @__PURE__ */ jsxs(
32077
- "div",
32078
- {
32079
- className: cn(
32080
- "absolute z-50 mt-1 w-full rounded-md border border-neutral-200 bg-white shadow-lg",
32081
- "dark:border-neutral-700 dark:bg-neutral-800",
32082
- "max-h-60 overflow-auto"
32083
- ),
32084
- role: "listbox",
32085
- id: listboxId,
32086
- "aria-multiselectable": "true",
32087
- children: [
32088
- /* @__PURE__ */ jsxs("div", { className: "sticky top-0 border-b border-neutral-200 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-800", children: [
32089
- /* @__PURE__ */ jsx(
32090
- "input",
32150
+ isOpen && createPortal(
32151
+ /* @__PURE__ */ jsxs(
32152
+ "div",
32153
+ {
32154
+ ref: floatingRef,
32155
+ style,
32156
+ className: cn(
32157
+ "rounded-md border border-neutral-200 bg-white shadow-lg",
32158
+ "dark:border-neutral-700 dark:bg-neutral-800",
32159
+ "overflow-auto"
32160
+ ),
32161
+ role: "listbox",
32162
+ id: listboxId,
32163
+ "aria-multiselectable": "true",
32164
+ children: [
32165
+ /* @__PURE__ */ jsxs("div", { className: "sticky top-0 border-b border-neutral-200 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-800", children: [
32166
+ /* @__PURE__ */ jsx(
32167
+ "input",
32168
+ {
32169
+ ref: inputRef,
32170
+ type: "text",
32171
+ value: searchTerm,
32172
+ onChange: (e) => setSearchTerm(e.target.value),
32173
+ placeholder: "Search services...",
32174
+ className: cn(inputVariants3({ hasIcon: true }), "pl-8"),
32175
+ autoFocus: true
32176
+ }
32177
+ ),
32178
+ /* @__PURE__ */ jsx(SearchIcon4, { className: "absolute top-1/2 left-4 -translate-y-1/2 text-neutral-400" })
32179
+ ] }),
32180
+ Object.entries(groupedServices).length > 0 ? Object.entries(groupedServices).map(
32181
+ ([category, categoryServices]) => /* @__PURE__ */ jsxs("div", { children: [
32182
+ services.some((s) => s.category) && /* @__PURE__ */ jsx("div", { className: "bg-neutral-50 px-3 py-2 text-xs font-semibold tracking-wider text-neutral-500 uppercase dark:bg-neutral-900 dark:text-neutral-400", children: category }),
32183
+ categoryServices.map((service) => {
32184
+ const isSelected = selectedServices.includes(
32185
+ service.value
32186
+ );
32187
+ return /* @__PURE__ */ jsxs(
32188
+ "button",
32189
+ {
32190
+ type: "button",
32191
+ role: "option",
32192
+ "aria-selected": isSelected,
32193
+ onClick: () => handleToggleService(service.value),
32194
+ className: cn(
32195
+ "flex w-full items-center justify-between px-3 py-2 text-left text-sm",
32196
+ "hover:bg-neutral-100 dark:hover:bg-neutral-700",
32197
+ isSelected && "bg-primary-50 dark:bg-primary-900/20"
32198
+ ),
32199
+ children: [
32200
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
32201
+ /* @__PURE__ */ jsx(
32202
+ "span",
32203
+ {
32204
+ className: cn(
32205
+ "flex h-4 w-4 items-center justify-center rounded border",
32206
+ isSelected ? "bg-primary-800 border-primary-500 text-white" : "border-neutral-300 dark:border-neutral-600"
32207
+ ),
32208
+ children: isSelected && /* @__PURE__ */ jsx(
32209
+ "svg",
32210
+ {
32211
+ "aria-hidden": "true",
32212
+ className: "h-3 w-3",
32213
+ viewBox: "0 0 12 12",
32214
+ fill: "currentColor",
32215
+ children: /* @__PURE__ */ jsx("path", { d: "M10.28 2.28L4.75 7.81 1.72 4.78a.75.75 0 00-1.06 1.06l3.75 3.75a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06z" })
32216
+ }
32217
+ )
32218
+ }
32219
+ ),
32220
+ service.label
32221
+ ] }),
32222
+ showCounts && service.count !== void 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-400", children: [
32223
+ "(",
32224
+ service.count,
32225
+ ")"
32226
+ ] })
32227
+ ]
32228
+ },
32229
+ service.value
32230
+ );
32231
+ })
32232
+ ] }, category)
32233
+ ) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-3 py-4 text-center text-sm", children: "No services found" }),
32234
+ selectedServices.length > 0 && /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 border-t border-neutral-200 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-800", children: /* @__PURE__ */ jsx(
32235
+ "button",
32091
32236
  {
32092
- ref: inputRef,
32093
- type: "text",
32094
- value: searchTerm,
32095
- onChange: (e) => setSearchTerm(e.target.value),
32096
- placeholder: "Search services...",
32097
- className: cn(inputVariants3({ hasIcon: true }), "pl-8"),
32098
- autoFocus: true
32237
+ type: "button",
32238
+ onClick: () => onSelectionChange([]),
32239
+ className: cn(
32240
+ "w-full rounded-md px-3 py-2 text-center text-sm",
32241
+ "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20"
32242
+ ),
32243
+ children: "Clear selection"
32099
32244
  }
32100
- ),
32101
- /* @__PURE__ */ jsx(SearchIcon4, { className: "absolute top-1/2 left-4 -translate-y-1/2 text-neutral-400" })
32102
- ] }),
32103
- Object.entries(groupedServices).length > 0 ? Object.entries(groupedServices).map(
32104
- ([category, categoryServices]) => /* @__PURE__ */ jsxs("div", { children: [
32105
- services.some((s) => s.category) && /* @__PURE__ */ jsx("div", { className: "bg-neutral-50 px-3 py-2 text-xs font-semibold tracking-wider text-neutral-500 uppercase dark:bg-neutral-900 dark:text-neutral-400", children: category }),
32106
- categoryServices.map((service) => {
32107
- const isSelected = selectedServices.includes(service.value);
32108
- return /* @__PURE__ */ jsxs(
32109
- "button",
32110
- {
32111
- type: "button",
32112
- role: "option",
32113
- "aria-selected": isSelected,
32114
- onClick: () => handleToggleService(service.value),
32115
- className: cn(
32116
- "flex w-full items-center justify-between px-3 py-2 text-left text-sm",
32117
- "hover:bg-neutral-100 dark:hover:bg-neutral-700",
32118
- isSelected && "bg-primary-50 dark:bg-primary-900/20"
32119
- ),
32120
- children: [
32121
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
32122
- /* @__PURE__ */ jsx(
32123
- "span",
32124
- {
32125
- className: cn(
32126
- "flex h-4 w-4 items-center justify-center rounded border",
32127
- isSelected ? "bg-primary-800 border-primary-500 text-white" : "border-neutral-300 dark:border-neutral-600"
32128
- ),
32129
- children: isSelected && /* @__PURE__ */ jsx(
32130
- "svg",
32131
- {
32132
- "aria-hidden": "true",
32133
- className: "h-3 w-3",
32134
- viewBox: "0 0 12 12",
32135
- fill: "currentColor",
32136
- children: /* @__PURE__ */ jsx("path", { d: "M10.28 2.28L4.75 7.81 1.72 4.78a.75.75 0 00-1.06 1.06l3.75 3.75a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06z" })
32137
- }
32138
- )
32139
- }
32140
- ),
32141
- service.label
32142
- ] }),
32143
- showCounts && service.count !== void 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-400", children: [
32144
- "(",
32145
- service.count,
32146
- ")"
32147
- ] })
32148
- ]
32149
- },
32150
- service.value
32151
- );
32152
- })
32153
- ] }, category)
32154
- ) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-3 py-4 text-center text-sm", children: "No services found" }),
32155
- selectedServices.length > 0 && /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 border-t border-neutral-200 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-800", children: /* @__PURE__ */ jsx(
32156
- "button",
32157
- {
32158
- type: "button",
32159
- onClick: () => onSelectionChange([]),
32160
- className: cn(
32161
- "w-full rounded-md px-3 py-2 text-center text-sm",
32162
- "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20"
32163
- ),
32164
- children: "Clear selection"
32165
- }
32166
- ) })
32167
- ]
32168
- }
32245
+ ) })
32246
+ ]
32247
+ }
32248
+ ),
32249
+ document.body
32169
32250
  )
32170
32251
  ]
32171
32252
  }
@@ -32526,15 +32607,12 @@ function ProviderSelector({
32526
32607
  const [isOpen, setIsOpen] = React10.useState(false);
32527
32608
  const [searchQuery, setSearchQuery] = React10.useState("");
32528
32609
  const containerRef = React10.useRef(null);
32529
- React10.useEffect(() => {
32530
- function handleClickOutside(event) {
32531
- if (containerRef.current && !containerRef.current.contains(event.target)) {
32532
- setIsOpen(false);
32533
- }
32534
- }
32535
- document.addEventListener("mousedown", handleClickOutside);
32536
- return () => document.removeEventListener("mousedown", handleClickOutside);
32537
- }, []);
32610
+ const { anchorRef, floatingRef, style } = useAnchoredPosition({ open: isOpen, matchWidth: true });
32611
+ const outsideRefs = React10.useMemo(
32612
+ () => [containerRef, floatingRef],
32613
+ [floatingRef]
32614
+ );
32615
+ useClickOutside(outsideRefs, () => setIsOpen(false), isOpen);
32538
32616
  React10.useEffect(() => {
32539
32617
  function handleEscape(event) {
32540
32618
  if (event.key === "Escape") {
@@ -32573,7 +32651,10 @@ function ProviderSelector({
32573
32651
  {
32574
32652
  "data-slot": "provider-selector",
32575
32653
  className: cn("relative", className),
32576
- ref: containerRef,
32654
+ ref: (node) => {
32655
+ containerRef.current = node;
32656
+ anchorRef.current = node;
32657
+ },
32577
32658
  children: [
32578
32659
  label && /* @__PURE__ */ jsx(
32579
32660
  "label",
@@ -32694,138 +32775,143 @@ function ProviderSelector({
32694
32775
  ]
32695
32776
  }
32696
32777
  ),
32697
- isOpen && /* @__PURE__ */ jsxs(
32698
- "div",
32699
- {
32700
- "data-slot": "provider-selector-dropdown",
32701
- className: "border-border bg-card absolute z-50 mt-1 w-full overflow-hidden rounded-lg border shadow-lg",
32702
- children: [
32703
- searchable && /* @__PURE__ */ jsx("div", { className: "border-border border-b p-2", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
32704
- /* @__PURE__ */ jsx(
32705
- "svg",
32706
- {
32707
- "aria-hidden": "true",
32708
- className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2",
32709
- fill: "none",
32710
- viewBox: "0 0 24 24",
32711
- stroke: "currentColor",
32712
- children: /* @__PURE__ */ jsx(
32713
- "path",
32714
- {
32715
- strokeLinecap: "round",
32716
- strokeLinejoin: "round",
32717
- strokeWidth: 2,
32718
- d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
32719
- }
32720
- )
32721
- }
32722
- ),
32723
- /* @__PURE__ */ jsx(
32724
- "input",
32725
- {
32726
- type: "text",
32727
- "data-slot": "provider-selector-search",
32728
- placeholder: searchPlaceholder,
32729
- value: searchQuery,
32730
- onChange: (e) => setSearchQuery(e.target.value),
32731
- className: "border-input bg-background text-foreground placeholder:text-muted-foreground focus:ring-ring w-full rounded-md border py-2 pr-4 pl-9 text-sm focus:ring-1 focus:outline-none",
32732
- autoFocus: true
32733
- }
32734
- )
32735
- ] }) }),
32736
- /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto", children: filteredProviders.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-4 py-6 text-center", children: "No providers found" }) : filteredProviders.map((provider) => /* @__PURE__ */ jsxs(
32737
- "button",
32738
- {
32739
- type: "button",
32740
- "data-slot": "provider-selector-option",
32741
- onClick: () => handleSelect(provider),
32742
- className: cn(
32743
- "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors",
32744
- "hover:bg-muted",
32745
- selectedProvider?.id === provider.id && "bg-primary/10"
32778
+ isOpen && createPortal(
32779
+ /* @__PURE__ */ jsxs(
32780
+ "div",
32781
+ {
32782
+ ref: floatingRef,
32783
+ style,
32784
+ "data-slot": "provider-selector-dropdown",
32785
+ className: "border-border bg-card flex flex-col overflow-hidden rounded-lg border shadow-lg",
32786
+ children: [
32787
+ searchable && /* @__PURE__ */ jsx("div", { className: "border-border shrink-0 border-b p-2", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
32788
+ /* @__PURE__ */ jsx(
32789
+ "svg",
32790
+ {
32791
+ "aria-hidden": "true",
32792
+ className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2",
32793
+ fill: "none",
32794
+ viewBox: "0 0 24 24",
32795
+ stroke: "currentColor",
32796
+ children: /* @__PURE__ */ jsx(
32797
+ "path",
32798
+ {
32799
+ strokeLinecap: "round",
32800
+ strokeLinejoin: "round",
32801
+ strokeWidth: 2,
32802
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
32803
+ }
32804
+ )
32805
+ }
32746
32806
  ),
32747
- children: [
32748
- provider.logoUrl ? /* @__PURE__ */ jsx(
32749
- "img",
32750
- {
32751
- "data-slot": "provider-selector-option-avatar",
32752
- src: provider.logoUrl,
32753
- alt: provider.name,
32754
- className: "h-8 w-8 rounded object-cover"
32755
- }
32756
- ) : /* @__PURE__ */ jsx(
32757
- "div",
32758
- {
32759
- "data-slot": "provider-selector-option-avatar",
32760
- className: "bg-muted text-muted-foreground flex h-8 w-8 items-center justify-center rounded text-sm font-medium",
32761
- children: getInitials2(provider.name)
32762
- }
32807
+ /* @__PURE__ */ jsx(
32808
+ "input",
32809
+ {
32810
+ type: "text",
32811
+ "data-slot": "provider-selector-search",
32812
+ placeholder: searchPlaceholder,
32813
+ value: searchQuery,
32814
+ onChange: (e) => setSearchQuery(e.target.value),
32815
+ className: "border-input bg-background text-foreground placeholder:text-muted-foreground focus:ring-ring w-full rounded-md border py-2 pr-4 pl-9 text-sm focus:ring-1 focus:outline-none",
32816
+ autoFocus: true
32817
+ }
32818
+ )
32819
+ ] }) }),
32820
+ /* @__PURE__ */ jsx("div", { className: "max-h-64 min-h-0 overflow-y-auto", children: filteredProviders.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-4 py-6 text-center", children: "No providers found" }) : filteredProviders.map((provider) => /* @__PURE__ */ jsxs(
32821
+ "button",
32822
+ {
32823
+ type: "button",
32824
+ "data-slot": "provider-selector-option",
32825
+ onClick: () => handleSelect(provider),
32826
+ className: cn(
32827
+ "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors",
32828
+ "hover:bg-muted",
32829
+ selectedProvider?.id === provider.id && "bg-primary/10"
32763
32830
  ),
32764
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
32765
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
32766
- /* @__PURE__ */ jsx(
32767
- "span",
32768
- {
32769
- "data-slot": "provider-selector-option-name",
32770
- className: "text-foreground font-medium",
32771
- children: provider.name
32772
- }
32773
- ),
32774
- provider.code && /* @__PURE__ */ jsxs(
32775
- "span",
32776
- {
32777
- "data-slot": "provider-selector-option-code",
32778
- className: "text-xs text-neutral-600 dark:text-neutral-400",
32779
- children: [
32780
- "(",
32781
- provider.code,
32782
- ")"
32783
- ]
32784
- }
32785
- ),
32786
- provider.isActive === false && /* @__PURE__ */ jsx(
32787
- "span",
32831
+ children: [
32832
+ provider.logoUrl ? /* @__PURE__ */ jsx(
32833
+ "img",
32834
+ {
32835
+ "data-slot": "provider-selector-option-avatar",
32836
+ src: provider.logoUrl,
32837
+ alt: provider.name,
32838
+ className: "h-8 w-8 rounded object-cover"
32839
+ }
32840
+ ) : /* @__PURE__ */ jsx(
32841
+ "div",
32842
+ {
32843
+ "data-slot": "provider-selector-option-avatar",
32844
+ className: "bg-muted text-muted-foreground flex h-8 w-8 items-center justify-center rounded text-sm font-medium",
32845
+ children: getInitials2(provider.name)
32846
+ }
32847
+ ),
32848
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
32849
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
32850
+ /* @__PURE__ */ jsx(
32851
+ "span",
32852
+ {
32853
+ "data-slot": "provider-selector-option-name",
32854
+ className: "text-foreground font-medium",
32855
+ children: provider.name
32856
+ }
32857
+ ),
32858
+ provider.code && /* @__PURE__ */ jsxs(
32859
+ "span",
32860
+ {
32861
+ "data-slot": "provider-selector-option-code",
32862
+ className: "text-xs text-neutral-600 dark:text-neutral-400",
32863
+ children: [
32864
+ "(",
32865
+ provider.code,
32866
+ ")"
32867
+ ]
32868
+ }
32869
+ ),
32870
+ provider.isActive === false && /* @__PURE__ */ jsx(
32871
+ "span",
32872
+ {
32873
+ "data-slot": "provider-selector-option-badge",
32874
+ className: "bg-muted rounded px-1.5 py-0.5 text-xs font-medium text-neutral-600 dark:text-neutral-400",
32875
+ children: "Inactive"
32876
+ }
32877
+ )
32878
+ ] }),
32879
+ (provider.location || provider.type) && /* @__PURE__ */ jsx(
32880
+ "div",
32788
32881
  {
32789
- "data-slot": "provider-selector-option-badge",
32790
- className: "bg-muted rounded px-1.5 py-0.5 text-xs font-medium text-neutral-600 dark:text-neutral-400",
32791
- children: "Inactive"
32882
+ "data-slot": "provider-selector-option-detail",
32883
+ className: "text-muted-foreground truncate text-sm",
32884
+ children: [provider.type, provider.location].filter(Boolean).join(" \u2022 ")
32792
32885
  }
32793
32886
  )
32794
32887
  ] }),
32795
- (provider.location || provider.type) && /* @__PURE__ */ jsx(
32796
- "div",
32888
+ selectedProvider?.id === provider.id && /* @__PURE__ */ jsx(
32889
+ "svg",
32797
32890
  {
32798
- "data-slot": "provider-selector-option-detail",
32799
- className: "text-muted-foreground truncate text-sm",
32800
- children: [provider.type, provider.location].filter(Boolean).join(" \u2022 ")
32891
+ "aria-hidden": "true",
32892
+ className: "text-primary-800 dark:text-primary-400 h-5 w-5 flex-shrink-0",
32893
+ fill: "none",
32894
+ viewBox: "0 0 24 24",
32895
+ stroke: "currentColor",
32896
+ children: /* @__PURE__ */ jsx(
32897
+ "path",
32898
+ {
32899
+ strokeLinecap: "round",
32900
+ strokeLinejoin: "round",
32901
+ strokeWidth: 2,
32902
+ d: "M5 13l4 4L19 7"
32903
+ }
32904
+ )
32801
32905
  }
32802
32906
  )
32803
- ] }),
32804
- selectedProvider?.id === provider.id && /* @__PURE__ */ jsx(
32805
- "svg",
32806
- {
32807
- "aria-hidden": "true",
32808
- className: "text-primary-800 dark:text-primary-400 h-5 w-5 flex-shrink-0",
32809
- fill: "none",
32810
- viewBox: "0 0 24 24",
32811
- stroke: "currentColor",
32812
- children: /* @__PURE__ */ jsx(
32813
- "path",
32814
- {
32815
- strokeLinecap: "round",
32816
- strokeLinejoin: "round",
32817
- strokeWidth: 2,
32818
- d: "M5 13l4 4L19 7"
32819
- }
32820
- )
32821
- }
32822
- )
32823
- ]
32824
- },
32825
- provider.id
32826
- )) })
32827
- ]
32828
- }
32907
+ ]
32908
+ },
32909
+ provider.id
32910
+ )) })
32911
+ ]
32912
+ }
32913
+ ),
32914
+ document.body
32829
32915
  )
32830
32916
  ]
32831
32917
  }