@jobber/components 4.85.5 → 4.85.6-CJS-to-ESM.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 (606) hide show
  1. package/dist/AnimatedPresence/{index.js → index.cjs} +1 -3
  2. package/dist/AnimatedPresence/index.mjs +4 -0
  3. package/dist/AnimatedPresence-D73apgLB.js +98 -0
  4. package/dist/{AnimatedPresence-20a02aaa.js → AnimatedPresence-DFaAEYUa.js} +3 -7
  5. package/dist/AnimatedSwitcher/index.cjs +11 -0
  6. package/dist/AnimatedSwitcher/index.mjs +5 -0
  7. package/dist/AnimatedSwitcher-B4fUExeN.js +90 -0
  8. package/dist/{AnimatedSwitcher-3d45ec5d.js → AnimatedSwitcher-UmlTf067.js} +4 -8
  9. package/dist/Autocomplete/index.cjs +34 -0
  10. package/dist/Autocomplete/index.mjs +28 -0
  11. package/dist/{Autocomplete/index.js → Autocomplete-CDpl009j.js} +24 -43
  12. package/dist/Autocomplete-DcuJsI7Z.js +188 -0
  13. package/dist/Avatar/index.cjs +13 -0
  14. package/dist/Avatar/index.mjs +7 -0
  15. package/dist/Avatar-DZCQBKMr.js +70 -0
  16. package/dist/Avatar-Q2BQymsE.js +72 -0
  17. package/dist/Banner/components/BannerIcon/index.cjs +13 -0
  18. package/dist/Banner/components/BannerIcon/index.mjs +7 -0
  19. package/dist/Banner/index.cjs +19 -0
  20. package/dist/Banner/index.mjs +13 -0
  21. package/dist/Banner-B230_jsV.js +84 -0
  22. package/dist/Banner-zMyKdO1y.js +82 -0
  23. package/dist/BannerIcon-QB3lZddm.js +24 -0
  24. package/dist/BannerIcon-YIreWKuC.js +27 -0
  25. package/dist/Body-DMRyfeGa.js +59 -0
  26. package/dist/Body-Dd2-HEDo.js +50 -0
  27. package/dist/Button/index.cjs +14 -0
  28. package/dist/Button/index.mjs +8 -0
  29. package/dist/Button-CWVwgwhn.js +50 -0
  30. package/dist/Button-D3mW3Hcg.js +52 -0
  31. package/dist/ButtonDismiss/index.cjs +15 -0
  32. package/dist/ButtonDismiss/index.mjs +9 -0
  33. package/dist/ButtonDismiss-GLptCaNc.js +8 -0
  34. package/dist/ButtonDismiss-l6Kunmen.js +10 -0
  35. package/dist/Card/index.cjs +22 -0
  36. package/dist/Card/index.mjs +16 -0
  37. package/dist/{Card-e3144022.js → Card-0WPJWxfz.js} +20 -25
  38. package/dist/Card-BOD8v9wH.js +86 -0
  39. package/dist/Checkbox/index.cjs +16 -0
  40. package/dist/Checkbox/index.mjs +10 -0
  41. package/dist/Checkbox-C78HDAVJ.js +58 -0
  42. package/dist/Checkbox-qsepteuE.js +56 -0
  43. package/dist/Chip/hooks/index.cjs +8 -0
  44. package/dist/Chip/hooks/index.mjs +2 -0
  45. package/dist/Chip/index.cjs +26 -0
  46. package/dist/Chip/index.mjs +18 -0
  47. package/dist/Chip-Div4v8At.js +73 -0
  48. package/dist/Chip-tWHAQezL.js +70 -0
  49. package/dist/ChipDismissible-B0DslYTJ.js +22 -0
  50. package/dist/ChipDismissible-DSLoDRyq.js +19 -0
  51. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +24 -0
  52. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +14 -0
  53. package/dist/Chips/InternalChipDismissible/index.cjs +35 -0
  54. package/dist/Chips/InternalChipDismissible/index.mjs +29 -0
  55. package/dist/Chips/index.cjs +48 -0
  56. package/dist/Chips/index.mjs +44 -0
  57. package/dist/Chips-DzPxRiFY.js +91 -0
  58. package/dist/Chips-tdDqEKfy.js +93 -0
  59. package/dist/Combobox/components/ComboboxAction/index.cjs +13 -0
  60. package/dist/Combobox/components/ComboboxAction/index.mjs +7 -0
  61. package/dist/Combobox/components/ComboboxActivator/index.cjs +27 -0
  62. package/dist/Combobox/components/ComboboxActivator/index.mjs +21 -0
  63. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.cjs +15 -0
  64. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.mjs +9 -0
  65. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +25 -0
  66. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +19 -0
  67. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +11 -0
  68. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +5 -0
  69. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +10 -0
  70. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +4 -0
  71. package/dist/Combobox/components/ComboboxContent/index.cjs +35 -0
  72. package/dist/Combobox/components/ComboboxContent/index.mjs +29 -0
  73. package/dist/Combobox/components/ComboboxOption/index.cjs +15 -0
  74. package/dist/Combobox/components/ComboboxOption/index.mjs +9 -0
  75. package/dist/Combobox/components/ComboboxTrigger/index.cjs +25 -0
  76. package/dist/Combobox/components/ComboboxTrigger/index.mjs +19 -0
  77. package/dist/Combobox/index.cjs +52 -0
  78. package/dist/Combobox/index.mjs +45 -0
  79. package/dist/Combobox-BwSFlPWt.js +120 -0
  80. package/dist/Combobox-Dr5ftH9X.js +122 -0
  81. package/dist/ComboboxAction-B3RwsCtx.js +27 -0
  82. package/dist/ComboboxAction-BzEwYtPm.js +25 -0
  83. package/dist/ComboboxActivator-B-2nmWQ-.js +28 -0
  84. package/dist/ComboboxActivator-DkcbNfv5.js +26 -0
  85. package/dist/ComboboxContent-B108quRR.js +144 -0
  86. package/dist/ComboboxContent-D44NnZaD.js +146 -0
  87. package/dist/ComboboxContentHeader-CJ0if4JI.js +32 -0
  88. package/dist/ComboboxContentHeader-DFLlxg-X.js +30 -0
  89. package/dist/ComboboxContentList-DHQ0x2ml.js +80 -0
  90. package/dist/ComboboxContentList-DmdT_cqp.js +78 -0
  91. package/dist/ComboboxContentSearch-B8hsfo_D.js +35 -0
  92. package/dist/ComboboxContentSearch-UAyHetvM.js +37 -0
  93. package/dist/ComboboxLoadMore-C3JuiaZf.js +17 -0
  94. package/dist/ComboboxLoadMore-Dk2tUBxS.js +19 -0
  95. package/dist/ComboboxOption-CWkyTkzU.js +25 -0
  96. package/dist/ComboboxOption-D_f4NcBM.js +23 -0
  97. package/dist/ComboboxProvider-BwxfVgmL.js +13 -0
  98. package/dist/ComboboxProvider-Dm_tfmkr.js +10 -0
  99. package/dist/ComboboxTrigger-BAOfY8Og.js +22 -0
  100. package/dist/ComboboxTrigger-ZqNl11Qy.js +24 -0
  101. package/dist/ConfirmationModal/index.cjs +29 -0
  102. package/dist/ConfirmationModal/index.mjs +23 -0
  103. package/dist/ConfirmationModal-CPNH-chF.js +94 -0
  104. package/dist/{ConfirmationModal-52e16873.js → ConfirmationModal-CZTiORX4.js} +6 -10
  105. package/dist/Content/index.cjs +10 -0
  106. package/dist/Content/index.mjs +4 -0
  107. package/dist/Content-B8Od1cqS.js +20 -0
  108. package/dist/Content-BknIp35w.js +18 -0
  109. package/dist/Countdown/index.cjs +10 -0
  110. package/dist/Countdown/index.mjs +4 -0
  111. package/dist/Countdown-DQYi_QSJ.js +63 -0
  112. package/dist/{Countdown/index.js → Countdown-mTio5lCJ.js} +2 -9
  113. package/dist/DataDump/index.cjs +25 -0
  114. package/dist/DataDump/index.mjs +19 -0
  115. package/dist/DataDump-BhkXdMFl.js +15 -0
  116. package/dist/DataDump-BoNQd_3r.js +17 -0
  117. package/dist/DataList/components/DataListAction/index.cjs +14 -0
  118. package/dist/DataList/components/DataListAction/index.mjs +8 -0
  119. package/dist/DataList/components/DataListActions/index.cjs +43 -0
  120. package/dist/DataList/components/DataListActions/index.mjs +37 -0
  121. package/dist/DataList/components/DataListActionsMenu/index.cjs +16 -0
  122. package/dist/DataList/components/DataListActionsMenu/index.mjs +10 -0
  123. package/dist/DataList/components/DataListBulkActions/index.cjs +46 -0
  124. package/dist/DataList/components/DataListBulkActions/index.mjs +39 -0
  125. package/dist/DataList/components/DataListEmptyState/index.cjs +21 -0
  126. package/dist/DataList/components/DataListEmptyState/index.mjs +14 -0
  127. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +53 -0
  128. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +47 -0
  129. package/dist/DataList/components/DataListFilters/index.cjs +67 -0
  130. package/dist/DataList/components/DataListFilters/index.mjs +60 -0
  131. package/dist/DataList/components/DataListHeader/index.cjs +53 -0
  132. package/dist/DataList/components/DataListHeader/index.mjs +47 -0
  133. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +13 -0
  134. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +7 -0
  135. package/dist/DataList/components/DataListHeaderTile/index.cjs +21 -0
  136. package/dist/DataList/components/DataListHeaderTile/index.mjs +15 -0
  137. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.cjs +15 -0
  138. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.mjs +9 -0
  139. package/dist/DataList/components/DataListItem/index.cjs +52 -0
  140. package/dist/DataList/components/DataListItem/index.mjs +46 -0
  141. package/dist/DataList/components/DataListItemActions/index.cjs +45 -0
  142. package/dist/DataList/components/DataListItemActions/index.mjs +38 -0
  143. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +25 -0
  144. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +19 -0
  145. package/dist/DataList/components/DataListItems/index.cjs +53 -0
  146. package/dist/DataList/components/DataListItems/index.mjs +47 -0
  147. package/dist/DataList/components/DataListLayout/index.cjs +56 -0
  148. package/dist/DataList/components/DataListLayout/index.mjs +50 -0
  149. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.cjs +9 -0
  150. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.mjs +2 -0
  151. package/dist/DataList/components/DataListLayoutActions/index.cjs +33 -0
  152. package/dist/DataList/components/DataListLayoutActions/index.mjs +27 -0
  153. package/dist/DataList/components/DataListLoadMore/index.cjs +22 -0
  154. package/dist/DataList/components/DataListLoadMore/index.mjs +15 -0
  155. package/dist/DataList/components/DataListLoadingState/index.cjs +22 -0
  156. package/dist/DataList/components/DataListLoadingState/index.mjs +14 -0
  157. package/dist/DataList/components/DataListOverflowFade/index.cjs +12 -0
  158. package/dist/DataList/components/DataListOverflowFade/index.mjs +5 -0
  159. package/dist/DataList/components/DataListSearch/index.cjs +35 -0
  160. package/dist/DataList/components/DataListSearch/index.mjs +27 -0
  161. package/dist/DataList/components/DataListStatusBar/index.cjs +32 -0
  162. package/dist/DataList/components/DataListStatusBar/index.mjs +25 -0
  163. package/dist/DataList/components/DataListStickyHeader/index.cjs +12 -0
  164. package/dist/DataList/components/DataListStickyHeader/index.mjs +6 -0
  165. package/dist/DataList/components/DataListTags/index.cjs +13 -0
  166. package/dist/DataList/components/DataListTags/index.mjs +7 -0
  167. package/dist/DataList/components/DataListTotalCount/index.cjs +16 -0
  168. package/dist/DataList/components/DataListTotalCount/index.mjs +9 -0
  169. package/dist/DataList/context/DataListContext/index.cjs +12 -0
  170. package/dist/DataList/context/DataListContext/index.mjs +4 -0
  171. package/dist/DataList/context/DataListLayoutContext/index.cjs +12 -0
  172. package/dist/DataList/context/DataListLayoutContext/index.mjs +4 -0
  173. package/dist/DataList/index.cjs +98 -0
  174. package/dist/DataList/index.mjs +92 -0
  175. package/dist/DataList-BL3zeA83.js +9 -0
  176. package/dist/DataList-D8rsiB6p.js +7 -0
  177. package/dist/DataList-DcPfsE4o.js +141 -0
  178. package/dist/DataList-UzxXqfXV.js +139 -0
  179. package/dist/DataList.const-Wz370ukq.js +25 -0
  180. package/dist/DataList.const-YbvF2-QB.js +38 -0
  181. package/dist/DataList.utils-B0hOFZaX.js +168 -0
  182. package/dist/DataList.utils-C931OWj0.js +161 -0
  183. package/dist/DataListAction-CMZbwbN5.js +40 -0
  184. package/dist/DataListAction-CzSLV230.js +42 -0
  185. package/dist/DataListActions-D2xI1Gnz.js +45 -0
  186. package/dist/DataListActions-DYrocbl7.js +43 -0
  187. package/dist/DataListActionsMenu-3JxvPbGZ.js +53 -0
  188. package/dist/DataListActionsMenu-CjBKmZT6.js +55 -0
  189. package/dist/DataListBulkActions-BSjCVCSw.js +32 -0
  190. package/dist/DataListBulkActions-OLJ1EzI6.js +29 -0
  191. package/dist/DataListContext-CWEeA357.js +29 -0
  192. package/dist/DataListContext-DHdRjGCC.js +25 -0
  193. package/dist/DataListEmptyState-CvRFHlYt.js +56 -0
  194. package/dist/DataListEmptyState-Rk1OowmR.js +53 -0
  195. package/dist/DataListFilters-Dfw7ptNa.js +46 -0
  196. package/dist/DataListFilters-y0CrJgWe.js +43 -0
  197. package/dist/DataListHeader-BFg0X9Jz.js +95 -0
  198. package/dist/DataListHeader-DB1ikJ1G.js +93 -0
  199. package/dist/DataListHeaderTile-BcvpRQqc.js +86 -0
  200. package/dist/DataListHeaderTile-CUaHgFkG.js +84 -0
  201. package/dist/DataListItem-27SGm5NU.js +114 -0
  202. package/dist/DataListItem-CEcG1clf.js +112 -0
  203. package/dist/DataListItemActions-B0IR13cA.js +35 -0
  204. package/dist/DataListItemActions-DbMxVTo5.js +32 -0
  205. package/dist/DataListItemActionsOverflow-B1XTLLAZ.js +33 -0
  206. package/dist/DataListItemActionsOverflow-Dt1rZ_ch.js +35 -0
  207. package/dist/DataListItemClickable-CPGV8QJU.js +47 -0
  208. package/dist/DataListItemClickable-a9vfumwQ.js +45 -0
  209. package/dist/DataListItems-C37QwFLL.js +21 -0
  210. package/dist/DataListItems-CmmwaaoF.js +19 -0
  211. package/dist/DataListLayout-BkqOAi5X.js +19 -0
  212. package/dist/DataListLayout-fuctDjAR.js +21 -0
  213. package/dist/DataListLayoutActions-BrXEXuWB.js +41 -0
  214. package/dist/DataListLayoutActions-C1xVkV8F.js +39 -0
  215. package/dist/DataListLayoutContext-BiMbo7LQ.js +18 -0
  216. package/dist/DataListLayoutContext-D3REliDa.js +8 -0
  217. package/dist/DataListLayoutContext-D5Jhd_ZG.js +14 -0
  218. package/dist/DataListLayoutContext-DT0mtKzt.js +11 -0
  219. package/dist/DataListLoadMore-BThmoeQ0.js +37 -0
  220. package/dist/DataListLoadMore-eMdC9JGb.js +34 -0
  221. package/dist/DataListLoadingState-BovqtnV7.js +29 -0
  222. package/dist/DataListLoadingState-DKSypijq.js +25 -0
  223. package/dist/DataListOverflowFade-DUocP0Jz.js +25 -0
  224. package/dist/DataListOverflowFade-DxUdWrD0.js +28 -0
  225. package/dist/DataListSearch-D0pqhE8d.js +66 -0
  226. package/dist/DataListSearch-DiHOG8VU.js +62 -0
  227. package/dist/DataListSort-CQ62ewRY.js +94 -0
  228. package/dist/DataListSort-CW4v1psG.js +92 -0
  229. package/dist/DataListSortingOptions-BGNu0KOG.js +38 -0
  230. package/dist/DataListSortingOptions-ZiARzP5b.js +40 -0
  231. package/dist/DataListStatusBar-EQKC5MHS.js +22 -0
  232. package/dist/DataListStatusBar-Va-ssWph.js +25 -0
  233. package/dist/DataListStickyHeader-BKN9V51R.js +28 -0
  234. package/dist/DataListStickyHeader-CCG09E7V.js +26 -0
  235. package/dist/DataListTags-C5inHFOR.js +67 -0
  236. package/dist/DataListTags-CHZr9DW3.js +65 -0
  237. package/dist/DataListTotalCount-B9K3hGqp.js +30 -0
  238. package/dist/DataListTotalCount-Dzzm_buN.js +27 -0
  239. package/dist/DataTable/index.cjs +34 -0
  240. package/dist/DataTable/index.mjs +23 -0
  241. package/dist/DataTable/test-utilities/index.cjs +241 -0
  242. package/dist/DataTable/test-utilities/index.mjs +233 -0
  243. package/dist/DataTable-BOZ_Zf4q.js +245 -0
  244. package/dist/DataTable-D1Q5tABs.js +247 -0
  245. package/dist/DatePicker/index.cjs +24 -0
  246. package/dist/DatePicker/index.mjs +18 -0
  247. package/dist/DatePicker-CqYEsDX3.js +1279 -0
  248. package/dist/DatePicker-DBObDXoW.js +1282 -0
  249. package/dist/DayOfMonthSelect--s7Ry-jx.js +141 -0
  250. package/dist/DayOfMonthSelect-UlE6seGW.js +148 -0
  251. package/dist/DescriptionList/index.cjs +11 -0
  252. package/dist/DescriptionList/index.mjs +5 -0
  253. package/dist/DescriptionList-CBeTDl49.js +15 -0
  254. package/dist/DescriptionList-DBENvQT5.js +17 -0
  255. package/dist/Disclosure/index.cjs +14 -0
  256. package/dist/Disclosure/index.mjs +8 -0
  257. package/dist/Disclosure-Bikm1B9V.js +38 -0
  258. package/dist/Disclosure-D7kJi1Df.js +36 -0
  259. package/dist/Divider/index.cjs +10 -0
  260. package/dist/Divider/index.mjs +4 -0
  261. package/dist/Divider-DOmpOAKU.js +20 -0
  262. package/dist/{Divider/index.js → Divider-Dt_qE9xe.js} +4 -11
  263. package/dist/Drawer/index.cjs +19 -0
  264. package/dist/Drawer/index.mjs +12 -0
  265. package/dist/DrawerGrid-Bg9ydPFR.js +33 -0
  266. package/dist/DrawerGrid-DM3WKmX6.js +36 -0
  267. package/dist/Emphasis/index.cjs +11 -0
  268. package/dist/Emphasis/index.mjs +5 -0
  269. package/dist/Emphasis-B3vf8Ek9.js +15 -0
  270. package/dist/Emphasis-xxFrrT2i.js +13 -0
  271. package/dist/FeatureSwitch/index.cjs +24 -0
  272. package/dist/FeatureSwitch/index.mjs +18 -0
  273. package/dist/FeatureSwitch-C1cXc0VS.js +55 -0
  274. package/dist/FeatureSwitch-C66nDoAy.js +57 -0
  275. package/dist/Flex/index.cjs +10 -0
  276. package/dist/Flex/index.mjs +4 -0
  277. package/dist/{Flex-d490c4db.js → Flex-CBKf3epb.js} +3 -8
  278. package/dist/Flex-DXDpEzMI.js +31 -0
  279. package/dist/Form/index.cjs +10 -0
  280. package/dist/Form/index.mjs +4 -0
  281. package/dist/{Form/index.js → Form-ChkdN1bx.js} +3 -9
  282. package/dist/Form-Dd9YKBh-.js +48 -0
  283. package/dist/FormField/index.cjs +22 -0
  284. package/dist/FormField/index.mjs +16 -0
  285. package/dist/FormField-BBg_JAlJ.js +248 -0
  286. package/dist/FormField-C-d0U7Ww.js +246 -0
  287. package/dist/FormatDate/{index.js → index.cjs} +1 -3
  288. package/dist/FormatDate/index.mjs +2 -0
  289. package/dist/{FormatDate-70ea5b43.js → FormatDate-BzJETLja.js} +1 -5
  290. package/dist/FormatDate-Dxs33-Xj.js +27 -0
  291. package/dist/FormatEmail/index.cjs +10 -0
  292. package/dist/FormatEmail/index.mjs +4 -0
  293. package/dist/FormatEmail-BH1qM7Va.js +16 -0
  294. package/dist/FormatEmail-_Ytrq7mn.js +14 -0
  295. package/dist/FormatFile/index.cjs +34 -0
  296. package/dist/FormatFile/index.mjs +28 -0
  297. package/dist/FormatFile-BQXjo6EG.js +154 -0
  298. package/dist/FormatFile-D-UIdDqE.js +156 -0
  299. package/dist/FormatRelativeDateTime/index.cjs +8 -0
  300. package/dist/FormatRelativeDateTime/index.mjs +2 -0
  301. package/dist/{FormatRelativeDateTime/index.js → FormatRelativeDateTime-COgItrYT.js} +5 -11
  302. package/dist/FormatRelativeDateTime-DTnQraIq.js +64 -0
  303. package/dist/FormatTime/index.cjs +8 -0
  304. package/dist/FormatTime/index.mjs +2 -0
  305. package/dist/FormatTime-BGr7_DaA.js +28 -0
  306. package/dist/{FormatTime/index.js → FormatTime-CfcVslez.js} +1 -7
  307. package/dist/Gallery/index.cjs +40 -0
  308. package/dist/Gallery/index.mjs +34 -0
  309. package/dist/Gallery-BMpC_ohB.js +66 -0
  310. package/dist/Gallery-DXXQxrHV.js +68 -0
  311. package/dist/Glimmer/index.cjs +13 -0
  312. package/dist/Glimmer/index.mjs +6 -0
  313. package/dist/Glimmer-Cgcy2Ruw.js +72 -0
  314. package/dist/Glimmer-Dz1E9Bo5.js +69 -0
  315. package/dist/Grid/InternalGridCell/index.cjs +10 -0
  316. package/dist/Grid/InternalGridCell/index.mjs +3 -0
  317. package/dist/Grid/index.cjs +13 -0
  318. package/dist/Grid/index.mjs +6 -0
  319. package/dist/Grid-2KPGnpZI.js +37 -0
  320. package/dist/Grid-ClBkskz-.js +34 -0
  321. package/dist/Heading/index.cjs +12 -0
  322. package/dist/Heading/index.mjs +6 -0
  323. package/dist/Heading-CL3UujY7.js +49 -0
  324. package/dist/{Heading-1e8e4bd3.js → Heading-suKDLmO4.js} +3 -7
  325. package/dist/Icon/index.cjs +9 -0
  326. package/dist/Icon/index.mjs +3 -0
  327. package/dist/Icon-B9XNdA1T.js +36 -0
  328. package/dist/Icon-CoHJokXb.js +34 -0
  329. package/dist/InlineLabel/index.cjs +11 -0
  330. package/dist/InlineLabel/index.mjs +5 -0
  331. package/dist/InlineLabel-BPjH1ASc.js +23 -0
  332. package/dist/InlineLabel-x3msDD5R.js +21 -0
  333. package/dist/InputAvatar/index.cjs +26 -0
  334. package/dist/InputAvatar/index.mjs +20 -0
  335. package/dist/InputAvatar-DcNJEpM3.js +52 -0
  336. package/dist/InputAvatar-Dp3cCHai.js +50 -0
  337. package/dist/InputDate/index.cjs +33 -0
  338. package/dist/InputDate/index.mjs +27 -0
  339. package/dist/InputDate-Brwb3gue.js +31 -0
  340. package/dist/InputDate-D5pZraRN.js +33 -0
  341. package/dist/InputEmail/index.cjs +24 -0
  342. package/dist/InputEmail/index.mjs +17 -0
  343. package/dist/InputEmail-DkvNQj63.js +23 -0
  344. package/dist/InputEmail-nxOzDFb8.js +20 -0
  345. package/dist/InputFile/index.cjs +23 -0
  346. package/dist/InputFile/index.mjs +16 -0
  347. package/dist/InputFile-BBOdV6FH.js +2794 -0
  348. package/dist/InputFile-l-Zdbe8r.js +2797 -0
  349. package/dist/InputGroup/index.cjs +10 -0
  350. package/dist/InputGroup/index.mjs +4 -0
  351. package/dist/{InputGroup-8d4fd4eb.js → InputGroup-Bljb97cw.js} +5 -10
  352. package/dist/InputGroup-CCJ2rycA.js +26 -0
  353. package/dist/InputNumber/index.cjs +23 -0
  354. package/dist/InputNumber/index.mjs +17 -0
  355. package/dist/{InputNumber-d451b52e.js → InputNumber-B3-6b6mT.js} +2 -6
  356. package/dist/InputNumber-D2jOwtOi.js +56 -0
  357. package/dist/InputPassword/index.cjs +23 -0
  358. package/dist/InputPassword/index.mjs +17 -0
  359. package/dist/InputPassword-BwPfewHd.js +19 -0
  360. package/dist/InputPassword-mWbDB3Oh.js +21 -0
  361. package/dist/InputPhoneNumber/index.cjs +23 -0
  362. package/dist/InputPhoneNumber/index.mjs +17 -0
  363. package/dist/{InputPhoneNumber/index.js → InputPhoneNumber-CrkVlyUE.js} +8 -25
  364. package/dist/InputPhoneNumber-ynZiTe9j.js +97 -0
  365. package/dist/InputText/index.cjs +24 -0
  366. package/dist/InputText/index.mjs +18 -0
  367. package/dist/InputText-CgykvJl2.js +96 -0
  368. package/dist/{InputText-55b6cb65.js → InputText-D1KkzO4T.js} +2 -6
  369. package/dist/InputTime/index.cjs +28 -0
  370. package/dist/InputTime/index.mjs +22 -0
  371. package/dist/InputTime-CVHCWh2x.js +187 -0
  372. package/dist/{InputTime/index.js → InputTime-Ce0H2RWH.js} +5 -25
  373. package/dist/InputValidation/index.cjs +15 -0
  374. package/dist/InputValidation/index.mjs +9 -0
  375. package/dist/InputValidation-BmgvSw0e.js +23 -0
  376. package/dist/InputValidation-DIwnbDDv.js +25 -0
  377. package/dist/InternalChipDismissible-BoAPXU91.js +158 -0
  378. package/dist/InternalChipDismissible-Dj-XvjT4.js +163 -0
  379. package/dist/InternalGridCell-CBv95C-G.js +37 -0
  380. package/dist/InternalGridCell-DFrhM8oX.js +40 -0
  381. package/dist/LightBox/index.cjs +25 -0
  382. package/dist/LightBox/index.mjs +19 -0
  383. package/dist/LightBox-DLJk1m24.js +109 -0
  384. package/dist/LightBox-oRvBzCVE.js +111 -0
  385. package/dist/Link/index.cjs +8 -0
  386. package/dist/Link/index.mjs +2 -0
  387. package/dist/Link-Bnzn51lp.js +9 -0
  388. package/dist/Link-CTWzdpyV.js +7 -0
  389. package/dist/List/index.cjs +28 -0
  390. package/dist/List/index.d.ts +1 -1
  391. package/dist/List/index.mjs +21 -0
  392. package/dist/List-BLRtWdVA.js +196 -0
  393. package/dist/List-C6AG4_dM.js +193 -0
  394. package/dist/Markdown/index.cjs +17 -0
  395. package/dist/Markdown/index.mjs +11 -0
  396. package/dist/Markdown-B2B4q1R4.js +57 -0
  397. package/dist/Markdown-BqNLA1UK.js +55 -0
  398. package/dist/Menu/{index.js → index.cjs} +5 -7
  399. package/dist/Menu/index.mjs +13 -0
  400. package/dist/Menu-BXvyYPow.js +132 -0
  401. package/dist/Menu-DWqTLjQu.js +134 -0
  402. package/dist/Modal/index.cjs +23 -0
  403. package/dist/Modal/index.mjs +17 -0
  404. package/dist/Modal-BsCYxzQV.js +65 -0
  405. package/dist/Modal-COtt6AGz.js +63 -0
  406. package/dist/MultiSelect/index.cjs +17 -0
  407. package/dist/MultiSelect/index.mjs +11 -0
  408. package/dist/MultiSelect-ByY6NzAS.js +169 -0
  409. package/dist/{MultiSelect/index.js → MultiSelect-D_-_TiTD.js} +16 -27
  410. package/dist/Option-BmWN4Bgv.js +15 -0
  411. package/dist/Option-DkWd2dv6.js +12 -0
  412. package/dist/Page/index.cjs +28 -0
  413. package/dist/Page/index.mjs +22 -0
  414. package/dist/Page-CI4G1pxg.js +61 -0
  415. package/dist/Page-DdD5O2fP.js +59 -0
  416. package/dist/Popover/index.cjs +18 -0
  417. package/dist/Popover/index.mjs +12 -0
  418. package/dist/Popover-D2Lc46rN.js +49 -0
  419. package/dist/Popover-MtwM2-M4.js +47 -0
  420. package/dist/ProgressBar/index.cjs +10 -0
  421. package/dist/ProgressBar/index.mjs +4 -0
  422. package/dist/ProgressBar-D2wik11q.js +38 -0
  423. package/dist/ProgressBar-DjFTRxLD.js +36 -0
  424. package/dist/RadioGroup/index.cjs +13 -0
  425. package/dist/RadioGroup/index.mjs +6 -0
  426. package/dist/RadioGroup-CL8tcJwY.js +42 -0
  427. package/dist/RadioGroup-CvoMZUNQ.js +39 -0
  428. package/dist/RecurringSelect/components/index.cjs +16 -0
  429. package/dist/RecurringSelect/components/index.mjs +7 -0
  430. package/dist/RecurringSelect/index.cjs +37 -0
  431. package/dist/RecurringSelect/index.mjs +23 -0
  432. package/dist/RecurringSelect-BQuw43z9.js +74 -0
  433. package/dist/RecurringSelect-DLFrS379.js +76 -0
  434. package/dist/Select/index.cjs +24 -0
  435. package/dist/Select/index.mjs +17 -0
  436. package/dist/Spinner/index.cjs +10 -0
  437. package/dist/Spinner/index.mjs +4 -0
  438. package/dist/Spinner-BOhyUAA_.js +17 -0
  439. package/dist/Spinner-DT15aa_r.js +19 -0
  440. package/dist/StatusIndicator/index.cjs +9 -0
  441. package/dist/StatusIndicator/index.mjs +3 -0
  442. package/dist/StatusIndicator-DMcPLJ2i.js +14 -0
  443. package/dist/StatusIndicator-DcXKG260.js +12 -0
  444. package/dist/StatusLabel/index.cjs +13 -0
  445. package/dist/StatusLabel/index.mjs +7 -0
  446. package/dist/StatusLabel-8RoVevu0.js +21 -0
  447. package/dist/StatusLabel-BJsnaMk6.js +19 -0
  448. package/dist/Switch/index.cjs +11 -0
  449. package/dist/Switch/index.mjs +5 -0
  450. package/dist/Switch-CQA6xnNA.js +49 -0
  451. package/dist/Switch-CWis2Tw3.js +51 -0
  452. package/dist/Table/index.cjs +18 -0
  453. package/dist/Table/index.mjs +5 -0
  454. package/dist/Tabs/index.cjs +12 -0
  455. package/dist/Tabs/index.mjs +5 -0
  456. package/dist/Tabs-D8_NCGQa.js +70 -0
  457. package/dist/Tabs-DsTn5FwP.js +73 -0
  458. package/dist/Text/index.cjs +11 -0
  459. package/dist/Text/index.mjs +5 -0
  460. package/dist/{Text-259af966.js → Text-D9gsHxbp.js} +2 -6
  461. package/dist/Text-DEviM1Tv.js +25 -0
  462. package/dist/Toast/index.cjs +17 -0
  463. package/dist/Toast/index.mjs +11 -0
  464. package/dist/Tooltip/{index.js → index.cjs} +2 -4
  465. package/dist/Tooltip/index.mjs +8 -0
  466. package/dist/Tooltip-DG1mcZlX.js +104 -0
  467. package/dist/{Tooltip-ef3d6ef4.js → Tooltip-DWAVu0yQ.js} +10 -16
  468. package/dist/Typography/index.cjs +10 -0
  469. package/dist/Typography/index.mjs +4 -0
  470. package/dist/Typography-Dx8KtnBw.js +57 -0
  471. package/dist/Typography-G8pA_xwj.js +55 -0
  472. package/dist/_baseAssignValue-BDfrxHwl.js +29 -0
  473. package/dist/_baseAssignValue-Cq-EPFBb.js +31 -0
  474. package/dist/_baseEach-C5AdInAP.js +1069 -0
  475. package/dist/_baseEach-fQjYIaCA.js +1073 -0
  476. package/dist/_commonjsHelpers-BFTU3MAI.js +7 -0
  477. package/dist/_commonjsHelpers-BJu3ubxk.js +10 -0
  478. package/dist/_defineProperty-DVTdBF7D.js +1326 -0
  479. package/dist/_defineProperty-DYWOWIJv.js +1306 -0
  480. package/dist/_getTag-CHBhnZgu.js +733 -0
  481. package/dist/_getTag-DYzEQmpZ.js +718 -0
  482. package/dist/_setToString-Cjq7b1P9.js +230 -0
  483. package/dist/_setToString-F-wwuS_Y.js +234 -0
  484. package/dist/debounce-B-pQrPa0.js +331 -0
  485. package/dist/debounce-asENWBkf.js +329 -0
  486. package/dist/getAtlantisConfig-6FPWID0P.js +11 -0
  487. package/dist/helpers-5vvADJkh.js +15 -0
  488. package/dist/helpers-CFWATKJI.js +36 -0
  489. package/dist/index.cjs +274 -0
  490. package/dist/index.d.mts +73 -0
  491. package/dist/index.d.ts +73 -0
  492. package/dist/index.mjs +164 -0
  493. package/dist/isObjectLike-91E0YOes.js +190 -0
  494. package/dist/isObjectLike-CsWGWxp9.js +197 -0
  495. package/dist/isSymbol-BEvcpX3s.js +33 -0
  496. package/dist/isSymbol-CqL-NQwG.js +35 -0
  497. package/dist/noop-DXH2P2oE.js +26 -0
  498. package/dist/noop-D_wzwwIq.js +24 -0
  499. package/dist/showToast-CSU2xysR.js +102 -0
  500. package/dist/showToast-lrVl7hOm.js +104 -0
  501. package/dist/style-inject.es-tgCJW-Cu.js +28 -0
  502. package/dist/tslib.es6-Df1SgIEn.js +97 -0
  503. package/dist/tslib.es6-ld72nsZq.js +102 -0
  504. package/dist/useActiveLayout-BzQghohH.js +16 -0
  505. package/dist/useActiveLayout-DazMYwxf.js +14 -0
  506. package/dist/useBatchSelect-B7U15920.js +38 -0
  507. package/dist/useBatchSelect-DMD3JH4P.js +36 -0
  508. package/dist/useChildComponent-BUH0ttPi.js +17 -0
  509. package/dist/useChildComponent-D95jU7NM.js +15 -0
  510. package/dist/useResponsiveSizing-CMuS7Or1.js +46 -0
  511. package/dist/useResponsiveSizing-DRjeJos_.js +44 -0
  512. package/dist/useScrollToActive-BB-8euJF.js +554 -0
  513. package/dist/useScrollToActive-KSEZO66J.js +548 -0
  514. package/package.json +382 -9
  515. package/{rollup.config.js → rollup.config.mjs} +27 -18
  516. package/dist/AnimatedSwitcher/index.js +0 -13
  517. package/dist/Avatar/index.js +0 -15
  518. package/dist/Avatar-76a799fa.js +0 -78
  519. package/dist/Banner/index.js +0 -110
  520. package/dist/Button/index.js +0 -16
  521. package/dist/Button-b73a5e01.js +0 -57
  522. package/dist/ButtonDismiss/index.js +0 -17
  523. package/dist/ButtonDismiss-350af163.js +0 -14
  524. package/dist/Card/index.js +0 -24
  525. package/dist/Checkbox/index.js +0 -18
  526. package/dist/Checkbox-787e2e47.js +0 -63
  527. package/dist/Chip/index.js +0 -41
  528. package/dist/Chip-3d1bfddc.js +0 -89
  529. package/dist/Chips/index.js +0 -524
  530. package/dist/Combobox/index.js +0 -40
  531. package/dist/Combobox-a24c8241.js +0 -479
  532. package/dist/ConfirmationModal/index.js +0 -31
  533. package/dist/Content/index.js +0 -12
  534. package/dist/Content-e3f7b6fc.js +0 -24
  535. package/dist/DataDump/index.js +0 -37
  536. package/dist/DataList/index.js +0 -1335
  537. package/dist/DataTable/index.js +0 -301
  538. package/dist/DatePicker/index.js +0 -20
  539. package/dist/DatePicker-64c5ab1a.js +0 -134
  540. package/dist/DescriptionList/index.js +0 -24
  541. package/dist/Disclosure/index.js +0 -46
  542. package/dist/Drawer/index.js +0 -49
  543. package/dist/Emphasis/index.js +0 -13
  544. package/dist/Emphasis-bda56d3b.js +0 -19
  545. package/dist/FeatureSwitch/index.js +0 -70
  546. package/dist/Flex/index.js +0 -12
  547. package/dist/FormField/index.js +0 -24
  548. package/dist/FormField-6ff183f8.js +0 -253
  549. package/dist/FormatEmail/index.js +0 -23
  550. package/dist/FormatFile/index.js +0 -36
  551. package/dist/FormatFile-f036902d.js +0 -162
  552. package/dist/Gallery/index.js +0 -99
  553. package/dist/Glimmer/index.js +0 -15
  554. package/dist/Glimmer-84dee1ed.js +0 -77
  555. package/dist/Grid/index.js +0 -76
  556. package/dist/Heading/index.js +0 -14
  557. package/dist/Icon/index.js +0 -11
  558. package/dist/Icon-405a216c.js +0 -40
  559. package/dist/InlineLabel/index.js +0 -13
  560. package/dist/InlineLabel-a6557829.js +0 -28
  561. package/dist/InputAvatar/index.js +0 -70
  562. package/dist/InputDate/index.js +0 -57
  563. package/dist/InputEmail/index.js +0 -43
  564. package/dist/InputFile/index.js +0 -25
  565. package/dist/InputFile-bb945071.js +0 -190
  566. package/dist/InputGroup/index.js +0 -12
  567. package/dist/InputNumber/index.js +0 -25
  568. package/dist/InputPassword/index.js +0 -41
  569. package/dist/InputText/index.js +0 -26
  570. package/dist/InputValidation/index.js +0 -17
  571. package/dist/InputValidation-05e839fa.js +0 -29
  572. package/dist/LightBox/index.js +0 -24
  573. package/dist/LightBox-a89d8863.js +0 -117
  574. package/dist/Link/index.js +0 -15
  575. package/dist/List/index.js +0 -93
  576. package/dist/Markdown/index.js +0 -19
  577. package/dist/Markdown-f7c55304.js +0 -62
  578. package/dist/Menu-083fc4c4.js +0 -139
  579. package/dist/Modal/index.js +0 -25
  580. package/dist/Modal-c336cac6.js +0 -71
  581. package/dist/Option-3c4d377e.js +0 -19
  582. package/dist/Page/index.js +0 -78
  583. package/dist/Popover/index.js +0 -61
  584. package/dist/ProgressBar/index.js +0 -12
  585. package/dist/ProgressBar-b68edc8f.js +0 -43
  586. package/dist/RadioGroup/index.js +0 -15
  587. package/dist/RadioGroup-17b67ade.js +0 -46
  588. package/dist/RecurringSelect/index.js +0 -227
  589. package/dist/Select/index.js +0 -26
  590. package/dist/Spinner/index.js +0 -12
  591. package/dist/Spinner-9d8fc7ff.js +0 -24
  592. package/dist/StatusIndicator/index.js +0 -11
  593. package/dist/StatusIndicator-b179d06e.js +0 -18
  594. package/dist/StatusLabel/index.js +0 -29
  595. package/dist/Switch/index.js +0 -13
  596. package/dist/Switch-7d4aa7c3.js +0 -56
  597. package/dist/Table/index.js +0 -66
  598. package/dist/Tabs/index.js +0 -80
  599. package/dist/Text/index.js +0 -13
  600. package/dist/Toast/index.js +0 -111
  601. package/dist/Typography/index.js +0 -12
  602. package/dist/Typography-c45bf216.js +0 -62
  603. package/dist/tslib.es6-754e2961.js +0 -46
  604. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
  605. /package/dist/{getAtlantisConfig-0f3e8af2.js → getAtlantisConfig-mcMVqf6m.js} +0 -0
  606. /package/dist/{style-inject.es-9d2f5f4e.js → style-inject.es-XZHJH68X.js} +0 -0
@@ -0,0 +1,120 @@
1
+ import React, { useCallback, useRef, useState, Children, isValidElement, useMemo } from 'react';
2
+ import { C as ComboboxContent } from './ComboboxContent-B108quRR.js';
3
+ import { C as ComboboxAction } from './ComboboxAction-BzEwYtPm.js';
4
+ import { C as ComboboxContextProvider } from './ComboboxProvider-Dm_tfmkr.js';
5
+ import { C as ComboboxTrigger } from './ComboboxTrigger-BAOfY8Og.js';
6
+ import { C as ComboboxOption } from './ComboboxOption-D_f4NcBM.js';
7
+ import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
8
+ import { d as debounce } from './debounce-asENWBkf.js';
9
+ import { n as noop } from './noop-D_wzwwIq.js';
10
+ import { C as ComboboxActivator } from './ComboboxActivator-DkcbNfv5.js';
11
+ import { useAssert } from '@jobber/hooks/useAssert';
12
+
13
+ var css_248z = ".W8qMZnORYxI- {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: var(--elevation-menu);\n background-color: transparent;\n}\n\n._-0dkolvLF-Y- {\n display: inline-block;\n}\n";
14
+ var styles = {"overlay":"W8qMZnORYxI-","wrapper":"_-0dkolvLF-Y-"};
15
+ styleInject(css_248z);
16
+
17
+ function useMakeComboboxHandlers(setOpen, setSearchValue, selectedOptions, shouldScroll, selectedStateSetter, multiSelect, onClose, onSearch) {
18
+ const handleClose = useCallback(() => {
19
+ setOpen(false);
20
+ setSearchValue("");
21
+ onSearch && onSearch("");
22
+ onClose && onClose();
23
+ if (selectedOptions.length > 0) {
24
+ shouldScroll.current = true;
25
+ }
26
+ }, [setOpen, setSearchValue, onClose, onSearch, selectedOptions.length]);
27
+ const handleSelection = useCallback((selection) => {
28
+ if (multiSelect) {
29
+ handleMultiSelect(selectedStateSetter, selectedOptions, selection);
30
+ }
31
+ else {
32
+ handleSingleSelect(selectedStateSetter, selection);
33
+ }
34
+ }, [multiSelect, selectedStateSetter, selectedOptions]);
35
+ const handleSingleSelect = useCallback((selectCallback, selection) => {
36
+ selectCallback([selection]);
37
+ handleClose();
38
+ }, []);
39
+ return {
40
+ handleClose,
41
+ handleSelection,
42
+ };
43
+ }
44
+ function handleMultiSelect(selectCallback, selected, selection) {
45
+ if (selected.some(s => s.id === selection.id)) {
46
+ selectCallback(selected.filter(s => s.id !== selection.id));
47
+ }
48
+ else {
49
+ selectCallback([...selected, selection]);
50
+ }
51
+ }
52
+
53
+ function useCombobox(selected, onSelect, options, onClose, multiSelect, onSearch, debounceTime = 300) {
54
+ const wrapperRef = useRef(null);
55
+ const shouldScroll = useRef(false);
56
+ const [open, setOpen] = useState(false);
57
+ const [searchValue, setSearchValue] = useState("");
58
+ const searchCallback = useCallback(debounce((value) => onSearch === null || onSearch === void 0 ? void 0 : onSearch(value), debounceTime), [onSearch, debounceTime]);
59
+ const { handleClose, handleSelection } = useMakeComboboxHandlers(setOpen, setSearchValue, selected, shouldScroll, onSelect, multiSelect, onClose, onSearch);
60
+ const internalFilteredOptions = options.filter(option => option.label.toLowerCase().includes(searchValue.toLowerCase()));
61
+ return {
62
+ wrapperRef,
63
+ searchValue,
64
+ setSearchValue,
65
+ open,
66
+ setOpen,
67
+ selectedOptions: selected,
68
+ selectedStateSetter: onSelect,
69
+ shouldScroll,
70
+ handleClose,
71
+ handleSelection,
72
+ internalFilteredOptions,
73
+ handleSearchChange: onSearch ? searchCallback : noop,
74
+ };
75
+ }
76
+
77
+ const COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE = "Combobox must have exactly one Trigger element";
78
+ function useComboboxValidation(children) {
79
+ const optionElements = getCompoundComponents(ComboboxOption, children);
80
+ const actionElements = getCompoundComponents(ComboboxAction, children);
81
+ const activatorElements = getCompoundComponents(ComboboxActivator, children);
82
+ const shouldThrowTriggerError = isInvalid(activatorElements);
83
+ useAssert(shouldThrowTriggerError, COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE);
84
+ return {
85
+ optionElements,
86
+ triggerElement: activatorElements[0],
87
+ actionElements,
88
+ };
89
+ }
90
+ function isInvalid(activators) {
91
+ return activators.length > 1 ? true : false;
92
+ }
93
+ /**
94
+ * Return all instances child component that matches the `type` provided
95
+ */
96
+ function getCompoundComponents(type, children) {
97
+ const childrenArray = Children.toArray(children);
98
+ const elements = childrenArray.filter((child) => isValidElement(child) && child.type === type);
99
+ return elements;
100
+ }
101
+
102
+ function Combobox(props) {
103
+ const { optionElements, triggerElement, actionElements } = useComboboxValidation(props.children);
104
+ const options = useMemo(() => (optionElements === null || optionElements === void 0 ? void 0 : optionElements.map(option => ({
105
+ id: option.props.id,
106
+ label: option.props.label,
107
+ prefix: option.props.prefix,
108
+ }))) || [], [optionElements]);
109
+ const { selectedOptions, selectedStateSetter, shouldScroll, wrapperRef, searchValue, setSearchValue, open, setOpen, handleClose, handleSelection, internalFilteredOptions, handleSearchChange, } = useCombobox(props.selected, props.onSelect, options, props.onClose, props.multiSelect, props.onSearch, props.onSearchDebounce);
110
+ return (React.createElement(ComboboxContextProvider, { selected: selectedOptions, selectionHandler: handleSelection, open: open, setOpen: setOpen, handleClose: handleClose, shouldScroll: shouldScroll, searchValue: searchValue },
111
+ React.createElement("div", { ref: wrapperRef, className: styles.wrapper },
112
+ open && (React.createElement("div", { className: styles.overlay, onClick: () => handleClose(), "data-testid": "ATL-Combobox-Overlay" })),
113
+ triggerElement || (React.createElement(ComboboxTrigger, { label: props.label, selected: props.selected })),
114
+ React.createElement(ComboboxContent, { multiselect: props.multiSelect, subjectNoun: props.subjectNoun, selected: selectedOptions, actionElements: actionElements, selectedStateSetter: selectedStateSetter, handleSelection: handleSelection, searchValue: searchValue, setSearchValue: setSearchValue, wrapperRef: wrapperRef, open: open, setOpen: setOpen, options: props.onSearch ? options : internalFilteredOptions, loading: props.loading, handleSearchChange: handleSearchChange, onLoadMore: props.onLoadMore }))));
115
+ }
116
+ Combobox.Activator = ComboboxActivator;
117
+ Combobox.Action = ComboboxAction;
118
+ Combobox.Option = ComboboxOption;
119
+
120
+ export { Combobox as C };
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var ComboboxContent = require('./ComboboxContent-D44NnZaD.js');
5
+ var ComboboxAction = require('./ComboboxAction-B3RwsCtx.js');
6
+ var ComboboxProvider = require('./ComboboxProvider-BwxfVgmL.js');
7
+ var ComboboxTrigger = require('./ComboboxTrigger-ZqNl11Qy.js');
8
+ var ComboboxOption = require('./ComboboxOption-CWkyTkzU.js');
9
+ var styleInject_es = require('./style-inject.es-XZHJH68X.js');
10
+ var debounce = require('./debounce-B-pQrPa0.js');
11
+ var noop = require('./noop-DXH2P2oE.js');
12
+ var ComboboxActivator = require('./ComboboxActivator-B-2nmWQ-.js');
13
+ var useAssert = require('@jobber/hooks/useAssert');
14
+
15
+ var css_248z = ".W8qMZnORYxI- {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: var(--elevation-menu);\n background-color: transparent;\n}\n\n._-0dkolvLF-Y- {\n display: inline-block;\n}\n";
16
+ var styles = {"overlay":"W8qMZnORYxI-","wrapper":"_-0dkolvLF-Y-"};
17
+ styleInject_es.styleInject(css_248z);
18
+
19
+ function useMakeComboboxHandlers(setOpen, setSearchValue, selectedOptions, shouldScroll, selectedStateSetter, multiSelect, onClose, onSearch) {
20
+ const handleClose = React.useCallback(() => {
21
+ setOpen(false);
22
+ setSearchValue("");
23
+ onSearch && onSearch("");
24
+ onClose && onClose();
25
+ if (selectedOptions.length > 0) {
26
+ shouldScroll.current = true;
27
+ }
28
+ }, [setOpen, setSearchValue, onClose, onSearch, selectedOptions.length]);
29
+ const handleSelection = React.useCallback((selection) => {
30
+ if (multiSelect) {
31
+ handleMultiSelect(selectedStateSetter, selectedOptions, selection);
32
+ }
33
+ else {
34
+ handleSingleSelect(selectedStateSetter, selection);
35
+ }
36
+ }, [multiSelect, selectedStateSetter, selectedOptions]);
37
+ const handleSingleSelect = React.useCallback((selectCallback, selection) => {
38
+ selectCallback([selection]);
39
+ handleClose();
40
+ }, []);
41
+ return {
42
+ handleClose,
43
+ handleSelection,
44
+ };
45
+ }
46
+ function handleMultiSelect(selectCallback, selected, selection) {
47
+ if (selected.some(s => s.id === selection.id)) {
48
+ selectCallback(selected.filter(s => s.id !== selection.id));
49
+ }
50
+ else {
51
+ selectCallback([...selected, selection]);
52
+ }
53
+ }
54
+
55
+ function useCombobox(selected, onSelect, options, onClose, multiSelect, onSearch, debounceTime = 300) {
56
+ const wrapperRef = React.useRef(null);
57
+ const shouldScroll = React.useRef(false);
58
+ const [open, setOpen] = React.useState(false);
59
+ const [searchValue, setSearchValue] = React.useState("");
60
+ const searchCallback = React.useCallback(debounce.debounce((value) => onSearch === null || onSearch === void 0 ? void 0 : onSearch(value), debounceTime), [onSearch, debounceTime]);
61
+ const { handleClose, handleSelection } = useMakeComboboxHandlers(setOpen, setSearchValue, selected, shouldScroll, onSelect, multiSelect, onClose, onSearch);
62
+ const internalFilteredOptions = options.filter(option => option.label.toLowerCase().includes(searchValue.toLowerCase()));
63
+ return {
64
+ wrapperRef,
65
+ searchValue,
66
+ setSearchValue,
67
+ open,
68
+ setOpen,
69
+ selectedOptions: selected,
70
+ selectedStateSetter: onSelect,
71
+ shouldScroll,
72
+ handleClose,
73
+ handleSelection,
74
+ internalFilteredOptions,
75
+ handleSearchChange: onSearch ? searchCallback : noop.noop,
76
+ };
77
+ }
78
+
79
+ const COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE = "Combobox must have exactly one Trigger element";
80
+ function useComboboxValidation(children) {
81
+ const optionElements = getCompoundComponents(ComboboxOption.ComboboxOption, children);
82
+ const actionElements = getCompoundComponents(ComboboxAction.ComboboxAction, children);
83
+ const activatorElements = getCompoundComponents(ComboboxActivator.ComboboxActivator, children);
84
+ const shouldThrowTriggerError = isInvalid(activatorElements);
85
+ useAssert.useAssert(shouldThrowTriggerError, COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE);
86
+ return {
87
+ optionElements,
88
+ triggerElement: activatorElements[0],
89
+ actionElements,
90
+ };
91
+ }
92
+ function isInvalid(activators) {
93
+ return activators.length > 1 ? true : false;
94
+ }
95
+ /**
96
+ * Return all instances child component that matches the `type` provided
97
+ */
98
+ function getCompoundComponents(type, children) {
99
+ const childrenArray = React.Children.toArray(children);
100
+ const elements = childrenArray.filter((child) => React.isValidElement(child) && child.type === type);
101
+ return elements;
102
+ }
103
+
104
+ function Combobox(props) {
105
+ const { optionElements, triggerElement, actionElements } = useComboboxValidation(props.children);
106
+ const options = React.useMemo(() => (optionElements === null || optionElements === void 0 ? void 0 : optionElements.map(option => ({
107
+ id: option.props.id,
108
+ label: option.props.label,
109
+ prefix: option.props.prefix,
110
+ }))) || [], [optionElements]);
111
+ const { selectedOptions, selectedStateSetter, shouldScroll, wrapperRef, searchValue, setSearchValue, open, setOpen, handleClose, handleSelection, internalFilteredOptions, handleSearchChange, } = useCombobox(props.selected, props.onSelect, options, props.onClose, props.multiSelect, props.onSearch, props.onSearchDebounce);
112
+ return (React.createElement(ComboboxProvider.ComboboxContextProvider, { selected: selectedOptions, selectionHandler: handleSelection, open: open, setOpen: setOpen, handleClose: handleClose, shouldScroll: shouldScroll, searchValue: searchValue },
113
+ React.createElement("div", { ref: wrapperRef, className: styles.wrapper },
114
+ open && (React.createElement("div", { className: styles.overlay, onClick: () => handleClose(), "data-testid": "ATL-Combobox-Overlay" })),
115
+ triggerElement || (React.createElement(ComboboxTrigger.ComboboxTrigger, { label: props.label, selected: props.selected })),
116
+ React.createElement(ComboboxContent.ComboboxContent, { multiselect: props.multiSelect, subjectNoun: props.subjectNoun, selected: selectedOptions, actionElements: actionElements, selectedStateSetter: selectedStateSetter, handleSelection: handleSelection, searchValue: searchValue, setSearchValue: setSearchValue, wrapperRef: wrapperRef, open: open, setOpen: setOpen, options: props.onSearch ? options : internalFilteredOptions, loading: props.loading, handleSearchChange: handleSearchChange, onLoadMore: props.onLoadMore }))));
117
+ }
118
+ Combobox.Activator = ComboboxActivator.ComboboxActivator;
119
+ Combobox.Action = ComboboxAction.ComboboxAction;
120
+ Combobox.Option = ComboboxOption.ComboboxOption;
121
+
122
+ exports.Combobox = Combobox;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var styleInject_es = require('./style-inject.es-XZHJH68X.js');
5
+ var Typography = require('./Typography-Dx8KtnBw.js');
6
+ var ComboboxProvider = require('./ComboboxProvider-BwxfVgmL.js');
7
+
8
+ var css_248z = ".Ow9wSNnGP-g- {\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--space-small);\n background-color: var(--color-surface);\n}\n\n.ncp0nKHQ7d8- {\n position: relative;\n width: 100%;\n min-height: calc((var(--space-largest) - var(--space-small)));\n padding: var(--space-small) 0;\n border: none;\n border-radius: var(--radius-large);\n text-align: left;\n background-color: var(--color-surface);\n cursor: pointer;\n transition: all var(--timing-base);\n}\n\n.jobber-retheme .ncp0nKHQ7d8- {\n border-radius: var(--radius-base);\n}\n\n.ncp0nKHQ7d8-:focus {\n outline: none;\n}\n\n.ncp0nKHQ7d8-:hover,\n.ncp0nKHQ7d8-:focus-visible {\n outline: none;\n background-color: var(--color-surface--hover);\n}\n\n.ncp0nKHQ7d8-:focus-visible {\n box-shadow: var(--shadow-focus);\n}\n\n.ncp0nKHQ7d8- span {\n margin-left: var(--space-small);\n}\n";
9
+ var styles = {"actionContainer":"Ow9wSNnGP-g-","actionButton":"ncp0nKHQ7d8-"};
10
+ styleInject_es.styleInject(css_248z);
11
+
12
+ function ComboboxAction(props) {
13
+ const { searchValue } = React.useContext(ComboboxProvider.ComboboxContext);
14
+ if (props.visible) {
15
+ const isVisible = typeof props.visible === "function" && !props.visible({ searchValue });
16
+ if (isVisible || !props.visible) {
17
+ return null;
18
+ }
19
+ }
20
+ const options = { searchValue };
21
+ const computedLabel = typeof props.label === "string" ? props.label : props.label(options);
22
+ return (React.createElement("div", { className: styles.actionContainer },
23
+ React.createElement("button", { className: styles.actionButton, onClick: e => props.onClick(e, options), type: "button" },
24
+ React.createElement(Typography.Typography, { element: "span", size: "base", textColor: "green", fontWeight: "semiBold" }, computedLabel))));
25
+ }
26
+
27
+ exports.ComboboxAction = ComboboxAction;
@@ -0,0 +1,25 @@
1
+ import React, { useContext } from 'react';
2
+ import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
3
+ import { T as Typography } from './Typography-G8pA_xwj.js';
4
+ import { a as ComboboxContext } from './ComboboxProvider-Dm_tfmkr.js';
5
+
6
+ var css_248z = ".Ow9wSNnGP-g- {\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--space-small);\n background-color: var(--color-surface);\n}\n\n.ncp0nKHQ7d8- {\n position: relative;\n width: 100%;\n min-height: calc((var(--space-largest) - var(--space-small)));\n padding: var(--space-small) 0;\n border: none;\n border-radius: var(--radius-large);\n text-align: left;\n background-color: var(--color-surface);\n cursor: pointer;\n transition: all var(--timing-base);\n}\n\n.jobber-retheme .ncp0nKHQ7d8- {\n border-radius: var(--radius-base);\n}\n\n.ncp0nKHQ7d8-:focus {\n outline: none;\n}\n\n.ncp0nKHQ7d8-:hover,\n.ncp0nKHQ7d8-:focus-visible {\n outline: none;\n background-color: var(--color-surface--hover);\n}\n\n.ncp0nKHQ7d8-:focus-visible {\n box-shadow: var(--shadow-focus);\n}\n\n.ncp0nKHQ7d8- span {\n margin-left: var(--space-small);\n}\n";
7
+ var styles = {"actionContainer":"Ow9wSNnGP-g-","actionButton":"ncp0nKHQ7d8-"};
8
+ styleInject(css_248z);
9
+
10
+ function ComboboxAction(props) {
11
+ const { searchValue } = useContext(ComboboxContext);
12
+ if (props.visible) {
13
+ const isVisible = typeof props.visible === "function" && !props.visible({ searchValue });
14
+ if (isVisible || !props.visible) {
15
+ return null;
16
+ }
17
+ }
18
+ const options = { searchValue };
19
+ const computedLabel = typeof props.label === "string" ? props.label : props.label(options);
20
+ return (React.createElement("div", { className: styles.actionContainer },
21
+ React.createElement("button", { className: styles.actionButton, onClick: e => props.onClick(e, options), type: "button" },
22
+ React.createElement(Typography, { element: "span", size: "base", textColor: "green", fontWeight: "semiBold" }, computedLabel))));
23
+ }
24
+
25
+ export { ComboboxAction as C };
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var Button = require('./Button-D3mW3Hcg.js');
5
+ var Chip = require('./Chip-Div4v8At.js');
6
+ require('./tslib.es6-ld72nsZq.js');
7
+ require('@jobber/design');
8
+ var ComboboxProvider = require('./ComboboxProvider-BwxfVgmL.js');
9
+
10
+ function ComboboxActivator(props) {
11
+ const { handleClose, open, setOpen } = React.useContext(ComboboxProvider.ComboboxContext);
12
+ if (props.children.type === Button.Button || props.children.type === Chip.Chip) {
13
+ return React.cloneElement(props.children, {
14
+ role: "combobox",
15
+ onClick: () => {
16
+ if (open) {
17
+ handleClose();
18
+ }
19
+ else {
20
+ setOpen(true);
21
+ }
22
+ },
23
+ });
24
+ }
25
+ return props.children;
26
+ }
27
+
28
+ exports.ComboboxActivator = ComboboxActivator;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { B as Button } from './Button-CWVwgwhn.js';
3
+ import { C as Chip } from './Chip-tWHAQezL.js';
4
+ import './tslib.es6-Df1SgIEn.js';
5
+ import '@jobber/design';
6
+ import { a as ComboboxContext } from './ComboboxProvider-Dm_tfmkr.js';
7
+
8
+ function ComboboxActivator(props) {
9
+ const { handleClose, open, setOpen } = React.useContext(ComboboxContext);
10
+ if (props.children.type === Button || props.children.type === Chip) {
11
+ return React.cloneElement(props.children, {
12
+ role: "combobox",
13
+ onClick: () => {
14
+ if (open) {
15
+ handleClose();
16
+ }
17
+ else {
18
+ setOpen(true);
19
+ }
20
+ },
21
+ });
22
+ }
23
+ return props.children;
24
+ }
25
+
26
+ export { ComboboxActivator as C };
@@ -0,0 +1,144 @@
1
+ import React, { useContext, useRef, useEffect } from 'react';
2
+ import classnames from 'classnames';
3
+ import ReactDOM from 'react-dom';
4
+ import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
5
+ import { C as ComboboxContentSearch } from './ComboboxContentSearch-B8hsfo_D.js';
6
+ import { C as ComboboxContentList } from './ComboboxContentList-DmdT_cqp.js';
7
+ import { C as ComboboxContentHeader } from './ComboboxContentHeader-DFLlxg-X.js';
8
+ import { a as ComboboxContext } from './ComboboxProvider-Dm_tfmkr.js';
9
+ import { useRefocusOnActivator } from '@jobber/hooks/useRefocusOnActivator';
10
+ import { useFocusTrap } from '@jobber/hooks/useFocusTrap';
11
+ import { usePopper } from 'react-popper';
12
+ import { useOnKeyDown } from '@jobber/hooks/useOnKeyDown';
13
+
14
+ var css_248z = ".m1w5vdUZ6rQ- {\n z-index: var(--elevation-tooltip);\n width: calc(var(--space-extravagant) * 3.75);\n box-shadow: var(--shadow-base);\n margin-top: var(--space-small);\n border: var(--border-base) solid var(--color-border);\n border-radius: var(--radius-larger);\n overflow: auto;\n background: var(--color-surface);\n}\n\n.jobber-retheme .m1w5vdUZ6rQ- {\n border-radius: var(--radius-base);\n}\n\n/* CAUTION: Tests for content visibility assume this class' presence hides the content\n* so please be careful if you change this class name, or the css rules within.\n*/\n\n.m1w5vdUZ6rQ-.Zlkv2HA096A- {\n display: none;\n visibility: hidden;\n}\n\n.m1w5vdUZ6rQ-:focus,\n.m1w5vdUZ6rQ-:focus-visible {\n outline: none;\n}\n\n.m1w5vdUZ6rQ-:focus-visible {\n box-shadow: var(--shadow-focus);\n}\n\n.YQry-Rd6zfQ- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: sticky;\n gap: var(--space-smaller);\n bottom: 0;\n width: 100%;\n background-color: var(--color-surface);\n}\n\n.TcpqL34s4lI- {\n padding-bottom: var(--space-small);\n}\n";
15
+ var styles = {"content":"m1w5vdUZ6rQ-","hidden":"Zlkv2HA096A-","actions":"YQry-Rd6zfQ-","actionPadding":"TcpqL34s4lI-"};
16
+ styleInject(css_248z);
17
+
18
+ function useComboboxContent(open, selected) {
19
+ const { shouldScroll } = useContext(ComboboxContext);
20
+ const optionsListRef = useRef(null);
21
+ useEffect(() => {
22
+ var _a;
23
+ if (open && shouldScroll.current && optionsListRef.current) {
24
+ const firstSelected = Array.from((_a = optionsListRef === null || optionsListRef === void 0 ? void 0 : optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children).find(child => {
25
+ if (child instanceof HTMLElement) {
26
+ return child.dataset.selected === "true";
27
+ }
28
+ });
29
+ scrollToFirstSelected(firstSelected, shouldScroll);
30
+ }
31
+ }, [open, selected]);
32
+ return {
33
+ optionsListRef,
34
+ };
35
+ }
36
+ function scrollToFirstSelected(firstSelected, shouldScroll) {
37
+ if (firstSelected) {
38
+ firstSelected.scrollIntoView({
39
+ block: "nearest",
40
+ });
41
+ shouldScroll.current = false;
42
+ }
43
+ }
44
+
45
+ // eslint-disable-next-line max-statements
46
+ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsListRef, open, wrapperRef) {
47
+ const { handleClose } = useContext(ComboboxContext);
48
+ const hasOptionsVisible = open && filteredOptions.length > 0;
49
+ const focusedIndex = useRef(null);
50
+ useRefocusOnActivator(open);
51
+ const popperRef = useFocusTrap(open);
52
+ const { styles: popperStyles, attributes, update, } = usePopper(wrapperRef.current, popperRef.current, {
53
+ modifiers: [
54
+ {
55
+ name: "flip",
56
+ options: {
57
+ fallbackPlacements: ["top-start"],
58
+ },
59
+ },
60
+ ],
61
+ placement: "bottom-start",
62
+ });
63
+ useEffect(() => {
64
+ focusedIndex.current = null;
65
+ if (open) {
66
+ update === null || update === void 0 ? void 0 : update();
67
+ }
68
+ }, [open, filteredOptions.length]);
69
+ useEffect(() => {
70
+ var _a;
71
+ if (open) {
72
+ (_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", handleContentKeydown);
73
+ }
74
+ return () => {
75
+ var _a;
76
+ (_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleContentKeydown);
77
+ };
78
+ }, [open, optionsListRef, filteredOptions]);
79
+ useOnKeyDown(() => {
80
+ if (open) {
81
+ handleClose();
82
+ }
83
+ }, "Escape");
84
+ function handleContentKeydown(event) {
85
+ var _a;
86
+ if (!hasOptionsVisible)
87
+ return;
88
+ if (event.key === "Enter" || event.key === " ") {
89
+ const activeElementInList = (_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement);
90
+ if (!activeElementInList)
91
+ return;
92
+ handleKeyboardSelection(event);
93
+ }
94
+ if (event.key === "ArrowDown") {
95
+ handleKeyboardNavigation(event, 1);
96
+ }
97
+ if (event.key === "ArrowUp") {
98
+ handleKeyboardNavigation(event, -1);
99
+ }
100
+ }
101
+ function handleKeyboardNavigation(event, indexChange) {
102
+ var _a;
103
+ const newIndex = focusedIndex.current === null ? 0 : focusedIndex.current + indexChange;
104
+ if (newIndex < 0 || newIndex >= filteredOptions.length)
105
+ return;
106
+ const optionElement = (_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children[newIndex];
107
+ optionElement === null || optionElement === void 0 ? void 0 : optionElement.focus();
108
+ focusedIndex.current = newIndex;
109
+ event.preventDefault();
110
+ event.stopPropagation();
111
+ }
112
+ function handleKeyboardSelection(event) {
113
+ event.preventDefault();
114
+ event.stopPropagation();
115
+ if (focusedIndex.current !== null) {
116
+ selectionCallback(filteredOptions[focusedIndex.current]);
117
+ }
118
+ }
119
+ return {
120
+ popperRef,
121
+ popperStyles,
122
+ attributes,
123
+ };
124
+ }
125
+
126
+ function ComboboxContent(props) {
127
+ const optionsExist = props.options.length > 0;
128
+ const { optionsListRef } = useComboboxContent(props.open, props.selected);
129
+ const { popperRef, popperStyles, attributes } = useComboboxAccessibility(props.handleSelection, props.options, optionsListRef, props.open, props.wrapperRef);
130
+ const template = (React.createElement("div", Object.assign({ ref: popperRef, id: "ATL-Combobox-Content", "data-testid": "ATL-Combobox-Content", tabIndex: 0, className: classnames(styles.content, { [styles.hidden]: !props.open }), style: popperStyles.popper }, attributes.popper),
131
+ React.createElement(ComboboxContentSearch, { open: props.open, placeholder: props.subjectNoun, searchValue: props.searchValue, setSearchValue: props.setSearchValue, handleSearchChange: props.handleSearchChange }),
132
+ props.multiselect && (optionsExist || props.selected.length > 0) && (React.createElement(ComboboxContentHeader, { hasOptionsVisible: optionsExist, subjectNoun: props.subjectNoun, selectedCount: props.selected.length, onClearAll: () => {
133
+ props.selectedStateSetter([]);
134
+ }, onSelectAll: () => {
135
+ props.selectedStateSetter(props.options);
136
+ } })),
137
+ React.createElement(ComboboxContentList, { multiselect: props.multiselect, options: props.options, selected: props.selected, optionsListRef: optionsListRef, searchValue: props.searchValue, subjectNoun: props.subjectNoun, loading: props.loading, onLoadMore: props.onLoadMore }),
138
+ props.actionElements && (React.createElement("div", { className: styles.actions, role: "group" }, props.actionElements.map((child, index, childrenArray) => (React.createElement("div", { key: index, className: classnames({
139
+ [styles.actionPadding]: index === childrenArray.length - 1,
140
+ }) }, child)))))));
141
+ return ReactDOM.createPortal(template, document.body);
142
+ }
143
+
144
+ export { ComboboxContent as C };
@@ -0,0 +1,146 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var classnames = require('classnames');
5
+ var ReactDOM = require('react-dom');
6
+ var styleInject_es = require('./style-inject.es-XZHJH68X.js');
7
+ var ComboboxContentSearch = require('./ComboboxContentSearch-UAyHetvM.js');
8
+ var ComboboxContentList = require('./ComboboxContentList-DHQ0x2ml.js');
9
+ var ComboboxContentHeader = require('./ComboboxContentHeader-CJ0if4JI.js');
10
+ var ComboboxProvider = require('./ComboboxProvider-BwxfVgmL.js');
11
+ var useRefocusOnActivator = require('@jobber/hooks/useRefocusOnActivator');
12
+ var useFocusTrap = require('@jobber/hooks/useFocusTrap');
13
+ var reactPopper = require('react-popper');
14
+ var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
15
+
16
+ var css_248z = ".m1w5vdUZ6rQ- {\n z-index: var(--elevation-tooltip);\n width: calc(var(--space-extravagant) * 3.75);\n box-shadow: var(--shadow-base);\n margin-top: var(--space-small);\n border: var(--border-base) solid var(--color-border);\n border-radius: var(--radius-larger);\n overflow: auto;\n background: var(--color-surface);\n}\n\n.jobber-retheme .m1w5vdUZ6rQ- {\n border-radius: var(--radius-base);\n}\n\n/* CAUTION: Tests for content visibility assume this class' presence hides the content\n* so please be careful if you change this class name, or the css rules within.\n*/\n\n.m1w5vdUZ6rQ-.Zlkv2HA096A- {\n display: none;\n visibility: hidden;\n}\n\n.m1w5vdUZ6rQ-:focus,\n.m1w5vdUZ6rQ-:focus-visible {\n outline: none;\n}\n\n.m1w5vdUZ6rQ-:focus-visible {\n box-shadow: var(--shadow-focus);\n}\n\n.YQry-Rd6zfQ- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: sticky;\n gap: var(--space-smaller);\n bottom: 0;\n width: 100%;\n background-color: var(--color-surface);\n}\n\n.TcpqL34s4lI- {\n padding-bottom: var(--space-small);\n}\n";
17
+ var styles = {"content":"m1w5vdUZ6rQ-","hidden":"Zlkv2HA096A-","actions":"YQry-Rd6zfQ-","actionPadding":"TcpqL34s4lI-"};
18
+ styleInject_es.styleInject(css_248z);
19
+
20
+ function useComboboxContent(open, selected) {
21
+ const { shouldScroll } = React.useContext(ComboboxProvider.ComboboxContext);
22
+ const optionsListRef = React.useRef(null);
23
+ React.useEffect(() => {
24
+ var _a;
25
+ if (open && shouldScroll.current && optionsListRef.current) {
26
+ const firstSelected = Array.from((_a = optionsListRef === null || optionsListRef === void 0 ? void 0 : optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children).find(child => {
27
+ if (child instanceof HTMLElement) {
28
+ return child.dataset.selected === "true";
29
+ }
30
+ });
31
+ scrollToFirstSelected(firstSelected, shouldScroll);
32
+ }
33
+ }, [open, selected]);
34
+ return {
35
+ optionsListRef,
36
+ };
37
+ }
38
+ function scrollToFirstSelected(firstSelected, shouldScroll) {
39
+ if (firstSelected) {
40
+ firstSelected.scrollIntoView({
41
+ block: "nearest",
42
+ });
43
+ shouldScroll.current = false;
44
+ }
45
+ }
46
+
47
+ // eslint-disable-next-line max-statements
48
+ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsListRef, open, wrapperRef) {
49
+ const { handleClose } = React.useContext(ComboboxProvider.ComboboxContext);
50
+ const hasOptionsVisible = open && filteredOptions.length > 0;
51
+ const focusedIndex = React.useRef(null);
52
+ useRefocusOnActivator.useRefocusOnActivator(open);
53
+ const popperRef = useFocusTrap.useFocusTrap(open);
54
+ const { styles: popperStyles, attributes, update, } = reactPopper.usePopper(wrapperRef.current, popperRef.current, {
55
+ modifiers: [
56
+ {
57
+ name: "flip",
58
+ options: {
59
+ fallbackPlacements: ["top-start"],
60
+ },
61
+ },
62
+ ],
63
+ placement: "bottom-start",
64
+ });
65
+ React.useEffect(() => {
66
+ focusedIndex.current = null;
67
+ if (open) {
68
+ update === null || update === void 0 ? void 0 : update();
69
+ }
70
+ }, [open, filteredOptions.length]);
71
+ React.useEffect(() => {
72
+ var _a;
73
+ if (open) {
74
+ (_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", handleContentKeydown);
75
+ }
76
+ return () => {
77
+ var _a;
78
+ (_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleContentKeydown);
79
+ };
80
+ }, [open, optionsListRef, filteredOptions]);
81
+ useOnKeyDown.useOnKeyDown(() => {
82
+ if (open) {
83
+ handleClose();
84
+ }
85
+ }, "Escape");
86
+ function handleContentKeydown(event) {
87
+ var _a;
88
+ if (!hasOptionsVisible)
89
+ return;
90
+ if (event.key === "Enter" || event.key === " ") {
91
+ const activeElementInList = (_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement);
92
+ if (!activeElementInList)
93
+ return;
94
+ handleKeyboardSelection(event);
95
+ }
96
+ if (event.key === "ArrowDown") {
97
+ handleKeyboardNavigation(event, 1);
98
+ }
99
+ if (event.key === "ArrowUp") {
100
+ handleKeyboardNavigation(event, -1);
101
+ }
102
+ }
103
+ function handleKeyboardNavigation(event, indexChange) {
104
+ var _a;
105
+ const newIndex = focusedIndex.current === null ? 0 : focusedIndex.current + indexChange;
106
+ if (newIndex < 0 || newIndex >= filteredOptions.length)
107
+ return;
108
+ const optionElement = (_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children[newIndex];
109
+ optionElement === null || optionElement === void 0 ? void 0 : optionElement.focus();
110
+ focusedIndex.current = newIndex;
111
+ event.preventDefault();
112
+ event.stopPropagation();
113
+ }
114
+ function handleKeyboardSelection(event) {
115
+ event.preventDefault();
116
+ event.stopPropagation();
117
+ if (focusedIndex.current !== null) {
118
+ selectionCallback(filteredOptions[focusedIndex.current]);
119
+ }
120
+ }
121
+ return {
122
+ popperRef,
123
+ popperStyles,
124
+ attributes,
125
+ };
126
+ }
127
+
128
+ function ComboboxContent(props) {
129
+ const optionsExist = props.options.length > 0;
130
+ const { optionsListRef } = useComboboxContent(props.open, props.selected);
131
+ const { popperRef, popperStyles, attributes } = useComboboxAccessibility(props.handleSelection, props.options, optionsListRef, props.open, props.wrapperRef);
132
+ const template = (React.createElement("div", Object.assign({ ref: popperRef, id: "ATL-Combobox-Content", "data-testid": "ATL-Combobox-Content", tabIndex: 0, className: classnames(styles.content, { [styles.hidden]: !props.open }), style: popperStyles.popper }, attributes.popper),
133
+ React.createElement(ComboboxContentSearch.ComboboxContentSearch, { open: props.open, placeholder: props.subjectNoun, searchValue: props.searchValue, setSearchValue: props.setSearchValue, handleSearchChange: props.handleSearchChange }),
134
+ props.multiselect && (optionsExist || props.selected.length > 0) && (React.createElement(ComboboxContentHeader.ComboboxContentHeader, { hasOptionsVisible: optionsExist, subjectNoun: props.subjectNoun, selectedCount: props.selected.length, onClearAll: () => {
135
+ props.selectedStateSetter([]);
136
+ }, onSelectAll: () => {
137
+ props.selectedStateSetter(props.options);
138
+ } })),
139
+ React.createElement(ComboboxContentList.ComboboxContentList, { multiselect: props.multiselect, options: props.options, selected: props.selected, optionsListRef: optionsListRef, searchValue: props.searchValue, subjectNoun: props.subjectNoun, loading: props.loading, onLoadMore: props.onLoadMore }),
140
+ props.actionElements && (React.createElement("div", { className: styles.actions, role: "group" }, props.actionElements.map((child, index, childrenArray) => (React.createElement("div", { key: index, className: classnames({
141
+ [styles.actionPadding]: index === childrenArray.length - 1,
142
+ }) }, child)))))));
143
+ return ReactDOM.createPortal(template, document.body);
144
+ }
145
+
146
+ exports.ComboboxContent = ComboboxContent;