@mercurjs/admin 2.1.2-canary.4 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-campaign-promotions-WRGU7MF4.js → add-campaign-promotions-6Z2STQT4.js} +7 -7
- package/dist/{api-key-management-detail-Q5RBMX4J.js → api-key-management-detail-IRYR6J2I.js} +4 -4
- package/dist/{api-key-management-list-DQ33T6KV.js → api-key-management-list-4WCDP4B3.js} +7 -7
- package/dist/{api-key-management-sales-channels-UGAAKILD.js → api-key-management-sales-channels-NVFG2ESH.js} +1 -1
- package/dist/{attribute-create-IVRJPVG5.js → attribute-create-EAOQ6KT6.js} +58 -45
- package/dist/{attribute-detail-FLQKKFCO.js → attribute-detail-R26GDX7Q.js} +7 -7
- package/dist/{attribute-list-ODT2ZP4T.js → attribute-list-XR7OSL2H.js} +7 -7
- package/dist/{campaign-create-QFNB5XZ2.js → campaign-create-AZTR5UZP.js} +2 -2
- package/dist/{campaign-detail-UKVHFA6H.js → campaign-detail-TCPO6DTI.js} +10 -10
- package/dist/{campaign-list-A3TVXCV4.js → campaign-list-DCLVAFEM.js} +7 -7
- package/dist/{category-create-XH6AM3NM.js → category-create-DG3Z5RYE.js} +2 -2
- package/dist/{category-detail-DXQECKDO.js → category-detail-K2UNFPRV.js} +7 -7
- package/dist/{category-list-AQIONIMS.js → category-list-2MG37UXJ.js} +7 -7
- package/dist/{category-organize-NCH6A57L.js → category-organize-CCX2INRS.js} +1 -1
- package/dist/{category-products-VV3JLNW7.js → category-products-LKT7564A.js} +4 -4
- package/dist/{chunk-XZQV2OLD.js → chunk-26UTIAAZ.js} +17 -2
- package/dist/{chunk-VXPWIJZV.js → chunk-2OYCT5NO.js} +1 -1
- package/dist/{chunk-R2FE3PBQ.js → chunk-2U5BRCQO.js} +1 -1
- package/dist/{chunk-Z4CSKRJ4.js → chunk-32OKBVER.js} +2 -2
- package/dist/{chunk-2MNDOYVE.js → chunk-35Q6JF3S.js} +2 -2
- package/dist/{chunk-3BBG3LC3.js → chunk-3DOCALSU.js} +2 -2
- package/dist/{chunk-RHCDOBTU.js → chunk-3IBSB2U6.js} +2 -2
- package/dist/{chunk-LNT72PI5.js → chunk-3T5S5RDO.js} +1 -1
- package/dist/{chunk-FZCXIX37.js → chunk-3ZSYFPHB.js} +5 -4
- package/dist/{chunk-MKIFFPHN.js → chunk-4IZ2RD3L.js} +3 -3
- package/dist/{chunk-S2Q7PO7I.js → chunk-4KX6CBJ4.js} +1 -0
- package/dist/{chunk-IGBGQDKS.js → chunk-4LQX5FRH.js} +2 -2
- package/dist/{chunk-BGSOUCCN.js → chunk-4Q7LZQVY.js} +2 -2
- package/dist/{chunk-OADU6FQZ.js → chunk-4ZN3D4YS.js} +2 -2
- package/dist/{chunk-36NDTZIV.js → chunk-56AUQBQX.js} +1 -1
- package/dist/{chunk-SCKY77PC.js → chunk-5OS2MBRB.js} +2 -2
- package/dist/{chunk-EHLONIAY.js → chunk-5ZBQICCP.js} +1 -1
- package/dist/{chunk-D3OIFOHY.js → chunk-63OSYRLS.js} +1 -1
- package/dist/{chunk-BURG4MO3.js → chunk-6YGOXPB5.js} +2 -2
- package/dist/{chunk-Q64H5G5C.js → chunk-7A5WEMNW.js} +2 -2
- package/dist/{chunk-ZOS6EBB2.js → chunk-7MTFPHXR.js} +2 -2
- package/dist/{chunk-ANHC5MBQ.js → chunk-7QWLLYOY.js} +1 -1
- package/dist/{chunk-TGK2C73H.js → chunk-7XXM72CF.js} +6 -2
- package/dist/{chunk-JDHG7FWL.js → chunk-7YHAFHGI.js} +17 -13
- package/dist/{chunk-4OHMUFVP.js → chunk-ABUQBBEM.js} +2 -2
- package/dist/{chunk-RTOCKSJ5.js → chunk-ARMGWHYU.js} +2 -2
- package/dist/{chunk-MSXZLZ4X.js → chunk-AZAGUAN4.js} +2 -2
- package/dist/{chunk-JPJISU7W.js → chunk-B6SYYKJI.js} +2 -2
- package/dist/{chunk-NZ4BXIO6.js → chunk-BEU674HI.js} +2 -2
- package/dist/{chunk-FNJNVUXR.js → chunk-CEG375CR.js} +1 -1
- package/dist/{chunk-TDQEXNX5.js → chunk-CIH5DSU7.js} +2 -2
- package/dist/{chunk-XILJNA3R.js → chunk-CXO3C3L2.js} +2 -2
- package/dist/{chunk-YQ6JASMO.js → chunk-DVKO4VRC.js} +3 -3
- package/dist/{chunk-V5J73NPW.js → chunk-E74OUNA3.js} +1 -1
- package/dist/{chunk-QRAFS63H.js → chunk-EWMEXGFZ.js} +2 -2
- package/dist/{chunk-GQUE4TAJ.js → chunk-F67RRVMJ.js} +3 -3
- package/dist/{chunk-IK6MPP7K.js → chunk-FSPZYOY6.js} +1 -1
- package/dist/{chunk-WQO26Z76.js → chunk-GDHF6CT5.js} +2 -2
- package/dist/{chunk-CUSRWXZY.js → chunk-GJPGL7RP.js} +1 -1
- package/dist/{chunk-3QIIWLCT.js → chunk-GKJLFLGN.js} +1 -1
- package/dist/{chunk-VTK4AZCW.js → chunk-GPKTJXGG.js} +2 -2
- package/dist/{chunk-GS7L2B4S.js → chunk-GXRLLA5H.js} +3 -4
- package/dist/{chunk-JJYOI5PR.js → chunk-GZBVMHXS.js} +2 -2
- package/dist/{chunk-XIZLPYEE.js → chunk-H6MYB7GB.js} +4 -1
- package/dist/{chunk-KERTIEWE.js → chunk-HGULM6DF.js} +2 -2
- package/dist/{chunk-KBYZLKI4.js → chunk-HKDFWQ6Q.js} +15 -12
- package/dist/{chunk-Z4OJNCER.js → chunk-HNUA6XIW.js} +2 -2
- package/dist/{chunk-VBJFCAKU.js → chunk-HY3CV5V6.js} +2 -2
- package/dist/{chunk-LN3OHONN.js → chunk-J24X54DB.js} +2 -2
- package/dist/{chunk-GU4T2RAQ.js → chunk-KCYUY2AI.js} +6 -1
- package/dist/{chunk-Z6DBHMEN.js → chunk-KHHMQM2L.js} +1 -1
- package/dist/{chunk-KLVTWJ4M.js → chunk-KYPPQGGE.js} +2 -2
- package/dist/{chunk-XZYRXNWO.js → chunk-L56WFGUN.js} +1 -1
- package/dist/{chunk-UEFWVPQ7.js → chunk-LBXPX3XC.js} +3 -3
- package/dist/{chunk-XRCERDBF.js → chunk-LFATSJPO.js} +1 -1
- package/dist/{chunk-YA53AXGM.js → chunk-M73MP4NC.js} +4 -4
- package/dist/{chunk-BJFFCELF.js → chunk-MNYDJXTM.js} +1 -1
- package/dist/{chunk-72Q2T2FK.js → chunk-MWX5JCOM.js} +8 -7
- package/dist/{chunk-L5SVR7FK.js → chunk-MXGDKEU5.js} +1 -1
- package/dist/{chunk-Y3I3LXKW.js → chunk-N23OD7WS.js} +1 -1
- package/dist/{chunk-V2MYKK5U.js → chunk-N57BOIPU.js} +1 -1
- package/dist/{chunk-52ZAPY3Z.js → chunk-NEN6KWAJ.js} +2 -2
- package/dist/{chunk-7AMAENN3.js → chunk-NHAOR25V.js} +2 -2
- package/dist/{chunk-WIDZXOML.js → chunk-NRJ7F7JW.js} +2 -2
- package/dist/{chunk-NNCIV74Y.js → chunk-O5YFLNSQ.js} +67 -57
- package/dist/{chunk-UQITHKTH.js → chunk-OB4NOV4M.js} +6 -15
- package/dist/{chunk-GIU72QEP.js → chunk-OG4WH7IW.js} +2 -2
- package/dist/{chunk-NHHZHVP6.js → chunk-ORI7UXS6.js} +2 -2
- package/dist/{chunk-CMLDMKSO.js → chunk-PIZ7FN3L.js} +11 -3
- package/dist/{chunk-K7BVNZS6.js → chunk-R46PKJUT.js} +2 -2
- package/dist/{chunk-CQFXSD2L.js → chunk-RE3AYHPM.js} +2 -2
- package/dist/{chunk-YWWUOGJA.js → chunk-SESTTUVM.js} +10 -2
- package/dist/{chunk-6AZBAS4D.js → chunk-SJQG3RCN.js} +3 -3
- package/dist/{chunk-N3XQFZPF.js → chunk-SOJ4TLWP.js} +2 -2
- package/dist/{chunk-IXWGJ4W7.js → chunk-SPIVEW2Y.js} +23 -5
- package/dist/{chunk-X3S5LZQO.js → chunk-UEEYZGM3.js} +4 -3
- package/dist/{chunk-OCEPZGFS.js → chunk-V7EPLR3E.js} +2 -2
- package/dist/{chunk-LWIWYLZL.js → chunk-VGM5UQRA.js} +1 -0
- package/dist/{chunk-J3JN6OWV.js → chunk-W576GZBG.js} +2 -2
- package/dist/{chunk-JRWXFXQ7.js → chunk-WIQ2HBJG.js} +3 -3
- package/dist/{chunk-CPZJNHAL.js → chunk-X3YEY2PY.js} +2 -2
- package/dist/{chunk-IBOTFRZP.js → chunk-X4DGVTMC.js} +2 -2
- package/dist/{chunk-QZBAACYC.js → chunk-XB3HXEZB.js} +2 -2
- package/dist/{chunk-FSCMVYXU.js → chunk-XBHUWCBD.js} +1 -1
- package/dist/{chunk-CQ7HSDCL.js → chunk-XCANTVXS.js} +1 -1
- package/dist/{chunk-YXFG3M2D.js → chunk-XLA2CNCW.js} +2 -2
- package/dist/{chunk-ENFPDBSU.js → chunk-Y3FXVIJO.js} +12 -3
- package/dist/{chunk-3UZVMGC6.js → chunk-Y6NK6GBB.js} +1 -1
- package/dist/chunk-YGRTRAWX.js +163 -0
- package/dist/{chunk-YBZWO4ZV.js → chunk-ZMC7BKLT.js} +2 -3
- package/dist/{chunk-OPAARXKJ.js → chunk-ZXYKF4A2.js} +7 -7
- package/dist/{collection-add-products-K4R67OLS.js → collection-add-products-IRYJ6U6P.js} +4 -4
- package/dist/{collection-detail-4ATHIFVS.js → collection-detail-263PM4DL.js} +7 -7
- package/dist/{collection-list-OFZNSMTS.js → collection-list-IVPTNBSI.js} +7 -7
- package/dist/{commission-rate-create-US6HFJ5L.js → commission-rate-create-3N6BHEGT.js} +5 -5
- package/dist/{commission-rate-detail-D5WUXKER.js → commission-rate-detail-MY3F2RHR.js} +3 -3
- package/dist/{commission-rate-edit-VA6VE2H4.js → commission-rate-edit-WZDPXLLZ.js} +5 -5
- package/dist/{commission-rate-list-TFMQC26F.js → commission-rate-list-JPBOTOTA.js} +7 -7
- package/dist/{customer-detail-5UW56MGD.js → customer-detail-2QBJPF7S.js} +7 -7
- package/dist/{customer-group-add-customers-YSFEUI5M.js → customer-group-add-customers-JCLAH45C.js} +4 -4
- package/dist/{customer-group-detail-NL7FAEBO.js → customer-group-detail-BDKFWKTI.js} +7 -7
- package/dist/{customer-group-list-T53DLWPQ.js → customer-group-list-3NEEJXQH.js} +7 -7
- package/dist/{customer-list-LHGKF34F.js → customer-list-ZIFNZXO4.js} +7 -7
- package/dist/{customers-add-customer-group-IWFFLQQQ.js → customers-add-customer-group-OQIFQZBL.js} +4 -4
- package/dist/{edit-rules-BRXIELG2.js → edit-rules-4AHZQGCX.js} +29 -23
- package/dist/index.js +160 -160
- package/dist/{inventory-create-3GAK5IYZ.js → inventory-create-P26OGAHD.js} +2 -2
- package/dist/{inventory-detail-RU37UA2Y.js → inventory-detail-7W7UUWNT.js} +7 -7
- package/dist/{inventory-list-3H3J7IOB.js → inventory-list-PA4B4RWY.js} +7 -7
- package/dist/{inventory-stock-JZNONQAL.js → inventory-stock-UZSYXXPX.js} +2 -2
- package/dist/{location-detail-QHF23BXP.js → location-detail-RUC2ZP3K.js} +3 -3
- package/dist/{location-fulfillment-providers-OQTYP6C7.js → location-fulfillment-providers-WDET6TJP.js} +7 -9
- package/dist/{location-list-XGFUQY7T.js → location-list-R7EECG5Z.js} +4 -4
- package/dist/{location-sales-channels-IRGVGAVC.js → location-sales-channels-IS6E3I4S.js} +1 -1
- package/dist/{location-service-zone-create-URK3O2H4.js → location-service-zone-create-HAQVVTKP.js} +5 -5
- package/dist/{location-service-zone-manage-areas-DO3XK6TU.js → location-service-zone-manage-areas-5LCENMAM.js} +5 -5
- package/dist/{location-service-zone-shipping-option-create-OOU6YVRS.js → location-service-zone-shipping-option-create-FV5Y2PNB.js} +3 -3
- package/dist/{location-service-zone-shipping-option-pricing-MZHMML32.js → location-service-zone-shipping-option-pricing-6QHLZ6IN.js} +2 -2
- package/dist/{manage-locations-BA7VMY3Q.js → manage-locations-TU5HCIKG.js} +34 -31
- package/dist/{marketplace-add-currencies-BIN4YT3V.js → marketplace-add-currencies-PB73MHM6.js} +4 -4
- package/dist/{marketplace-detail-AXO5YXED.js → marketplace-detail-3KFGJWQ7.js} +7 -7
- package/dist/{order-allocate-items-A365NKBM.js → order-allocate-items-2B6T5JCK.js} +6 -2
- package/dist/{order-create-claim-PLC342V5.js → order-create-claim-R2SX6YUS.js} +83 -49
- package/dist/{order-create-edit-25CJG3KZ.js → order-create-edit-G35PDCQ2.js} +12 -8
- package/dist/{order-create-exchange-TK65KBGW.js → order-create-exchange-7KKMJHXE.js} +83 -49
- package/dist/{order-create-fulfillment-BB2FCLAH.js → order-create-fulfillment-2FTTWTFE.js} +18 -3
- package/dist/{order-create-refund-LDODI2AP.js → order-create-refund-KWYYLAED.js} +7 -2
- package/dist/{order-create-return-5XDDN456.js → order-create-return-BQFRANNG.js} +32 -14
- package/dist/{order-detail-SFIBIQTI.js → order-detail-BITJD73H.js} +7 -7
- package/dist/{order-edit-billing-address-JNO7KJKW.js → order-edit-billing-address-FLEI4VDB.js} +1 -1
- package/dist/{order-list-IDKVSUYO.js → order-list-D2SJOMZ2.js} +7 -7
- package/dist/{order-receive-return-6IU2HGAD.js → order-receive-return-JV3X7YHG.js} +9 -2
- package/dist/pages/index.js +88 -88
- package/dist/{payout-detail-DZFTTDUR.js → payout-detail-JWS2Q4TY.js} +3 -3
- package/dist/{payout-list-75YIMPCS.js → payout-list-PW6BFT4O.js} +7 -7
- package/dist/{price-list-configuration-FEO2XAX5.js → price-list-configuration-N5D5OFXX.js} +6 -6
- package/dist/{price-list-create-6XVOYBM4.js → price-list-create-NQFC2JIJ.js} +8 -8
- package/dist/{price-list-detail-FBY7PWN3.js → price-list-detail-HRVLVBPS.js} +7 -7
- package/dist/{price-list-list-TZIZJJH3.js → price-list-list-K4IJFZYH.js} +7 -7
- package/dist/{price-list-prices-add-HQHRB3XG.js → price-list-prices-add-WXEGEWRA.js} +7 -7
- package/dist/{price-list-prices-edit-WSLGG7VC.js → price-list-prices-edit-KJEKS6TL.js} +2 -2
- package/dist/{product-create-NT5YV3BN.js → product-create-BDQ66ECX.js} +9 -9
- package/dist/{product-create-option-WDFFZYTE.js → product-create-option-B7SV42LO.js} +1 -1
- package/dist/{product-create-variant-TJB7NNKY.js → product-create-variant-7YAG2YRZ.js} +2 -2
- package/dist/{product-detail-XXA3V6V3.js → product-detail-DCHR4B4T.js} +4 -4
- package/dist/{product-edit-option-UMOGVYLM.js → product-edit-option-KVTIY5NM.js} +1 -1
- package/dist/{product-export-IJBCSQ5H.js → product-export-E7RBOIO6.js} +2 -2
- package/dist/{product-import-JB7S4EL6.js → product-import-KOSPPCSW.js} +1 -1
- package/dist/{product-list-XXSHUGNI.js → product-list-X72QPKOK.js} +7 -7
- package/dist/{product-media-HCM6UI2O.js → product-media-VNSFLCSH.js} +4 -4
- package/dist/{product-organization-63ODFBLM.js → product-organization-PN22LYKQ.js} +1 -1
- package/dist/{product-prices-RLZBWN6C.js → product-prices-HI4SOTMP.js} +1 -1
- package/dist/{product-sales-channels-53YVZ5G5.js → product-sales-channels-J2ZNRKZT.js} +1 -1
- package/dist/{product-shipping-profile-X5CZJCET.js → product-shipping-profile-G7UPGWYK.js} +1 -1
- package/dist/{product-stock-XB3HKT5G.js → product-stock-666D3AMJ.js} +2 -2
- package/dist/{product-tag-detail-2H7EJV5J.js → product-tag-detail-B7JEBNMJ.js} +7 -7
- package/dist/{product-tag-list-6LTEJAI7.js → product-tag-list-MAUUWH25.js} +8 -8
- package/dist/{product-type-detail-LOCLZUCY.js → product-type-detail-7GHH4ACU.js} +7 -7
- package/dist/{product-type-list-7SXDLL6L.js → product-type-list-LTYTTF4F.js} +7 -7
- package/dist/{product-variant-detail-T2OM45NJ.js → product-variant-detail-PHGVJWUV.js} +7 -7
- package/dist/{profile-detail-IWSYAO67.js → profile-detail-UQTGEFYF.js} +3 -3
- package/dist/{promotion-add-campaign-GBB6M2OB.js → promotion-add-campaign-M4OT6URB.js} +2 -2
- package/dist/{promotion-create-4ZEXEV4G.js → promotion-create-GM37OXEW.js} +5 -5
- package/dist/{promotion-detail-TE54RSNT.js → promotion-detail-PDBRQII7.js} +5 -5
- package/dist/{promotion-list-IANWEI3X.js → promotion-list-XW4PNLJF.js} +10 -10
- package/dist/{refund-reason-list-7G23NIRL.js → refund-reason-list-2S2MDKBQ.js} +4 -4
- package/dist/{region-add-countries-TZEP4SML.js → region-add-countries-T4XZ2CU3.js} +4 -4
- package/dist/{region-create-7YJ25C3H.js → region-create-MQXTWBKC.js} +4 -4
- package/dist/{region-detail-KFFPZLZL.js → region-detail-6OFP76OY.js} +7 -7
- package/dist/{region-list-TPQG44BF.js → region-list-EYTDREE2.js} +7 -7
- package/dist/{reservation-detail-X3W6APD5.js → reservation-detail-G26K6HZV.js} +3 -3
- package/dist/{reservation-list-DOW3PKTS.js → reservation-list-CHHR6CEV.js} +7 -7
- package/dist/{reset-password-BQFZL5XM.js → reset-password-S6IBWG47.js} +1 -1
- package/dist/{return-reason-list-J5S45BMZ.js → return-reason-list-MCGW2JV3.js} +7 -7
- package/dist/{sales-channel-add-products-P5AAQFVB.js → sales-channel-add-products-FH7B7UYR.js} +4 -4
- package/dist/{sales-channel-detail-BJCMSTSA.js → sales-channel-detail-KCS472HN.js} +7 -7
- package/dist/{sales-channel-list-QKFVTZ6A.js → sales-channel-list-6HBRUZ2Z.js} +4 -4
- package/dist/{shipping-option-type-detail-OAKOWHU7.js → shipping-option-type-detail-IS7CNAYI.js} +3 -3
- package/dist/{shipping-option-type-list-HRW7XFEQ.js → shipping-option-type-list-BTPCLBSD.js} +7 -7
- package/dist/{shipping-profile-detail-XKLW22RQ.js → shipping-profile-detail-L3IHPGLL.js} +3 -3
- package/dist/{shipping-profiles-list-IT433GKY.js → shipping-profiles-list-2JKVMEZG.js} +7 -7
- package/dist/{store-bulk-edit-HCEEME3D.js → store-bulk-edit-A4ZWZ7HJ.js} +1 -1
- package/dist/{store-details-6NDWU65D.js → store-details-BOGWBWE7.js} +7 -7
- package/dist/{store-edit-U5I6TFKD.js → store-edit-77WKNZUH.js} +3 -3
- package/dist/{store-list-TJXHXAPH.js → store-list-2G34KVD5.js} +7 -7
- package/dist/{tax-region-create-PSQRQ3UC.js → tax-region-create-5DDZ23QQ.js} +1 -1
- package/dist/{tax-region-detail-KCJTJZZI.js → tax-region-detail-VNBNS7FS.js} +6 -6
- package/dist/{tax-region-list-LP6SV4BF.js → tax-region-list-WCHVLVVC.js} +3 -3
- package/dist/{tax-region-province-detail-IQ3IRVIE.js → tax-region-province-detail-MXYZMUX7.js} +6 -6
- package/dist/{tax-region-tax-override-create-2MNB5QSB.js → tax-region-tax-override-create-VIOPM26G.js} +5 -5
- package/dist/{tax-region-tax-override-edit-JCG5D2HY.js → tax-region-tax-override-edit-5FW6YCCW.js} +5 -5
- package/dist/{user-detail-3KQDH6LZ.js → user-detail-LGIMHLY4.js} +3 -3
- package/dist/{user-invite-ZAGFYQDN.js → user-invite-ZZSWFXFM.js} +4 -4
- package/dist/{user-list-7PIKWZQY.js → user-list-5QJJS7EA.js} +7 -7
- package/package.json +2 -2
- package/dist/chunk-NCYTM57J.js +0 -160
package/dist/chunk-NCYTM57J.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
// src/components/inputs/chip-input/chip-input.tsx
|
|
2
|
-
import { XMarkMini } from "@medusajs/icons";
|
|
3
|
-
import { Badge, clx } from "@medusajs/ui";
|
|
4
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
5
|
-
import {
|
|
6
|
-
forwardRef,
|
|
7
|
-
useImperativeHandle,
|
|
8
|
-
useRef,
|
|
9
|
-
useState
|
|
10
|
-
} from "react";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
var ChipInput = forwardRef(
|
|
13
|
-
({
|
|
14
|
-
value,
|
|
15
|
-
onChange,
|
|
16
|
-
onBlur,
|
|
17
|
-
disabled,
|
|
18
|
-
name,
|
|
19
|
-
showRemove = true,
|
|
20
|
-
variant = "base",
|
|
21
|
-
allowDuplicates = false,
|
|
22
|
-
placeholder,
|
|
23
|
-
className
|
|
24
|
-
}, ref) => {
|
|
25
|
-
const innerRef = useRef(null);
|
|
26
|
-
const isControlledRef = useRef(typeof value !== "undefined");
|
|
27
|
-
const isControlled = isControlledRef.current;
|
|
28
|
-
const [uncontrolledValue, setUncontrolledValue] = useState([]);
|
|
29
|
-
useImperativeHandle(
|
|
30
|
-
ref,
|
|
31
|
-
() => innerRef.current
|
|
32
|
-
);
|
|
33
|
-
const [duplicateIndex, setDuplicateIndex] = useState(null);
|
|
34
|
-
const chips = isControlled ? value : uncontrolledValue;
|
|
35
|
-
const handleAddChip = (chip) => {
|
|
36
|
-
const cleanValue = chip.trim();
|
|
37
|
-
if (!cleanValue) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!allowDuplicates && chips.includes(cleanValue)) {
|
|
41
|
-
setDuplicateIndex(chips.indexOf(cleanValue));
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
setDuplicateIndex(null);
|
|
44
|
-
}, 300);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
onChange?.([...chips, cleanValue]);
|
|
48
|
-
if (!isControlled) {
|
|
49
|
-
setUncontrolledValue([...chips, cleanValue]);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const handleRemoveChip = (chip) => {
|
|
53
|
-
onChange?.(chips.filter((v) => v !== chip));
|
|
54
|
-
if (!isControlled) {
|
|
55
|
-
setUncontrolledValue(chips.filter((v) => v !== chip));
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const handleBlur = (e) => {
|
|
59
|
-
onBlur?.();
|
|
60
|
-
if (e.target.value) {
|
|
61
|
-
handleAddChip(e.target.value);
|
|
62
|
-
e.target.value = "";
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const handleKeyDown = (e) => {
|
|
66
|
-
if (e.key === "Enter" || e.key === ",") {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
if (!innerRef.current?.value) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
handleAddChip(innerRef.current?.value ?? "");
|
|
72
|
-
innerRef.current.value = "";
|
|
73
|
-
innerRef.current?.focus();
|
|
74
|
-
}
|
|
75
|
-
if (e.key === "Backspace" && innerRef.current?.value === "") {
|
|
76
|
-
handleRemoveChip(chips[chips.length - 1]);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const shake = {
|
|
80
|
-
x: [0, -2, 2, -2, 2, 0],
|
|
81
|
-
transition: { duration: 0.3 }
|
|
82
|
-
};
|
|
83
|
-
return /* @__PURE__ */ jsxs(
|
|
84
|
-
"div",
|
|
85
|
-
{
|
|
86
|
-
className: clx(
|
|
87
|
-
"shadow-borders-base flex min-h-8 flex-wrap items-center gap-1 rounded-md px-2 py-1.5",
|
|
88
|
-
"transition-fg focus-within:shadow-borders-interactive-with-active",
|
|
89
|
-
"has-[input:disabled]:bg-ui-bg-disabled has-[input:disabled]:text-ui-fg-disabled has-[input:disabled]:cursor-not-allowed",
|
|
90
|
-
{
|
|
91
|
-
"bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover": variant === "contrast",
|
|
92
|
-
"bg-ui-bg-field hover:bg-ui-bg-field-hover": variant === "base"
|
|
93
|
-
},
|
|
94
|
-
className
|
|
95
|
-
),
|
|
96
|
-
tabIndex: -1,
|
|
97
|
-
onClick: () => innerRef.current?.focus(),
|
|
98
|
-
children: [
|
|
99
|
-
chips.map((v, index) => {
|
|
100
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(
|
|
101
|
-
Badge,
|
|
102
|
-
{
|
|
103
|
-
size: "2xsmall",
|
|
104
|
-
className: clx("gap-x-0.5 pl-1.5 pr-1.5", {
|
|
105
|
-
"transition-fg pr-1": showRemove,
|
|
106
|
-
"shadow-borders-focus": index === duplicateIndex
|
|
107
|
-
}),
|
|
108
|
-
asChild: true,
|
|
109
|
-
children: /* @__PURE__ */ jsxs(
|
|
110
|
-
motion.div,
|
|
111
|
-
{
|
|
112
|
-
animate: index === duplicateIndex ? shake : void 0,
|
|
113
|
-
children: [
|
|
114
|
-
v,
|
|
115
|
-
showRemove && /* @__PURE__ */ jsx(
|
|
116
|
-
"button",
|
|
117
|
-
{
|
|
118
|
-
tabIndex: -1,
|
|
119
|
-
type: "button",
|
|
120
|
-
onClick: () => handleRemoveChip(v),
|
|
121
|
-
className: clx(
|
|
122
|
-
"text-ui-fg-subtle transition-fg outline-none"
|
|
123
|
-
),
|
|
124
|
-
children: /* @__PURE__ */ jsx(XMarkMini, {})
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
) }, `${v}-${index}`);
|
|
132
|
-
}),
|
|
133
|
-
/* @__PURE__ */ jsx(
|
|
134
|
-
"input",
|
|
135
|
-
{
|
|
136
|
-
className: clx(
|
|
137
|
-
"caret-ui-fg-base text-ui-fg-base txt-compact-small flex-1 appearance-none bg-transparent",
|
|
138
|
-
"disabled:text-ui-fg-disabled disabled:cursor-not-allowed",
|
|
139
|
-
"focus:outline-none",
|
|
140
|
-
"placeholder:text-ui-fg-muted"
|
|
141
|
-
),
|
|
142
|
-
onKeyDown: handleKeyDown,
|
|
143
|
-
onBlur: handleBlur,
|
|
144
|
-
disabled,
|
|
145
|
-
name,
|
|
146
|
-
ref: innerRef,
|
|
147
|
-
placeholder: chips.length === 0 ? placeholder : void 0,
|
|
148
|
-
autoComplete: "off"
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
ChipInput.displayName = "ChipInput";
|
|
157
|
-
|
|
158
|
-
export {
|
|
159
|
-
ChipInput
|
|
160
|
-
};
|