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

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 (225) 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 +112 -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 +17 -0
  40. package/dist/react/combobox.js +322 -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 +319 -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 +773 -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 +549 -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 +527 -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 +507 -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 +790 -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 +799 -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 +501 -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 +754 -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 +543 -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 +505 -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 +1325 -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 +998 -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 +960 -0
  86. package/dist/react/dropdown-search-simple.js.map +1 -0
  87. package/dist/react/dropdown.d.ts +32 -133
  88. package/dist/react/dropdown.js +404 -1351
  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 +89 -0
  130. package/dist/react/multi-select.js +1036 -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 +7 -73
  136. package/dist/react/popover.js +23 -569
  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 +116 -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 +13 -0
  157. package/dist/react/select-item.js +336 -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 +18 -61
  163. package/dist/react/select.js +625 -923
  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 +44 -0
  181. package/dist/react/tag-select.js +1062 -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-shared-B3Y5SMXU.d.ts +62 -0
  193. package/package.json +28 -21
  194. package/source.css +2 -13
  195. package/theme.css +883 -79
  196. package/dist/react/calendar.d.ts +0 -13
  197. package/dist/react/calendar.js +0 -4639
  198. package/dist/react/calendar.js.map +0 -1
  199. package/dist/react/card.d.ts +0 -11
  200. package/dist/react/card.js +0 -113
  201. package/dist/react/card.js.map +0 -1
  202. package/dist/react/datetime-picker.d.ts +0 -21
  203. package/dist/react/datetime-picker.js +0 -6142
  204. package/dist/react/datetime-picker.js.map +0 -1
  205. package/dist/react/pagination.d.ts +0 -28
  206. package/dist/react/pagination.js +0 -262
  207. package/dist/react/pagination.js.map +0 -1
  208. package/dist/react/table-pagination.d.ts +0 -15
  209. package/dist/react/table-pagination.js +0 -1247
  210. package/dist/react/table-pagination.js.map +0 -1
  211. package/dist/react/table-view/column-menu.d.ts +0 -15
  212. package/dist/react/table-view/column-menu.js +0 -1049
  213. package/dist/react/table-view/column-menu.js.map +0 -1
  214. package/dist/react/table-view/index.d.ts +0 -70
  215. package/dist/react/table-view/index.js +0 -2284
  216. package/dist/react/table-view/index.js.map +0 -1
  217. package/dist/react/table.d.ts +0 -86
  218. package/dist/react/table.js +0 -414
  219. package/dist/react/table.js.map +0 -1
  220. package/dist/react/tabs.d.ts +0 -34
  221. package/dist/react/tabs.js +0 -423
  222. package/dist/react/tabs.js.map +0 -1
  223. package/dist/react/time-picker.d.ts +0 -22
  224. package/dist/react/time-picker.js +0 -856
  225. package/dist/react/time-picker.js.map +0 -1
@@ -0,0 +1,1062 @@
1
+ import { createContext, useCallback, useRef, useState, useContext, useMemo, useEffect, isValidElement, useLayoutEffect } from 'react';
2
+ import { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/csr/MagnifyingGlass';
3
+ import { useFilter, FocusScope, useFocusManager } from 'react-aria';
4
+ import { ComboBox, ListBox, Group, Label as Label$1, Popover as Popover$1, Text, ComboBoxStateContext, Input, ListBoxItem, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow, Button } from 'react-aria-components';
5
+ import { UserIcon } from '@phosphor-icons/react/dist/csr/User';
6
+ import { extendTailwindMerge } from 'tailwind-merge';
7
+ import '@phosphor-icons/react/dist/csr/Plus';
8
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
+ import { QuestionIcon } from '@phosphor-icons/react/dist/csr/Question';
10
+ import { XIcon } from '@phosphor-icons/react/dist/csr/X';
11
+ import '@phosphor-icons/react/dist/csr/Eye';
12
+ import '@phosphor-icons/react/dist/csr/EyeSlash';
13
+ import '@phosphor-icons/react/dist/csr/Info';
14
+ import { CheckIcon } from '@phosphor-icons/react/dist/csr/Check';
15
+
16
+ function $232f8dea1b0a4f2f$export$762f73dccccd255d(options) {
17
+ let { initialItems = [], initialSelectedKeys, getKey = (item) => item.id ?? item.key, filter, initialFilterText = "" } = options;
18
+ let [state, setState] = (useState)({
19
+ items: initialItems,
20
+ selectedKeys: initialSelectedKeys === "all" ? "all" : new Set(initialSelectedKeys || []),
21
+ filterText: initialFilterText
22
+ });
23
+ let filteredItems = (useMemo)(() => filter ? state.items.filter((item) => filter(item, state.filterText)) : state.items, [
24
+ state.items,
25
+ state.filterText,
26
+ filter
27
+ ]);
28
+ return {
29
+ ...state,
30
+ items: filteredItems,
31
+ ...$232f8dea1b0a4f2f$export$79c0c687a5963b0a({
32
+ getKey
33
+ }, setState),
34
+ getItem(key) {
35
+ return state.items.find((item) => getKey(item) === key);
36
+ }
37
+ };
38
+ }
39
+ function $232f8dea1b0a4f2f$export$79c0c687a5963b0a(opts, dispatch) {
40
+ let { cursor, getKey } = opts;
41
+ return {
42
+ setSelectedKeys(selectedKeys) {
43
+ dispatch((state) => ({
44
+ ...state,
45
+ selectedKeys
46
+ }));
47
+ },
48
+ addKeysToSelection(selectedKeys) {
49
+ dispatch((state) => {
50
+ if (state.selectedKeys === "all") return state;
51
+ if (selectedKeys === "all") return {
52
+ ...state,
53
+ selectedKeys: "all"
54
+ };
55
+ return {
56
+ ...state,
57
+ selectedKeys: /* @__PURE__ */ new Set([
58
+ ...state.selectedKeys,
59
+ ...selectedKeys
60
+ ])
61
+ };
62
+ });
63
+ },
64
+ removeKeysFromSelection(selectedKeys) {
65
+ dispatch((state) => {
66
+ if (selectedKeys === "all") return {
67
+ ...state,
68
+ selectedKeys: /* @__PURE__ */ new Set()
69
+ };
70
+ let selection = state.selectedKeys === "all" ? new Set(state.items.map(getKey)) : new Set(state.selectedKeys);
71
+ for (let key of selectedKeys) selection.delete(key);
72
+ return {
73
+ ...state,
74
+ selectedKeys: selection
75
+ };
76
+ });
77
+ },
78
+ setFilterText(filterText) {
79
+ dispatch((state) => ({
80
+ ...state,
81
+ filterText
82
+ }));
83
+ },
84
+ insert(index, ...values) {
85
+ dispatch((state) => $232f8dea1b0a4f2f$var$insert(state, index, ...values));
86
+ },
87
+ insertBefore(key, ...values) {
88
+ dispatch((state) => {
89
+ let index = state.items.findIndex((item) => getKey?.(item) === key);
90
+ if (index === -1) {
91
+ if (state.items.length === 0) index = 0;
92
+ else return state;
93
+ }
94
+ return $232f8dea1b0a4f2f$var$insert(state, index, ...values);
95
+ });
96
+ },
97
+ insertAfter(key, ...values) {
98
+ dispatch((state) => {
99
+ let index = state.items.findIndex((item) => getKey?.(item) === key);
100
+ if (index === -1) {
101
+ if (state.items.length === 0) index = 0;
102
+ else return state;
103
+ }
104
+ return $232f8dea1b0a4f2f$var$insert(state, index + 1, ...values);
105
+ });
106
+ },
107
+ prepend(...values) {
108
+ dispatch((state) => $232f8dea1b0a4f2f$var$insert(state, 0, ...values));
109
+ },
110
+ append(...values) {
111
+ dispatch((state) => $232f8dea1b0a4f2f$var$insert(state, state.items.length, ...values));
112
+ },
113
+ remove(...keys) {
114
+ dispatch((state) => {
115
+ let keySet = new Set(keys);
116
+ let items = state.items.filter((item) => !keySet.has(getKey(item)));
117
+ let selection = "all";
118
+ if (state.selectedKeys !== "all") {
119
+ selection = new Set(state.selectedKeys);
120
+ for (let key of keys) selection.delete(key);
121
+ }
122
+ if (cursor == null && items.length === 0) selection = /* @__PURE__ */ new Set();
123
+ return {
124
+ ...state,
125
+ items,
126
+ selectedKeys: selection
127
+ };
128
+ });
129
+ },
130
+ removeSelectedItems() {
131
+ dispatch((state) => {
132
+ if (state.selectedKeys === "all") return {
133
+ ...state,
134
+ items: [],
135
+ selectedKeys: /* @__PURE__ */ new Set()
136
+ };
137
+ let selectedKeys = state.selectedKeys;
138
+ let items = state.items.filter((item) => !selectedKeys.has(getKey(item)));
139
+ return {
140
+ ...state,
141
+ items,
142
+ selectedKeys: /* @__PURE__ */ new Set()
143
+ };
144
+ });
145
+ },
146
+ move(key, toIndex) {
147
+ dispatch((state) => {
148
+ let index = state.items.findIndex((item2) => getKey(item2) === key);
149
+ if (index === -1) return state;
150
+ let copy = state.items.slice();
151
+ let [item] = copy.splice(index, 1);
152
+ copy.splice(toIndex, 0, item);
153
+ return {
154
+ ...state,
155
+ items: copy
156
+ };
157
+ });
158
+ },
159
+ moveBefore(key, keys) {
160
+ dispatch((state) => {
161
+ let toIndex = state.items.findIndex((item) => getKey(item) === key);
162
+ if (toIndex === -1) return state;
163
+ let keyArray = Array.isArray(keys) ? keys : [
164
+ ...keys
165
+ ];
166
+ let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey(item) === key2)).sort((a, b) => a - b);
167
+ return $232f8dea1b0a4f2f$var$move(state, indices, toIndex);
168
+ });
169
+ },
170
+ moveAfter(key, keys) {
171
+ dispatch((state) => {
172
+ let toIndex = state.items.findIndex((item) => getKey(item) === key);
173
+ if (toIndex === -1) return state;
174
+ let keyArray = Array.isArray(keys) ? keys : [
175
+ ...keys
176
+ ];
177
+ let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey(item) === key2)).sort((a, b) => a - b);
178
+ return $232f8dea1b0a4f2f$var$move(state, indices, toIndex + 1);
179
+ });
180
+ },
181
+ update(key, newValue) {
182
+ dispatch((state) => {
183
+ let index = state.items.findIndex((item) => getKey(item) === key);
184
+ if (index === -1) return state;
185
+ let updatedValue;
186
+ if (typeof newValue === "function") updatedValue = newValue(state.items[index]);
187
+ else updatedValue = newValue;
188
+ return {
189
+ ...state,
190
+ items: [
191
+ ...state.items.slice(0, index),
192
+ updatedValue,
193
+ ...state.items.slice(index + 1)
194
+ ]
195
+ };
196
+ });
197
+ }
198
+ };
199
+ }
200
+ function $232f8dea1b0a4f2f$var$insert(state, index, ...values) {
201
+ return {
202
+ ...state,
203
+ items: [
204
+ ...state.items.slice(0, index),
205
+ ...values,
206
+ ...state.items.slice(index)
207
+ ]
208
+ };
209
+ }
210
+ function $232f8dea1b0a4f2f$var$move(state, indices, toIndex) {
211
+ toIndex -= indices.filter((index) => index < toIndex).length;
212
+ let moves = indices.map((from) => ({
213
+ from,
214
+ to: toIndex++
215
+ }));
216
+ for (let i = 0; i < moves.length; i++) {
217
+ let a = moves[i].from;
218
+ for (let j = i; j < moves.length; j++) {
219
+ let b = moves[j].from;
220
+ if (b > a) moves[j].from--;
221
+ }
222
+ }
223
+ for (let i = 0; i < moves.length; i++) {
224
+ let a = moves[i];
225
+ for (let j = moves.length - 1; j > i; j--) {
226
+ let b = moves[j];
227
+ if (b.from < a.to) a.to++;
228
+ else b.from++;
229
+ }
230
+ }
231
+ let copy = state.items.slice();
232
+ for (let move of moves) {
233
+ let [item] = copy.splice(move.from, 1);
234
+ copy.splice(move.to, 0, item);
235
+ }
236
+ return {
237
+ ...state,
238
+ items: copy
239
+ };
240
+ }
241
+ var twMerge = extendTailwindMerge({
242
+ extend: {
243
+ theme: {
244
+ text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
245
+ }
246
+ }
247
+ });
248
+ var cx = twMerge;
249
+ var Tooltip = ({
250
+ title,
251
+ description,
252
+ children,
253
+ arrow = false,
254
+ delay = 100,
255
+ closeDelay = 0,
256
+ trigger,
257
+ isDisabled,
258
+ isOpen,
259
+ defaultOpen,
260
+ offset = 6,
261
+ crossOffset,
262
+ placement = "top",
263
+ onOpenChange,
264
+ ...tooltipProps
265
+ }) => {
266
+ const isTopOrBottomLeft = ["top left", "top end", "bottom left", "bottom end"].includes(placement);
267
+ const isTopOrBottomRight = ["top right", "top start", "bottom right", "bottom start"].includes(placement);
268
+ const calculatedCrossOffset = isTopOrBottomLeft ? -12 : isTopOrBottomRight ? 12 : 0;
269
+ return /* @__PURE__ */ jsxs(TooltipTrigger$1, { ...{ trigger, delay, closeDelay, isDisabled, isOpen, defaultOpen, onOpenChange }, children: [
270
+ children,
271
+ /* @__PURE__ */ jsx(
272
+ Tooltip$1,
273
+ {
274
+ ...tooltipProps,
275
+ offset,
276
+ placement,
277
+ crossOffset: crossOffset ?? calculatedCrossOffset,
278
+ className: ({ isEntering, isExiting }) => cx(isEntering && "ease-out animate-in", isExiting && "ease-in animate-out"),
279
+ children: ({ isEntering, isExiting }) => /* @__PURE__ */ jsxs(
280
+ "div",
281
+ {
282
+ className: cx(
283
+ "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",
284
+ description ? "py-3" : "py-2",
285
+ 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",
286
+ 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"
287
+ ),
288
+ children: [
289
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-white", children: title }),
290
+ description && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-tooltip-supporting-text", children: description }),
291
+ arrow && /* @__PURE__ */ jsx(OverlayArrow, { children: /* @__PURE__ */ jsx(
292
+ "svg",
293
+ {
294
+ viewBox: "0 0 100 100",
295
+ 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",
296
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L35.858,35.858 Q50,50 64.142,35.858 L100,0 Z" })
297
+ }
298
+ ) })
299
+ ]
300
+ }
301
+ )
302
+ }
303
+ )
304
+ ] });
305
+ };
306
+ var TooltipTrigger = ({ children, className, ...buttonProps }) => {
307
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, className: (values) => cx("h-max w-max outline-hidden", typeof className === "function" ? className(values) : className), children });
308
+ };
309
+ var sizes = {
310
+ xs: "size-1.5",
311
+ sm: "size-2",
312
+ md: "size-2.5",
313
+ lg: "size-3",
314
+ xl: "size-3.5",
315
+ "2xl": "size-4",
316
+ "3xl": "size-4.5",
317
+ "4xl": "size-5"
318
+ };
319
+ var AvatarOnlineIndicator = ({ size, status, className }) => /* @__PURE__ */ jsx(
320
+ "span",
321
+ {
322
+ className: cx(
323
+ "absolute right-0 bottom-0 flex justify-center rounded-full ring-[1.5px] ring-bg-primary",
324
+ status === "online" ? "bg-fg-success-secondary" : "bg-utility-neutral-300",
325
+ sizes[size],
326
+ className
327
+ ),
328
+ style: {
329
+ 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%)"
330
+ },
331
+ children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 7.2 2.85", fill: "none", className: "mt-[10%] h-[20%] w-[60%]", children: [
332
+ /* @__PURE__ */ jsx(
333
+ "path",
334
+ {
335
+ 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",
336
+ fill: "url(#reflection-gradient)",
337
+ fillOpacity: "0.4"
338
+ }
339
+ ),
340
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "reflection-gradient", x1: "3.6", y1: "0", x2: "3.6", y2: "2.4", gradientUnits: "userSpaceOnUse", children: [
341
+ /* @__PURE__ */ jsx("stop", { stopColor: "white" }),
342
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0.1" })
343
+ ] }) })
344
+ ] })
345
+ }
346
+ );
347
+ var sizes2 = {
348
+ xs: "size-2.5",
349
+ sm: "size-3",
350
+ md: "size-3.5",
351
+ lg: "size-4",
352
+ xl: "size-4.5",
353
+ "2xl": "size-5",
354
+ "3xl": "size-6",
355
+ "4xl": "size-8"
356
+ };
357
+ 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: [
358
+ /* @__PURE__ */ jsx(
359
+ "path",
360
+ {
361
+ 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",
362
+ className: "fill-current"
363
+ }
364
+ ),
365
+ /* @__PURE__ */ jsx(
366
+ "path",
367
+ {
368
+ fillRule: "evenodd",
369
+ clipRule: "evenodd",
370
+ 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",
371
+ fill: "white"
372
+ }
373
+ )
374
+ ] });
375
+ 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 }) });
376
+ var styles = {
377
+ xs: { root: "size-6", rootWithBorder: "p-px", initials: "text-xs font-semibold", icon: "size-4" },
378
+ sm: { root: "size-8", rootWithBorder: "p-px", initials: "text-sm font-semibold", icon: "size-5" },
379
+ md: { root: "size-10", rootWithBorder: "p-px", initials: "text-md font-semibold", icon: "size-6" },
380
+ lg: { root: "size-12", rootWithBorder: "p-[1.5px]", initials: "text-lg font-semibold", icon: "size-7" },
381
+ xl: { root: "size-14", rootWithBorder: "p-0.5", initials: "text-xl font-semibold", icon: "size-8" },
382
+ "2xl": { root: "size-16", rootWithBorder: "p-0.5", initials: "text-display-xs font-semibold", icon: "size-8" }
383
+ };
384
+ var Avatar = ({
385
+ size = "md",
386
+ src,
387
+ alt,
388
+ initials,
389
+ placeholder,
390
+ placeholderIcon: PlaceholderIcon,
391
+ border,
392
+ badge,
393
+ status,
394
+ verified,
395
+ count,
396
+ focusable = false,
397
+ rounded = true,
398
+ className,
399
+ contentClassName
400
+ }) => {
401
+ const [isFailed, setIsFailed] = useState(false);
402
+ const canShowImage = src && !isFailed;
403
+ const renderMainContent = () => {
404
+ if (canShowImage) {
405
+ return /* @__PURE__ */ jsx("img", { "data-avatar-img": true, className: "size-full object-cover", src, alt, onError: () => setIsFailed(true) });
406
+ }
407
+ if (initials) {
408
+ return /* @__PURE__ */ jsx("span", { className: cx("text-quaternary", styles[size].initials), children: initials });
409
+ }
410
+ if (PlaceholderIcon) {
411
+ return /* @__PURE__ */ jsx(PlaceholderIcon, { className: cx("text-fg-quaternary", styles[size].icon) });
412
+ }
413
+ return placeholder || /* @__PURE__ */ jsx(UserIcon, { className: cx("text-fg-quaternary", styles[size].icon) });
414
+ };
415
+ const renderBadgeContent = () => {
416
+ if (status) {
417
+ return /* @__PURE__ */ jsx(AvatarOnlineIndicator, { status, size });
418
+ }
419
+ if (verified) {
420
+ return /* @__PURE__ */ jsx(VerifiedTick, { size, className: cx("absolute right-0 bottom-0", size === "xs" && "-right-px -bottom-px") });
421
+ }
422
+ if (count) {
423
+ return /* @__PURE__ */ jsx(AvatarCount, { count });
424
+ }
425
+ return badge;
426
+ };
427
+ return /* @__PURE__ */ jsxs(
428
+ "div",
429
+ {
430
+ "data-avatar": true,
431
+ className: cx(
432
+ "relative inline-flex shrink-0 rounded-[7px]",
433
+ rounded && "rounded-full",
434
+ // Focus styles
435
+ focusable && "outline-none group-focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]",
436
+ border && "ring-1 ring-secondary_alt",
437
+ border && styles[size].rootWithBorder,
438
+ styles[size].root,
439
+ className
440
+ ),
441
+ children: [
442
+ /* @__PURE__ */ jsx(
443
+ "div",
444
+ {
445
+ className: cx(
446
+ "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]",
447
+ rounded && "rounded-full",
448
+ 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%)]",
449
+ contentClassName
450
+ ),
451
+ children: renderMainContent()
452
+ }
453
+ ),
454
+ renderBadgeContent()
455
+ ]
456
+ }
457
+ );
458
+ };
459
+ var HintText = ({ isInvalid, className, size = "md", ...props }) => {
460
+ return /* @__PURE__ */ jsx(
461
+ Text,
462
+ {
463
+ ...props,
464
+ slot: isInvalid ? "errorMessage" : "description",
465
+ className: cx(
466
+ "text-sm text-tertiary",
467
+ // Size
468
+ size === "sm" && "text-xs",
469
+ "in-data-[input-size=sm]:text-xs",
470
+ // Invalid state
471
+ isInvalid && "text-error-primary",
472
+ "group-invalid:text-error-primary",
473
+ className
474
+ )
475
+ }
476
+ );
477
+ };
478
+ HintText.displayName = "HintText";
479
+ var Label = ({ isInvalid, isRequired, tooltip, tooltipDescription, className, ...props }) => {
480
+ return /* @__PURE__ */ jsxs(
481
+ Label$1,
482
+ {
483
+ "data-label": "true",
484
+ ...props,
485
+ className: cx("flex cursor-default items-center gap-0.5 text-sm font-medium text-secondary", className),
486
+ children: [
487
+ props.children,
488
+ /* @__PURE__ */ jsx(
489
+ "span",
490
+ {
491
+ className: cx(
492
+ "hidden text-brand-tertiary",
493
+ isRequired && "block",
494
+ typeof isRequired === "undefined" && "group-required:block",
495
+ isInvalid && "text-error-primary",
496
+ typeof isInvalid === "undefined" && "group-invalid:text-error-primary"
497
+ ),
498
+ children: "*"
499
+ }
500
+ ),
501
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, description: tooltipDescription, placement: "top", children: /* @__PURE__ */ jsx(
502
+ TooltipTrigger,
503
+ {
504
+ isDisabled: false,
505
+ className: "cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
506
+ children: /* @__PURE__ */ jsx(QuestionIcon, { className: "size-4" })
507
+ }
508
+ ) })
509
+ ]
510
+ }
511
+ );
512
+ };
513
+ Label.displayName = "Label";
514
+ var Popover = (props) => {
515
+ return /* @__PURE__ */ jsx(
516
+ Popover$1,
517
+ {
518
+ placement: "bottom",
519
+ containerPadding: 0,
520
+ offset: 4,
521
+ ...props,
522
+ className: (state) => cx(
523
+ "w-(--trigger-width) origin-(--trigger-anchor-point) overflow-x-hidden overflow-y-auto rounded-lg bg-primary py-1 shadow-lg ring-1 ring-secondary_alt outline-hidden will-change-transform",
524
+ 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",
525
+ 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",
526
+ props.size === "sm" && "max-h-56!",
527
+ props.size === "md" && "max-h-64!",
528
+ props.size === "lg" && "max-h-80!",
529
+ typeof props.className === "function" ? props.className(state) : props.className
530
+ )
531
+ }
532
+ );
533
+ };
534
+ var sizes3 = {
535
+ sm: {
536
+ root: "py-2 pl-3 pr-2.5 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]",
537
+ withIcon: "",
538
+ text: "text-sm",
539
+ textContainer: "gap-x-1.5",
540
+ shortcut: "pr-2.5"
541
+ },
542
+ 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" },
543
+ 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" }
544
+ };
545
+ var SelectContext = createContext({ size: "md" });
546
+ var focusShadowPlain = "focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
547
+ var styles2 = {
548
+ sm: { root: "p-0.5", icon: "size-2.5" },
549
+ md: { root: "p-0.5", icon: "size-3" },
550
+ lg: { root: "p-[3px]", icon: "size-3.5" }
551
+ };
552
+ var TagCloseX = ({ size = "md", className, ...otherProps }) => {
553
+ return /* @__PURE__ */ jsx(
554
+ Button,
555
+ {
556
+ slot: "remove",
557
+ "aria-label": "Remove this tag",
558
+ className: cx(
559
+ "flex cursor-pointer rounded-[3px] text-fg-quaternary outline-transparent transition duration-100 ease-linear hover:bg-primary_hover focus-visible:rounded-[3px] disabled:cursor-not-allowed disabled:opacity-50",
560
+ focusShadowPlain,
561
+ styles2[size].root,
562
+ className
563
+ ),
564
+ ...otherProps,
565
+ children: /* @__PURE__ */ jsx(XIcon, { className: cx("shrink-0 transition-inherit-all", styles2[size].icon) })
566
+ }
567
+ );
568
+ };
569
+ function hasResizeObserver() {
570
+ return typeof window.ResizeObserver !== "undefined";
571
+ }
572
+ function useResizeObserver(options) {
573
+ const { ref, box, onResize } = options;
574
+ useEffect(() => {
575
+ const element = ref?.current;
576
+ if (!element) {
577
+ return;
578
+ }
579
+ if (!hasResizeObserver()) {
580
+ window.addEventListener("resize", onResize, false);
581
+ return () => {
582
+ window.removeEventListener("resize", onResize, false);
583
+ };
584
+ } else {
585
+ const resizeObserverInstance = new window.ResizeObserver((entries) => {
586
+ if (!entries.length) {
587
+ return;
588
+ }
589
+ onResize();
590
+ });
591
+ resizeObserverInstance.observe(element, { box });
592
+ return () => {
593
+ if (element) {
594
+ resizeObserverInstance.unobserve(element);
595
+ }
596
+ };
597
+ }
598
+ }, [onResize, ref, box]);
599
+ }
600
+ var inputFocusRingShadow = "border-brand ring-1 ring-inset ring-brand";
601
+ var inputErrorFocusRingShadow = "border-error ring-1 ring-inset ring-error";
602
+ createContext({});
603
+ var CHECKBOX_TICK_DELAY_MS = 60;
604
+ var CHECKBOX_TICK_DRAW_MS = 100;
605
+ function CheckboxAnimatedCheckMark({ className }) {
606
+ const pathRef = useRef(null);
607
+ useLayoutEffect(() => {
608
+ const path = pathRef.current;
609
+ if (!path || typeof path.getTotalLength !== "function") return;
610
+ const len = path.getTotalLength();
611
+ if (len <= 0) return;
612
+ path.style.strokeDasharray = `${len}`;
613
+ path.style.strokeDashoffset = `${len}`;
614
+ if (typeof path.animate !== "function") {
615
+ path.style.strokeDashoffset = "0";
616
+ return;
617
+ }
618
+ const anim = path.animate([{ strokeDashoffset: len }, { strokeDashoffset: 0 }], {
619
+ duration: CHECKBOX_TICK_DRAW_MS,
620
+ delay: CHECKBOX_TICK_DELAY_MS,
621
+ easing: "cubic-bezier(0.45, 0, 0.2, 1)",
622
+ fill: "forwards"
623
+ });
624
+ return () => anim.cancel();
625
+ }, []);
626
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 14 14", fill: "none", className: cx("block shrink-0", className), children: /* @__PURE__ */ jsx(
627
+ "path",
628
+ {
629
+ ref: pathRef,
630
+ d: "M2.33325 7L5.24992 9.91667L11.6666 3.5",
631
+ stroke: "currentColor",
632
+ strokeWidth: "2",
633
+ strokeLinecap: "round",
634
+ strokeLinejoin: "round"
635
+ }
636
+ ) });
637
+ }
638
+ var focusRingShadow = "outline-none [box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
639
+ var CheckboxBase = ({ className, isSelected, isDisabled, isIndeterminate, size = "sm", isFocusVisible = false }) => {
640
+ const isChecked = isSelected || isIndeterminate;
641
+ const iconClassName = size === "sm" ? "size-2.5" : "size-3.5";
642
+ return /* @__PURE__ */ jsxs(
643
+ "div",
644
+ {
645
+ className: cx(
646
+ "relative flex shrink-0 cursor-pointer appearance-none items-center justify-center border border-solid border-primary",
647
+ size === "sm" ? "size-4 rounded-xs" : "size-5 rounded-sm",
648
+ isChecked ? "border-transparent bg-brand-solid" : "bg-primary",
649
+ isDisabled && "cursor-not-allowed opacity-50",
650
+ isDisabled && !isChecked && "bg-tertiary",
651
+ isFocusVisible && !isDisabled && focusRingShadow,
652
+ className
653
+ ),
654
+ children: [
655
+ isIndeterminate && /* @__PURE__ */ jsx(
656
+ "svg",
657
+ {
658
+ "aria-hidden": "true",
659
+ viewBox: "0 0 14 14",
660
+ fill: "none",
661
+ className: cx("pointer-events-none block shrink-0 text-fg-white", iconClassName),
662
+ children: /* @__PURE__ */ jsx("path", { d: "M2.91675 7H11.0834", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
663
+ }
664
+ ),
665
+ isSelected && !isIndeterminate && /* @__PURE__ */ jsx(CheckboxAnimatedCheckMark, { className: cx("pointer-events-none text-fg-white", iconClassName) })
666
+ ]
667
+ }
668
+ );
669
+ };
670
+ CheckboxBase.displayName = "CheckboxBase";
671
+
672
+ // ../../utils/is-react-component.ts
673
+ var isFunctionComponent = (component) => {
674
+ return typeof component === "function";
675
+ };
676
+ var isClassComponent = (component) => {
677
+ return typeof component === "function" && component.prototype && (!!component.prototype.isReactComponent || !!component.prototype.render);
678
+ };
679
+ var isForwardRefComponent = (component) => {
680
+ return typeof component === "object" && component !== null && component.$$typeof.toString() === "Symbol(react.forward_ref)";
681
+ };
682
+ var isReactComponent = (component) => {
683
+ return isFunctionComponent(component) || isForwardRefComponent(component) || isClassComponent(component);
684
+ };
685
+ var sizes4 = {
686
+ sm: {
687
+ root: "p-2 pr-2.5 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]",
688
+ text: "text-sm",
689
+ textContainer: "gap-x-1.5",
690
+ check: "size-4 stroke-[2.25px]",
691
+ checkbox: "sm"
692
+ },
693
+ md: {
694
+ root: "p-2 pr-2.5 gap-2 *:data-icon:size-5",
695
+ text: "text-md",
696
+ textContainer: "gap-x-2",
697
+ check: "size-5",
698
+ checkbox: "sm"
699
+ },
700
+ lg: {
701
+ root: "p-2.5 pl-2 gap-2 *:data-icon:size-5",
702
+ text: "text-md",
703
+ textContainer: "gap-x-2",
704
+ check: "size-5",
705
+ checkbox: "md"
706
+ }
707
+ };
708
+ var SelectItem = ({
709
+ label,
710
+ id,
711
+ value,
712
+ avatarUrl,
713
+ supportingText,
714
+ isDisabled,
715
+ icon: Icon,
716
+ className,
717
+ children,
718
+ selectionIndicator = "checkmark",
719
+ selectionIndicatorAlign = "right",
720
+ ...props
721
+ }) => {
722
+ const { size } = useContext(SelectContext);
723
+ const labelOrChildren = label || (typeof children === "string" ? children : "");
724
+ const textValue = supportingText ? labelOrChildren + " " + supportingText : labelOrChildren;
725
+ const isLeft = selectionIndicatorAlign === "left";
726
+ return /* @__PURE__ */ jsx(
727
+ ListBoxItem,
728
+ {
729
+ id,
730
+ value: value ?? {
731
+ id,
732
+ label: labelOrChildren,
733
+ avatarUrl,
734
+ supportingText,
735
+ isDisabled,
736
+ icon: Icon
737
+ },
738
+ textValue,
739
+ isDisabled,
740
+ ...props,
741
+ className: (state) => cx("w-full py-px outline-hidden", size === "sm" ? "px-1" : "px-1.5", typeof className === "function" ? className(state) : className),
742
+ children: (state) => /* @__PURE__ */ jsxs(
743
+ "div",
744
+ {
745
+ className: cx(
746
+ "flex cursor-pointer items-center rounded-md outline-hidden select-none",
747
+ (state.isFocused || state.isHovered || state.isSelected && selectionIndicator !== "checkbox") && "bg-primary_hover",
748
+ state.isDisabled && "cursor-not-allowed opacity-50",
749
+ // Icon styles
750
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
751
+ sizes4[size].root
752
+ ),
753
+ children: [
754
+ isLeft && selectionIndicator === "checkbox" && /* @__PURE__ */ jsx(CheckboxBase, { size: sizes4[size].checkbox, isSelected: state.isSelected, isDisabled: state.isDisabled }),
755
+ 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,
756
+ /* @__PURE__ */ jsxs("div", { className: cx("flex w-full min-w-0 flex-1 flex-wrap", sizes4[size].textContainer), children: [
757
+ /* @__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) }),
758
+ supportingText && /* @__PURE__ */ jsx(Text, { slot: "description", className: cx("whitespace-nowrap text-tertiary", sizes4[size].text), children: supportingText })
759
+ ] }),
760
+ state.isSelected && selectionIndicator === "checkmark" && /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: cx("ml-auto text-fg-brand-primary", sizes4[size].check) }),
761
+ !isLeft && selectionIndicator === "checkbox" && /* @__PURE__ */ jsx(CheckboxBase, { size: sizes4[size].checkbox, isSelected: state.isSelected, isDisabled: state.isDisabled, className: "ml-auto" })
762
+ ]
763
+ }
764
+ )
765
+ }
766
+ );
767
+ };
768
+ var TagSelectContext = createContext({
769
+ size: "sm",
770
+ selectedKeys: [],
771
+ selectedItems: {},
772
+ onRemove: () => {
773
+ },
774
+ onInputChange: () => {
775
+ }
776
+ });
777
+ var TagSelectBase = ({
778
+ items,
779
+ children,
780
+ size = "sm",
781
+ selectedItems,
782
+ onItemCleared,
783
+ onItemInserted,
784
+ valueFormatter,
785
+ shortcut,
786
+ placeholder = "Search",
787
+ icon,
788
+ // Omit name to avoid conflicts with the `Select` component
789
+ name: _name,
790
+ className,
791
+ ...props
792
+ }) => {
793
+ const { contains } = useFilter({ sensitivity: "base" });
794
+ const selectedKeys = selectedItems.items.map((item) => item.id);
795
+ const filter = useCallback(
796
+ (item, filterText) => {
797
+ return !selectedKeys.includes(item.id) && contains(item.label || item.supportingText || "", filterText);
798
+ },
799
+ [contains, selectedKeys]
800
+ );
801
+ const accessibleList = $232f8dea1b0a4f2f$export$762f73dccccd255d({
802
+ initialItems: items,
803
+ filter
804
+ });
805
+ const onRemove = useCallback(
806
+ (keys) => {
807
+ const key = keys.values().next().value;
808
+ if (!key) return;
809
+ selectedItems.remove(key);
810
+ onItemCleared?.(key);
811
+ },
812
+ [selectedItems, onItemCleared]
813
+ );
814
+ const onSelectionChange = (id) => {
815
+ if (!id) {
816
+ return;
817
+ }
818
+ const item = accessibleList.getItem(id);
819
+ if (!item) {
820
+ return;
821
+ }
822
+ if (!selectedKeys.includes(id)) {
823
+ selectedItems.append(item);
824
+ onItemInserted?.(id);
825
+ }
826
+ accessibleList.setFilterText("");
827
+ };
828
+ const onInputChange = (value) => {
829
+ accessibleList.setFilterText(value);
830
+ };
831
+ const placeholderRef = useRef(null);
832
+ const [popoverWidth, setPopoverWidth] = useState("");
833
+ const onResize = useCallback(() => {
834
+ if (!placeholderRef.current) return;
835
+ let divRect = placeholderRef.current?.getBoundingClientRect();
836
+ setPopoverWidth(divRect.width + "px");
837
+ }, [placeholderRef, setPopoverWidth]);
838
+ useResizeObserver({
839
+ ref: placeholderRef,
840
+ onResize,
841
+ box: "border-box"
842
+ });
843
+ return /* @__PURE__ */ jsx(
844
+ TagSelectContext.Provider,
845
+ {
846
+ value: {
847
+ size,
848
+ selectedKeys,
849
+ selectedItems,
850
+ onInputChange,
851
+ onRemove,
852
+ valueFormatter
853
+ },
854
+ children: /* @__PURE__ */ jsx(
855
+ ComboBox,
856
+ {
857
+ allowsEmptyCollection: true,
858
+ menuTrigger: "focus",
859
+ items: accessibleList.items,
860
+ onInputChange,
861
+ inputValue: accessibleList.filterText,
862
+ value: null,
863
+ onChange: onSelectionChange,
864
+ className: (state) => cx("flex flex-col gap-1.5", typeof className === "function" ? className(state) : className),
865
+ ...props,
866
+ children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [
867
+ props.label && /* @__PURE__ */ jsx(Label, { isRequired: state.isRequired, tooltip: props.tooltip, children: props.label }),
868
+ /* @__PURE__ */ jsx(
869
+ TagSelectTagsValue,
870
+ {
871
+ size,
872
+ shortcut,
873
+ ref: placeholderRef,
874
+ placeholder,
875
+ icon,
876
+ onFocus: onResize,
877
+ onPointerEnter: onResize
878
+ }
879
+ ),
880
+ /* @__PURE__ */ jsx(Popover, { size, triggerRef: placeholderRef, style: { width: popoverWidth }, className: props?.popoverClassName, children: /* @__PURE__ */ jsx(ListBox, { selectionMode: "multiple", className: "size-full outline-hidden", children }) }),
881
+ props.hint && /* @__PURE__ */ jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === "sm" && "text-xs"), children: props.hint })
882
+ ] })
883
+ }
884
+ )
885
+ }
886
+ );
887
+ };
888
+ var InnerTagSelect = ({ isDisabled, shortcut, shortcutClassName, placeholder, size = "sm" }) => {
889
+ const focusManager = useFocusManager();
890
+ const tagSelectContext = useContext(TagSelectContext);
891
+ const comboBoxStateContext = useContext(ComboBoxStateContext);
892
+ const handleInputKeyDown = (event) => {
893
+ const isCaretAtStart = event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === 0;
894
+ if (!isCaretAtStart && event.currentTarget.value !== "") {
895
+ return;
896
+ }
897
+ switch (event.key) {
898
+ case "Backspace":
899
+ case "ArrowLeft":
900
+ focusManager?.focusPrevious({ wrap: false, tabbable: false });
901
+ break;
902
+ case "ArrowRight":
903
+ focusManager?.focusNext({ wrap: false, tabbable: false });
904
+ break;
905
+ }
906
+ };
907
+ const handleInputMouseDown = (_event) => {
908
+ if (comboBoxStateContext && !comboBoxStateContext.isOpen) {
909
+ comboBoxStateContext.open();
910
+ }
911
+ };
912
+ const handleTagKeyDown = (event, value) => {
913
+ if (event.key === "Tab") {
914
+ return;
915
+ }
916
+ event.preventDefault();
917
+ const isFirstTag = tagSelectContext?.selectedItems?.items?.[0]?.id === value;
918
+ switch (event.key) {
919
+ case " ":
920
+ case "Enter":
921
+ case "Backspace":
922
+ if (isFirstTag) {
923
+ focusManager?.focusNext({ wrap: false, tabbable: false });
924
+ } else {
925
+ focusManager?.focusPrevious({ wrap: false, tabbable: false });
926
+ }
927
+ tagSelectContext.onRemove(/* @__PURE__ */ new Set([value]));
928
+ break;
929
+ case "ArrowLeft":
930
+ focusManager?.focusPrevious({ wrap: false, tabbable: false });
931
+ break;
932
+ case "ArrowRight":
933
+ focusManager?.focusNext({ wrap: false, tabbable: false });
934
+ break;
935
+ case "Escape":
936
+ comboBoxStateContext?.close();
937
+ break;
938
+ }
939
+ };
940
+ const isSelectionEmpty = tagSelectContext?.selectedItems?.items?.length === 0;
941
+ return /* @__PURE__ */ jsxs("div", { className: "relative flex w-full min-w-0 flex-1 flex-row flex-wrap items-center justify-start gap-1.5", children: [
942
+ !isSelectionEmpty && tagSelectContext?.selectedItems?.items?.map((value) => /* @__PURE__ */ jsxs(
943
+ "span",
944
+ {
945
+ className: cx(
946
+ "flex min-w-0 items-center rounded-md border border-solid border-primary bg-primary",
947
+ size === "sm" ? "px-1 py-0.75" : "py-0.5 pr-1 pl-1.25"
948
+ ),
949
+ children: [
950
+ /* @__PURE__ */ jsx(Avatar, { size: "xs", alt: value?.label, src: value?.avatarUrl, className: "size-4" }),
951
+ /* @__PURE__ */ jsx(
952
+ "p",
953
+ {
954
+ className: cx(
955
+ "truncate font-medium whitespace-nowrap text-secondary select-none",
956
+ size === "sm" ? "ml-1 text-xs" : "ml-1.25 text-sm"
957
+ ),
958
+ children: tagSelectContext.valueFormatter ? tagSelectContext.valueFormatter(value) : value?.label
959
+ }
960
+ ),
961
+ /* @__PURE__ */ jsx(
962
+ TagCloseX,
963
+ {
964
+ size: size === "sm" ? "sm" : "md",
965
+ isDisabled,
966
+ className: "ml-0.75",
967
+ onKeyDown: (event) => handleTagKeyDown(event, value.id),
968
+ onPress: () => tagSelectContext.onRemove(/* @__PURE__ */ new Set([value.id]))
969
+ }
970
+ )
971
+ ]
972
+ },
973
+ value.id
974
+ )),
975
+ /* @__PURE__ */ jsxs("div", { className: cx("relative flex min-w-12 flex-1 flex-row items-center", !isSelectionEmpty && "ml-0.5", shortcut && "min-w-[30%]"), children: [
976
+ /* @__PURE__ */ jsx(
977
+ Input,
978
+ {
979
+ placeholder,
980
+ onKeyDown: handleInputKeyDown,
981
+ onMouseDown: handleInputMouseDown,
982
+ className: cx(
983
+ "w-full flex-[1_0_0] appearance-none bg-transparent text-ellipsis text-primary caret-alpha-black/90 outline-hidden placeholder:text-placeholder focus:outline-hidden disabled:cursor-not-allowed",
984
+ sizes3[size].text
985
+ )
986
+ }
987
+ ),
988
+ shortcut && /* @__PURE__ */ jsx(
989
+ "div",
990
+ {
991
+ "aria-hidden": "true",
992
+ className: cx(
993
+ "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",
994
+ shortcutClassName,
995
+ sizes3[size].shortcut
996
+ ),
997
+ children: /* @__PURE__ */ jsx(
998
+ "span",
999
+ {
1000
+ className: cx(
1001
+ "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
1002
+ isDisabled && "bg-transparent"
1003
+ ),
1004
+ children: "\u2318K"
1005
+ }
1006
+ )
1007
+ }
1008
+ )
1009
+ ] })
1010
+ ] });
1011
+ };
1012
+ var TagSelectTagsValue = ({
1013
+ size = "sm",
1014
+ shortcut,
1015
+ placeholder,
1016
+ shortcutClassName,
1017
+ icon: Icon = MagnifyingGlassIcon,
1018
+ // Omit this prop to avoid invalid HTML attribute warning
1019
+ isDisabled: _isDisabled,
1020
+ ...otherProps
1021
+ }) => {
1022
+ const tagSelectContext = useContext(TagSelectContext);
1023
+ const selectedItemsCount = tagSelectContext.selectedKeys.length;
1024
+ return /* @__PURE__ */ jsx(
1025
+ Group,
1026
+ {
1027
+ ...otherProps,
1028
+ className: ({ isFocusWithin, isDisabled, isInvalid }) => cx(
1029
+ "relative flex w-full items-center rounded-lg border border-solid border-primary bg-primary shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
1030
+ isDisabled && "cursor-not-allowed opacity-50",
1031
+ !isInvalid && isFocusWithin && inputFocusRingShadow,
1032
+ isInvalid && !isFocusWithin && "border-error_subtle",
1033
+ isInvalid && isFocusWithin && inputErrorFocusRingShadow,
1034
+ // Icon styles
1035
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
1036
+ sizes3[size].root,
1037
+ // Overwrite vertical padding for small size when there are selected items
1038
+ // to prevent height jump because the tags are taller than the input text.
1039
+ size === "sm" && selectedItemsCount > 0 && "py-1.5"
1040
+ ),
1041
+ children: ({ isDisabled }) => /* @__PURE__ */ jsxs(Fragment, { children: [
1042
+ Icon && /* @__PURE__ */ jsx(Icon, { "data-icon": true, className: "pointer-events-none" }),
1043
+ /* @__PURE__ */ jsx(FocusScope, { contain: false, autoFocus: false, restoreFocus: false, children: /* @__PURE__ */ jsx(
1044
+ InnerTagSelect,
1045
+ {
1046
+ isDisabled,
1047
+ size,
1048
+ shortcut,
1049
+ shortcutClassName,
1050
+ placeholder
1051
+ }
1052
+ ) })
1053
+ ] })
1054
+ }
1055
+ );
1056
+ };
1057
+ var TagSelect = TagSelectBase;
1058
+ TagSelect.Item = SelectItem;
1059
+
1060
+ export { TagSelect, TagSelectBase, TagSelectTagsValue };
1061
+ //# sourceMappingURL=tag-select.js.map
1062
+ //# sourceMappingURL=tag-select.js.map