@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
@@ -0,0 +1,574 @@
1
+ import { createContext, useMemo, useRef, useState, useCallback, useEffect, useContext, isValidElement, useLayoutEffect } from 'react';
2
+ import { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/csr/MagnifyingGlass';
3
+ import { ComboBox as ComboBox$1, ListBox, Label as Label$1, ComboBoxStateContext, Button, Group, Input, OverlayTriggerStateContext, Popover as Popover$1, Text, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow } from 'react-aria-components';
4
+ import { extendTailwindMerge } from 'tailwind-merge';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import { QuestionIcon } from '@phosphor-icons/react/dist/csr/Question';
7
+ import { createPortal } from 'react-dom';
8
+ import { XIcon } from '@phosphor-icons/react/dist/csr/X';
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
+
13
+ var twMerge = extendTailwindMerge({
14
+ extend: {
15
+ theme: {
16
+ text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
17
+ }
18
+ }
19
+ });
20
+ var cx = twMerge;
21
+ var HintText = ({ isInvalid, className, size = "md", ...props }) => {
22
+ return /* @__PURE__ */ jsx(
23
+ Text,
24
+ {
25
+ ...props,
26
+ slot: isInvalid ? "errorMessage" : "description",
27
+ className: cx(
28
+ "text-sm text-tertiary",
29
+ // Size
30
+ size === "sm" && "text-xs",
31
+ "in-data-[input-size=sm]:text-xs",
32
+ // Invalid state
33
+ isInvalid && "text-error-primary",
34
+ "group-invalid:text-error-primary",
35
+ className
36
+ )
37
+ }
38
+ );
39
+ };
40
+ HintText.displayName = "HintText";
41
+ var Tooltip = ({
42
+ title,
43
+ description,
44
+ children,
45
+ arrow = false,
46
+ delay = 100,
47
+ closeDelay = 0,
48
+ trigger,
49
+ isDisabled,
50
+ isOpen,
51
+ defaultOpen,
52
+ offset = 6,
53
+ crossOffset,
54
+ placement = "top",
55
+ onOpenChange,
56
+ ...tooltipProps
57
+ }) => {
58
+ const isTopOrBottomLeft = ["top left", "top end", "bottom left", "bottom end"].includes(placement);
59
+ const isTopOrBottomRight = ["top right", "top start", "bottom right", "bottom start"].includes(placement);
60
+ const calculatedCrossOffset = isTopOrBottomLeft ? -12 : isTopOrBottomRight ? 12 : 0;
61
+ return /* @__PURE__ */ jsxs(TooltipTrigger$1, { ...{ trigger, delay, closeDelay, isDisabled, isOpen, defaultOpen, onOpenChange }, children: [
62
+ children,
63
+ /* @__PURE__ */ jsx(
64
+ Tooltip$1,
65
+ {
66
+ ...tooltipProps,
67
+ offset,
68
+ placement,
69
+ crossOffset: crossOffset ?? calculatedCrossOffset,
70
+ className: ({ isEntering, isExiting }) => cx(isEntering && "ease-out animate-in", isExiting && "ease-in animate-out"),
71
+ children: ({ isEntering, isExiting }) => /* @__PURE__ */ jsxs(
72
+ "div",
73
+ {
74
+ className: cx(
75
+ "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",
76
+ description ? "py-3" : "py-2",
77
+ 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",
78
+ 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"
79
+ ),
80
+ children: [
81
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-white", children: title }),
82
+ description && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-tooltip-supporting-text", children: description }),
83
+ arrow && /* @__PURE__ */ jsx(OverlayArrow, { children: /* @__PURE__ */ jsx(
84
+ "svg",
85
+ {
86
+ viewBox: "0 0 100 100",
87
+ 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",
88
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L35.858,35.858 Q50,50 64.142,35.858 L100,0 Z" })
89
+ }
90
+ ) })
91
+ ]
92
+ }
93
+ )
94
+ }
95
+ )
96
+ ] });
97
+ };
98
+ var TooltipTrigger = ({ children, className, ...buttonProps }) => {
99
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, className: (values) => cx("h-max w-max outline-hidden", typeof className === "function" ? className(values) : className), children });
100
+ };
101
+ var Label = ({ isInvalid, isRequired, tooltip, tooltipDescription, className, ...props }) => {
102
+ return /* @__PURE__ */ jsxs(
103
+ Label$1,
104
+ {
105
+ "data-label": "true",
106
+ ...props,
107
+ className: cx("flex cursor-default items-center gap-0.5 text-sm font-medium text-secondary", className),
108
+ children: [
109
+ props.children,
110
+ /* @__PURE__ */ jsx(
111
+ "span",
112
+ {
113
+ className: cx(
114
+ "hidden text-brand-tertiary",
115
+ isRequired && "block",
116
+ typeof isRequired === "undefined" && "group-required:block",
117
+ isInvalid && "text-error-primary",
118
+ typeof isInvalid === "undefined" && "group-invalid:text-error-primary"
119
+ ),
120
+ children: "*"
121
+ }
122
+ ),
123
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, description: tooltipDescription, placement: "top", children: /* @__PURE__ */ jsx(
124
+ TooltipTrigger,
125
+ {
126
+ isDisabled: false,
127
+ className: "cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
128
+ children: /* @__PURE__ */ jsx(QuestionIcon, { className: "size-4" })
129
+ }
130
+ ) })
131
+ ]
132
+ }
133
+ );
134
+ };
135
+ Label.displayName = "Label";
136
+ var MOBILE_SHEET_MAX_PX = 1024;
137
+ function useIsMobile(breakpoint = MOBILE_SHEET_MAX_PX + 1) {
138
+ const [isMobile, setIsMobile] = useState(() => {
139
+ if (typeof window === "undefined") return false;
140
+ return window.matchMedia(`(max-width: ${breakpoint - 1}px)`).matches;
141
+ });
142
+ useEffect(() => {
143
+ const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
144
+ const handler = (e) => setIsMobile(e.matches);
145
+ mq.addEventListener("change", handler);
146
+ return () => mq.removeEventListener("change", handler);
147
+ }, [breakpoint]);
148
+ return isMobile;
149
+ }
150
+ var MOBILE_SHEET_MOTION_MS = 175;
151
+ var MOBILE_SHEET_ENTRY_EASING = "cubic-bezier(0.85, 0, 0.15, 1)";
152
+ var MOBILE_SHEET_EXIT_EASING = "cubic-bezier(0.85, 0, 1, 0.15)";
153
+ var MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX = 120;
154
+ function resolveSelectMobileOptions(mobileOptions) {
155
+ return {
156
+ sheet: mobileOptions?.sheet ?? true,
157
+ title: mobileOptions?.title,
158
+ sheetClassName: mobileOptions?.className,
159
+ contentClassName: mobileOptions?.contentClassName
160
+ };
161
+ }
162
+ function useMobileSheetAnimation(open, enabled, slideEntrance = true, slideOffsetPx = MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX) {
163
+ const [shouldRender, setShouldRender] = useState(open);
164
+ const [isAnimating, setIsAnimating] = useState(false);
165
+ useLayoutEffect(() => {
166
+ if (!enabled) {
167
+ setShouldRender(open);
168
+ return;
169
+ }
170
+ if (open) {
171
+ setShouldRender(true);
172
+ }
173
+ }, [open, enabled]);
174
+ useEffect(() => {
175
+ if (!enabled || open) return;
176
+ const timer = setTimeout(() => setShouldRender(false), MOBILE_SHEET_MOTION_MS);
177
+ return () => clearTimeout(timer);
178
+ }, [open, enabled]);
179
+ useLayoutEffect(() => {
180
+ if (!enabled || open || !shouldRender) return;
181
+ setIsAnimating(false);
182
+ }, [enabled, open, shouldRender]);
183
+ useEffect(() => {
184
+ if (!enabled || !shouldRender || !open) return;
185
+ let raf2 = 0;
186
+ const raf1 = requestAnimationFrame(() => {
187
+ raf2 = requestAnimationFrame(() => setIsAnimating(true));
188
+ });
189
+ return () => {
190
+ cancelAnimationFrame(raf1);
191
+ if (raf2) cancelAnimationFrame(raf2);
192
+ };
193
+ }, [shouldRender, open, enabled]);
194
+ const motionEasing = open ? MOBILE_SHEET_ENTRY_EASING : MOBILE_SHEET_EXIT_EASING;
195
+ const hiddenTransform = slideEntrance ? `translateY(${slideOffsetPx}px)` : "translateY(100%)";
196
+ const panelStyle = enabled ? {
197
+ transform: isAnimating ? "translateY(0)" : hiddenTransform,
198
+ opacity: isAnimating ? 1 : 0,
199
+ transitionProperty: "transform, opacity",
200
+ transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
201
+ transitionTimingFunction: motionEasing
202
+ } : void 0;
203
+ const backdropStyle = enabled ? {
204
+ opacity: isAnimating ? 1 : 0,
205
+ transitionProperty: "opacity",
206
+ transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
207
+ transitionTimingFunction: motionEasing
208
+ } : void 0;
209
+ return { shouldRender, isAnimating, panelStyle, backdropStyle };
210
+ }
211
+ function MobileSheetCloseButton({ onClose }) {
212
+ return /* @__PURE__ */ jsxs(
213
+ "button",
214
+ {
215
+ type: "button",
216
+ onClick: (e) => {
217
+ e.stopPropagation();
218
+ onClose();
219
+ },
220
+ 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)]",
221
+ children: [
222
+ /* @__PURE__ */ jsx(XIcon, { className: "size-5", "aria-hidden": "true" }),
223
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
224
+ ]
225
+ }
226
+ );
227
+ }
228
+ function MobileSheetChrome({
229
+ title,
230
+ contentClassName,
231
+ onClose,
232
+ children
233
+ }) {
234
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
235
+ /* @__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: [
236
+ title ? /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-base font-semibold text-primary", children: title }) : null,
237
+ /* @__PURE__ */ jsx(MobileSheetCloseButton, { onClose })
238
+ ] }),
239
+ /* @__PURE__ */ jsx(
240
+ "div",
241
+ {
242
+ className: cx(
243
+ "min-h-0 flex-1 overflow-y-auto pb-[calc(5rem+env(safe-area-inset-bottom,0px))]",
244
+ contentClassName
245
+ ),
246
+ children
247
+ }
248
+ )
249
+ ] });
250
+ }
251
+ var Popover = ({ mobileOptions, children, size, className, style, compoundContent = false, ...props }) => {
252
+ const isMobile = useIsMobile();
253
+ const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
254
+ const useMobileSheet = isMobile && resolvedMobile.sheet;
255
+ const overlayState = useContext(OverlayTriggerStateContext);
256
+ const open = overlayState?.isOpen ?? false;
257
+ const { shouldRender, panelStyle, backdropStyle } = useMobileSheetAnimation(open, useMobileSheet);
258
+ useEffect(() => {
259
+ if (!useMobileSheet || !open) return;
260
+ const prev = document.body.style.overflow;
261
+ document.body.style.overflow = "hidden";
262
+ return () => {
263
+ document.body.style.overflow = prev;
264
+ };
265
+ }, [useMobileSheet, open]);
266
+ const close = () => overlayState?.close();
267
+ const showMobileSheet = useMobileSheet && shouldRender;
268
+ const isMobileSheetExiting = showMobileSheet && !open;
269
+ const mobileScrim = useMobileSheet && shouldRender && typeof document !== "undefined" ? createPortal(
270
+ /* @__PURE__ */ jsx(
271
+ "div",
272
+ {
273
+ className: "fixed inset-0 z-50 bg-overlay/70",
274
+ style: backdropStyle,
275
+ onClick: close,
276
+ "aria-hidden": "true"
277
+ }
278
+ ),
279
+ document.body
280
+ ) : null;
281
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
282
+ mobileScrim,
283
+ /* @__PURE__ */ jsx(
284
+ Popover$1,
285
+ {
286
+ placement: "bottom",
287
+ containerPadding: 0,
288
+ offset: 4,
289
+ ...props,
290
+ isExiting: isMobileSheetExiting,
291
+ ...useMobileSheet ? { "data-select-mobile-sheet": true } : {},
292
+ style: useMobileSheet ? { ...panelStyle, ...style } : style,
293
+ className: (state) => cx(
294
+ "outline-hidden",
295
+ !useMobileSheet && [
296
+ "w-(--trigger-width) origin-(--trigger-anchor-point) rounded-lg bg-primary shadow-lg ring-1 ring-secondary_alt will-change-transform",
297
+ compoundContent ? "overflow-hidden outline-hidden" : "overflow-x-hidden overflow-y-auto py-1 outline-hidden",
298
+ 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",
299
+ 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",
300
+ !compoundContent && size === "sm" && "max-h-56!",
301
+ !compoundContent && size === "md" && "max-h-64!",
302
+ !compoundContent && size === "lg" && "max-h-80!"
303
+ ],
304
+ useMobileSheet && [
305
+ "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",
306
+ "max-h-[min(90dvh,calc(100dvh-env(safe-area-inset-bottom,0px)))]",
307
+ resolvedMobile.sheetClassName
308
+ ],
309
+ typeof className === "function" ? className(state) : className
310
+ ),
311
+ children: (state) => {
312
+ const content = typeof children === "function" ? children(state) : children;
313
+ if (useMobileSheet) {
314
+ return /* @__PURE__ */ jsx(
315
+ MobileSheetChrome,
316
+ {
317
+ title: resolvedMobile.title,
318
+ contentClassName: resolvedMobile.contentClassName,
319
+ onClose: close,
320
+ children: content
321
+ }
322
+ );
323
+ }
324
+ return content;
325
+ }
326
+ }
327
+ )
328
+ ] });
329
+ };
330
+ var sizes = {
331
+ sm: {
332
+ root: "py-2 pl-3 pr-2.5 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]",
333
+ withIcon: "",
334
+ text: "text-sm",
335
+ textContainer: "gap-x-1.5",
336
+ shortcut: "pr-2.5"
337
+ },
338
+ 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" },
339
+ 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" }
340
+ };
341
+ var searchSizes = {
342
+ sm: { wrapper: "py-1", root: "px-3 py-2 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]", text: "text-sm" },
343
+ md: { wrapper: "py-0.5", root: "px-3 py-2 gap-2 *:data-icon:size-5", text: "text-md" },
344
+ lg: { wrapper: "py-0.5", root: "px-3.5 py-2.5 gap-2 *:data-icon:size-5", text: "text-md" }
345
+ };
346
+ var SelectContext = createContext({ size: "md" });
347
+ function hasResizeObserver() {
348
+ return typeof window.ResizeObserver !== "undefined";
349
+ }
350
+ function useResizeObserver(options) {
351
+ const { ref, box, onResize } = options;
352
+ useEffect(() => {
353
+ const element = ref?.current;
354
+ if (!element) {
355
+ return;
356
+ }
357
+ if (!hasResizeObserver()) {
358
+ window.addEventListener("resize", onResize, false);
359
+ return () => {
360
+ window.removeEventListener("resize", onResize, false);
361
+ };
362
+ } else {
363
+ const resizeObserverInstance = new window.ResizeObserver((entries) => {
364
+ if (!entries.length) {
365
+ return;
366
+ }
367
+ onResize();
368
+ });
369
+ resizeObserverInstance.observe(element, { box });
370
+ return () => {
371
+ if (element) {
372
+ resizeObserverInstance.unobserve(element);
373
+ }
374
+ };
375
+ }
376
+ }, [onResize, ref, box]);
377
+ }
378
+ var inputFocusRingShadow = "border-brand ring-1 ring-inset ring-brand";
379
+ var inputErrorFocusRingShadow = "border-error ring-1 ring-inset ring-error";
380
+ createContext({});
381
+
382
+ // ../../utils/is-react-component.ts
383
+ var isFunctionComponent = (component) => {
384
+ return typeof component === "function";
385
+ };
386
+ var isClassComponent = (component) => {
387
+ return typeof component === "function" && component.prototype && (!!component.prototype.isReactComponent || !!component.prototype.render);
388
+ };
389
+ var isForwardRefComponent = (component) => {
390
+ return typeof component === "object" && component !== null && component.$$typeof.toString() === "Symbol(react.forward_ref)";
391
+ };
392
+ var isReactComponent = (component) => {
393
+ return isFunctionComponent(component) || isForwardRefComponent(component) || isClassComponent(component);
394
+ };
395
+ var ComboBoxMobileTrigger = ({ size, placeholder, icon: IconProp, isInvalid, onPointerEnter, ref }) => {
396
+ const state = useContext(ComboBoxStateContext);
397
+ const selectedItem = state?.selectedItem?.value ?? null;
398
+ return /* @__PURE__ */ jsxs(
399
+ Button,
400
+ {
401
+ ref,
402
+ onPress: () => state?.open(),
403
+ onPointerEnter,
404
+ className: ({ isFocusVisible, isDisabled }) => cx(
405
+ "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",
406
+ isDisabled && "cursor-not-allowed opacity-50",
407
+ !isInvalid && (isFocusVisible || state?.isOpen) && inputFocusRingShadow,
408
+ isInvalid && !(isFocusVisible || state?.isOpen) && "border-error_subtle",
409
+ isInvalid && (isFocusVisible || state?.isOpen) && inputErrorFocusRingShadow,
410
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
411
+ sizes[size].root
412
+ ),
413
+ children: [
414
+ 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" }),
415
+ selectedItem ? /* @__PURE__ */ jsxs("section", { className: cx("flex w-full truncate", sizes[size].textContainer), children: [
416
+ /* @__PURE__ */ jsx("p", { className: cx("truncate font-medium text-primary", sizes[size].text), children: selectedItem.label }),
417
+ selectedItem.supportingText && /* @__PURE__ */ jsx("p", { className: cx("text-tertiary", sizes[size].text), children: selectedItem.supportingText })
418
+ ] }) : /* @__PURE__ */ jsx("p", { className: cx("truncate text-placeholder", sizes[size].text), children: placeholder })
419
+ ]
420
+ }
421
+ );
422
+ };
423
+ 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: [
424
+ 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" }),
425
+ /* @__PURE__ */ jsx(
426
+ Input,
427
+ {
428
+ placeholder,
429
+ className: cx(
430
+ "w-full appearance-none bg-transparent text-primary caret-alpha-black/90 outline-hidden placeholder:text-placeholder",
431
+ searchSizes[size].text
432
+ )
433
+ }
434
+ )
435
+ ] }) });
436
+ var ComboBoxValue = ({ size, shortcut, placeholder, shortcutClassName, icon: IconProp, isInvalid, ref, ...otherProps }) => {
437
+ const state = useContext(ComboBoxStateContext);
438
+ const value = state?.selectedItem?.value || null;
439
+ const inputValue = state?.inputValue || null;
440
+ const first = inputValue?.split(value?.supportingText)?.[0] || "";
441
+ const last = inputValue?.split(first)[1];
442
+ return /* @__PURE__ */ jsxs(
443
+ Group,
444
+ {
445
+ ref,
446
+ ...otherProps,
447
+ isInvalid,
448
+ className: ({ isDisabled, isInvalid: isGroupInvalid }) => cx(
449
+ "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",
450
+ isDisabled && "cursor-not-allowed opacity-50",
451
+ !isGroupInvalid && state?.isOpen && inputFocusRingShadow,
452
+ !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",
453
+ isGroupInvalid && !state?.isOpen && "border-error_subtle",
454
+ isGroupInvalid && state?.isOpen && inputErrorFocusRingShadow,
455
+ 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",
456
+ // Icon styles
457
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
458
+ sizes[size].root
459
+ ),
460
+ children: [
461
+ 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" }),
462
+ /* @__PURE__ */ jsxs("div", { className: "relative flex w-full items-center", children: [
463
+ inputValue && /* @__PURE__ */ jsxs("span", { className: cx("absolute top-1/2 z-0 inline-flex w-full -translate-y-1/2 truncate", sizes[size].textContainer), "aria-hidden": "true", children: [
464
+ /* @__PURE__ */ jsx("p", { className: cx("font-medium text-primary", sizes[size].text), children: first }),
465
+ last && /* @__PURE__ */ jsx("p", { className: cx("-ml-0.75 text-tertiary", sizes[size].text), children: last })
466
+ ] }),
467
+ /* @__PURE__ */ jsx(
468
+ Input,
469
+ {
470
+ placeholder,
471
+ className: cx(
472
+ "z-10 w-full appearance-none bg-transparent text-transparent caret-alpha-black/90 placeholder:text-placeholder focus:outline-hidden disabled:cursor-not-allowed",
473
+ sizes[size].text
474
+ )
475
+ }
476
+ )
477
+ ] }),
478
+ shortcut && /* @__PURE__ */ jsx(
479
+ "div",
480
+ {
481
+ className: cx(
482
+ "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",
483
+ sizes[size].shortcut,
484
+ shortcutClassName
485
+ ),
486
+ children: /* @__PURE__ */ jsx(
487
+ "span",
488
+ {
489
+ className: "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
490
+ "aria-hidden": "true",
491
+ children: "\u2318K"
492
+ }
493
+ )
494
+ }
495
+ )
496
+ ]
497
+ }
498
+ );
499
+ };
500
+ var ComboBox = ({
501
+ placeholder = "Search",
502
+ shortcut = true,
503
+ size = "md",
504
+ children,
505
+ items,
506
+ shortcutClassName,
507
+ icon,
508
+ hideRequiredIndicator,
509
+ mobileOptions,
510
+ ...otherProps
511
+ }) => {
512
+ const isMobile = useIsMobile();
513
+ const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
514
+ const useMobileSheet = isMobile && resolvedMobile.sheet;
515
+ const triggerRef = useRef(null);
516
+ const [popoverWidth, setPopoverWidth] = useState("");
517
+ const onResize = useCallback(() => {
518
+ if (!triggerRef.current) return;
519
+ const divRect = triggerRef.current.getBoundingClientRect();
520
+ setPopoverWidth(divRect.width + "px");
521
+ }, []);
522
+ useResizeObserver({
523
+ ref: triggerRef,
524
+ box: "border-box",
525
+ onResize
526
+ });
527
+ 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: [
528
+ otherProps.label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : state.isRequired, tooltip: otherProps.tooltip, children: otherProps.label }),
529
+ useMobileSheet ? /* @__PURE__ */ jsx(
530
+ ComboBoxMobileTrigger,
531
+ {
532
+ ref: triggerRef,
533
+ placeholder,
534
+ icon,
535
+ size,
536
+ isInvalid: state.isInvalid,
537
+ onPointerEnter: onResize
538
+ }
539
+ ) : /* @__PURE__ */ jsx(
540
+ ComboBoxValue,
541
+ {
542
+ ref: triggerRef,
543
+ placeholder,
544
+ shortcut,
545
+ shortcutClassName,
546
+ icon,
547
+ size,
548
+ isInvalid: state.isInvalid,
549
+ onFocus: onResize,
550
+ onPointerEnter: onResize
551
+ }
552
+ ),
553
+ /* @__PURE__ */ jsx(
554
+ Popover,
555
+ {
556
+ size,
557
+ triggerRef,
558
+ compoundContent: useMobileSheet,
559
+ style: useMobileSheet ? void 0 : { width: popoverWidth },
560
+ className: otherProps.popoverClassName,
561
+ mobileOptions: { title: otherProps.label, ...mobileOptions },
562
+ children: useMobileSheet ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-col overflow-hidden outline-hidden", children: [
563
+ /* @__PURE__ */ jsx(ComboBoxSheetSearch, { size, placeholder, icon }),
564
+ /* @__PURE__ */ jsx(ListBox, { items, className: "min-h-0 flex-1 overflow-y-auto py-1 outline-hidden", children })
565
+ ] }) : /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children })
566
+ }
567
+ ),
568
+ otherProps.hint && /* @__PURE__ */ jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === "sm" && "text-xs"), children: otherProps.hint })
569
+ ] }) }) });
570
+ };
571
+
572
+ export { ComboBox };
573
+ //# sourceMappingURL=combobox.js.map
574
+ //# sourceMappingURL=combobox.js.map