@avenue-ticketing/ui 0.11.0 → 0.12.0-beta.2

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 (226) hide show
  1. package/README.md +47 -0
  2. package/dist/badge-types-B67wcd4m.d.ts +22 -0
  3. package/dist/react/app-store-buttons-outline.d.ts +17 -0
  4. package/dist/react/app-store-buttons-outline.js +582 -0
  5. package/dist/react/app-store-buttons-outline.js.map +1 -0
  6. package/dist/react/app-store-buttons.d.ts +20 -0
  7. package/dist/react/app-store-buttons.js +817 -0
  8. package/dist/react/app-store-buttons.js.map +1 -0
  9. package/dist/react/avatar-label-group.d.ts +14 -0
  10. package/dist/react/avatar-label-group.js +183 -0
  11. package/dist/react/avatar-label-group.js.map +1 -0
  12. package/dist/react/avatar-profile-photo.d.ts +9 -0
  13. package/dist/react/avatar-profile-photo.js +202 -0
  14. package/dist/react/avatar-profile-photo.js.map +1 -0
  15. package/dist/react/avatar.d.ts +66 -40
  16. package/dist/react/avatar.js +159 -149
  17. package/dist/react/avatar.js.map +1 -1
  18. package/dist/react/badge-groups.d.ts +25 -0
  19. package/dist/react/badge-groups.js +162 -0
  20. package/dist/react/badge-groups.js.map +1 -0
  21. package/dist/react/badge.d.ts +123 -59
  22. package/dist/react/badge.js +314 -86
  23. package/dist/react/badge.js.map +1 -1
  24. package/dist/react/button-group.d.ts +43 -0
  25. package/dist/react/button-group.js +108 -0
  26. package/dist/react/button-group.js.map +1 -0
  27. package/dist/react/button-utility.d.ts +47 -0
  28. package/dist/react/button-utility.js +158 -0
  29. package/dist/react/button-utility.js.map +1 -0
  30. package/dist/react/button.d.ts +112 -37
  31. package/dist/react/button.js +270 -55
  32. package/dist/react/button.js.map +1 -1
  33. package/dist/react/checkbox.d.ts +25 -8
  34. package/dist/react/checkbox.js +115 -110
  35. package/dist/react/checkbox.js.map +1 -1
  36. package/dist/react/close-button.d.ts +25 -0
  37. package/dist/react/close-button.js +54 -0
  38. package/dist/react/close-button.js.map +1 -0
  39. package/dist/react/combobox.d.ts +18 -0
  40. package/dist/react/combobox.js +574 -0
  41. package/dist/react/combobox.js.map +1 -0
  42. package/dist/react/dialog.d.ts +15 -15
  43. package/dist/react/dialog.js +43 -108
  44. package/dist/react/dialog.js.map +1 -1
  45. package/dist/react/dropdown-account-breadcrumb.d.ts +5 -0
  46. package/dist/react/dropdown-account-breadcrumb.js +481 -0
  47. package/dist/react/dropdown-account-breadcrumb.js.map +1 -0
  48. package/dist/react/dropdown-account-button.d.ts +5 -0
  49. package/dist/react/dropdown-account-button.js +938 -0
  50. package/dist/react/dropdown-account-button.js.map +1 -0
  51. package/dist/react/dropdown-account-card-md.d.ts +5 -0
  52. package/dist/react/dropdown-account-card-md.js +714 -0
  53. package/dist/react/dropdown-account-card-md.js.map +1 -0
  54. package/dist/react/dropdown-account-card-sm.d.ts +5 -0
  55. package/dist/react/dropdown-account-card-sm.js +692 -0
  56. package/dist/react/dropdown-account-card-sm.js.map +1 -0
  57. package/dist/react/dropdown-account-card-xs.d.ts +5 -0
  58. package/dist/react/dropdown-account-card-xs.js +672 -0
  59. package/dist/react/dropdown-account-card-xs.js.map +1 -0
  60. package/dist/react/dropdown-avatar.d.ts +5 -0
  61. package/dist/react/dropdown-avatar.js +955 -0
  62. package/dist/react/dropdown-avatar.js.map +1 -0
  63. package/dist/react/dropdown-button-advanced.d.ts +5 -0
  64. package/dist/react/dropdown-button-advanced.js +964 -0
  65. package/dist/react/dropdown-button-advanced.js.map +1 -0
  66. package/dist/react/dropdown-button-link.d.ts +5 -0
  67. package/dist/react/dropdown-button-link.js +666 -0
  68. package/dist/react/dropdown-button-link.js.map +1 -0
  69. package/dist/react/dropdown-button-simple.d.ts +5 -0
  70. package/dist/react/dropdown-button-simple.js +919 -0
  71. package/dist/react/dropdown-button-simple.js.map +1 -0
  72. package/dist/react/dropdown-icon-advanced.d.ts +5 -0
  73. package/dist/react/dropdown-icon-advanced.js +708 -0
  74. package/dist/react/dropdown-icon-advanced.js.map +1 -0
  75. package/dist/react/dropdown-icon-simple.d.ts +5 -0
  76. package/dist/react/dropdown-icon-simple.js +670 -0
  77. package/dist/react/dropdown-icon-simple.js.map +1 -0
  78. package/dist/react/dropdown-integration.d.ts +5 -0
  79. package/dist/react/dropdown-integration.js +1490 -0
  80. package/dist/react/dropdown-integration.js.map +1 -0
  81. package/dist/react/dropdown-search-advanced.d.ts +5 -0
  82. package/dist/react/dropdown-search-advanced.js +1163 -0
  83. package/dist/react/dropdown-search-advanced.js.map +1 -0
  84. package/dist/react/dropdown-search-simple.d.ts +5 -0
  85. package/dist/react/dropdown-search-simple.js +1125 -0
  86. package/dist/react/dropdown-search-simple.js.map +1 -0
  87. package/dist/react/dropdown.d.ts +35 -133
  88. package/dist/react/dropdown.js +536 -1318
  89. package/dist/react/dropdown.js.map +1 -1
  90. package/dist/react/file-upload-trigger.d.ts +34 -0
  91. package/dist/react/file-upload-trigger.js +39 -0
  92. package/dist/react/file-upload-trigger.js.map +1 -0
  93. package/dist/react/form.d.ts +10 -0
  94. package/dist/react/form.js +11 -0
  95. package/dist/react/form.js.map +1 -0
  96. package/dist/react/hint-text.d.ts +17 -0
  97. package/dist/react/hint-text.js +36 -0
  98. package/dist/react/hint-text.js.map +1 -0
  99. package/dist/react/hook-form.d.ts +35 -0
  100. package/dist/react/hook-form.js +50 -0
  101. package/dist/react/hook-form.js.map +1 -0
  102. package/dist/react/input-date.d.ts +43 -0
  103. package/dist/react/input-date.js +306 -0
  104. package/dist/react/input-date.js.map +1 -0
  105. package/dist/react/input-file.d.ts +45 -0
  106. package/dist/react/input-file.js +748 -0
  107. package/dist/react/input-file.js.map +1 -0
  108. package/dist/react/input-group.d.ts +37 -0
  109. package/dist/react/input-group.js +251 -0
  110. package/dist/react/input-group.js.map +1 -0
  111. package/dist/react/input-number.d.ts +32 -0
  112. package/dist/react/input-number.js +553 -0
  113. package/dist/react/input-number.js.map +1 -0
  114. package/dist/react/input-payment.d.ts +16 -0
  115. package/dist/react/input-payment.js +593 -0
  116. package/dist/react/input-payment.js.map +1 -0
  117. package/dist/react/input-tags-outer.d.ts +53 -0
  118. package/dist/react/input-tags-outer.js +607 -0
  119. package/dist/react/input-tags-outer.js.map +1 -0
  120. package/dist/react/input-tags.d.ts +53 -0
  121. package/dist/react/input-tags.js +565 -0
  122. package/dist/react/input-tags.js.map +1 -0
  123. package/dist/react/input.d.ts +71 -22
  124. package/dist/react/input.js +332 -45
  125. package/dist/react/input.js.map +1 -1
  126. package/dist/react/label.d.ts +18 -0
  127. package/dist/react/label.js +112 -0
  128. package/dist/react/label.js.map +1 -0
  129. package/dist/react/multi-select.d.ts +90 -0
  130. package/dist/react/multi-select.js +1237 -0
  131. package/dist/react/multi-select.js.map +1 -0
  132. package/dist/react/pin-input.d.ts +59 -0
  133. package/dist/react/pin-input.js +229 -0
  134. package/dist/react/pin-input.js.map +1 -0
  135. package/dist/react/popover.d.ts +14 -71
  136. package/dist/react/popover.js +171 -540
  137. package/dist/react/popover.js.map +1 -1
  138. package/dist/react/progress-circle.d.ts +9 -0
  139. package/dist/react/progress-circle.js +36 -0
  140. package/dist/react/progress-circle.js.map +1 -0
  141. package/dist/react/progress-circles.d.ts +14 -0
  142. package/dist/react/progress-circles.js +160 -0
  143. package/dist/react/progress-circles.js.map +1 -0
  144. package/dist/react/progress-indicators.d.ts +52 -0
  145. package/dist/react/progress-indicators.js +78 -0
  146. package/dist/react/progress-indicators.js.map +1 -0
  147. package/dist/react/radio-buttons.d.ts +35 -0
  148. package/dist/react/radio-buttons.js +117 -0
  149. package/dist/react/radio-buttons.js.map +1 -0
  150. package/dist/react/scroll-header.d.ts +6 -0
  151. package/dist/react/scroll-header.js +42 -61
  152. package/dist/react/scroll-header.js.map +1 -1
  153. package/dist/react/scroll-wheel.d.ts +4 -5
  154. package/dist/react/scroll-wheel.js +19 -15
  155. package/dist/react/scroll-wheel.js.map +1 -1
  156. package/dist/react/select-item.d.ts +14 -0
  157. package/dist/react/select-item.js +340 -0
  158. package/dist/react/select-item.js.map +1 -0
  159. package/dist/react/select-native.d.ts +17 -0
  160. package/dist/react/select-native.js +203 -0
  161. package/dist/react/select-native.js.map +1 -0
  162. package/dist/react/select.d.ts +19 -61
  163. package/dist/react/select.js +866 -908
  164. package/dist/react/select.js.map +1 -1
  165. package/dist/react/sheet.d.ts +19 -19
  166. package/dist/react/sheet.js +97 -219
  167. package/dist/react/sheet.js.map +1 -1
  168. package/dist/react/slider.d.ts +15 -0
  169. package/dist/react/slider.js +66 -0
  170. package/dist/react/slider.js.map +1 -0
  171. package/dist/react/social-button.d.ts +55 -0
  172. package/dist/react/social-button.js +263 -0
  173. package/dist/react/social-button.js.map +1 -0
  174. package/dist/react/social-logos.d.ts +20 -0
  175. package/dist/react/social-logos.js +131 -0
  176. package/dist/react/social-logos.js.map +1 -0
  177. package/dist/react/switch.d.ts +21 -36
  178. package/dist/react/switch.js +121 -109
  179. package/dist/react/switch.js.map +1 -1
  180. package/dist/react/tag-select.d.ts +47 -0
  181. package/dist/react/tag-select.js +1252 -0
  182. package/dist/react/tag-select.js.map +1 -0
  183. package/dist/react/tags.d.ts +30 -0
  184. package/dist/react/tags.js +228 -0
  185. package/dist/react/tags.js.map +1 -0
  186. package/dist/react/textarea.d.ts +40 -4
  187. package/dist/react/textarea.js +193 -27
  188. package/dist/react/textarea.js.map +1 -1
  189. package/dist/react/tooltip.d.ts +30 -43
  190. package/dist/react/tooltip.js +65 -521
  191. package/dist/react/tooltip.js.map +1 -1
  192. package/dist/select-mobile-sheet-CB2ptDTJ.d.ts +12 -0
  193. package/dist/select-shared-oJEeJxeB.d.ts +68 -0
  194. package/package.json +28 -21
  195. package/source.css +2 -13
  196. package/theme.css +883 -79
  197. package/dist/react/calendar.d.ts +0 -13
  198. package/dist/react/calendar.js +0 -4639
  199. package/dist/react/calendar.js.map +0 -1
  200. package/dist/react/card.d.ts +0 -11
  201. package/dist/react/card.js +0 -113
  202. package/dist/react/card.js.map +0 -1
  203. package/dist/react/datetime-picker.d.ts +0 -21
  204. package/dist/react/datetime-picker.js +0 -6142
  205. package/dist/react/datetime-picker.js.map +0 -1
  206. package/dist/react/pagination.d.ts +0 -28
  207. package/dist/react/pagination.js +0 -262
  208. package/dist/react/pagination.js.map +0 -1
  209. package/dist/react/table-pagination.d.ts +0 -15
  210. package/dist/react/table-pagination.js +0 -1247
  211. package/dist/react/table-pagination.js.map +0 -1
  212. package/dist/react/table-view/column-menu.d.ts +0 -15
  213. package/dist/react/table-view/column-menu.js +0 -1049
  214. package/dist/react/table-view/column-menu.js.map +0 -1
  215. package/dist/react/table-view/index.d.ts +0 -70
  216. package/dist/react/table-view/index.js +0 -2284
  217. package/dist/react/table-view/index.js.map +0 -1
  218. package/dist/react/table.d.ts +0 -86
  219. package/dist/react/table.js +0 -414
  220. package/dist/react/table.js.map +0 -1
  221. package/dist/react/tabs.d.ts +0 -34
  222. package/dist/react/tabs.js +0 -423
  223. package/dist/react/tabs.js.map +0 -1
  224. package/dist/react/time-picker.d.ts +0 -22
  225. package/dist/react/time-picker.js +0 -856
  226. package/dist/react/time-picker.js.map +0 -1
@@ -1,983 +1,941 @@
1
- import * as React2 from 'react';
2
- import { useCallback, useState, useRef, useMemo, useLayoutEffect, useEffect } from 'react';
1
+ import { createContext, isValidElement, useMemo, useContext, useEffect, useRef, useState, useCallback, useLayoutEffect } from 'react';
2
+ import { CaretDownIcon } from '@phosphor-icons/react/dist/csr/CaretDown';
3
+ import { Select as Select$1, ListBox, Label as Label$1, Button, SelectValue as SelectValue$1, OverlayTriggerStateContext, Popover as Popover$1, Text, ComboBox as ComboBox$1, ListBoxItem, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow, ComboBoxStateContext, Group, Input } from 'react-aria-components';
4
+ import { UserIcon } from '@phosphor-icons/react/dist/csr/User';
5
+ import { extendTailwindMerge } from 'tailwind-merge';
6
+ import '@phosphor-icons/react/dist/csr/Plus';
7
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
+ import { QuestionIcon } from '@phosphor-icons/react/dist/csr/Question';
9
+ import '@phosphor-icons/react/dist/csr/Eye';
10
+ import '@phosphor-icons/react/dist/csr/EyeSlash';
11
+ import '@phosphor-icons/react/dist/csr/Info';
12
+ import { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/csr/MagnifyingGlass';
3
13
  import { createPortal } from 'react-dom';
4
- import { X, ChevronDown, Check } from 'lucide-react';
5
- import { clsx } from 'clsx';
6
- import { twMerge } from 'tailwind-merge';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
14
+ import { XIcon } from '@phosphor-icons/react/dist/csr/X';
15
+ import { CheckIcon } from '@phosphor-icons/react/dist/csr/Check';
8
16
 
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
- var sizeClass = {
13
- xs: "h-8 min-h-8 gap-2 px-4 text-sm has-[>svg]:px-3 [&_svg:not([class*='size-'])]:size-3",
14
- default: "h-10 min-h-10 gap-2 px-5 text-sm has-[>svg]:px-4 [&_svg:not([class*='size-'])]:size-4",
15
- lg: "h-11 min-h-11 gap-2 px-6 text-base has-[>svg]:px-5 [&_svg:not([class*='size-'])]:size-5"
16
- };
17
- var iconOnlySizeClass = {
18
- xs: "size-8 min-h-8 min-w-8 gap-0 p-0 [&_svg:not([class*='size-'])]:size-3",
19
- default: "size-10 min-h-10 min-w-10 gap-0 p-0 [&_svg:not([class*='size-'])]:size-4",
20
- lg: "size-11 min-h-11 min-w-11 gap-0 p-0 [&_svg:not([class*='size-'])]:size-5"
17
+ var twMerge = extendTailwindMerge({
18
+ extend: {
19
+ theme: {
20
+ text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
21
+ }
22
+ }
23
+ });
24
+ var cx = twMerge;
25
+ var Tooltip = ({
26
+ title,
27
+ description,
28
+ children,
29
+ arrow = false,
30
+ delay = 100,
31
+ closeDelay = 0,
32
+ trigger,
33
+ isDisabled,
34
+ isOpen,
35
+ defaultOpen,
36
+ offset = 6,
37
+ crossOffset,
38
+ placement = "top",
39
+ onOpenChange,
40
+ ...tooltipProps
41
+ }) => {
42
+ const isTopOrBottomLeft = ["top left", "top end", "bottom left", "bottom end"].includes(placement);
43
+ const isTopOrBottomRight = ["top right", "top start", "bottom right", "bottom start"].includes(placement);
44
+ const calculatedCrossOffset = isTopOrBottomLeft ? -12 : isTopOrBottomRight ? 12 : 0;
45
+ return /* @__PURE__ */ jsxs(TooltipTrigger$1, { ...{ trigger, delay, closeDelay, isDisabled, isOpen, defaultOpen, onOpenChange }, children: [
46
+ children,
47
+ /* @__PURE__ */ jsx(
48
+ Tooltip$1,
49
+ {
50
+ ...tooltipProps,
51
+ offset,
52
+ placement,
53
+ crossOffset: crossOffset ?? calculatedCrossOffset,
54
+ className: ({ isEntering, isExiting }) => cx(isEntering && "ease-out animate-in", isExiting && "ease-in animate-out"),
55
+ children: ({ isEntering, isExiting }) => /* @__PURE__ */ jsxs(
56
+ "div",
57
+ {
58
+ className: cx(
59
+ "z-50 flex max-w-xs origin-(--trigger-anchor-point) flex-col items-start gap-1 rounded-lg bg-primary-solid px-3 shadow-lg will-change-transform",
60
+ description ? "py-3" : "py-2",
61
+ isEntering && "ease-out animate-in fade-in zoom-in-95 in-placement-left:slide-in-from-right-0.5 in-placement-right:slide-in-from-left-0.5 in-placement-top:slide-in-from-bottom-0.5 in-placement-bottom:slide-in-from-top-0.5",
62
+ isExiting && "ease-in animate-out fade-out zoom-out-95 in-placement-left:slide-out-to-right-0.5 in-placement-right:slide-out-to-left-0.5 in-placement-top:slide-out-to-bottom-0.5 in-placement-bottom:slide-out-to-top-0.5"
63
+ ),
64
+ children: [
65
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-white", children: title }),
66
+ description && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-tooltip-supporting-text", children: description }),
67
+ arrow && /* @__PURE__ */ jsx(OverlayArrow, { children: /* @__PURE__ */ jsx(
68
+ "svg",
69
+ {
70
+ viewBox: "0 0 100 100",
71
+ className: "size-2.5 fill-bg-primary-solid in-placement-left:-rotate-90 in-placement-right:rotate-90 in-placement-top:rotate-0 in-placement-bottom:rotate-180",
72
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L35.858,35.858 Q50,50 64.142,35.858 L100,0 Z" })
73
+ }
74
+ ) })
75
+ ]
76
+ }
77
+ )
78
+ }
79
+ )
80
+ ] });
21
81
  };
22
- var roundedClass = {
23
- full: "rounded-full",
24
- lg: "rounded-lg",
25
- md: "rounded-md"
82
+ var TooltipTrigger = ({ children, className, ...buttonProps }) => {
83
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, className: (values) => cx("h-max w-max outline-hidden", typeof className === "function" ? className(values) : className), children });
26
84
  };
27
- var variantClass = {
28
- primary: "bg-primary text-background border border-transparent hover:bg-primary/90 active:bg-primary/85",
29
- secondary: "bg-background text-primary border border-primary/10 hover:bg-primary/5",
30
- destructive: "bg-background text-red-500 border border-red-500/25 hover:bg-red-500/5",
31
- success: "bg-background text-green-500 border border-green-500/25 hover:bg-green-500/5"
85
+ var sizes = {
86
+ xs: "size-1.5",
87
+ sm: "size-2",
88
+ md: "size-2.5",
89
+ lg: "size-3",
90
+ xl: "size-3.5",
91
+ "2xl": "size-4",
92
+ "3xl": "size-4.5",
93
+ "4xl": "size-5"
32
94
  };
33
- var Button = React2.forwardRef(
34
- ({
35
- className,
36
- type = "button",
37
- variant = "secondary",
38
- rounded: roundedProp,
39
- size = "default",
40
- iconOnly = false,
41
- disabled,
42
- ...props
43
- }, ref) => {
44
- const rounded = roundedProp ?? (iconOnly ? "md" : "full");
45
- return /* @__PURE__ */ jsx(
46
- "button",
47
- {
48
- type,
49
- disabled,
50
- "data-slot": "button",
51
- "data-icon-only": iconOnly ? "" : void 0,
52
- className: cn(
53
- "inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap outline-none scale-100 transition-[color,background-color,box-shadow,transform] duration-150 ease-out active:scale-[0.98] active:duration-100 active:ease-linear [&_svg]:pointer-events-none [&_svg]:shrink-0",
54
- "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
55
- "focus-visible:border-ring font-medium lg:tracking-wide focus-visible:ring-ring/50 focus-visible:ring-[3px]",
56
- iconOnly ? iconOnlySizeClass[size] : sizeClass[size],
57
- roundedClass[rounded],
58
- variantClass[variant],
59
- className
60
- ),
61
- ref,
62
- ...props
63
- }
64
- );
95
+ var AvatarOnlineIndicator = ({ size, status, className }) => /* @__PURE__ */ jsx(
96
+ "span",
97
+ {
98
+ className: cx(
99
+ "absolute right-0 bottom-0 flex justify-center rounded-full ring-[1.5px] ring-bg-primary",
100
+ status === "online" ? "bg-fg-success-secondary" : "bg-utility-neutral-300",
101
+ sizes[size],
102
+ className
103
+ ),
104
+ style: {
105
+ backgroundImage: "radial-gradient(43.75% 43.75% at 50% 28.75%, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.00) 100%), radial-gradient(50% 50% at 50% 50%, rgba(255, 255, 255, 0.00) 74.66%, rgba(255, 255, 255, 0.18) 100%), radial-gradient(75% 75% at 50% 0%, rgba(255, 255, 255, 0.00) 0%, rgba(255, 255, 255, 0.00) 50%, rgba(255, 255, 255, 0.08) 99%, rgba(255, 255, 255, 0.00) 100%)"
106
+ },
107
+ children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 7.2 2.85", fill: "none", className: "mt-[10%] h-[20%] w-[60%]", children: [
108
+ /* @__PURE__ */ jsx(
109
+ "path",
110
+ {
111
+ d: "M7.2 1.83107C7.2 2.84235 5.58823 2.19729 3.6 2.19729C1.61177 2.19729 0 2.84235 0 1.83107C0 0.8198 1.61177 0 3.6 0C5.58823 0 7.2 0.8198 7.2 1.83107Z",
112
+ fill: "url(#reflection-gradient)",
113
+ fillOpacity: "0.4"
114
+ }
115
+ ),
116
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "reflection-gradient", x1: "3.6", y1: "0", x2: "3.6", y2: "2.4", gradientUnits: "userSpaceOnUse", children: [
117
+ /* @__PURE__ */ jsx("stop", { stopColor: "white" }),
118
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0.1" })
119
+ ] }) })
120
+ ] })
65
121
  }
66
122
  );
67
- Button.displayName = "Button";
68
-
69
- // src/lib/typeahead.ts
70
- var TYPEAHEAD_TIMEOUT_MS = 500;
71
- function createTypeaheadState() {
72
- return { search: "", timer: null };
73
- }
74
- function resetTypeahead(state) {
75
- state.search = "";
76
- if (state.timer) {
77
- clearTimeout(state.timer);
78
- state.timer = null;
79
- }
80
- }
81
- function getItemLabel(item) {
82
- const aria = item.getAttribute("aria-label")?.trim();
83
- if (aria) return aria;
84
- const marked = item.querySelector("[data-menu-label]");
85
- if (marked?.textContent) return marked.textContent.replace(/\s+/g, " ").trim();
86
- return (item.textContent ?? "").replace(/\s+/g, " ").trim();
87
- }
88
- function normalizeSearch(value) {
89
- return value.trim().toLocaleLowerCase();
90
- }
91
- function isTypeaheadTarget(target) {
92
- if (!(target instanceof HTMLElement)) return true;
93
- if (target.isContentEditable) return false;
94
- const tag = target.tagName;
95
- return tag !== "INPUT" && tag !== "TEXTAREA" && tag !== "SELECT";
96
- }
97
- function handleTypeaheadKeyDown(event, items, state, options) {
98
- if (options?.enabled === false || items.length === 0) return false;
99
- if (event.ctrlKey || event.metaKey || event.altKey) return false;
100
- if (event.key.length !== 1 || !isTypeaheadTarget(event.target)) return false;
101
- event.preventDefault();
102
- const timeoutMs = options?.timeoutMs ?? TYPEAHEAD_TIMEOUT_MS;
103
- const char = event.key;
104
- const prevSearch = state.search;
105
- const repeatSingleChar = prevSearch.length === 1 && prevSearch === char;
106
- if (repeatSingleChar) {
107
- state.search = prevSearch;
108
- } else {
109
- state.search = prevSearch + char;
110
- }
111
- if (state.timer) clearTimeout(state.timer);
112
- state.timer = setTimeout(() => {
113
- state.search = "";
114
- state.timer = null;
115
- }, timeoutMs);
116
- const labels = items.map((item) => normalizeSearch(getItemLabel(item)));
117
- let needle = normalizeSearch(state.search);
118
- let matches = items.map((item, index) => ({ item, index, label: labels[index] })).filter(({ label }) => label.startsWith(needle));
119
- if (matches.length === 0 && state.search.length > 1) {
120
- state.search = char;
121
- needle = normalizeSearch(char);
122
- matches = items.map((item, index) => ({ item, index, label: labels[index] })).filter(({ label }) => label.startsWith(needle));
123
- }
124
- if (matches.length === 0) return true;
125
- const focused = document.activeElement;
126
- const focusedIndex = focused ? items.indexOf(focused) : -1;
127
- if (repeatSingleChar && focusedIndex !== -1) {
128
- const currentMatch = matches.findIndex(
129
- ({ index }) => index === focusedIndex
130
- );
131
- if (currentMatch !== -1) {
132
- const next = matches[(currentMatch + 1) % matches.length];
133
- next?.item.focus();
134
- return true;
123
+ var sizes2 = {
124
+ xs: "size-2.5",
125
+ sm: "size-3",
126
+ md: "size-3.5",
127
+ lg: "size-4",
128
+ xl: "size-4.5",
129
+ "2xl": "size-5",
130
+ "3xl": "size-6",
131
+ "4xl": "size-8"
132
+ };
133
+ var VerifiedTick = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { className: cx("z-10 text-utility-blue-500", sizes2[size], className), viewBox: "0 0 10 10", fill: "none", children: [
134
+ /* @__PURE__ */ jsx(
135
+ "path",
136
+ {
137
+ d: "M7.72237 1.77098C7.81734 2.00068 7.99965 2.18326 8.2292 2.27858L9.03413 2.61199C9.26384 2.70714 9.44635 2.88965 9.5415 3.11936C9.63665 3.34908 9.63665 3.60718 9.5415 3.83689L9.20833 4.64125C9.11313 4.87106 9.113 5.12943 9.20863 5.35913L9.54122 6.16325C9.58839 6.27702 9.61268 6.39897 9.6127 6.52214C9.61272 6.6453 9.58847 6.76726 9.54134 6.88105C9.4942 6.99484 9.42511 7.09823 9.33801 7.18531C9.2509 7.27238 9.14749 7.34144 9.03369 7.38854L8.22934 7.72171C7.99964 7.81669 7.81706 7.99899 7.72174 8.22855L7.38833 9.03348C7.29318 9.26319 7.11067 9.4457 6.88096 9.54085C6.65124 9.636 6.39314 9.636 6.16343 9.54085L5.35907 9.20767C5.12935 9.11276 4.87134 9.11295 4.64177 9.20821L3.83684 9.54115C3.60725 9.63608 3.34937 9.636 3.11984 9.54092C2.89032 9.44585 2.70791 9.26356 2.6127 9.03409L2.27918 8.22892C2.18421 7.99923 2.0019 7.81665 1.77235 7.72133L0.967421 7.38792C0.737807 7.29281 0.555355 7.11041 0.460169 6.88083C0.364983 6.65125 0.364854 6.39327 0.45981 6.16359L0.792984 5.35924C0.8879 5.12952 0.887707 4.87151 0.792445 4.64193L0.459749 3.83642C0.41258 3.72265 0.388291 3.60069 0.388272 3.47753C0.388252 3.35436 0.412501 3.2324 0.459634 3.11861C0.506767 3.00482 0.57586 2.90144 0.662965 2.81436C0.75007 2.72728 0.853479 2.65822 0.967283 2.61113L1.77164 2.27795C2.00113 2.18306 2.1836 2.00099 2.27899 1.7717L2.6124 0.966768C2.70755 0.737054 2.89006 0.554547 3.11978 0.459397C3.34949 0.364246 3.60759 0.364246 3.83731 0.459397L4.64166 0.792571C4.87138 0.887487 5.12939 0.887293 5.35897 0.792031L6.16424 0.459913C6.39392 0.364816 6.65197 0.364836 6.88164 0.459968C7.11131 0.555099 7.29379 0.737554 7.38895 0.967208L7.72247 1.77238L7.72237 1.77098Z",
138
+ className: "fill-current"
135
139
  }
136
- }
137
- if (focusedIndex !== -1) {
138
- const nextAfterFocus = matches.find(({ index }) => index > focusedIndex);
139
- if (nextAfterFocus) {
140
- nextAfterFocus.item.focus();
141
- return true;
140
+ ),
141
+ /* @__PURE__ */ jsx(
142
+ "path",
143
+ {
144
+ fillRule: "evenodd",
145
+ clipRule: "evenodd",
146
+ d: "M6.95829 3.68932C7.02509 3.58439 7.04747 3.45723 7.02051 3.3358C6.99356 3.21437 6.91946 3.10862 6.81454 3.04182C6.70961 2.97502 6.58245 2.95264 6.46102 2.97959C6.33959 3.00655 6.23384 3.08064 6.16704 3.18557L4.33141 6.06995L3.49141 5.01995C3.41375 4.92281 3.30069 4.8605 3.17709 4.84673C3.05349 4.83296 2.92949 4.86885 2.83235 4.94651C2.73522 5.02417 2.67291 5.13723 2.65914 5.26083C2.64536 5.38443 2.68125 5.50843 2.75891 5.60557L4.00891 7.16807C4.0555 7.22638 4.11533 7.27271 4.18344 7.30323C4.25154 7.33375 4.32595 7.34757 4.40047 7.34353C4.47499 7.3395 4.54747 7.31773 4.61188 7.28004C4.67629 7.24234 4.73077 7.18981 4.77079 7.12682L6.95829 3.68932Z",
147
+ fill: "white"
142
148
  }
143
- }
144
- matches[0]?.item.focus();
145
- return true;
146
- }
147
- var PANEL_OPEN_EASING = "cubic-bezier(0,0.55,0.45,1)";
148
- var PANEL_CLOSE_EASING = "cubic-bezier(0.55,0,1,0.45)";
149
- var MOBILE_SHEET_MAX_PX = 1024;
150
- var MOBILE_SHEET_MS = 175;
151
- var MOBILE_SHEET_IN = "cubic-bezier(0.85, 0, 0.15, 1)";
152
- var MOBILE_SHEET_OUT = "cubic-bezier(0.85, 0, 1, 0.15)";
153
- var SLIDE_DEFAULT_PX = 120;
154
- var SHEET_MENU_TEXT = "max-[1024px]:text-base";
155
- var SHEET_MENU_SHORTCUT = "max-[1024px]:text-sm";
156
- var SELECT_FLIP_MIN_SPACE_PX = 100;
157
- var CONTENT_ORIGIN = {
158
- bottom: "top center",
159
- top: "bottom center",
160
- left: "right center",
161
- right: "left center"
162
- };
163
- var CONTENT_HIDDEN = {
164
- bottom: "translateY(-4px) scale(0.97)",
165
- top: "translateY(4px) scale(0.97)",
166
- left: "translateX(4px) scale(0.97)",
167
- right: "translateX(-4px) scale(0.97)"
149
+ )
150
+ ] });
151
+ var AvatarCount = ({ count, className }) => /* @__PURE__ */ jsx("div", { className: cx("absolute right-0 bottom-0 p-px", className), children: /* @__PURE__ */ jsx("div", { className: "flex size-3.5 items-center justify-center rounded-full bg-fg-error-primary text-center text-[10px] leading-[13px] font-bold text-white", children: count }) });
152
+ var styles = {
153
+ xs: { root: "size-6", rootWithBorder: "p-px", initials: "text-xs font-semibold", icon: "size-4" },
154
+ sm: { root: "size-8", rootWithBorder: "p-px", initials: "text-sm font-semibold", icon: "size-5" },
155
+ md: { root: "size-10", rootWithBorder: "p-px", initials: "text-md font-semibold", icon: "size-6" },
156
+ lg: { root: "size-12", rootWithBorder: "p-[1.5px]", initials: "text-lg font-semibold", icon: "size-7" },
157
+ xl: { root: "size-14", rootWithBorder: "p-0.5", initials: "text-xl font-semibold", icon: "size-8" },
158
+ "2xl": { root: "size-16", rootWithBorder: "p-0.5", initials: "text-display-xs font-semibold", icon: "size-8" }
168
159
  };
169
- function computeMenuPosition(trigger, menu, side, align, offset, pad) {
170
- const tr = trigger.getBoundingClientRect();
171
- const mr = menu.getBoundingClientRect();
172
- const contentHeight = menu.scrollHeight;
173
- const vh = window.innerHeight;
174
- const vw = window.innerWidth;
175
- const sx = window.scrollX;
176
- const sy = window.scrollY;
177
- let top = 0;
178
- let left = 0;
179
- let effectiveSide = side;
180
- let maxHeight;
181
- const placeVertical = (s, height) => {
182
- if (s === "bottom") top = tr.bottom + sy + offset;
183
- else top = tr.top + sy - height - offset;
184
- if (align === "start") left = tr.left + sx;
185
- else if (align === "end") left = tr.right + sx - mr.width;
186
- else left = tr.left + sx + tr.width / 2 - mr.width / 2;
187
- };
188
- const place = (s, height = contentHeight) => {
189
- switch (s) {
190
- case "bottom":
191
- case "top":
192
- placeVertical(s, height);
193
- break;
194
- case "right":
195
- left = tr.right + sx + offset;
196
- if (align === "start") top = tr.top + sy;
197
- else if (align === "end") top = tr.bottom + sy - mr.height;
198
- else top = tr.top + sy + tr.height / 2 - mr.height / 2;
199
- break;
200
- case "left":
201
- left = tr.left + sx - mr.width - offset;
202
- if (align === "start") top = tr.top + sy;
203
- else if (align === "end") top = tr.bottom + sy - mr.height;
204
- else top = tr.top + sy + tr.height / 2 - mr.height / 2;
205
- break;
160
+ var Avatar = ({
161
+ size = "md",
162
+ src,
163
+ alt,
164
+ initials,
165
+ placeholder,
166
+ placeholderIcon: PlaceholderIcon,
167
+ border,
168
+ badge,
169
+ status,
170
+ verified,
171
+ count,
172
+ focusable = false,
173
+ rounded = true,
174
+ className,
175
+ contentClassName
176
+ }) => {
177
+ const [isFailed, setIsFailed] = useState(false);
178
+ const canShowImage = src && !isFailed;
179
+ const renderMainContent = () => {
180
+ if (canShowImage) {
181
+ return /* @__PURE__ */ jsx("img", { "data-avatar-img": true, className: "size-full object-cover", src, alt, onError: () => setIsFailed(true) });
206
182
  }
183
+ if (initials) {
184
+ return /* @__PURE__ */ jsx("span", { className: cx("text-quaternary", styles[size].initials), children: initials });
185
+ }
186
+ if (PlaceholderIcon) {
187
+ return /* @__PURE__ */ jsx(PlaceholderIcon, { className: cx("text-fg-quaternary", styles[size].icon) });
188
+ }
189
+ return placeholder || /* @__PURE__ */ jsx(UserIcon, { className: cx("text-fg-quaternary", styles[size].icon) });
207
190
  };
208
- place(side);
209
- const spaceBelow = Math.max(0, vh - pad - tr.bottom - offset);
210
- const spaceAbove = Math.max(0, tr.top - offset - pad);
211
- if (side === "bottom" || side === "top") {
212
- const primarySpace = side === "bottom" ? spaceBelow : spaceAbove;
213
- const alternateSpace = side === "bottom" ? spaceAbove : spaceBelow;
214
- const alternateSide = side === "bottom" ? "top" : "bottom";
215
- if (contentHeight > primarySpace) {
216
- maxHeight = Math.min(contentHeight, primarySpace);
217
- place(side, maxHeight);
191
+ const renderBadgeContent = () => {
192
+ if (status) {
193
+ return /* @__PURE__ */ jsx(AvatarOnlineIndicator, { status, size });
218
194
  }
219
- if (contentHeight > primarySpace && primarySpace < SELECT_FLIP_MIN_SPACE_PX && alternateSpace > primarySpace) {
220
- effectiveSide = alternateSide;
221
- maxHeight = Math.min(contentHeight, alternateSpace);
222
- place(alternateSide, maxHeight);
195
+ if (verified) {
196
+ return /* @__PURE__ */ jsx(VerifiedTick, { size, className: cx("absolute right-0 bottom-0", size === "xs" && "-right-px -bottom-px") });
223
197
  }
224
- } else if (side === "right" && left + mr.width > vw + sx - pad) {
225
- const flip = tr.left + sx - mr.width - offset;
226
- if (flip >= sx + pad) {
227
- effectiveSide = "left";
228
- left = flip;
198
+ if (count) {
199
+ return /* @__PURE__ */ jsx(AvatarCount, { count });
229
200
  }
230
- } else if (side === "left" && left < sx + pad) {
231
- const flip = tr.right + sx + offset;
232
- if (flip + mr.width <= vw + sx - pad) {
233
- effectiveSide = "right";
234
- left = flip;
201
+ return badge;
202
+ };
203
+ return /* @__PURE__ */ jsxs(
204
+ "div",
205
+ {
206
+ "data-avatar": true,
207
+ className: cx(
208
+ "relative inline-flex shrink-0 rounded-[7px]",
209
+ rounded && "rounded-full",
210
+ // Focus styles
211
+ focusable && "outline-none group-focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]",
212
+ border && "ring-1 ring-secondary_alt",
213
+ border && styles[size].rootWithBorder,
214
+ styles[size].root,
215
+ className
216
+ ),
217
+ children: [
218
+ /* @__PURE__ */ jsx(
219
+ "div",
220
+ {
221
+ className: cx(
222
+ "relative inline-flex size-full shrink-0 items-center justify-center overflow-hidden rounded-md bg-tertiary outline-[0.5px] -outline-offset-[0.5px] outline-black/16 before:inset-[0.5px]",
223
+ rounded && "rounded-full",
224
+ canShowImage && size !== "xs" && "before:absolute before:inset-0 before:rounded-[inherit] before:border before:border-white/32 before:mask-[linear-gradient(to_bottom,black_0%,transparent_25%,transparent_75%,black_100%)]",
225
+ contentClassName
226
+ ),
227
+ children: renderMainContent()
228
+ }
229
+ ),
230
+ renderBadgeContent()
231
+ ]
235
232
  }
236
- }
237
- return { top, left, side: effectiveSide, maxHeight };
238
- }
239
- function useNarrowSheetViewport(breakpoint = 1025) {
240
- const [narrow, setNarrow] = useState(false);
241
- useEffect(() => {
242
- const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
243
- setNarrow(mq.matches);
244
- const h = (e) => setNarrow(e.matches);
245
- mq.addEventListener("change", h);
246
- return () => mq.removeEventListener("change", h);
247
- }, [breakpoint]);
248
- return narrow;
249
- }
250
- function plainTextFromNode(node) {
251
- if (node == null || node === false || node === true) return "";
252
- if (typeof node === "string" || typeof node === "number")
253
- return String(node);
254
- if (Array.isArray(node)) return node.map(plainTextFromNode).join("");
255
- if (React2.isValidElement(node)) {
256
- return plainTextFromNode(
257
- node.props.children
258
- );
259
- }
260
- return "";
261
- }
262
- var ValueContext = React2.createContext(null);
263
- function useSelectValue() {
264
- const c = React2.useContext(ValueContext);
265
- if (!c) throw new Error("Select subcomponents must be used within <Select>");
266
- return c;
267
- }
268
- var OpenContext = React2.createContext(null);
269
- function useSelectOpen() {
270
- const c = React2.useContext(OpenContext);
271
- if (!c)
272
- throw new Error(
273
- "Select.Trigger, SelectContent, and SelectItem need <Select> without native"
274
- );
275
- return c;
276
- }
277
- var Select = ({
278
- children,
279
- className,
280
- value: valueProp,
281
- defaultValue = "",
282
- onValueChange,
283
- native: nativeProp = false,
284
- disabled = false,
285
- name,
286
- id: idAttr,
287
- placeholder = "Select",
288
- open: openProp,
289
- onOpenChange
290
- }) => {
291
- const isValueControlled = valueProp !== void 0;
292
- const [internalValue, setInternalValue] = useState(defaultValue);
293
- const value = isValueControlled ? valueProp : internalValue;
294
- const [labels, setLabels] = useState({});
295
- const [nativeMeta, setNativeMeta] = useState({});
296
- const [nativeOrder, setNativeOrder] = useState([]);
297
- const setValue = useCallback(
298
- (v) => {
299
- if (!isValueControlled) setInternalValue(v);
300
- onValueChange?.(v);
301
- },
302
- [isValueControlled, onValueChange]
303
- );
304
- const setLabel = useCallback((v, n) => {
305
- setLabels((p) => p[v] === n ? p : { ...p, [v]: n });
306
- }, []);
307
- const clearLabel = useCallback((v) => {
308
- setLabels((p) => {
309
- if (!(v in p)) return p;
310
- const n = { ...p };
311
- delete n[v];
312
- return n;
313
- });
314
- }, []);
315
- const labelsRef = useRef(labels);
316
- labelsRef.current = labels;
317
- const labelFor = useCallback(
318
- (v) => labelsRef.current[v],
319
- []
320
- );
321
- const registerNativeItem = useCallback(
322
- (e) => {
323
- setLabel(e.value, e.label);
324
- setNativeMeta((p) => ({ ...p, [e.value]: { label: e.label, disabled: e.disabled } }));
325
- setNativeOrder((o) => o.includes(e.value) ? o : [...o, e.value]);
326
- },
327
- [setLabel]
328
- );
329
- const unregisterNativeItem = useCallback(
330
- (v) => {
331
- setNativeMeta((p) => {
332
- if (!(v in p)) return p;
333
- const n = { ...p };
334
- delete n[v];
335
- return n;
336
- });
337
- setNativeOrder((o) => o.filter((x) => x !== v));
338
- clearLabel(v);
339
- },
340
- [clearLabel]
341
- );
342
- const valueCtx = useMemo(
343
- () => ({
344
- native: nativeProp,
345
- value,
346
- setValue,
347
- disabled,
348
- setLabel,
349
- clearLabel,
350
- registerNativeItem,
351
- unregisterNativeItem,
352
- labelFor,
353
- placeholder
354
- }),
355
- [
356
- nativeProp,
357
- value,
358
- setValue,
359
- disabled,
360
- labels,
361
- setLabel,
362
- clearLabel,
363
- registerNativeItem,
364
- unregisterNativeItem,
365
- labelFor,
366
- placeholder
367
- ]
368
233
  );
369
- if (nativeProp) {
370
- return /* @__PURE__ */ jsxs(ValueContext.Provider, { value: valueCtx, children: [
371
- /* @__PURE__ */ jsxs(
372
- "div",
373
- {
374
- className: cn(
375
- "group relative inline-block w-max min-w-0 max-w-full",
376
- className
377
- ),
378
- children: [
379
- /* @__PURE__ */ jsxs(
380
- "select",
381
- {
382
- id: idAttr,
383
- name,
384
- className: cn(
385
- "peer",
386
- "border-primary/10 bg-background text-primary w-full min-w-0 max-w-full cursor-pointer appearance-none border pr-9 pl-3 outline-none",
387
- "h-10 min-h-10 text-sm font-medium",
388
- "rounded-full transition-[color,background-color,box-shadow,transform] duration-150",
389
- "focus-visible:ring-ring/50 focus-visible:ring-[3px]",
390
- "active:scale-[0.99]",
391
- "disabled:cursor-not-allowed disabled:opacity-50"
392
- ),
393
- value,
394
- disabled,
395
- onChange: (ev) => setValue(ev.target.value),
396
- children: [
397
- /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }),
398
- nativeOrder.map((key) => {
399
- const m = nativeMeta[key];
400
- if (!m) return null;
401
- return /* @__PURE__ */ jsx("option", { value: key, disabled: m.disabled, children: plainTextFromNode(m.label) }, key);
402
- })
403
- ]
404
- }
405
- ),
406
- /* @__PURE__ */ jsx(
407
- ChevronDown,
408
- {
409
- "aria-hidden": true,
410
- className: "text-primary/50 pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 peer-disabled:opacity-50"
411
- }
412
- )
413
- ]
414
- }
415
- ),
416
- children
417
- ] });
418
- }
419
- return /* @__PURE__ */ jsx(ValueContext.Provider, { value: valueCtx, children: /* @__PURE__ */ jsx(SelectOpenBridge, { open: openProp, onOpenChange, children: /* @__PURE__ */ jsx("div", { className: cn("inline-block min-w-0 max-w-full", className), children }) }) });
420
234
  };
421
- function SelectOpenBridge({
422
- children,
423
- open: controlled,
424
- onOpenChange
425
- }) {
426
- const [inner, setInner] = useState(false);
427
- const isControlled = controlled !== void 0;
428
- const open = isControlled ? controlled : inner;
429
- const setOpen = useCallback(
430
- (o) => {
431
- if (!isControlled) setInner(o);
432
- onOpenChange?.(o);
433
- },
434
- [isControlled, onOpenChange]
235
+ var HintText = ({ isInvalid, className, size = "md", ...props }) => {
236
+ return /* @__PURE__ */ jsx(
237
+ Text,
238
+ {
239
+ ...props,
240
+ slot: isInvalid ? "errorMessage" : "description",
241
+ className: cx(
242
+ "text-sm text-tertiary",
243
+ // Size
244
+ size === "sm" && "text-xs",
245
+ "in-data-[input-size=sm]:text-xs",
246
+ // Invalid state
247
+ isInvalid && "text-error-primary",
248
+ "group-invalid:text-error-primary",
249
+ className
250
+ )
251
+ }
435
252
  );
436
- const triggerRef = useRef(null);
437
- const ctx = useMemo(
438
- () => ({ open, setOpen, triggerRef }),
439
- [open, setOpen]
253
+ };
254
+ HintText.displayName = "HintText";
255
+ var Label = ({ isInvalid, isRequired, tooltip, tooltipDescription, className, ...props }) => {
256
+ return /* @__PURE__ */ jsxs(
257
+ Label$1,
258
+ {
259
+ "data-label": "true",
260
+ ...props,
261
+ className: cx("flex cursor-default items-center gap-0.5 text-sm font-medium text-secondary", className),
262
+ children: [
263
+ props.children,
264
+ /* @__PURE__ */ jsx(
265
+ "span",
266
+ {
267
+ className: cx(
268
+ "hidden text-brand-tertiary",
269
+ isRequired && "block",
270
+ typeof isRequired === "undefined" && "group-required:block",
271
+ isInvalid && "text-error-primary",
272
+ typeof isInvalid === "undefined" && "group-invalid:text-error-primary"
273
+ ),
274
+ children: "*"
275
+ }
276
+ ),
277
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, description: tooltipDescription, placement: "top", children: /* @__PURE__ */ jsx(
278
+ TooltipTrigger,
279
+ {
280
+ isDisabled: false,
281
+ className: "cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
282
+ children: /* @__PURE__ */ jsx(QuestionIcon, { className: "size-4" })
283
+ }
284
+ ) })
285
+ ]
286
+ }
440
287
  );
441
- return /* @__PURE__ */ jsx(OpenContext.Provider, { value: ctx, children });
288
+ };
289
+ Label.displayName = "Label";
290
+ var inputFocusRingShadow = "border-brand ring-1 ring-inset ring-brand";
291
+ var inputErrorFocusRingShadow = "border-error ring-1 ring-inset ring-error";
292
+ createContext({});
293
+
294
+ // ../../utils/is-react-component.ts
295
+ var isFunctionComponent = (component) => {
296
+ return typeof component === "function";
297
+ };
298
+ var isClassComponent = (component) => {
299
+ return typeof component === "function" && component.prototype && (!!component.prototype.isReactComponent || !!component.prototype.render);
300
+ };
301
+ var isForwardRefComponent = (component) => {
302
+ return typeof component === "object" && component !== null && component.$$typeof.toString() === "Symbol(react.forward_ref)";
303
+ };
304
+ var isReactComponent = (component) => {
305
+ return isFunctionComponent(component) || isForwardRefComponent(component) || isClassComponent(component);
306
+ };
307
+ var MOBILE_SHEET_MAX_PX = 1024;
308
+ function useIsMobile(breakpoint = MOBILE_SHEET_MAX_PX + 1) {
309
+ const [isMobile, setIsMobile] = useState(() => {
310
+ if (typeof window === "undefined") return false;
311
+ return window.matchMedia(`(max-width: ${breakpoint - 1}px)`).matches;
312
+ });
313
+ useEffect(() => {
314
+ const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
315
+ const handler = (e) => setIsMobile(e.matches);
316
+ mq.addEventListener("change", handler);
317
+ return () => mq.removeEventListener("change", handler);
318
+ }, [breakpoint]);
319
+ return isMobile;
442
320
  }
443
- var SheetClose = React2.forwardRef(({ className, type = "button", ...p }, ref) => /* @__PURE__ */ jsxs(
444
- "button",
445
- {
446
- ref,
447
- type,
448
- className: cn(
449
- "z-100 flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-full transition-all hover:bg-secondary-background active:scale-[0.96]",
450
- className
451
- ),
452
- ...p,
453
- children: [
454
- /* @__PURE__ */ jsx(X, { className: "size-5.5" }),
455
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
456
- ]
457
- }
458
- ));
459
- SheetClose.displayName = "SelectSheetClose";
460
- function resolveSheetOpts(o) {
321
+ var MOBILE_SHEET_MOTION_MS = 175;
322
+ var MOBILE_SHEET_ENTRY_EASING = "cubic-bezier(0.85, 0, 0.15, 1)";
323
+ var MOBILE_SHEET_EXIT_EASING = "cubic-bezier(0.85, 0, 1, 0.15)";
324
+ var MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX = 120;
325
+ function resolveSelectMobileOptions(mobileOptions) {
461
326
  return {
462
- sheet: o?.sheet ?? true,
463
- title: o?.title,
464
- panelClass: o?.className,
465
- bodyClass: o?.contentClassName
327
+ sheet: mobileOptions?.sheet ?? true,
328
+ title: mobileOptions?.title,
329
+ sheetClassName: mobileOptions?.className,
330
+ contentClassName: mobileOptions?.contentClassName
466
331
  };
467
332
  }
468
- function MobileSheetPortal({
469
- open,
470
- isAnimating,
471
- slideEntrance,
472
- slideOffsetPx,
473
- sheetTitle,
474
- sheetPanelClassName,
475
- contentClassName,
476
- onRequestClose,
477
- menuRef,
478
- children,
479
- className,
480
- style,
481
- ...rest
482
- }) {
483
- const ease = open ? MOBILE_SHEET_IN : MOBILE_SHEET_OUT;
484
- const hiddenY = slideEntrance ? `translateY(${slideOffsetPx}px)` : "translateY(100%)";
485
- return createPortal(
486
- /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-end justify-center p-0", children: [
487
- /* @__PURE__ */ jsx(
488
- "div",
489
- {
490
- className: cn(
491
- "fixed inset-0 bg-black/40 dark:bg-primary/4",
492
- isAnimating ? "opacity-100" : "opacity-0"
493
- ),
494
- style: {
495
- transition: `opacity ${MOBILE_SHEET_MS}ms ${ease}`
496
- },
497
- onClick: onRequestClose
498
- }
499
- ),
500
- /* @__PURE__ */ jsxs(
501
- "div",
502
- {
503
- ...rest,
504
- ref: menuRef,
505
- className: cn(
506
- "bg-background border-primary/10 relative z-10 flex w-full max-h-[min(90dvh,calc(100dvh-env(safe-area-inset-bottom,0px)))] flex-col overflow-hidden shadow-2xl outline-none",
507
- "rounded-t-2xl rounded-b-none border-x-0 border-b-0 border-t",
508
- sheetPanelClassName,
509
- className
510
- ),
511
- style: {
512
- transform: isAnimating ? "translateY(0)" : hiddenY,
513
- opacity: isAnimating ? 1 : 0,
514
- transition: `transform ${MOBILE_SHEET_MS}ms ${ease}, opacity ${MOBILE_SHEET_MS}ms ${ease}`,
515
- ...style
516
- },
517
- children: [
518
- /* @__PURE__ */ jsxs(
519
- "div",
520
- {
521
- className: cn(
522
- "flex w-full shrink-0 items-center py-2 pl-4 pr-2",
523
- sheetTitle ? "justify-between gap-3" : "justify-end"
524
- ),
525
- children: [
526
- sheetTitle ? /* @__PURE__ */ jsx("p", { className: "text-foreground min-w-0 flex-1 truncate text-base font-semibold", children: sheetTitle }) : null,
527
- /* @__PURE__ */ jsx(
528
- SheetClose,
529
- {
530
- onClick: (e) => {
531
- e.stopPropagation();
532
- onRequestClose();
533
- }
534
- }
535
- )
536
- ]
537
- }
538
- ),
539
- /* @__PURE__ */ jsx(
540
- "div",
541
- {
542
- className: cn(
543
- "min-h-0 flex-1 overflow-y-auto pb-[calc(5rem+env(safe-area-inset-bottom,0px))]",
544
- contentClassName
545
- ),
546
- children
547
- }
548
- )
549
- ]
550
- }
551
- )
552
- ] }),
553
- document.body
554
- );
555
- }
556
- function listFocusableItems(host) {
557
- return Array.from(
558
- host.querySelectorAll(
559
- '[data-select-item="true"]:not([aria-disabled="true"])'
560
- )
561
- );
562
- }
563
- var SelectContent = ({
564
- children,
565
- side = "bottom",
566
- align = "start",
567
- offset = 10,
568
- duration = 80,
569
- viewportPadding = 8,
570
- closeOnEscape = true,
571
- minWidth = "trigger",
572
- loop = true,
573
- typeahead = true,
574
- mobileOptions,
575
- slideEntrance = true,
576
- slideEntranceOffsetPx: slidePxProp,
577
- className,
578
- style,
579
- ...rest
580
- }) => {
581
- const narrow = useNarrowSheetViewport(MOBILE_SHEET_MAX_PX + 1);
582
- const { open, setOpen, triggerRef } = useSelectOpen();
583
- const [show, setShow] = useState(false);
584
- const [anim, setAnim] = useState(false);
585
- const [pos, setPos] = useState({ top: -9999, left: -9999, side });
586
- const [triggerW, setTriggerW] = useState(0);
587
- const menuRef = useRef(null);
588
- const typeaheadStateRef = useRef(createTypeaheadState());
589
- const sheet = useMemo(() => resolveSheetOpts(mobileOptions), [mobileOptions]);
590
- const slidePx = slidePxProp ?? SLIDE_DEFAULT_PX;
591
- const closeMs = narrow && sheet.sheet ? MOBILE_SHEET_MS : duration;
592
- const close = useCallback(() => setOpen(false), [setOpen]);
593
- const [portalReady, setPortalReady] = useState(false);
333
+ function useMobileSheetAnimation(open, enabled, slideEntrance = true, slideOffsetPx = MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX) {
334
+ const [shouldRender, setShouldRender] = useState(open);
335
+ const [isAnimating, setIsAnimating] = useState(false);
594
336
  useLayoutEffect(() => {
595
- setPortalReady(true);
596
- }, []);
597
- useEffect(() => {
337
+ if (!enabled) {
338
+ setShouldRender(open);
339
+ return;
340
+ }
598
341
  if (open) {
599
- setShow(true);
600
- } else {
601
- setAnim(false);
602
- const t = setTimeout(() => setShow(false), closeMs);
603
- return () => clearTimeout(t);
342
+ setShouldRender(true);
604
343
  }
605
- }, [open, closeMs]);
344
+ }, [open, enabled]);
606
345
  useEffect(() => {
607
- if (!show || !open) return;
608
- let r2 = 0;
609
- const r1 = requestAnimationFrame(() => {
610
- r2 = requestAnimationFrame(() => setAnim(true));
611
- });
612
- return () => {
613
- cancelAnimationFrame(r1);
614
- if (r2) cancelAnimationFrame(r2);
615
- };
616
- }, [show, open]);
346
+ if (!enabled || open) return;
347
+ const timer = setTimeout(() => setShouldRender(false), MOBILE_SHEET_MOTION_MS);
348
+ return () => clearTimeout(timer);
349
+ }, [open, enabled]);
617
350
  useLayoutEffect(() => {
618
- if (!triggerRef.current || !menuRef.current) return;
619
- if (!open && !show) return;
620
- const run = () => {
621
- if (!triggerRef.current || !menuRef.current) return;
622
- setTriggerW(triggerRef.current.getBoundingClientRect().width);
623
- setPos(
624
- computeMenuPosition(
625
- triggerRef.current,
626
- menuRef.current,
627
- side,
628
- align,
629
- offset,
630
- viewportPadding
631
- )
632
- );
633
- };
634
- run();
635
- window.addEventListener("resize", run);
636
- window.addEventListener("scroll", run, true);
637
- return () => {
638
- window.removeEventListener("resize", run);
639
- window.removeEventListener("scroll", run, true);
640
- };
641
- }, [open, show, side, align, offset, viewportPadding, triggerRef]);
642
- useEffect(() => {
643
- if (anim && menuRef.current) menuRef.current.focus();
644
- }, [anim]);
645
- useEffect(() => {
646
- if (!open) resetTypeahead(typeaheadStateRef.current);
647
- }, [open]);
351
+ if (!enabled || open || !shouldRender) return;
352
+ setIsAnimating(false);
353
+ }, [enabled, open, shouldRender]);
648
354
  useEffect(() => {
649
- if (!open) return;
650
- const onDoc = (e) => {
651
- const t = e.target;
652
- if (menuRef.current?.contains(t) || triggerRef.current?.contains(t)) return;
653
- setOpen(false);
355
+ if (!enabled || !shouldRender || !open) return;
356
+ let raf2 = 0;
357
+ const raf1 = requestAnimationFrame(() => {
358
+ raf2 = requestAnimationFrame(() => setIsAnimating(true));
359
+ });
360
+ return () => {
361
+ cancelAnimationFrame(raf1);
362
+ if (raf2) cancelAnimationFrame(raf2);
654
363
  };
655
- document.addEventListener("mousedown", onDoc);
656
- return () => document.removeEventListener("mousedown", onDoc);
657
- }, [open, setOpen, triggerRef]);
658
- useEffect(() => {
659
- if (!open) return;
660
- const onKey = (e) => {
661
- const m = menuRef.current;
662
- if (!m) return;
663
- const active = document.activeElement;
664
- if (active && !m.contains(active) && !triggerRef.current?.contains(active))
665
- return;
666
- const items = listFocusableItems(m);
667
- const i = items.indexOf(active);
668
- switch (e.key) {
669
- case "Escape":
670
- if (closeOnEscape) {
671
- e.preventDefault();
672
- setOpen(false);
673
- triggerRef.current?.focus();
674
- }
675
- break;
676
- case "ArrowDown":
677
- e.preventDefault();
678
- if (!items.length) break;
679
- if (i === -1 || i === items.length - 1 && loop) items[0]?.focus();
680
- else if (i < items.length - 1) items[i + 1]?.focus();
681
- break;
682
- case "ArrowUp":
683
- e.preventDefault();
684
- if (!items.length) break;
685
- if (i <= 0 && loop) items[items.length - 1]?.focus();
686
- else if (i > 0) items[i - 1]?.focus();
687
- break;
688
- case "Home":
689
- e.preventDefault();
690
- items[0]?.focus();
691
- break;
692
- case "End":
693
- e.preventDefault();
694
- items[items.length - 1]?.focus();
695
- break;
696
- case "Tab":
697
- setOpen(false);
698
- break;
699
- default:
700
- handleTypeaheadKeyDown(e, items, typeaheadStateRef.current, {
701
- enabled: typeahead
702
- });
703
- break;
364
+ }, [shouldRender, open, enabled]);
365
+ const motionEasing = open ? MOBILE_SHEET_ENTRY_EASING : MOBILE_SHEET_EXIT_EASING;
366
+ const hiddenTransform = slideEntrance ? `translateY(${slideOffsetPx}px)` : "translateY(100%)";
367
+ const panelStyle = enabled ? {
368
+ transform: isAnimating ? "translateY(0)" : hiddenTransform,
369
+ opacity: isAnimating ? 1 : 0,
370
+ transitionProperty: "transform, opacity",
371
+ transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
372
+ transitionTimingFunction: motionEasing
373
+ } : void 0;
374
+ const backdropStyle = enabled ? {
375
+ opacity: isAnimating ? 1 : 0,
376
+ transitionProperty: "opacity",
377
+ transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
378
+ transitionTimingFunction: motionEasing
379
+ } : void 0;
380
+ return { shouldRender, isAnimating, panelStyle, backdropStyle };
381
+ }
382
+ function MobileSheetCloseButton({ onClose }) {
383
+ return /* @__PURE__ */ jsxs(
384
+ "button",
385
+ {
386
+ type: "button",
387
+ onClick: (e) => {
388
+ e.stopPropagation();
389
+ onClose();
390
+ },
391
+ className: "flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-full text-fg-primary transition duration-100 ease-linear hover:bg-primary_hover active:scale-[0.96] focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]",
392
+ children: [
393
+ /* @__PURE__ */ jsx(XIcon, { className: "size-5", "aria-hidden": "true" }),
394
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
395
+ ]
396
+ }
397
+ );
398
+ }
399
+ function MobileSheetChrome({
400
+ title,
401
+ contentClassName,
402
+ onClose,
403
+ children
404
+ }) {
405
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
406
+ /* @__PURE__ */ jsxs("div", { className: cx("flex w-full shrink-0 items-center py-2 pl-4 pr-2", title ? "justify-between gap-3" : "justify-end"), children: [
407
+ title ? /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-base font-semibold text-primary", children: title }) : null,
408
+ /* @__PURE__ */ jsx(MobileSheetCloseButton, { onClose })
409
+ ] }),
410
+ /* @__PURE__ */ jsx(
411
+ "div",
412
+ {
413
+ className: cx(
414
+ "min-h-0 flex-1 overflow-y-auto pb-[calc(5rem+env(safe-area-inset-bottom,0px))]",
415
+ contentClassName
416
+ ),
417
+ children
704
418
  }
705
- };
706
- window.addEventListener("keydown", onKey);
707
- return () => window.removeEventListener("keydown", onKey);
708
- }, [open, closeOnEscape, loop, typeahead, setOpen, triggerRef]);
709
- const lockBodyScroll = (open || show) && narrow && sheet.sheet;
419
+ )
420
+ ] });
421
+ }
422
+ var Popover = ({ mobileOptions, children, size, className, style, compoundContent = false, ...props }) => {
423
+ const isMobile = useIsMobile();
424
+ const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
425
+ const useMobileSheet = isMobile && resolvedMobile.sheet;
426
+ const overlayState = useContext(OverlayTriggerStateContext);
427
+ const open = overlayState?.isOpen ?? false;
428
+ const { shouldRender, panelStyle, backdropStyle } = useMobileSheetAnimation(open, useMobileSheet);
710
429
  useEffect(() => {
711
- if (!lockBodyScroll) return;
430
+ if (!useMobileSheet || !open) return;
712
431
  const prev = document.body.style.overflow;
713
432
  document.body.style.overflow = "hidden";
714
433
  return () => {
715
434
  document.body.style.overflow = prev;
716
435
  };
717
- }, [lockBodyScroll]);
718
- if (narrow && sheet.sheet) {
719
- if (!open && !show) {
720
- const registrationSlot = /* @__PURE__ */ jsx("div", { className: "sr-only pointer-events-none", "aria-hidden": true, children });
721
- if (!portalReady) return registrationSlot;
722
- return createPortal(registrationSlot, document.body);
723
- }
724
- return /* @__PURE__ */ jsx(
725
- MobileSheetPortal,
436
+ }, [useMobileSheet, open]);
437
+ const close = () => overlayState?.close();
438
+ const showMobileSheet = useMobileSheet && shouldRender;
439
+ const isMobileSheetExiting = showMobileSheet && !open;
440
+ const mobileScrim = useMobileSheet && shouldRender && typeof document !== "undefined" ? createPortal(
441
+ /* @__PURE__ */ jsx(
442
+ "div",
726
443
  {
727
- ...rest,
728
- open,
729
- isAnimating: anim,
730
- slideEntrance,
731
- slideOffsetPx: slidePx,
732
- sheetTitle: sheet.title,
733
- sheetPanelClassName: sheet.panelClass,
734
- contentClassName: sheet.bodyClass,
735
- onRequestClose: close,
736
- menuRef,
737
- className,
738
- style,
739
- role: "listbox",
740
- tabIndex: -1,
741
- "aria-label": sheet.title,
742
- children
444
+ className: "fixed inset-0 z-50 bg-overlay/70",
445
+ style: backdropStyle,
446
+ onClick: close,
447
+ "aria-hidden": "true"
743
448
  }
744
- );
745
- }
746
- const resolvedMin = minWidth === "trigger" ? triggerW > 0 ? triggerW : void 0 : minWidth;
747
- const listbox = /* @__PURE__ */ jsx(
748
- "div",
749
- {
750
- ...rest,
751
- ref: menuRef,
752
- role: "listbox",
753
- tabIndex: -1,
754
- "aria-hidden": !open,
755
- className: cn(
756
- "bg-background border-primary/10 absolute z-50 rounded-xl border py-1.5 shadow-xl outline-none",
757
- className,
758
- pos.maxHeight != null ? "overflow-y-auto overscroll-contain" : "overflow-hidden"
759
- ),
760
- style: {
761
- position: "absolute",
762
- top: pos.top,
763
- left: pos.left,
764
- ...typeof resolvedMin === "number" ? { minWidth: resolvedMin } : {},
765
- maxHeight: pos.maxHeight,
766
- transformOrigin: CONTENT_ORIGIN[pos.side],
767
- transform: anim ? "none" : CONTENT_HIDDEN[pos.side],
768
- opacity: anim ? 1 : 0,
769
- pointerEvents: !open ? "none" : "auto",
770
- transitionProperty: "opacity, transform",
771
- transitionDuration: `${duration}ms`,
772
- transitionTimingFunction: anim ? PANEL_OPEN_EASING : PANEL_CLOSE_EASING,
773
- ...style
774
- },
775
- children
776
- }
777
- );
778
- if (!portalReady) {
779
- return listbox;
780
- }
781
- return createPortal(listbox, document.body);
449
+ ),
450
+ document.body
451
+ ) : null;
452
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
453
+ mobileScrim,
454
+ /* @__PURE__ */ jsx(
455
+ Popover$1,
456
+ {
457
+ placement: "bottom",
458
+ containerPadding: 0,
459
+ offset: 4,
460
+ ...props,
461
+ isExiting: isMobileSheetExiting,
462
+ ...useMobileSheet ? { "data-select-mobile-sheet": true } : {},
463
+ style: useMobileSheet ? { ...panelStyle, ...style } : style,
464
+ className: (state) => cx(
465
+ "outline-hidden",
466
+ !useMobileSheet && [
467
+ "w-(--trigger-width) origin-(--trigger-anchor-point) rounded-lg bg-primary shadow-lg ring-1 ring-secondary_alt will-change-transform",
468
+ compoundContent ? "overflow-hidden outline-hidden" : "overflow-x-hidden overflow-y-auto py-1 outline-hidden",
469
+ state.isEntering && "duration-150 ease-out animate-in fade-in placement-right:slide-in-from-left-0.5 placement-top:slide-in-from-bottom-0.5 placement-bottom:slide-in-from-top-0.5",
470
+ state.isExiting && "duration-100 ease-in animate-out fade-out placement-right:slide-out-to-left-0.5 placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5",
471
+ !compoundContent && size === "sm" && "max-h-56!",
472
+ !compoundContent && size === "md" && "max-h-64!",
473
+ !compoundContent && size === "lg" && "max-h-80!"
474
+ ],
475
+ useMobileSheet && [
476
+ "fixed! inset-x-0! bottom-0! top-auto! left-0! right-0! z-[51] flex w-full! max-w-none! flex-col overflow-hidden rounded-t-2xl rounded-b-none border-x-0 border-t border-secondary bg-primary shadow-xl",
477
+ "max-h-[min(90dvh,calc(100dvh-env(safe-area-inset-bottom,0px)))]",
478
+ resolvedMobile.sheetClassName
479
+ ],
480
+ typeof className === "function" ? className(state) : className
481
+ ),
482
+ children: (state) => {
483
+ const content = typeof children === "function" ? children(state) : children;
484
+ if (useMobileSheet) {
485
+ return /* @__PURE__ */ jsx(
486
+ MobileSheetChrome,
487
+ {
488
+ title: resolvedMobile.title,
489
+ contentClassName: resolvedMobile.contentClassName,
490
+ onClose: close,
491
+ children: content
492
+ }
493
+ );
494
+ }
495
+ return content;
496
+ }
497
+ }
498
+ )
499
+ ] });
500
+ };
501
+ var sizes3 = {
502
+ sm: {
503
+ root: "py-2 pl-3 pr-2.5 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]",
504
+ withIcon: "",
505
+ text: "text-sm",
506
+ textContainer: "gap-x-1.5",
507
+ shortcut: "pr-2.5"
508
+ },
509
+ md: { root: "py-2 px-3 gap-2 *:data-icon:size-5", withIcon: "", text: "text-md", textContainer: "gap-x-1.5", shortcut: "pr-2.5" },
510
+ lg: { root: "py-2.5 px-3.5 gap-2 *:data-icon:size-5", withIcon: "", text: "text-md", textContainer: "gap-x-1.5", shortcut: "pr-3" }
511
+ };
512
+ var searchSizes = {
513
+ sm: { wrapper: "py-1", root: "px-3 py-2 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]", text: "text-sm" },
514
+ md: { wrapper: "py-0.5", root: "px-3 py-2 gap-2 *:data-icon:size-5", text: "text-md" },
515
+ lg: { wrapper: "py-0.5", root: "px-3.5 py-2.5 gap-2 *:data-icon:size-5", text: "text-md" }
782
516
  };
783
- function mergeRef(store, node, fromChild) {
784
- store.current = node;
785
- if (typeof fromChild === "function") fromChild(node);
786
- else if (fromChild && typeof fromChild === "object")
787
- fromChild.current = node;
517
+ var SelectContext = createContext({ size: "md" });
518
+ function hasResizeObserver() {
519
+ return typeof window.ResizeObserver !== "undefined";
788
520
  }
789
- var SelectTrigger = React2.forwardRef(
790
- function SelectTrigger2({ children, asChild, className, onClick, disabled, ...buttonProps }, ref) {
791
- const { open, setOpen, triggerRef } = useSelectOpen();
792
- const triggerVariant = buttonProps.variant ?? "secondary";
793
- const onPress = useCallback(
794
- (e) => {
795
- onClick?.(
796
- e
797
- );
798
- e.stopPropagation();
799
- if (disabled) return;
800
- setOpen(!open);
801
- },
802
- [onClick, disabled, open, setOpen]
803
- );
804
- const setBtnRef = useCallback(
805
- (el) => {
806
- mergeRef(triggerRef, el, null);
807
- if (typeof ref === "function") ref(el);
808
- else if (ref) ref.current = el;
809
- },
810
- [ref, triggerRef]
811
- );
812
- if (asChild && React2.isValidElement(children)) {
813
- const ch = children;
814
- const childRef = ch.ref;
815
- return React2.cloneElement(ch, {
816
- ref: (n) => mergeRef(triggerRef, n, childRef),
817
- className: cn("group w-fit max-w-full min-w-0 justify-start gap-2", ch.props.className),
818
- onClick: (e) => {
819
- ch.props.onClick?.(e);
820
- onPress(e);
821
- },
822
- "aria-expanded": open,
823
- "aria-haspopup": "listbox",
824
- "data-state": open ? "open" : "closed",
825
- "data-variant": triggerVariant,
826
- ...disabled !== void 0 ? { "aria-disabled": disabled } : {}
521
+ function useResizeObserver(options) {
522
+ const { ref, box, onResize } = options;
523
+ useEffect(() => {
524
+ const element = ref?.current;
525
+ if (!element) {
526
+ return;
527
+ }
528
+ if (!hasResizeObserver()) {
529
+ window.addEventListener("resize", onResize, false);
530
+ return () => {
531
+ window.removeEventListener("resize", onResize, false);
532
+ };
533
+ } else {
534
+ const resizeObserverInstance = new window.ResizeObserver((entries) => {
535
+ if (!entries.length) {
536
+ return;
537
+ }
538
+ onResize();
827
539
  });
540
+ resizeObserverInstance.observe(element, { box });
541
+ return () => {
542
+ if (element) {
543
+ resizeObserverInstance.unobserve(element);
544
+ }
545
+ };
828
546
  }
829
- return /* @__PURE__ */ jsx(
830
- Button,
831
- {
832
- ref: setBtnRef,
833
- type: "button",
834
- ...buttonProps,
835
- disabled,
836
- className: cn("group w-fit max-w-full min-w-0 justify-start gap-2", className),
837
- "aria-expanded": open,
838
- "aria-haspopup": "listbox",
839
- "data-state": open ? "open" : "closed",
840
- "data-variant": triggerVariant,
841
- onClick: onPress,
842
- children
843
- }
844
- );
845
- }
846
- );
847
- SelectTrigger.displayName = "SelectTrigger";
848
- var SelectChevron = ({
849
- className,
850
- ...props
851
- }) => {
852
- const { open } = useSelectOpen();
853
- return /* @__PURE__ */ jsx(
854
- ChevronDown,
547
+ }, [onResize, ref, box]);
548
+ }
549
+ var ComboBoxMobileTrigger = ({ size, placeholder, icon: IconProp, isInvalid, onPointerEnter, ref }) => {
550
+ const state = useContext(ComboBoxStateContext);
551
+ const selectedItem = state?.selectedItem?.value ?? null;
552
+ return /* @__PURE__ */ jsxs(
553
+ Button,
855
554
  {
856
- "aria-hidden": true,
857
- className: cn("size-4 shrink-0", open && "rotate-180", className),
858
- ...props
555
+ ref,
556
+ onPress: () => state?.open(),
557
+ onPointerEnter,
558
+ className: ({ isFocusVisible, isDisabled }) => cx(
559
+ "relative flex w-full cursor-pointer items-center gap-2 rounded-lg border border-solid border-primary bg-primary text-left shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
560
+ isDisabled && "cursor-not-allowed opacity-50",
561
+ !isInvalid && (isFocusVisible || state?.isOpen) && inputFocusRingShadow,
562
+ isInvalid && !(isFocusVisible || state?.isOpen) && "border-error_subtle",
563
+ isInvalid && (isFocusVisible || state?.isOpen) && inputErrorFocusRingShadow,
564
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
565
+ sizes3[size].root
566
+ ),
567
+ children: [
568
+ isReactComponent(IconProp) ? /* @__PURE__ */ jsx(IconProp, { "data-icon": true, className: "pointer-events-none", "aria-hidden": "true" }) : isValidElement(IconProp) ? IconProp : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "data-icon": true, className: "pointer-events-none", "aria-hidden": "true" }),
569
+ selectedItem ? /* @__PURE__ */ jsxs("section", { className: cx("flex w-full truncate", sizes3[size].textContainer), children: [
570
+ /* @__PURE__ */ jsx("p", { className: cx("truncate font-medium text-primary", sizes3[size].text), children: selectedItem.label }),
571
+ selectedItem.supportingText && /* @__PURE__ */ jsx("p", { className: cx("text-tertiary", sizes3[size].text), children: selectedItem.supportingText })
572
+ ] }) : /* @__PURE__ */ jsx("p", { className: cx("truncate text-placeholder", sizes3[size].text), children: placeholder })
573
+ ]
859
574
  }
860
575
  );
861
576
  };
862
- var SelectValue = ({ placeholder, className }) => {
863
- const c = useSelectValue();
864
- if (c.native) return null;
865
- const ph = placeholder ?? c.placeholder;
866
- const text = c.value ? c.labelFor(c.value) : void 0;
867
- const isEmpty = !c.value;
868
- return /* @__PURE__ */ jsx(
869
- "span",
577
+ var ComboBoxSheetSearch = ({ size, placeholder, icon: IconProp }) => /* @__PURE__ */ jsx("div", { className: cx("shrink-0 border-b border-secondary", searchSizes[size].wrapper), children: /* @__PURE__ */ jsxs("div", { className: cx("flex items-center", searchSizes[size].root), children: [
578
+ isReactComponent(IconProp) ? /* @__PURE__ */ jsx(IconProp, { "data-icon": true, "aria-hidden": "true", className: "shrink-0 text-fg-quaternary" }) : isValidElement(IconProp) ? IconProp : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "data-icon": true, "aria-hidden": "true", className: "shrink-0 text-fg-quaternary" }),
579
+ /* @__PURE__ */ jsx(
580
+ Input,
870
581
  {
871
- "data-slot": "select-value",
872
- className: cn(
873
- "min-w-0 flex-1 truncate text-left",
874
- isEmpty && cn(
875
- "group-data-[variant=primary]:!text-background/50",
876
- "group-data-[variant=secondary]:!text-primary/50",
877
- "group-data-[variant=destructive]:!text-red-500/50",
878
- "group-data-[variant=success]:!text-green-500/50"
879
- ),
880
- className
582
+ placeholder,
583
+ className: cx(
584
+ "w-full appearance-none bg-transparent text-primary caret-alpha-black/90 outline-hidden placeholder:text-placeholder",
585
+ searchSizes[size].text
586
+ )
587
+ }
588
+ )
589
+ ] }) });
590
+ var ComboBoxValue = ({ size, shortcut, placeholder, shortcutClassName, icon: IconProp, isInvalid, ref, ...otherProps }) => {
591
+ const state = useContext(ComboBoxStateContext);
592
+ const value = state?.selectedItem?.value || null;
593
+ const inputValue = state?.inputValue || null;
594
+ const first = inputValue?.split(value?.supportingText)?.[0] || "";
595
+ const last = inputValue?.split(first)[1];
596
+ return /* @__PURE__ */ jsxs(
597
+ Group,
598
+ {
599
+ ref,
600
+ ...otherProps,
601
+ isInvalid,
602
+ className: ({ isDisabled, isInvalid: isGroupInvalid }) => cx(
603
+ "relative flex w-full items-center gap-2 rounded-lg border border-solid border-primary bg-primary shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
604
+ isDisabled && "cursor-not-allowed opacity-50",
605
+ !isGroupInvalid && state?.isOpen && inputFocusRingShadow,
606
+ !isGroupInvalid && "has-[input:focus-visible]:border-brand has-[input:focus-visible]:ring-1 has-[input:focus-visible]:ring-inset has-[input:focus-visible]:ring-brand",
607
+ isGroupInvalid && !state?.isOpen && "border-error_subtle",
608
+ isGroupInvalid && state?.isOpen && inputErrorFocusRingShadow,
609
+ isGroupInvalid && "has-[input:focus-visible]:border-error has-[input:focus-visible]:ring-1 has-[input:focus-visible]:ring-inset has-[input:focus-visible]:ring-error",
610
+ // Icon styles
611
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
612
+ sizes3[size].root
881
613
  ),
882
- children: text != null ? text : ph
614
+ children: [
615
+ isReactComponent(IconProp) ? /* @__PURE__ */ jsx(IconProp, { "data-icon": true, className: "pointer-events-none", "aria-hidden": "true" }) : isValidElement(IconProp) ? IconProp : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "data-icon": true, className: "pointer-events-none", "aria-hidden": "true" }),
616
+ /* @__PURE__ */ jsxs("div", { className: "relative flex w-full items-center", children: [
617
+ inputValue && /* @__PURE__ */ jsxs("span", { className: cx("absolute top-1/2 z-0 inline-flex w-full -translate-y-1/2 truncate", sizes3[size].textContainer), "aria-hidden": "true", children: [
618
+ /* @__PURE__ */ jsx("p", { className: cx("font-medium text-primary", sizes3[size].text), children: first }),
619
+ last && /* @__PURE__ */ jsx("p", { className: cx("-ml-0.75 text-tertiary", sizes3[size].text), children: last })
620
+ ] }),
621
+ /* @__PURE__ */ jsx(
622
+ Input,
623
+ {
624
+ placeholder,
625
+ className: cx(
626
+ "z-10 w-full appearance-none bg-transparent text-transparent caret-alpha-black/90 placeholder:text-placeholder focus:outline-hidden disabled:cursor-not-allowed",
627
+ sizes3[size].text
628
+ )
629
+ }
630
+ )
631
+ ] }),
632
+ shortcut && /* @__PURE__ */ jsx(
633
+ "div",
634
+ {
635
+ className: cx(
636
+ "absolute inset-y-0.5 right-0.5 z-10 hidden items-center rounded-r-[inherit] bg-linear-to-r from-transparent to-bg-primary to-40% pl-8 md:flex",
637
+ sizes3[size].shortcut,
638
+ shortcutClassName
639
+ ),
640
+ children: /* @__PURE__ */ jsx(
641
+ "span",
642
+ {
643
+ className: "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
644
+ "aria-hidden": "true",
645
+ children: "\u2318K"
646
+ }
647
+ )
648
+ }
649
+ )
650
+ ]
883
651
  }
884
652
  );
885
653
  };
886
- var SelectItemRow = ({
887
- value: v,
654
+ var ComboBox = ({
655
+ placeholder = "Search",
656
+ shortcut = true,
657
+ size = "md",
888
658
  children,
889
- disabled,
890
- shortcut,
891
- className,
892
- onClick: userClick,
893
- ...divProps
659
+ items,
660
+ shortcutClassName,
661
+ icon,
662
+ hideRequiredIndicator,
663
+ mobileOptions,
664
+ ...otherProps
894
665
  }) => {
895
- const c = useSelectValue();
896
- const { setOpen } = useSelectOpen();
897
- const selected = c.value === v;
898
- const click = (e) => {
899
- if (disabled) return;
900
- c.setValue(v);
901
- userClick?.(e);
902
- setOpen(false);
903
- };
904
- const keyDown = (e) => {
905
- if (e.key === "Enter" || e.key === " ") {
906
- e.preventDefault();
907
- click(e);
666
+ const isMobile = useIsMobile();
667
+ const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
668
+ const useMobileSheet = isMobile && resolvedMobile.sheet;
669
+ const triggerRef = useRef(null);
670
+ const [popoverWidth, setPopoverWidth] = useState("");
671
+ const onResize = useCallback(() => {
672
+ if (!triggerRef.current) return;
673
+ const divRect = triggerRef.current.getBoundingClientRect();
674
+ setPopoverWidth(divRect.width + "px");
675
+ }, []);
676
+ useResizeObserver({
677
+ ref: triggerRef,
678
+ box: "border-box",
679
+ onResize
680
+ });
681
+ return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(ComboBox$1, { menuTrigger: useMobileSheet ? "manual" : "focus", ...otherProps, children: (state) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
682
+ otherProps.label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : state.isRequired, tooltip: otherProps.tooltip, children: otherProps.label }),
683
+ useMobileSheet ? /* @__PURE__ */ jsx(
684
+ ComboBoxMobileTrigger,
685
+ {
686
+ ref: triggerRef,
687
+ placeholder,
688
+ icon,
689
+ size,
690
+ isInvalid: state.isInvalid,
691
+ onPointerEnter: onResize
692
+ }
693
+ ) : /* @__PURE__ */ jsx(
694
+ ComboBoxValue,
695
+ {
696
+ ref: triggerRef,
697
+ placeholder,
698
+ shortcut,
699
+ shortcutClassName,
700
+ icon,
701
+ size,
702
+ isInvalid: state.isInvalid,
703
+ onFocus: onResize,
704
+ onPointerEnter: onResize
705
+ }
706
+ ),
707
+ /* @__PURE__ */ jsx(
708
+ Popover,
709
+ {
710
+ size,
711
+ triggerRef,
712
+ compoundContent: useMobileSheet,
713
+ style: useMobileSheet ? void 0 : { width: popoverWidth },
714
+ className: otherProps.popoverClassName,
715
+ mobileOptions: { title: otherProps.label, ...mobileOptions },
716
+ children: useMobileSheet ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-col overflow-hidden outline-hidden", children: [
717
+ /* @__PURE__ */ jsx(ComboBoxSheetSearch, { size, placeholder, icon }),
718
+ /* @__PURE__ */ jsx(ListBox, { items, className: "min-h-0 flex-1 overflow-y-auto py-1 outline-hidden", children })
719
+ ] }) : /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children })
720
+ }
721
+ ),
722
+ otherProps.hint && /* @__PURE__ */ jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === "sm" && "text-xs"), children: otherProps.hint })
723
+ ] }) }) });
724
+ };
725
+ var CHECKBOX_TICK_DELAY_MS = 60;
726
+ var CHECKBOX_TICK_DRAW_MS = 100;
727
+ function CheckboxAnimatedCheckMark({ pixelSize, className }) {
728
+ const pathRef = useRef(null);
729
+ useLayoutEffect(() => {
730
+ const path = pathRef.current;
731
+ if (!path || typeof path.getTotalLength !== "function") return;
732
+ const len = path.getTotalLength();
733
+ if (len <= 0) return;
734
+ path.style.strokeDasharray = `${len}`;
735
+ path.style.strokeDashoffset = `${len}`;
736
+ if (typeof path.animate !== "function") {
737
+ path.style.strokeDashoffset = "0";
738
+ return;
908
739
  }
909
- };
740
+ const anim = path.animate([{ strokeDashoffset: len }, { strokeDashoffset: 0 }], {
741
+ duration: CHECKBOX_TICK_DRAW_MS,
742
+ delay: CHECKBOX_TICK_DELAY_MS,
743
+ easing: "cubic-bezier(0.45, 0, 0.2, 1)",
744
+ fill: "forwards"
745
+ });
746
+ return () => anim.cancel();
747
+ }, []);
748
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", width: pixelSize, height: pixelSize, viewBox: "0 0 14 14", fill: "none", className: cx("block", className), children: /* @__PURE__ */ jsx(
749
+ "path",
750
+ {
751
+ ref: pathRef,
752
+ d: "M2.33325 7L5.24992 9.91667L11.6666 3.5",
753
+ stroke: "currentColor",
754
+ strokeWidth: "2",
755
+ strokeLinecap: "round",
756
+ strokeLinejoin: "round"
757
+ }
758
+ ) });
759
+ }
760
+ var focusRingShadow = "outline-none [box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
761
+ var CheckboxBase = ({ className, isSelected, isDisabled, isIndeterminate, size = "sm", isFocusVisible = false }) => {
762
+ const isChecked = isSelected || isIndeterminate;
763
+ const iconPixelSize = size === "sm" ? 10 : 14;
910
764
  return /* @__PURE__ */ jsxs(
911
765
  "div",
912
766
  {
913
- ...divProps,
914
- "data-select-item": "true",
915
- role: "option",
916
- "aria-selected": selected,
917
- tabIndex: disabled ? void 0 : -1,
918
- "aria-disabled": disabled,
919
- onClick: click,
920
- onKeyDown: keyDown,
921
- className: cn(
922
- "relative mx-1.5 flex items-center gap-2 rounded-md px-3 py-2 text-sm transition-colors duration-0 outline-none select-none",
923
- SHEET_MENU_TEXT,
924
- !disabled && "text-foreground hover:bg-primary/8 focus-visible:bg-primary/8 dark:hover:bg-primary/4 dark:focus-visible:bg-primary/4",
925
- disabled && "lg:cursor-not-allowed text-foreground/45 dark:text-foreground/50",
926
- !disabled && "cursor-pointer",
767
+ className: cx(
768
+ "relative flex shrink-0 cursor-pointer appearance-none items-center justify-center overflow-clip border border-solid border-primary",
769
+ size === "sm" ? "size-4 rounded-xs" : "size-5 rounded-sm",
770
+ isChecked ? "border-transparent bg-brand-solid" : "bg-primary",
771
+ !isChecked && !isDisabled && "group-hover:bg-primary_hover",
772
+ isDisabled && "cursor-not-allowed opacity-50",
773
+ isDisabled && !isChecked && "bg-tertiary",
774
+ isFocusVisible && !isDisabled && focusRingShadow,
927
775
  className
928
776
  ),
929
777
  children: [
930
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", "data-menu-label": true, children }),
931
- shortcut ? /* @__PURE__ */ jsx(
932
- "span",
778
+ isIndeterminate && /* @__PURE__ */ jsx(
779
+ "svg",
933
780
  {
934
- className: cn(
935
- "shrink-0 text-xs tracking-widest opacity-40",
936
- SHEET_MENU_SHORTCUT
937
- ),
938
- children: shortcut
781
+ "aria-hidden": "true",
782
+ width: iconPixelSize,
783
+ height: iconPixelSize,
784
+ viewBox: "0 0 14 14",
785
+ fill: "none",
786
+ className: "pointer-events-none block text-fg-white",
787
+ children: /* @__PURE__ */ jsx("path", { d: "M2.91675 7H11.0834", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
939
788
  }
940
- ) : null,
941
- /* @__PURE__ */ jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", "aria-hidden": true, children: selected ? /* @__PURE__ */ jsx(Check, { className: "size-3.5", strokeWidth: 2.5 }) : null })
789
+ ),
790
+ isSelected && !isIndeterminate && /* @__PURE__ */ jsx(CheckboxAnimatedCheckMark, { pixelSize: iconPixelSize, className: "pointer-events-none text-fg-white" })
942
791
  ]
943
792
  }
944
793
  );
945
794
  };
795
+ CheckboxBase.displayName = "CheckboxBase";
796
+ var sizes4 = {
797
+ sm: {
798
+ root: "p-2 pr-2.5 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]",
799
+ text: "text-sm",
800
+ textContainer: "gap-x-1.5",
801
+ check: "size-4 stroke-[2.25px]",
802
+ checkbox: "sm"
803
+ },
804
+ md: {
805
+ root: "p-2 pr-2.5 gap-2 *:data-icon:size-5",
806
+ text: "text-md",
807
+ textContainer: "gap-x-2",
808
+ check: "size-5",
809
+ checkbox: "sm"
810
+ },
811
+ lg: {
812
+ root: "p-2.5 pl-2 gap-2 *:data-icon:size-5",
813
+ text: "text-md",
814
+ textContainer: "gap-x-2",
815
+ check: "size-5",
816
+ checkbox: "md"
817
+ }
818
+ };
946
819
  var SelectItem = ({
947
- value: v,
820
+ label,
821
+ id,
822
+ value,
823
+ avatarUrl,
824
+ supportingText,
825
+ isDisabled,
826
+ icon: Icon,
827
+ className,
948
828
  children,
949
- disabled,
950
- ...rest
829
+ selectionIndicator = "checkmark",
830
+ selectionIndicatorAlign = "right",
831
+ ...props
951
832
  }) => {
952
- const {
953
- native,
954
- setLabel,
955
- clearLabel,
956
- registerNativeItem,
957
- unregisterNativeItem
958
- } = useSelectValue();
959
- useLayoutEffect(() => {
960
- setLabel(v, children);
961
- if (native) registerNativeItem({ value: v, label: children, disabled });
962
- return () => {
963
- clearLabel(v);
964
- if (native) unregisterNativeItem(v);
965
- };
966
- }, [
967
- v,
968
- children,
969
- disabled,
970
- native,
971
- setLabel,
972
- clearLabel,
973
- registerNativeItem,
974
- unregisterNativeItem
975
- ]);
976
- if (native) return null;
977
- return /* @__PURE__ */ jsx(SelectItemRow, { value: v, disabled, ...rest, children });
833
+ const { size } = useContext(SelectContext);
834
+ const labelOrChildren = label || (typeof children === "string" ? children : "");
835
+ const textValue = supportingText ? labelOrChildren + " " + supportingText : labelOrChildren;
836
+ const isLeft = selectionIndicatorAlign === "left";
837
+ return /* @__PURE__ */ jsx(
838
+ ListBoxItem,
839
+ {
840
+ id,
841
+ value: value ?? {
842
+ id,
843
+ label: labelOrChildren,
844
+ avatarUrl,
845
+ supportingText,
846
+ isDisabled,
847
+ icon: Icon
848
+ },
849
+ textValue,
850
+ isDisabled,
851
+ ...props,
852
+ className: (state) => cx("w-full py-px outline-hidden", size === "sm" ? "px-1" : "px-1.5", typeof className === "function" ? className(state) : className),
853
+ children: (state) => /* @__PURE__ */ jsxs(
854
+ "div",
855
+ {
856
+ className: cx(
857
+ "flex cursor-pointer items-center rounded-md outline-hidden select-none",
858
+ (state.isFocused || state.isHovered) && !(state.isSelected && selectionIndicator !== "checkbox") && "bg-primary_hover",
859
+ state.isSelected && selectionIndicator !== "checkbox" && "bg-brand-primary_alt",
860
+ state.isDisabled && "cursor-not-allowed opacity-50",
861
+ // Icon styles
862
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
863
+ sizes4[size].root
864
+ ),
865
+ children: [
866
+ isLeft && selectionIndicator === "checkbox" && /* @__PURE__ */ jsx(CheckboxBase, { size: sizes4[size].checkbox, isSelected: state.isSelected, isDisabled: state.isDisabled }),
867
+ avatarUrl ? /* @__PURE__ */ jsx(Avatar, { "aria-hidden": "true", size: "xs", src: avatarUrl, alt: label, className: cx(size === "sm" && "size-5") }) : isReactComponent(Icon) ? /* @__PURE__ */ jsx(Icon, { "data-icon": true, "aria-hidden": "true" }) : isValidElement(Icon) ? Icon : null,
868
+ /* @__PURE__ */ jsxs("div", { className: cx("flex w-full min-w-0 flex-1 flex-wrap", sizes4[size].textContainer), children: [
869
+ /* @__PURE__ */ jsx(Text, { slot: "label", className: cx("truncate font-medium whitespace-nowrap text-primary", sizes4[size].text), children: label || (typeof children === "function" ? children(state) : children) }),
870
+ supportingText && /* @__PURE__ */ jsx(Text, { slot: "description", className: cx("whitespace-nowrap text-tertiary", sizes4[size].text), children: supportingText })
871
+ ] }),
872
+ state.isSelected && selectionIndicator === "checkmark" && /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: cx("ml-auto text-fg-brand-primary", sizes4[size].check) }),
873
+ !isLeft && selectionIndicator === "checkbox" && /* @__PURE__ */ jsx(CheckboxBase, { size: sizes4[size].checkbox, isSelected: state.isSelected, isDisabled: state.isDisabled, className: "ml-auto" })
874
+ ]
875
+ }
876
+ )
877
+ }
878
+ );
879
+ };
880
+ var SelectValue = ({ isOpen, isFocusVisible, isDisabled, isInvalid, size, placeholder, icon, ref }) => {
881
+ const isActive = isOpen || isFocusVisible;
882
+ return /* @__PURE__ */ jsx(
883
+ Button,
884
+ {
885
+ ref,
886
+ className: cx(
887
+ "relative flex w-full cursor-pointer items-center rounded-lg border border-solid border-primary bg-primary shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
888
+ !isInvalid && isActive && inputFocusRingShadow,
889
+ isInvalid && !isActive && "border-error_subtle",
890
+ isInvalid && isActive && inputErrorFocusRingShadow,
891
+ isDisabled && "cursor-not-allowed opacity-50"
892
+ ),
893
+ children: /* @__PURE__ */ jsx(
894
+ SelectValue$1,
895
+ {
896
+ className: (state) => cx(
897
+ "flex h-max w-full items-center justify-start truncate text-left align-middle",
898
+ sizes3[size].root,
899
+ // With icon
900
+ (state.selectedItems[0]?.icon || icon) && sizes3[size].withIcon,
901
+ // Icon styles
902
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary"
903
+ ),
904
+ children: (state) => {
905
+ const selectedItem = state.selectedItems[0];
906
+ const Icon = selectedItem?.icon || icon;
907
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
908
+ selectedItem?.avatarUrl ? /* @__PURE__ */ jsx(Avatar, { size: "xs", src: selectedItem.avatarUrl, alt: selectedItem.label, className: cx(size === "sm" && "size-5") }) : isReactComponent(Icon) ? /* @__PURE__ */ jsx(Icon, { "data-icon": true, "aria-hidden": "true" }) : isValidElement(Icon) ? Icon : null,
909
+ selectedItem ? /* @__PURE__ */ jsxs("section", { className: cx("flex w-full truncate", sizes3[size].textContainer), children: [
910
+ /* @__PURE__ */ jsx("p", { className: cx("truncate font-medium text-primary", sizes3[size].text), children: selectedItem?.label }),
911
+ selectedItem?.supportingText && /* @__PURE__ */ jsx("p", { className: cx("text-tertiary", sizes3[size].text), children: selectedItem?.supportingText })
912
+ ] }) : /* @__PURE__ */ jsx("p", { className: cx("text-placeholder", sizes3[size].text), children: placeholder }),
913
+ /* @__PURE__ */ jsx(
914
+ CaretDownIcon,
915
+ {
916
+ "aria-hidden": "true",
917
+ className: cx("ml-auto shrink-0 text-fg-quaternary", size === "lg" ? "size-5" : "size-4 stroke-[2.25px]")
918
+ }
919
+ )
920
+ ] });
921
+ }
922
+ }
923
+ )
924
+ }
925
+ );
926
+ };
927
+ var Select = ({ placeholder = "Select", icon, size = "md", children, items, label, hint, tooltip, hideRequiredIndicator, mobileOptions, className, ...rest }) => {
928
+ return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(Select$1, { ...rest, className: (state) => cx("flex flex-col gap-1.5", typeof className === "function" ? className(state) : className), children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [
929
+ label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : state.isRequired, tooltip, children: label }),
930
+ /* @__PURE__ */ jsx(SelectValue, { ...state, ...{ size, placeholder }, icon }),
931
+ /* @__PURE__ */ jsx(Popover, { size, className: rest.popoverClassName, mobileOptions: { title: label, ...mobileOptions }, children: /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children }) }),
932
+ hint && /* @__PURE__ */ jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === "sm" && "text-xs"), children: hint })
933
+ ] }) }) });
978
934
  };
979
- SelectItem.displayName = "SelectItem";
935
+ var _Select = Select;
936
+ _Select.ComboBox = ComboBox;
937
+ _Select.Item = SelectItem;
980
938
 
981
- export { Select, SelectChevron, SelectContent, SelectItem, SelectTrigger, SelectValue };
939
+ export { _Select as Select, SelectContext, sizes3 as sizes };
982
940
  //# sourceMappingURL=select.js.map
983
941
  //# sourceMappingURL=select.js.map