@mercurjs/vendor 2.1.6 → 2.2.0-canary.11

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 (259) hide show
  1. package/dist/[id]-A55T2ORL.js +3066 -0
  2. package/dist/[id]-B4YZTANM.js +1571 -0
  3. package/dist/{[id]-UTKO3VG4.js → [id]-EKLRGVBA.js} +10 -10
  4. package/dist/{[id]-TO6KT3ZE.js → [id]-FE5GYYVZ.js} +28 -25
  5. package/dist/{[id]-4VCL3MMM.js → [id]-GBT6VB4S.js} +29 -23
  6. package/dist/{[id]-3G5G7ZFV.js → [id]-GC3ZYPK4.js} +25 -22
  7. package/dist/{[id]-6PXEWRG7.js → [id]-J6BZG5PU.js} +14 -14
  8. package/dist/{[id]-B3LHVQM5.js → [id]-QOEO3JOV.js} +29 -23
  9. package/dist/{[id]-H3C3ZSC6.js → [id]-QQU5HVFU.js} +29 -23
  10. package/dist/{[id]-PDGHF5J2.js → [id]-SHAJTJNZ.js} +43 -36
  11. package/dist/{[id]-X4DDKOMQ.js → [id]-T5ECVBPF.js} +30 -24
  12. package/dist/{[id]-T2ROPEGY.js → [id]-U5KZEQDR.js} +7 -7
  13. package/dist/{[id]-7RUAH3TI.js → [id]-YPCO3DJV.js} +5 -5
  14. package/dist/{[id]-Y7GAMNC5.js → [id]-ZCMSBEVM.js} +4 -4
  15. package/dist/{[location_id]-D55RQOXT.js → [location_id]-NUBXDDJC.js} +9 -9
  16. package/dist/{[province_id]-OFH2ZOFQ.js → [province_id]-6GUA4PV5.js} +23 -20
  17. package/dist/{add-C6OX5C54.js → add-NTRYWOJF.js} +42 -35
  18. package/dist/add-RU3WL4YB.js +428 -0
  19. package/dist/{add-customer-groups-PJRJUWS2.js → add-customer-groups-U5RZWW4B.js} +19 -16
  20. package/dist/{add-products-INOLNPO6.js → add-products-Q4MMDQKT.js} +26 -20
  21. package/dist/{add-promotions-AHDOP52Q.js → add-promotions-3AYXQXTP.js} +8 -8
  22. package/dist/{add-to-campaign-HL6NGRR4.js → add-to-campaign-QKYQCSR2.js} +4 -4
  23. package/dist/{address-KRENKSLP.js → address-77Y3AOQ3.js} +19 -16
  24. package/dist/{adjust-inventory-H4EUP7J3.js → adjust-inventory-AFJLWF5R.js} +2 -2
  25. package/dist/{allocate-items-SUCUZU4D.js → allocate-items-TCM5A55Y.js} +141 -126
  26. package/dist/{areas-UUMZDXLX.js → areas-XUC5V5UO.js} +8 -8
  27. package/dist/{attributes-CALEHJJG.js → attributes-SZP2MM5L.js} +3 -3
  28. package/dist/{breadcrumb-KQSFIXQ4.js → breadcrumb-2XA2WOK7.js} +1 -1
  29. package/dist/{breadcrumb-IG7VZGW2.js → breadcrumb-5NP23D6X.js} +15 -12
  30. package/dist/{breadcrumb-TW5JEOYS.js → breadcrumb-EVZIOB2G.js} +14 -11
  31. package/dist/{breadcrumb-OIGGCB3L.js → breadcrumb-FPWBT76A.js} +8 -2
  32. package/dist/{breadcrumb-BS7Y5OKF.js → breadcrumb-IK6XCQOQ.js} +2 -2
  33. package/dist/{breadcrumb-M5Z5WA6I.js → breadcrumb-KTARIL65.js} +2 -2
  34. package/dist/{breadcrumb-VNNZ3TTW.js → breadcrumb-PBR27GGX.js} +3 -3
  35. package/dist/breadcrumb-THJ2HPRB.js +26 -0
  36. package/dist/{breadcrumb-6W2VP3OZ.js → breadcrumb-TNJSGX4T.js} +15 -12
  37. package/dist/{campaigns-HS6MIO7X.js → campaigns-JAQTSA4Z.js} +6 -6
  38. package/dist/{categories-PKWR3FM3.js → categories-T4QJYX4R.js} +8 -8
  39. package/dist/{chunk-4URLUCTD.js → chunk-25E4KME5.js} +3 -3
  40. package/dist/chunk-27KRIXMQ.js +71 -0
  41. package/dist/{chunk-SFQKKIHA.js → chunk-27WLUOI2.js} +1 -1
  42. package/dist/{chunk-ZYOXKUKZ.js → chunk-2QTNCGKX.js} +1 -1
  43. package/dist/{chunk-5UD4P6YL.js → chunk-2USXZSTK.js} +4 -4
  44. package/dist/{chunk-PXYDR7WQ.js → chunk-3BXCPHN6.js} +3 -2
  45. package/dist/{chunk-VQ5EKDA3.js → chunk-3PMM6AMP.js} +3 -3
  46. package/dist/{chunk-J6BRLL3F.js → chunk-463CNCJC.js} +3 -3
  47. package/dist/{chunk-Y2QI7KWS.js → chunk-4LVP635F.js} +408 -664
  48. package/dist/{chunk-UL4O5M4S.js → chunk-4S6XGIC6.js} +1 -18
  49. package/dist/{chunk-RUE5BPC2.js → chunk-5QI3NDJG.js} +1 -1
  50. package/dist/{chunk-PPLC4IKI.js → chunk-5T6UWTRU.js} +10 -5
  51. package/dist/{chunk-WITQNQXN.js → chunk-6FUIK3PX.js} +4 -4
  52. package/dist/{chunk-HGQTL7NX.js → chunk-6K6EQOJF.js} +3 -3
  53. package/dist/{chunk-KAZ5BYTQ.js → chunk-6OUPJNYO.js} +5 -3
  54. package/dist/{chunk-PEKANQ3T.js → chunk-6UZERVBI.js} +2 -2
  55. package/dist/{chunk-RTAWYMQP.js → chunk-7CMRFP5Q.js} +2 -2
  56. package/dist/{chunk-I2IKYOZX.js → chunk-7IPCLQ5V.js} +19 -19
  57. package/dist/chunk-ADGVQVHP.js +101 -0
  58. package/dist/{chunk-IZ5RG5XI.js → chunk-AJLGY3LQ.js} +1 -21
  59. package/dist/chunk-BER45EYD.js +82 -0
  60. package/dist/{chunk-PCMNEUMV.js → chunk-BXRNZS5K.js} +1 -1
  61. package/dist/chunk-CFRWIQIZ.js +43 -0
  62. package/dist/{chunk-RL7SFZOF.js → chunk-DDJQRV6E.js} +1 -1
  63. package/dist/{chunk-D2MA5TAP.js → chunk-DO4F5FIO.js} +2 -2
  64. package/dist/{chunk-X4FLOQ45.js → chunk-DQKK43PR.js} +3 -3
  65. package/dist/{chunk-6WY5X4PE.js → chunk-E6W57UP3.js} +35 -125
  66. package/dist/chunk-FP6U6BPH.js +61 -0
  67. package/dist/chunk-FWPGOIFA.js +22 -0
  68. package/dist/{chunk-BLVJAKBA.js → chunk-FWS4YJ4B.js} +1 -1
  69. package/dist/chunk-GAE6TKOR.js +811 -0
  70. package/dist/{chunk-3CK6OINO.js → chunk-GDWBOQI5.js} +3 -5
  71. package/dist/{chunk-PDQSPKG5.js → chunk-GN6KB75Z.js} +1 -1
  72. package/dist/chunk-HDEOZN2Q.js +60 -0
  73. package/dist/chunk-IBEUR3J7.js +173 -0
  74. package/dist/chunk-J6XCRFBW.js +30 -0
  75. package/dist/{chunk-ZEVYT6IX.js → chunk-JAUZ73XE.js} +151 -266
  76. package/dist/{chunk-CNLP35S7.js → chunk-K6LOZ4S3.js} +54 -18
  77. package/dist/{chunk-JQP7MOFH.js → chunk-KIFSQOM2.js} +2 -2
  78. package/dist/{chunk-DARJTN4I.js → chunk-L4KBTV57.js} +9 -2
  79. package/dist/chunk-L57USMYC.js +39 -0
  80. package/dist/chunk-LARLBYU6.js +127 -0
  81. package/dist/chunk-LDZCCWJB.js +518 -0
  82. package/dist/chunk-LEWA4BPH.js +18 -0
  83. package/dist/chunk-LFX6WU4A.js +36 -0
  84. package/dist/{chunk-ITI54CII.js → chunk-LKUW5SV4.js} +6 -6
  85. package/dist/{chunk-LPOAVK6Y.js → chunk-LQD232FW.js} +47 -12
  86. package/dist/{chunk-4MFMCZEJ.js → chunk-MJCL3WID.js} +2 -2
  87. package/dist/{chunk-32RYSB2V.js → chunk-NBKWY6XN.js} +2 -2
  88. package/dist/{chunk-GYV6SKY7.js → chunk-O7VOGTLX.js} +4 -6
  89. package/dist/{chunk-KQGVSLUI.js → chunk-OYKUQXJX.js} +1926 -957
  90. package/dist/{chunk-CYTNBXWF.js → chunk-OZ44ATGE.js} +8 -8
  91. package/dist/{chunk-7Q5SDEK7.js → chunk-PAVZ6FPK.js} +7 -7
  92. package/dist/{chunk-2RHAI7WK.js → chunk-QLBIBLOY.js} +2 -2
  93. package/dist/chunk-RXV7INUV.js +426 -0
  94. package/dist/chunk-S23FD6FA.js +210 -0
  95. package/dist/{chunk-NYDJTWRL.js → chunk-SGR4DMCW.js} +4 -4
  96. package/dist/{chunk-OXXL4WQU.js → chunk-SPOHNK4X.js} +6 -6
  97. package/dist/{chunk-AIF2KTEE.js → chunk-SSUUT5LK.js} +12 -2
  98. package/dist/{chunk-QX45GVAL.js → chunk-SZBERGA4.js} +8 -8
  99. package/dist/{chunk-6SBMVLJ2.js → chunk-T5MJWWDX.js} +2 -2
  100. package/dist/chunk-T6LHVNWO.js +27 -0
  101. package/dist/chunk-TBYCZRZ7.js +248 -0
  102. package/dist/chunk-TF6V3TFG.js +438 -0
  103. package/dist/chunk-TW324MAT.js +185 -0
  104. package/dist/{chunk-4ZGFODSC.js → chunk-TYESCFYW.js} +1 -1
  105. package/dist/chunk-U5G3AVED.js +64 -0
  106. package/dist/chunk-U6PBLMXD.js +14 -0
  107. package/dist/{chunk-GZMXTNDN.js → chunk-UCYSCKZV.js} +1432 -1380
  108. package/dist/{chunk-P3ZTO6T2.js → chunk-UFFVRF4V.js} +2 -2
  109. package/dist/chunk-UM7ZR3VU.js +14 -0
  110. package/dist/chunk-UORPTGV2.js +114 -0
  111. package/dist/{chunk-5M3SL4UZ.js → chunk-VCOQ7WQ2.js} +30 -106
  112. package/dist/chunk-VCUUITW6.js +35 -0
  113. package/dist/{chunk-PTW7JNAP.js → chunk-VDHW6H5F.js} +5 -5
  114. package/dist/chunk-VZUA5SRD.js +62 -0
  115. package/dist/{chunk-DKQ4XMSN.js → chunk-X4GWB6AT.js} +6 -6
  116. package/dist/{chunk-6YA3C4NB.js → chunk-XCIMOIX6.js} +3 -12
  117. package/dist/chunk-XP23ZVQT.js +2183 -0
  118. package/dist/{chunk-WBI7FEGI.js → chunk-Y2MQ5EMD.js} +29 -24
  119. package/dist/chunk-YBF45CX5.js +23 -0
  120. package/dist/{chunk-N7OVXN72.js → chunk-YGJCJBPM.js} +1 -1
  121. package/dist/{chunk-WNVEMFIK.js → chunk-YHIJCI4U.js} +3 -3
  122. package/dist/{chunk-WFE6CT6M.js → chunk-YQZBAP3S.js} +22 -76
  123. package/dist/chunk-ZHFFTT3I.js +17 -0
  124. package/dist/{collections-DJZI2RM2.js → collections-URH2TCWJ.js} +28 -24
  125. package/dist/{configuration-GN3TO77H.js → configuration-7IYZ6GNP.js} +3 -3
  126. package/dist/{configuration-RHPIO2QT.js → configuration-C4IGBNXH.js} +1 -1
  127. package/dist/{create-7S7CZWEN.js → create-5PSOIHIT.js} +4 -4
  128. package/dist/create-7R6CZU53.js +215 -0
  129. package/dist/{create-3EK5CNNX.js → create-A7B3MLJX.js} +41 -34
  130. package/dist/create-F5R76QML.js +1178 -0
  131. package/dist/create-FKRYB7ZS.js +1784 -0
  132. package/dist/create-GGACODDN.js +1914 -0
  133. package/dist/{create-YO55Z3YD.js → create-HVZYJ3YC.js} +35 -38
  134. package/dist/{create-IDVCZHIX.js → create-JF2OUZQA.js} +16 -13
  135. package/dist/{create-3ZVXEPX5.js → create-JGYG5SBM.js} +29 -23
  136. package/dist/{create-G4T2PAJH.js → create-MS6KKFSV.js} +21 -18
  137. package/dist/{create-OCFPLNNY.js → create-MZYXMGKP.js} +6 -6
  138. package/dist/{create-HKJVSFB7.js → create-O35JRZEF.js} +25 -22
  139. package/dist/{create-OGLPDVOI.js → create-ODOFJF5N.js} +40 -37
  140. package/dist/{create-GHM7OTCR.js → create-R7K3ECN6.js} +1 -1
  141. package/dist/{create-D6EW3EWC.js → create-SFU3W3ZH.js} +1 -1
  142. package/dist/create-TKXH5KQY.js +239 -0
  143. package/dist/{create-33TRLASX.js → create-UPYB65PD.js} +1 -1
  144. package/dist/{create-KGYL7FBM.js → create-XVHOCZHJ.js} +1 -1
  145. package/dist/{create-4AE3VTWN.js → create-YBF4YGWG.js} +2 -2
  146. package/dist/{customers-6ZLE65UX.js → customers-SOLJ2KQQ.js} +5 -5
  147. package/dist/{edit-QBISX7D3.js → edit-2R5QCPTB.js} +16 -13
  148. package/dist/{edit-IR6V2IDN.js → edit-3E4ZO7HT.js} +21 -18
  149. package/dist/{edit-ZSOI56BQ.js → edit-4G5D7TES.js} +52 -40
  150. package/dist/{edit-B5B3XKDM.js → edit-522DG3BY.js} +1 -1
  151. package/dist/{edit-B75KK5ZX.js → edit-5CROKEJE.js} +41 -34
  152. package/dist/{edit-ATXE6CM5.js → edit-C4OCKQVU.js} +1 -1
  153. package/dist/{edit-7HTH2UJF.js → edit-FXNXTVIW.js} +3 -3
  154. package/dist/{edit-RNT555GP.js → edit-G2E5SNGU.js} +15 -12
  155. package/dist/{edit-4HZHLYI3.js → edit-GQNIINRR.js} +1 -1
  156. package/dist/{edit-2KRJIPRK.js → edit-HTLLYECP.js} +21 -18
  157. package/dist/{edit-LRRJTHV2.js → edit-KAKVPHZZ.js} +1 -1
  158. package/dist/{edit-GIJXLMC3.js → edit-O4JLGKQR.js} +2 -2
  159. package/dist/{edit-FNDDSSMT.js → edit-OKU6FMHJ.js} +60 -9
  160. package/dist/{edit-5CJZRHAA.js → edit-ORXS3A2Y.js} +1 -1
  161. package/dist/{edit-FC64DWB2.js → edit-Q3UQIOLS.js} +1 -1
  162. package/dist/edit-VVLITC2E.js +910 -0
  163. package/dist/edit-XSICGAVO.js +176 -0
  164. package/dist/{edit-7GVP6SRA.js → edit-ZAHCMF5U.js} +1 -1
  165. package/dist/{edit-MYSWY6W4.js → edit-ZMERG3L7.js} +1 -1
  166. package/dist/{edit-budget-J27CSEZH.js → edit-budget-L3CCEWNF.js} +1 -1
  167. package/dist/{edit-inventory-item-US77M2FF.js → edit-inventory-item-ZKXXL3QK.js} +2 -2
  168. package/dist/{edit-inventory-item-attributes-UGAE2NAZ.js → edit-inventory-item-attributes-GSKUMORD.js} +3 -3
  169. package/dist/{fulfillment-DCS67LTK.js → fulfillment-76IVZ266.js} +32 -22
  170. package/dist/{fulfillment-providers-GM5PO6N3.js → fulfillment-providers-G2L6LEVO.js} +24 -20
  171. package/dist/index.css +104 -65
  172. package/dist/index.d.ts +3 -10
  173. package/dist/index.js +549 -456
  174. package/dist/{inventory-OPZ2FSEE.js → inventory-WSFLTA6Z.js} +7 -7
  175. package/dist/{invite-KEJLNXEZ.js → invite-2673PU4I.js} +17 -13
  176. package/dist/{invite-CQCKEQW2.js → invite-HRXZ5YBP.js} +28 -24
  177. package/dist/loader-VDYPD3RI.js +31 -0
  178. package/dist/{locations-ZVPTQCQY.js → locations-INS6FTMJ.js} +4 -4
  179. package/dist/{login-OUHRNNXA.js → login-TWUBU6I6.js} +14 -11
  180. package/dist/{manage-locations-YUKEFCBJ.js → manage-locations-XHH5DVIR.js} +2 -2
  181. package/dist/{media-4KYFHB5V.js → media-Z4N5MKFG.js} +42 -9
  182. package/dist/{metadata-AWUKZ25V.js → metadata-5BPOBBU2.js} +3 -3
  183. package/dist/{metadata-OCE6A3JE.js → metadata-D6M66NQK.js} +17 -14
  184. package/dist/{metadata-PYY4IB7K.js → metadata-NIDIBXJT.js} +17 -14
  185. package/dist/{metadata-XP3ZYW2M.js → metadata-Q74OJWUD.js} +18 -15
  186. package/dist/{metadata-NYYL26MQ.js → metadata-REQIFWWH.js} +18 -15
  187. package/dist/{metadata-G7KZXVNE.js → metadata-YVHJPDLD.js} +17 -14
  188. package/dist/offer-create-page-E4FLSDJQ.js +743 -0
  189. package/dist/offer-detail-page-6SIBQTLP.js +492 -0
  190. package/dist/offer-edit-page-3MO566RP.js +151 -0
  191. package/dist/offer-inventory-batch-page-BD6PMDLW.js +290 -0
  192. package/dist/offer-pricing-edit-page-4TINK42V.js +199 -0
  193. package/dist/offers-GVN5LCK6.js +32 -0
  194. package/dist/{onboarding-WXZHW62K.js → onboarding-MK2RIFD4.js} +24 -21
  195. package/dist/{orders-LWJ472VM.js → orders-TVQDR4OJ.js} +30 -26
  196. package/dist/organization-XO3T2K2X.js +340 -0
  197. package/dist/{organize-RFOMQCBG.js → organize-5XRZWD5C.js} +4 -4
  198. package/dist/{organize-OVKJ3HZO.js → organize-Z7JTTDH4.js} +4 -4
  199. package/dist/pages/index.d.ts +439 -758
  200. package/dist/pages/index.js +85 -78
  201. package/dist/{payment-details-UVXYCTUK.js → payment-details-CFTX3QDL.js} +19 -16
  202. package/dist/{payouts-TR7K5I37.js → payouts-7Q7D4FET.js} +8 -8
  203. package/dist/{price-lists-S2WNELFZ.js → price-lists-6TFLA53G.js} +9 -9
  204. package/dist/{pricing-UF27DAXA.js → pricing-ECXV6K7G.js} +41 -37
  205. package/dist/{product-tags-2CKH2M6D.js → product-tags-5O7ZG6SA.js} +40 -33
  206. package/dist/{product-types-FX43JEO2.js → product-types-PKUEL7X5.js} +6 -6
  207. package/dist/product-variant-detail-PUWOMVHQ.js +210 -0
  208. package/dist/{product-variant-edit-P3DSIFE3.js → product-variant-edit-WZNO4CQX.js} +134 -66
  209. package/dist/{products-H5EMRJYS.js → products-BM3IIH5P.js} +27 -21
  210. package/dist/{products-2LHGS7X3.js → products-CPTRYL2Z.js} +44 -45
  211. package/dist/{professional-details-HYKTH44B.js → professional-details-ED4HNYXY.js} +18 -15
  212. package/dist/{profile-PB27WIRW.js → profile-6TGCNNUU.js} +21 -18
  213. package/dist/{promotions-5EYPGHJP.js → promotions-4336KI7E.js} +9 -9
  214. package/dist/receive-224KLULH.js +578 -0
  215. package/dist/refund-IGMSXQNX.js +268 -0
  216. package/dist/{register-X45K325N.js → register-OZ5CRANZ.js} +18 -15
  217. package/dist/{reset-password-GTWLBOFK.js → reset-password-5UHZU4D3.js} +1 -1
  218. package/dist/{return-reasons-LOKYRGMI.js → return-reasons-QJRA2ZX6.js} +21 -17
  219. package/dist/{sales-channels-Y4LRP7JC.js → sales-channels-CZDU7VTE.js} +7 -6
  220. package/dist/{sales-channels-7R2IY3KG.js → sales-channels-U55MUDQP.js} +7 -6
  221. package/dist/{settings-2XDLFYMS.js → settings-2GCQQTO6.js} +47 -40
  222. package/dist/shipment-HWQHMX2L.js +242 -0
  223. package/dist/{shipping-profile-R3NABPQF.js → shipping-profile-ZP7M6VSS.js} +2 -2
  224. package/dist/{shipping-profiles-QVKNFLCW.js → shipping-profiles-C5WBXWZ2.js} +21 -18
  225. package/dist/{stock-5RXNUPUT.js → stock-MQA7PRO6.js} +21 -18
  226. package/dist/{store-MPYOWMZT.js → store-5ZHZR4JI.js} +84 -149
  227. package/dist/{store-closure-DNMCHUXD.js → store-closure-H5WHV3LA.js} +24 -16
  228. package/dist/{store-select-UTPJ7DM7.js → store-select-PZS556FB.js} +19 -16
  229. package/dist/{tax-regions-UD6P5FVC.js → tax-regions-HDLBFZVG.js} +6 -6
  230. package/dist/{team-IMS66MVP.js → team-CLKJCZNH.js} +29 -26
  231. package/dist/types-CtCEtTE6.d.ts +16 -0
  232. package/package.json +5 -5
  233. package/dist/[id]-BYP37PU4.js +0 -1314
  234. package/dist/[id]-INOFZHL7.js +0 -1219
  235. package/dist/add-KRAGFFBJ.js +0 -158
  236. package/dist/bulk-edit-3SMBLIOA.js +0 -244
  237. package/dist/chunk-47SXTGLN.js +0 -397
  238. package/dist/chunk-4KX6CBJ4.js +0 -178
  239. package/dist/chunk-DLNNTQRY.js +0 -217
  240. package/dist/chunk-FX4V5JCF.js +0 -37
  241. package/dist/chunk-GC33DBKG.js +0 -143
  242. package/dist/chunk-LQYMBSRQ.js +0 -66
  243. package/dist/chunk-NK4NR6MN.js +0 -173
  244. package/dist/chunk-PFU6FSXY.js +0 -430
  245. package/dist/chunk-QJEOPT2P.js +0 -330
  246. package/dist/chunk-QSGR43JM.js +0 -30
  247. package/dist/chunk-STR3NGWE.js +0 -3736
  248. package/dist/create-3DOO3RNH.js +0 -716
  249. package/dist/create-I7HV3RM6.js +0 -150
  250. package/dist/edit-K2AD335I.js +0 -237
  251. package/dist/edit-VO5XLIEL.js +0 -362
  252. package/dist/edit-stocks-and-prices-MHHQFWFA.js +0 -408
  253. package/dist/organization-LPYQRTQC.js +0 -303
  254. package/dist/prices-3OXV5RGY.js +0 -270
  255. package/dist/product-variant-detail-WV4KXVXR.js +0 -590
  256. package/dist/shipment-4GW2JFWB.js +0 -174
  257. package/dist/stock-GPC3BCL6.js +0 -500
  258. package/dist/{chunk-SDSEW72R.js → chunk-E2HQPY32.js} +3 -3
  259. /package/dist/{chunk-CAS74NLJ.js → chunk-YV6MK4PZ.js} +0 -0
@@ -0,0 +1,811 @@
1
+ import {
2
+ useDebouncedSearch
3
+ } from "./chunk-OVPAOBZB.js";
4
+ import {
5
+ TextSkeleton
6
+ } from "./chunk-INNFZYX2.js";
7
+ import {
8
+ useProductCategories
9
+ } from "./chunk-5QI3NDJG.js";
10
+
11
+ // src/pages/products/common/components/category-combobox/single-category-combobox.tsx
12
+ import {
13
+ ArrowUturnLeft,
14
+ EllipseMiniSolid,
15
+ TriangleRightMini,
16
+ TrianglesMini
17
+ } from "@medusajs/icons";
18
+ import { Divider, Text, clx } from "@medusajs/ui";
19
+ import { Popover as RadixPopover } from "radix-ui";
20
+ import {
21
+ Fragment,
22
+ forwardRef,
23
+ useCallback,
24
+ useEffect,
25
+ useImperativeHandle,
26
+ useRef,
27
+ useState
28
+ } from "react";
29
+ import { Trans, useTranslation } from "react-i18next";
30
+ import { jsx, jsxs } from "react/jsx-runtime";
31
+ var SingleCategoryCombobox = forwardRef(({ value, onChange, className, ...props }, ref) => {
32
+ const innerRef = useRef(null);
33
+ useImperativeHandle(
34
+ ref,
35
+ () => innerRef.current,
36
+ []
37
+ );
38
+ const [open, setOpen] = useState(false);
39
+ const { i18n, t } = useTranslation();
40
+ const [level, setLevel] = useState([]);
41
+ const { searchValue, onSearchValueChange, query } = useDebouncedSearch();
42
+ const { product_categories, isPending, isError, error } = useProductCategories(
43
+ {
44
+ q: query,
45
+ parent_category_id: !searchValue ? getParentId(level) : void 0,
46
+ include_descendants_tree: !searchValue ? true : false
47
+ },
48
+ {
49
+ enabled: open
50
+ }
51
+ );
52
+ const { product_categories: selectedCategories } = useProductCategories(
53
+ { id: value ? [value] : [] },
54
+ { enabled: !!value }
55
+ );
56
+ const selectedLabel = selectedCategories?.[0]?.name ?? null;
57
+ const [showLoading, setShowLoading] = useState(false);
58
+ useEffect(() => {
59
+ let timeoutId;
60
+ if (isPending) {
61
+ setShowLoading(true);
62
+ } else {
63
+ timeoutId = setTimeout(() => {
64
+ setShowLoading(false);
65
+ }, 150);
66
+ }
67
+ return () => {
68
+ clearTimeout(timeoutId);
69
+ };
70
+ }, [isPending]);
71
+ useEffect(() => {
72
+ if (searchValue) {
73
+ setLevel([]);
74
+ }
75
+ }, [searchValue]);
76
+ function handleLevelUp(e) {
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ setLevel(level.slice(0, level.length - 1));
80
+ innerRef.current?.focus();
81
+ }
82
+ function handleLevelDown(option) {
83
+ return (e) => {
84
+ e.preventDefault();
85
+ e.stopPropagation();
86
+ setLevel([...level, { id: option.value, label: option.label }]);
87
+ innerRef.current?.focus();
88
+ };
89
+ }
90
+ const handleSelect = useCallback(
91
+ (option) => {
92
+ return (e) => {
93
+ e.preventDefault();
94
+ e.stopPropagation();
95
+ if (value === option.value) {
96
+ onChange(null);
97
+ } else {
98
+ onChange(option.value);
99
+ handleOpenChange(false);
100
+ }
101
+ innerRef.current?.focus();
102
+ };
103
+ },
104
+ [value, onChange]
105
+ );
106
+ function handleOpenChange(open2) {
107
+ if (!open2) {
108
+ onSearchValueChange("");
109
+ setLevel([]);
110
+ }
111
+ if (open2) {
112
+ requestAnimationFrame(() => {
113
+ innerRef.current?.focus();
114
+ });
115
+ }
116
+ setOpen(open2);
117
+ }
118
+ const options = getOptions(product_categories || []);
119
+ const hasValue = !!value;
120
+ const hideInput = hasValue && !open;
121
+ const showLevelUp = !searchValue && level.length > 0;
122
+ const [focusedIndex, setFocusedIndex] = useState(-1);
123
+ const handleKeyDown = useCallback(
124
+ (e) => {
125
+ if (!open) {
126
+ return;
127
+ }
128
+ const optionsLength = showLevelUp ? options.length + 1 : options.length;
129
+ if (e.key === "ArrowDown") {
130
+ e.preventDefault();
131
+ setFocusedIndex((prev) => {
132
+ const nextIndex = prev < optionsLength - 1 ? prev + 1 : prev;
133
+ return nextIndex;
134
+ });
135
+ } else if (e.key === "ArrowUp") {
136
+ e.preventDefault();
137
+ setFocusedIndex((prev) => {
138
+ return prev > 0 ? prev - 1 : prev;
139
+ });
140
+ } else if (e.key === "ArrowRight") {
141
+ const index = showLevelUp ? focusedIndex - 1 : focusedIndex;
142
+ const hasChildren = options[index]?.has_children;
143
+ if (!hasChildren || !!searchValue) {
144
+ return;
145
+ }
146
+ e.preventDefault();
147
+ setLevel([
148
+ ...level,
149
+ {
150
+ id: options[index].value,
151
+ label: options[index].label
152
+ }
153
+ ]);
154
+ setFocusedIndex(0);
155
+ } else if (e.key === "Enter" && focusedIndex !== -1) {
156
+ e.preventDefault();
157
+ if (showLevelUp && focusedIndex === 0) {
158
+ setLevel(level.slice(0, level.length - 1));
159
+ setFocusedIndex(0);
160
+ return;
161
+ }
162
+ const index = showLevelUp ? focusedIndex - 1 : focusedIndex;
163
+ handleSelect(options[index])(e);
164
+ }
165
+ },
166
+ [open, focusedIndex, options, level, handleSelect, searchValue, showLevelUp]
167
+ );
168
+ useEffect(() => {
169
+ window.addEventListener("keydown", handleKeyDown);
170
+ return () => {
171
+ window.removeEventListener("keydown", handleKeyDown);
172
+ };
173
+ }, [handleKeyDown]);
174
+ if (isError) {
175
+ throw error;
176
+ }
177
+ return /* @__PURE__ */ jsxs(RadixPopover.Root, { open, onOpenChange: handleOpenChange, children: [
178
+ /* @__PURE__ */ jsx(
179
+ RadixPopover.Anchor,
180
+ {
181
+ asChild: true,
182
+ onClick: () => {
183
+ if (!open) {
184
+ handleOpenChange(true);
185
+ }
186
+ },
187
+ children: /* @__PURE__ */ jsxs(
188
+ "div",
189
+ {
190
+ "data-anchor": true,
191
+ className: clx(
192
+ "relative flex cursor-pointer items-center gap-x-2 overflow-hidden",
193
+ "h-8 w-full rounded-md",
194
+ "bg-ui-bg-field transition-fg shadow-borders-base",
195
+ "has-[input:focus]:shadow-borders-interactive-with-active",
196
+ "has-[:invalid]:shadow-borders-error has-[[aria-invalid=true]]:shadow-borders-error",
197
+ "has-[:disabled]:bg-ui-bg-disabled has-[:disabled]:text-ui-fg-disabled has-[:disabled]:cursor-not-allowed",
198
+ {
199
+ "shadow-borders-interactive-with-active": open
200
+ },
201
+ className
202
+ ),
203
+ children: [
204
+ hideInput && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-y-0 start-2 flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: selectedLabel }) }),
205
+ /* @__PURE__ */ jsx(
206
+ "input",
207
+ {
208
+ ref: innerRef,
209
+ value: searchValue,
210
+ onChange: (e) => {
211
+ onSearchValueChange(e.target.value);
212
+ },
213
+ className: clx(
214
+ "txt-compact-small size-full cursor-pointer appearance-none bg-transparent ps-2 pe-8 outline-none",
215
+ "hover:bg-ui-bg-field-hover",
216
+ "focus:cursor-text",
217
+ "placeholder:text-ui-fg-muted",
218
+ {
219
+ "opacity-0": hideInput
220
+ }
221
+ ),
222
+ ...props
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsx(
226
+ "button",
227
+ {
228
+ type: "button",
229
+ onClick: () => handleOpenChange(true),
230
+ className: "text-ui-fg-muted transition-fg hover:bg-ui-bg-field-hover absolute end-0 flex size-8 items-center justify-center rounded-r outline-none",
231
+ children: /* @__PURE__ */ jsx(TrianglesMini, { className: "text-ui-fg-muted" })
232
+ }
233
+ )
234
+ ]
235
+ }
236
+ )
237
+ }
238
+ ),
239
+ /* @__PURE__ */ jsxs(
240
+ RadixPopover.Content,
241
+ {
242
+ sideOffset: 4,
243
+ role: "listbox",
244
+ className: clx(
245
+ "shadow-elevation-flyout bg-ui-bg-base -start-2 z-50 w-[var(--radix-popper-anchor-width)] rounded-[8px]",
246
+ "max-h-[200px] overflow-y-auto",
247
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
248
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
249
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=start]:slide-in-from-end-2 data-[side=end]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2"
250
+ ),
251
+ onInteractOutside: (e) => {
252
+ e.preventDefault();
253
+ const target = e.target;
254
+ if (target.closest("[data-anchor]")) {
255
+ return;
256
+ }
257
+ handleOpenChange(false);
258
+ },
259
+ children: [
260
+ showLevelUp && /* @__PURE__ */ jsxs(Fragment, { children: [
261
+ /* @__PURE__ */ jsx("div", { className: "p-1", children: /* @__PURE__ */ jsxs(
262
+ "button",
263
+ {
264
+ "data-active": focusedIndex === 0,
265
+ role: "button",
266
+ className: clx(
267
+ "transition-fg grid w-full appearance-none grid-cols-[20px_1fr] items-center justify-center gap-2 rounded-md px-2 py-1.5 text-start outline-none",
268
+ "data-[active=true]:bg-ui-bg-field-hover"
269
+ ),
270
+ type: "button",
271
+ onClick: handleLevelUp,
272
+ onMouseEnter: () => setFocusedIndex(0),
273
+ onMouseLeave: () => setFocusedIndex(-1),
274
+ tabIndex: -1,
275
+ children: [
276
+ /* @__PURE__ */ jsx(ArrowUturnLeft, { className: "text-ui-fg-muted" }),
277
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: getParentLabel(level) })
278
+ ]
279
+ }
280
+ ) }),
281
+ /* @__PURE__ */ jsx(Divider, {})
282
+ ] }),
283
+ /* @__PURE__ */ jsxs("div", { className: "p-1", children: [
284
+ options.length > 0 && !showLoading && options.map((option, index) => /* @__PURE__ */ jsxs(
285
+ "div",
286
+ {
287
+ className: clx(
288
+ "transition-fg bg-ui-bg-base grid cursor-pointer grid-cols-1 items-center gap-2 overflow-hidden",
289
+ {
290
+ "grid-cols-[1fr_32px]": option.has_children && !searchValue
291
+ }
292
+ ),
293
+ children: [
294
+ /* @__PURE__ */ jsxs(
295
+ "button",
296
+ {
297
+ "data-active": showLevelUp ? focusedIndex === index + 1 : focusedIndex === index,
298
+ type: "button",
299
+ role: "option",
300
+ className: clx(
301
+ "grid h-full w-full appearance-none grid-cols-[20px_1fr] items-center gap-2 overflow-hidden rounded-md px-2 py-1.5 text-start outline-none",
302
+ "data-[active=true]:bg-ui-bg-field-hover"
303
+ ),
304
+ onClick: handleSelect(option),
305
+ onMouseEnter: () => setFocusedIndex(showLevelUp ? index + 1 : index),
306
+ onMouseLeave: () => setFocusedIndex(-1),
307
+ tabIndex: -1,
308
+ children: [
309
+ /* @__PURE__ */ jsx("div", { className: "flex size-5 items-center justify-center", children: value === option.value && /* @__PURE__ */ jsx(EllipseMiniSolid, {}) }),
310
+ /* @__PURE__ */ jsx(
311
+ Text,
312
+ {
313
+ as: "span",
314
+ size: "small",
315
+ leading: "compact",
316
+ className: "w-full truncate",
317
+ children: option.label
318
+ }
319
+ )
320
+ ]
321
+ }
322
+ ),
323
+ option.has_children && !searchValue && /* @__PURE__ */ jsx(
324
+ "button",
325
+ {
326
+ className: clx(
327
+ "text-ui-fg-muted flex size-8 appearance-none items-center justify-center rounded-md outline-none",
328
+ "hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed"
329
+ ),
330
+ type: "button",
331
+ onClick: handleLevelDown(option),
332
+ tabIndex: -1,
333
+ children: /* @__PURE__ */ jsx(TriangleRightMini, { className: "rtl:rotate-180" })
334
+ }
335
+ )
336
+ ]
337
+ },
338
+ option.value
339
+ )),
340
+ showLoading && Array.from({ length: 5 }).map((_, index) => /* @__PURE__ */ jsxs(
341
+ "div",
342
+ {
343
+ className: "grid grid-cols-[20px_1fr_20px] gap-2 px-2 py-1.5",
344
+ children: [
345
+ /* @__PURE__ */ jsx("div", {}),
346
+ /* @__PURE__ */ jsx(TextSkeleton, { size: "small", leading: "compact" }),
347
+ /* @__PURE__ */ jsx("div", {})
348
+ ]
349
+ },
350
+ index
351
+ )),
352
+ options.length === 0 && !showLoading && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: query ? /* @__PURE__ */ jsx(
353
+ Trans,
354
+ {
355
+ i18n,
356
+ i18nKey: "general.noResultsTitle",
357
+ tOptions: {
358
+ query
359
+ },
360
+ components: [/* @__PURE__ */ jsx("span", { className: "font-medium" }, "query")]
361
+ }
362
+ ) : t("general.noResultsTitle") }) })
363
+ ] })
364
+ ]
365
+ }
366
+ )
367
+ ] });
368
+ });
369
+ SingleCategoryCombobox.displayName = "SingleCategoryCombobox";
370
+ function getParentId(level) {
371
+ if (!level.length) {
372
+ return "null";
373
+ }
374
+ return level[level.length - 1].id;
375
+ }
376
+ function getParentLabel(level) {
377
+ if (!level.length) {
378
+ return null;
379
+ }
380
+ return level[level.length - 1].label;
381
+ }
382
+ function getOptions(categories) {
383
+ return categories.map((cat) => {
384
+ return {
385
+ value: cat.id,
386
+ label: cat.name,
387
+ has_children: cat.category_children?.length > 0
388
+ };
389
+ });
390
+ }
391
+
392
+ // src/pages/products/common/components/category-combobox/category-combobox.tsx
393
+ import {
394
+ ArrowUturnLeft as ArrowUturnLeft2,
395
+ EllipseMiniSolid as EllipseMiniSolid2,
396
+ TriangleRightMini as TriangleRightMini2,
397
+ TrianglesMini as TrianglesMini2,
398
+ XMarkMini
399
+ } from "@medusajs/icons";
400
+ import { Divider as Divider2, Text as Text2, clx as clx2 } from "@medusajs/ui";
401
+ import { Popover as RadixPopover2 } from "radix-ui";
402
+ import {
403
+ Fragment as Fragment2,
404
+ forwardRef as forwardRef2,
405
+ useCallback as useCallback2,
406
+ useEffect as useEffect2,
407
+ useImperativeHandle as useImperativeHandle2,
408
+ useMemo,
409
+ useRef as useRef2,
410
+ useState as useState2
411
+ } from "react";
412
+ import { Trans as Trans2, useTranslation as useTranslation2 } from "react-i18next";
413
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
414
+ var TABLUAR_NUM_WIDTH = 8;
415
+ var TAG_BASE_WIDTH = 28;
416
+ var CategoryCombobox = forwardRef2(({ value, onChange, className, isSingleSelect: _isSingleSelect, allowClear: _allowClear, ...props }, ref) => {
417
+ const innerRef = useRef2(null);
418
+ useImperativeHandle2(
419
+ ref,
420
+ () => innerRef.current,
421
+ []
422
+ );
423
+ const [open, setOpen] = useState2(false);
424
+ const { i18n, t } = useTranslation2();
425
+ const [level, setLevel] = useState2([]);
426
+ const { searchValue, onSearchValueChange, query } = useDebouncedSearch();
427
+ const { product_categories, isPending, isError, error } = useProductCategories(
428
+ {
429
+ q: query,
430
+ parent_category_id: !searchValue ? getParentId2(level) : void 0,
431
+ include_descendants_tree: !searchValue
432
+ },
433
+ {
434
+ enabled: open
435
+ }
436
+ );
437
+ const [showLoading, setShowLoading] = useState2(false);
438
+ useEffect2(() => {
439
+ let timeoutId;
440
+ if (isPending) {
441
+ setShowLoading(true);
442
+ } else {
443
+ timeoutId = setTimeout(() => {
444
+ setShowLoading(false);
445
+ }, 150);
446
+ }
447
+ return () => {
448
+ clearTimeout(timeoutId);
449
+ };
450
+ }, [isPending]);
451
+ useEffect2(() => {
452
+ if (searchValue) {
453
+ setLevel([]);
454
+ }
455
+ }, [searchValue]);
456
+ function handleLevelUp(e) {
457
+ e.preventDefault();
458
+ e.stopPropagation();
459
+ setLevel(level.slice(0, level.length - 1));
460
+ innerRef.current?.focus();
461
+ }
462
+ function handleLevelDown(option) {
463
+ return (e) => {
464
+ e.preventDefault();
465
+ e.stopPropagation();
466
+ setLevel([...level, { id: option.value, label: option.label }]);
467
+ innerRef.current?.focus();
468
+ };
469
+ }
470
+ const handleSelect = useCallback2(
471
+ (option) => {
472
+ return (e) => {
473
+ e.preventDefault();
474
+ e.stopPropagation();
475
+ if (isSelected(value, option.value)) {
476
+ onChange(value.filter((v) => v !== option.value));
477
+ } else {
478
+ onChange([...value, option.value]);
479
+ }
480
+ innerRef.current?.focus();
481
+ };
482
+ },
483
+ [value, onChange]
484
+ );
485
+ function handleOpenChange(open2) {
486
+ if (!open2) {
487
+ onSearchValueChange("");
488
+ setLevel([]);
489
+ }
490
+ if (open2) {
491
+ requestAnimationFrame(() => {
492
+ innerRef.current?.focus();
493
+ });
494
+ }
495
+ setOpen(open2);
496
+ }
497
+ const options = getOptions2(product_categories || []);
498
+ const showTag = value.length > 0;
499
+ const showSelected = !open && value.length > 0;
500
+ const tagWidth = useMemo(() => {
501
+ const count = value.length;
502
+ const digits = count.toString().length;
503
+ return TAG_BASE_WIDTH + digits * TABLUAR_NUM_WIDTH;
504
+ }, [value]);
505
+ const showLevelUp = !searchValue && level.length > 0;
506
+ const [focusedIndex, setFocusedIndex] = useState2(-1);
507
+ const handleKeyDown = useCallback2(
508
+ (e) => {
509
+ if (!open) {
510
+ return;
511
+ }
512
+ const optionsLength = showLevelUp ? options.length + 1 : options.length;
513
+ if (e.key === "ArrowDown") {
514
+ e.preventDefault();
515
+ setFocusedIndex((prev) => {
516
+ const nextIndex = prev < optionsLength - 1 ? prev + 1 : prev;
517
+ return nextIndex;
518
+ });
519
+ } else if (e.key === "ArrowUp") {
520
+ e.preventDefault();
521
+ setFocusedIndex((prev) => {
522
+ return prev > 0 ? prev - 1 : prev;
523
+ });
524
+ } else if (e.key === "ArrowRight") {
525
+ const index = showLevelUp ? focusedIndex - 1 : focusedIndex;
526
+ const hasChildren = options[index]?.has_children;
527
+ if (!hasChildren || !!searchValue) {
528
+ return;
529
+ }
530
+ e.preventDefault();
531
+ setLevel([
532
+ ...level,
533
+ {
534
+ id: options[index].value,
535
+ label: options[index].label
536
+ }
537
+ ]);
538
+ setFocusedIndex(0);
539
+ } else if (e.key === "Enter" && focusedIndex !== -1) {
540
+ e.preventDefault();
541
+ if (showLevelUp && focusedIndex === 0) {
542
+ setLevel(level.slice(0, level.length - 1));
543
+ setFocusedIndex(0);
544
+ return;
545
+ }
546
+ const index = showLevelUp ? focusedIndex - 1 : focusedIndex;
547
+ handleSelect(options[index])(e);
548
+ }
549
+ },
550
+ [
551
+ open,
552
+ focusedIndex,
553
+ options,
554
+ level,
555
+ handleSelect,
556
+ searchValue,
557
+ showLevelUp
558
+ ]
559
+ );
560
+ useEffect2(() => {
561
+ window.addEventListener("keydown", handleKeyDown);
562
+ return () => {
563
+ window.removeEventListener("keydown", handleKeyDown);
564
+ };
565
+ }, [handleKeyDown]);
566
+ if (isError) {
567
+ throw error;
568
+ }
569
+ return /* @__PURE__ */ jsxs2(RadixPopover2.Root, { open, onOpenChange: handleOpenChange, children: [
570
+ /* @__PURE__ */ jsx2(
571
+ RadixPopover2.Anchor,
572
+ {
573
+ asChild: true,
574
+ onClick: () => {
575
+ if (!open) {
576
+ handleOpenChange(true);
577
+ }
578
+ },
579
+ children: /* @__PURE__ */ jsxs2(
580
+ "div",
581
+ {
582
+ "data-anchor": true,
583
+ className: clx2(
584
+ "relative flex cursor-pointer items-center gap-x-2 overflow-hidden",
585
+ "h-8 w-full rounded-md",
586
+ "bg-ui-bg-field transition-fg shadow-borders-base",
587
+ "has-[input:focus]:shadow-borders-interactive-with-active",
588
+ "has-[:invalid]:shadow-borders-error has-[[aria-invalid=true]]:shadow-borders-error",
589
+ "has-[:disabled]:bg-ui-bg-disabled has-[:disabled]:text-ui-fg-disabled has-[:disabled]:cursor-not-allowed",
590
+ {
591
+ // Fake the focus state as long as the popover is open,
592
+ // this prevents the styling from flickering when navigating
593
+ // between levels.
594
+ "shadow-borders-interactive-with-active": open
595
+ },
596
+ className
597
+ ),
598
+ style: {
599
+ "--tag-width": `${tagWidth}px`
600
+ },
601
+ children: [
602
+ showTag && /* @__PURE__ */ jsxs2(
603
+ "button",
604
+ {
605
+ type: "button",
606
+ onClick: (e) => {
607
+ e.preventDefault();
608
+ onChange([]);
609
+ },
610
+ className: "bg-ui-bg-base hover:bg-ui-bg-base-hover txt-compact-small-plus text-ui-fg-subtle focus-within:border-ui-fg-interactive transition-fg absolute start-0.5 top-0.5 flex h-[28px] items-center rounded-[4px] border py-[3px] ps-1.5 pe-1 outline-none",
611
+ children: [
612
+ /* @__PURE__ */ jsx2("span", { className: "tabular-nums", children: value.length }),
613
+ /* @__PURE__ */ jsx2(XMarkMini, { className: "text-ui-fg-muted" })
614
+ ]
615
+ }
616
+ ),
617
+ showSelected && /* @__PURE__ */ jsx2("div", { className: "pointer-events-none absolute inset-y-0 start-[calc(var(--tag-width)+8px)] flex size-full items-center", children: /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", children: t("general.selected") }) }),
618
+ /* @__PURE__ */ jsx2(
619
+ "input",
620
+ {
621
+ ref: innerRef,
622
+ value: searchValue,
623
+ onChange: (e) => {
624
+ onSearchValueChange(e.target.value);
625
+ },
626
+ className: clx2(
627
+ "txt-compact-small size-full cursor-pointer appearance-none bg-transparent pe-8 outline-none",
628
+ "hover:bg-ui-bg-field-hover",
629
+ "focus:cursor-text",
630
+ "placeholder:text-ui-fg-muted",
631
+ {
632
+ "ps-2": !showTag,
633
+ "ps-[calc(var(--tag-width)+8px)]": showTag
634
+ }
635
+ ),
636
+ ...props
637
+ }
638
+ ),
639
+ /* @__PURE__ */ jsx2(
640
+ "button",
641
+ {
642
+ type: "button",
643
+ onClick: () => handleOpenChange(true),
644
+ className: "text-ui-fg-muted transition-fg hover:bg-ui-bg-field-hover absolute end-0 flex size-8 items-center justify-center rounded-r outline-none",
645
+ children: /* @__PURE__ */ jsx2(TrianglesMini2, { className: "text-ui-fg-muted" })
646
+ }
647
+ )
648
+ ]
649
+ }
650
+ )
651
+ }
652
+ ),
653
+ /* @__PURE__ */ jsxs2(
654
+ RadixPopover2.Content,
655
+ {
656
+ sideOffset: 4,
657
+ role: "listbox",
658
+ className: clx2(
659
+ "shadow-elevation-flyout bg-ui-bg-base -start-2 z-50 w-[var(--radix-popper-anchor-width)] rounded-[8px]",
660
+ "max-h-[200px] overflow-y-auto",
661
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
662
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
663
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=start]:slide-in-from-end-2 data-[side=end]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2"
664
+ ),
665
+ onInteractOutside: (e) => {
666
+ e.preventDefault();
667
+ const target = e.target;
668
+ if (target.closest("[data-anchor]")) {
669
+ return;
670
+ }
671
+ handleOpenChange(false);
672
+ },
673
+ children: [
674
+ showLevelUp && /* @__PURE__ */ jsxs2(Fragment2, { children: [
675
+ /* @__PURE__ */ jsx2("div", { className: "p-1", children: /* @__PURE__ */ jsxs2(
676
+ "button",
677
+ {
678
+ "data-active": focusedIndex === 0,
679
+ className: clx2(
680
+ "transition-fg grid w-full appearance-none grid-cols-[20px_1fr] items-center justify-center gap-2 rounded-md px-2 py-1.5 text-start outline-none",
681
+ "data-[active=true]:bg-ui-bg-field-hover"
682
+ ),
683
+ type: "button",
684
+ onClick: handleLevelUp,
685
+ onMouseEnter: () => setFocusedIndex(0),
686
+ onMouseLeave: () => setFocusedIndex(-1),
687
+ tabIndex: -1,
688
+ children: [
689
+ /* @__PURE__ */ jsx2(ArrowUturnLeft2, { className: "text-ui-fg-muted" }),
690
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", children: getParentLabel2(level) })
691
+ ]
692
+ }
693
+ ) }),
694
+ /* @__PURE__ */ jsx2(Divider2, {})
695
+ ] }),
696
+ /* @__PURE__ */ jsxs2("div", { className: "p-1", children: [
697
+ options.length > 0 && !showLoading && options.map((option, index) => /* @__PURE__ */ jsxs2(
698
+ "div",
699
+ {
700
+ className: clx2(
701
+ "transition-fg bg-ui-bg-base grid cursor-pointer grid-cols-1 items-center gap-2 overflow-hidden",
702
+ {
703
+ "grid-cols-[1fr_32px]": option.has_children && !searchValue
704
+ }
705
+ ),
706
+ children: [
707
+ /* @__PURE__ */ jsxs2(
708
+ "button",
709
+ {
710
+ "data-active": showLevelUp ? focusedIndex === index + 1 : focusedIndex === index,
711
+ type: "button",
712
+ role: "option",
713
+ "aria-selected": false,
714
+ className: clx2(
715
+ "grid h-full w-full appearance-none grid-cols-[20px_1fr] items-center gap-2 overflow-hidden rounded-md px-2 py-1.5 text-start outline-none",
716
+ "data-[active=true]:bg-ui-bg-field-hover"
717
+ ),
718
+ onClick: handleSelect(option),
719
+ onMouseEnter: () => setFocusedIndex(showLevelUp ? index + 1 : index),
720
+ onMouseLeave: () => setFocusedIndex(-1),
721
+ tabIndex: -1,
722
+ children: [
723
+ /* @__PURE__ */ jsx2("div", { className: "flex size-5 items-center justify-center", children: isSelected(value, option.value) && /* @__PURE__ */ jsx2(EllipseMiniSolid2, {}) }),
724
+ /* @__PURE__ */ jsx2(
725
+ Text2,
726
+ {
727
+ as: "span",
728
+ size: "small",
729
+ leading: "compact",
730
+ className: "w-full truncate",
731
+ children: option.label
732
+ }
733
+ )
734
+ ]
735
+ }
736
+ ),
737
+ option.has_children && !searchValue && /* @__PURE__ */ jsx2(
738
+ "button",
739
+ {
740
+ className: clx2(
741
+ "text-ui-fg-muted flex size-8 appearance-none items-center justify-center rounded-md outline-none",
742
+ "hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed"
743
+ ),
744
+ type: "button",
745
+ onClick: handleLevelDown(option),
746
+ tabIndex: -1,
747
+ children: /* @__PURE__ */ jsx2(TriangleRightMini2, { className: "rtl:rotate-180" })
748
+ }
749
+ )
750
+ ]
751
+ },
752
+ option.value
753
+ )),
754
+ showLoading && Array.from({ length: 5 }).map((_, index) => /* @__PURE__ */ jsxs2(
755
+ "div",
756
+ {
757
+ className: "grid grid-cols-[20px_1fr_20px] gap-2 px-2 py-1.5",
758
+ children: [
759
+ /* @__PURE__ */ jsx2("div", {}),
760
+ /* @__PURE__ */ jsx2(TextSkeleton, { size: "small", leading: "compact" }),
761
+ /* @__PURE__ */ jsx2("div", {})
762
+ ]
763
+ },
764
+ index
765
+ )),
766
+ options.length === 0 && !showLoading && /* @__PURE__ */ jsx2("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", children: query ? /* @__PURE__ */ jsx2(
767
+ Trans2,
768
+ {
769
+ i18n,
770
+ i18nKey: "general.noResultsTitle",
771
+ tOptions: {
772
+ query
773
+ },
774
+ components: [/* @__PURE__ */ jsx2("span", { className: "font-medium" }, "query")]
775
+ }
776
+ ) : t("general.noResultsTitle") }) })
777
+ ] })
778
+ ]
779
+ }
780
+ )
781
+ ] });
782
+ });
783
+ CategoryCombobox.displayName = "CategoryCombobox";
784
+ function getParentId2(level) {
785
+ if (!level.length) {
786
+ return "null";
787
+ }
788
+ return level[level.length - 1].id;
789
+ }
790
+ function getParentLabel2(level) {
791
+ if (!level.length) {
792
+ return null;
793
+ }
794
+ return level[level.length - 1].label;
795
+ }
796
+ function getOptions2(categories) {
797
+ return categories.map((cat) => {
798
+ return {
799
+ value: cat.id,
800
+ label: cat.name,
801
+ has_children: cat.category_children?.length > 0
802
+ };
803
+ });
804
+ }
805
+ function isSelected(values, value) {
806
+ return values.includes(value);
807
+ }
808
+
809
+ export {
810
+ SingleCategoryCombobox
811
+ };