seppia 0.1.0 → 0.3.0
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/README.md +85 -60
- package/dist/blocks/ai-chat.cjs +19 -0
- package/dist/blocks/ai-chat.d.cts +1 -0
- package/dist/blocks/ai-chat.d.ts +1 -0
- package/dist/blocks/ai-chat.js +10 -0
- package/dist/blocks/app-shell.cjs +49 -0
- package/dist/blocks/app-shell.d.cts +1 -0
- package/dist/blocks/app-shell.d.ts +1 -0
- package/dist/blocks/app-shell.js +16 -0
- package/dist/blocks/auth.cjs +58 -0
- package/dist/blocks/auth.d.cts +1 -0
- package/dist/blocks/auth.d.ts +1 -0
- package/dist/blocks/auth.js +13 -0
- package/dist/blocks/dashboard.cjs +23 -0
- package/dist/blocks/dashboard.d.cts +1 -0
- package/dist/blocks/dashboard.d.ts +1 -0
- package/dist/blocks/dashboard.js +10 -0
- package/dist/blocks/data-table.cjs +29 -0
- package/dist/blocks/data-table.d.cts +1 -0
- package/dist/blocks/data-table.d.ts +1 -0
- package/dist/blocks/data-table.js +20 -0
- package/dist/blocks/forms.cjs +33 -0
- package/dist/blocks/forms.d.cts +1 -0
- package/dist/blocks/forms.d.ts +1 -0
- package/dist/blocks/forms.js +16 -0
- package/dist/blocks/kanban.cjs +16 -0
- package/dist/blocks/kanban.d.cts +1 -0
- package/dist/blocks/kanban.d.ts +1 -0
- package/dist/blocks/kanban.js +7 -0
- package/dist/blocks/modals.cjs +33 -0
- package/dist/blocks/modals.d.cts +1 -0
- package/dist/blocks/modals.d.ts +1 -0
- package/dist/blocks/modals.js +16 -0
- package/dist/blocks/notifications.cjs +37 -0
- package/dist/blocks/notifications.d.cts +1 -0
- package/dist/blocks/notifications.d.ts +1 -0
- package/dist/blocks/notifications.js +16 -0
- package/dist/blocks/permissions.cjs +21 -0
- package/dist/blocks/permissions.d.cts +1 -0
- package/dist/blocks/permissions.d.ts +1 -0
- package/dist/blocks/permissions.js +12 -0
- package/dist/blocks/scheduling.cjs +24 -0
- package/dist/blocks/scheduling.d.cts +1 -0
- package/dist/blocks/scheduling.d.ts +1 -0
- package/dist/blocks/scheduling.js +7 -0
- package/dist/chunk-22XE2ZSK.js +115 -0
- package/dist/{chunk-T7AMVHIB.js → chunk-2AS3PZ62.js} +10 -9
- package/dist/{chunk-VHXWP5OX.cjs → chunk-2DW7PF2P.cjs} +22 -21
- package/dist/chunk-2HMUVVUR.cjs +45 -0
- package/dist/chunk-2IBDXUBG.js +2 -0
- package/dist/chunk-2L7GUYB2.js +152 -0
- package/dist/{chunk-AFGJQET4.js → chunk-2MX7EYXA.js} +16 -15
- package/dist/chunk-2UB2HKMF.cjs +131 -0
- package/dist/chunk-2YB44UOW.js +2 -0
- package/dist/chunk-32OCNZWB.js +2 -0
- package/dist/chunk-3BC4NA2C.cjs +126 -0
- package/dist/chunk-3ENS37RT.cjs +373 -0
- package/dist/{chunk-4YGBUMQC.js → chunk-3FLWYYDS.js} +13 -12
- package/dist/{chunk-EUQ6BCML.cjs → chunk-3GGOAJIG.cjs} +16 -15
- package/dist/chunk-3HME5VXL.cjs +3 -0
- package/dist/chunk-3S3MBTXC.cjs +3 -0
- package/dist/chunk-3WWOK2IV.cjs +104 -0
- package/dist/{chunk-6EABLOB7.js → chunk-3YOPOWUB.js} +9 -8
- package/dist/chunk-3Z5M2WVW.cjs +3 -0
- package/dist/chunk-43N5QL6C.cjs +3 -0
- package/dist/{chunk-WGFJLFTP.js → chunk-4C7VKLTU.js} +8 -1
- package/dist/chunk-4GLMIQUX.js +275 -0
- package/dist/{chunk-XLZPYDNI.js → chunk-4MTRY6D2.js} +15 -14
- package/dist/{chunk-NN3HMY7H.cjs → chunk-4Q6LY3TN.cjs} +24 -25
- package/dist/chunk-4STGAE4T.js +2 -0
- package/dist/chunk-4YXWES4C.cjs +81 -0
- package/dist/{chunk-GJ6WO63L.js → chunk-54SA4YJ7.js} +14 -13
- package/dist/chunk-5A46EAUE.js +42 -0
- package/dist/chunk-5CKY3233.js +2 -0
- package/dist/{chunk-QPWVBVDC.cjs → chunk-5IGY4W4T.cjs} +20 -19
- package/dist/chunk-5KNKWEIE.cjs +564 -0
- package/dist/chunk-5OOVB2S5.cjs +244 -0
- package/dist/{chunk-6FF73V3S.js → chunk-64WDKM52.js} +8 -7
- package/dist/chunk-6CZIXWOU.js +2 -0
- package/dist/{chunk-CCDDQHCS.js → chunk-6HPGI7VU.js} +13 -12
- package/dist/chunk-6HZLPZ5A.js +146 -0
- package/dist/chunk-6IH2PZO5.js +122 -0
- package/dist/{chunk-UFU5S3LK.cjs → chunk-6JZYZDCV.cjs} +11 -10
- package/dist/{chunk-ZF5HY2K4.cjs → chunk-6K3RXUKZ.cjs} +17 -16
- package/dist/chunk-6MJYJC3V.cjs +3 -0
- package/dist/{chunk-IUSSIILO.cjs → chunk-6OA3BX3U.cjs} +40 -39
- package/dist/chunk-6PE3ZGPD.cjs +239 -0
- package/dist/chunk-6QQPGNNK.js +2 -0
- package/dist/{chunk-SDWRKTFC.cjs → chunk-6W3OO6DK.cjs} +10 -9
- package/dist/chunk-744QNW5E.js +77 -0
- package/dist/chunk-7DCJW7LC.cjs +146 -0
- package/dist/chunk-7OOBMBHB.js +34 -0
- package/dist/chunk-7PWTWLXL.cjs +3 -0
- package/dist/chunk-7RZVSATZ.js +83 -0
- package/dist/chunk-7S3BMPK6.js +262 -0
- package/dist/chunk-7V6SXPFO.cjs +164 -0
- package/dist/chunk-7WZL3ZII.js +124 -0
- package/dist/chunk-7XYHI3LD.cjs +3 -0
- package/dist/chunk-A2QD7OLJ.js +213 -0
- package/dist/chunk-A3M6ALHJ.js +2 -0
- package/dist/{chunk-JV6GJ3JJ.js → chunk-AEQ6DMPS.js} +21 -20
- package/dist/chunk-APFW2I3Q.js +38 -0
- package/dist/chunk-AXWQJPZL.js +222 -0
- package/dist/chunk-B3D6KWG3.cjs +11 -0
- package/dist/{chunk-7B2YEOYF.js → chunk-B5Z4XIIF.js} +4 -4
- package/dist/chunk-BQUUTWTZ.cjs +129 -0
- package/dist/chunk-BRHXMXA7.cjs +3 -0
- package/dist/chunk-CIMKUKAG.cjs +3 -0
- package/dist/{chunk-GP32TY6P.cjs → chunk-CM7W446Z.cjs} +37 -36
- package/dist/chunk-CQZU4EHR.cjs +263 -0
- package/dist/{chunk-SSARMSS3.cjs → chunk-DKTUKZ5A.cjs} +22 -21
- package/dist/{chunk-AG3OBSP5.cjs → chunk-DLS6YGNX.cjs} +16 -15
- package/dist/chunk-DO4CSXWD.js +2 -0
- package/dist/chunk-DQQLYUXT.cjs +36 -0
- package/dist/chunk-DU2E5QXZ.js +2 -0
- package/dist/chunk-E2IMDHN3.cjs +286 -0
- package/dist/chunk-EAIDRCQS.js +2 -0
- package/dist/{chunk-AHRXESD2.js → chunk-EAQYTXY7.js} +15 -14
- package/dist/chunk-ECJ6AOAB.js +542 -0
- package/dist/chunk-EJV27E62.cjs +3 -0
- package/dist/chunk-ESHVB27V.cjs +3 -0
- package/dist/chunk-FDFQRXGC.cjs +3 -0
- package/dist/chunk-FG53BXIR.js +2 -0
- package/dist/{chunk-EYO4XMKU.js → chunk-FLLU5FAE.js} +10 -34
- package/dist/{chunk-EOPY2VWT.cjs → chunk-FO7ZZP52.cjs} +17 -16
- package/dist/chunk-FVVH37UH.js +57 -0
- package/dist/chunk-FXCVPRHV.cjs +52 -0
- package/dist/chunk-FXQKHROS.cjs +3 -0
- package/dist/chunk-GASIBRAJ.js +650 -0
- package/dist/{chunk-PBMXL53R.cjs → chunk-GHC7MKBR.cjs} +0 -8
- package/dist/chunk-GK7BIWGS.cjs +149 -0
- package/dist/{chunk-DO5WEBTN.cjs → chunk-GROWBVU5.cjs} +12 -11
- package/dist/{chunk-RFCZJPGM.js → chunk-GSF7YUXO.js} +7 -6
- package/dist/{chunk-4IHNW52F.cjs → chunk-GTU6TD5Q.cjs} +19 -19
- package/dist/chunk-HN3FTZJN.cjs +3 -0
- package/dist/chunk-HNALBJPN.cjs +36 -0
- package/dist/chunk-HSZEON5G.js +351 -0
- package/dist/chunk-HV4PLJGS.js +2 -0
- package/dist/{chunk-66ITQTT2.js → chunk-HWHAD4OZ.js} +10 -9
- package/dist/{chunk-YDJMVDAJ.cjs → chunk-I2QUKJX7.cjs} +19 -18
- package/dist/chunk-I2RCFWV3.cjs +174 -0
- package/dist/chunk-I3GJQHNE.cjs +144 -0
- package/dist/{chunk-CPUW5LDN.cjs → chunk-I3HEEAHX.cjs} +5 -5
- package/dist/chunk-I4VXNHO7.cjs +115 -0
- package/dist/chunk-IA664Z6A.js +2 -0
- package/dist/chunk-IEI6INUF.js +2 -0
- package/dist/chunk-IJSWK5ST.cjs +3 -0
- package/dist/chunk-IPNKP4DH.cjs +297 -0
- package/dist/{chunk-3XIEBFVO.cjs → chunk-IT27FHWR.cjs} +14 -13
- package/dist/chunk-IUZBQ5G2.cjs +3 -0
- package/dist/chunk-J2JRWEOR.js +2 -0
- package/dist/chunk-JC6MXMQZ.cjs +109 -0
- package/dist/chunk-JD4NHZXF.js +2 -0
- package/dist/chunk-JGIKKJAS.cjs +16 -0
- package/dist/{chunk-NU5MGYFP.cjs → chunk-JUMI5UBA.cjs} +18 -42
- package/dist/chunk-JXPOKP66.js +2 -0
- package/dist/chunk-JZUEW7WR.js +2 -0
- package/dist/{chunk-F7UECO7G.js → chunk-K2CVKVIF.js} +15 -15
- package/dist/{chunk-RIBXHAKG.cjs → chunk-K6MCWJ35.cjs} +15 -14
- package/dist/chunk-K6X6O42N.js +9 -0
- package/dist/{chunk-76MEQHGW.js → chunk-KA24K3XP.js} +18 -17
- package/dist/chunk-KEISLNT6.cjs +3 -0
- package/dist/{chunk-5Z32CAHE.cjs → chunk-KLJ4DMH2.cjs} +22 -21
- package/dist/chunk-KO5DJXD4.js +2 -0
- package/dist/chunk-KVDIEAWQ.cjs +3 -0
- package/dist/{chunk-I525FOTN.cjs → chunk-KVFBDLSA.cjs} +23 -22
- package/dist/chunk-KVXARKY4.js +136 -0
- package/dist/chunk-KXCKL4P2.cjs +3 -0
- package/dist/chunk-KZKDZRZJ.cjs +3 -0
- package/dist/chunk-KZOXFNUE.cjs +44 -0
- package/dist/chunk-L5JDNZS3.cjs +299 -0
- package/dist/chunk-L5P5R7QQ.cjs +3 -0
- package/dist/chunk-L5YN6PRP.js +2 -0
- package/dist/{chunk-SMY24MVU.js → chunk-LD3DXOQ7.js} +1 -1
- package/dist/{chunk-QWYHH465.cjs → chunk-LRI6V2NK.cjs} +2 -2
- package/dist/{chunk-ZZYMYQU2.js → chunk-LVE2WXGB.js} +18 -17
- package/dist/chunk-M4U2IWVW.js +54 -0
- package/dist/chunk-MCK6WCG2.cjs +168 -0
- package/dist/{chunk-AJPI65BL.cjs → chunk-MCQYUABH.cjs} +20 -19
- package/dist/chunk-MFFNV55T.cjs +223 -0
- package/dist/chunk-MGUOCT7T.cjs +1047 -0
- package/dist/{chunk-M42F5QS5.cjs → chunk-MHIFGXVD.cjs} +10 -9
- package/dist/chunk-MHS4TQAK.cjs +77 -0
- package/dist/chunk-MK7U7I4G.js +2 -0
- package/dist/chunk-MNDB6QKQ.js +2 -0
- package/dist/chunk-MO5QNNWF.cjs +99 -0
- package/dist/chunk-MQR6Y7I3.cjs +3 -0
- package/dist/chunk-MVAFOPND.cjs +3 -0
- package/dist/chunk-MX54ZBNC.js +108 -0
- package/dist/{chunk-IAPRIVJO.js → chunk-MYTU26NE.js} +10 -9
- package/dist/chunk-N4KGLSBT.cjs +85 -0
- package/dist/chunk-N64ZJPCO.cjs +3 -0
- package/dist/chunk-NGKH2EEJ.cjs +326 -0
- package/dist/{chunk-PGEK6DFE.cjs → chunk-NIT46ZG7.cjs} +26 -25
- package/dist/{chunk-I2XZ2WMY.js → chunk-NJEGW6SX.js} +32 -31
- package/dist/{chunk-ZXKEYL6L.js → chunk-NJYCQEIR.js} +11 -10
- package/dist/chunk-NNDDH7H7.cjs +91 -0
- package/dist/chunk-NTKJSGK3.cjs +3 -0
- package/dist/chunk-NUQUDBTT.js +142 -0
- package/dist/chunk-NYRO7BWG.cjs +283 -0
- package/dist/chunk-OGVNBCOT.cjs +3 -0
- package/dist/{chunk-HQLB5Z37.cjs → chunk-OLWS65QZ.cjs} +22 -21
- package/dist/chunk-OO5T2XLL.js +13 -0
- package/dist/chunk-OYCYKMKG.js +2 -0
- package/dist/chunk-PDP4YT3H.js +61 -0
- package/dist/chunk-PIXN6IV7.js +2 -0
- package/dist/{chunk-DAO7YH2R.cjs → chunk-POKS6BSL.cjs} +13 -12
- package/dist/{chunk-Y3UCNSXF.js → chunk-PSMIDELA.js} +15 -14
- package/dist/chunk-PT736HBJ.js +27 -0
- package/dist/{chunk-HSXGQNQ6.js → chunk-PWKKLWBX.js} +10 -9
- package/dist/chunk-PWV4XF5I.js +198 -0
- package/dist/chunk-Q6ZVUGRJ.js +2 -0
- package/dist/chunk-Q7PT2DJ7.js +22 -0
- package/dist/chunk-QCUKTEYH.cjs +3 -0
- package/dist/{chunk-6LRDNOZX.cjs → chunk-QHFMQWSO.cjs} +9 -8
- package/dist/chunk-QNLWPVUI.cjs +149 -0
- package/dist/chunk-QVTEK35C.js +22 -0
- package/dist/chunk-QYR4WKJI.js +124 -0
- package/dist/chunk-R6MVKE2B.cjs +331 -0
- package/dist/chunk-R7T6GOUN.cjs +3 -0
- package/dist/chunk-RDU664LO.js +253 -0
- package/dist/{chunk-T533JPW5.js → chunk-RZNIXIJU.js} +18 -17
- package/dist/chunk-RZUCUWKB.js +104 -0
- package/dist/chunk-RZXU6H5L.js +202 -0
- package/dist/chunk-SELSORIZ.js +2 -0
- package/dist/chunk-SMK542RT.js +273 -0
- package/dist/{chunk-DUUDPN7C.cjs → chunk-SS6DGMZY.cjs} +15 -14
- package/dist/chunk-SVUVXYWK.cjs +225 -0
- package/dist/chunk-SVZT7RT3.js +2 -0
- package/dist/chunk-T4DK7EUO.js +93 -0
- package/dist/chunk-T7M6256W.cjs +3 -0
- package/dist/chunk-TBSUIWGD.cjs +3 -0
- package/dist/chunk-TH7GDZUC.js +2 -0
- package/dist/{chunk-5PAJS63K.cjs → chunk-TLP4LLIX.cjs} +18 -17
- package/dist/chunk-TTUJ3IQK.cjs +225 -0
- package/dist/chunk-TTVLRRPE.js +241 -0
- package/dist/chunk-TWAJYDMC.cjs +3 -0
- package/dist/chunk-U3X4QBY4.js +2 -0
- package/dist/chunk-U7MANZTW.cjs +3 -0
- package/dist/chunk-UCWS7WMQ.cjs +677 -0
- package/dist/{chunk-TVGVZSIA.js → chunk-UGDDUI2N.js} +9 -8
- package/dist/chunk-UORTZAPR.js +2 -0
- package/dist/chunk-UTYMDSOE.cjs +3 -0
- package/dist/chunk-UWQGY3GT.cjs +60 -0
- package/dist/{chunk-LYYMITLC.js → chunk-UZS7VXCA.js} +20 -21
- package/dist/chunk-VACQZKYM.cjs +44 -0
- package/dist/{chunk-UFUN2OKY.js → chunk-VDQ3DWO4.js} +1 -8
- package/dist/chunk-VKYDWRL2.cjs +3 -0
- package/dist/chunk-VRFYJ4BN.js +80 -0
- package/dist/{chunk-5ARTY5RT.cjs → chunk-W3VOEVRS.cjs} +8 -0
- package/dist/chunk-W7OZ3DOL.js +14 -0
- package/dist/{chunk-LYEOVFOQ.cjs → chunk-WG4KHU2E.cjs} +24 -23
- package/dist/chunk-WHM3QKTO.js +1012 -0
- package/dist/chunk-WINVYCMX.js +380 -0
- package/dist/{chunk-WVWVJSU2.cjs → chunk-WPTNMFHO.cjs} +18 -17
- package/dist/chunk-WVZMSS2Z.cjs +411 -0
- package/dist/chunk-WX7H4YUM.js +2 -0
- package/dist/chunk-X355AHLF.js +2 -0
- package/dist/chunk-X47PLMHL.js +304 -0
- package/dist/chunk-X7WVGTJK.js +2 -0
- package/dist/chunk-XL2A3RFS.js +202 -0
- package/dist/{chunk-LGBMJIY6.js → chunk-XQMLBUHW.js} +16 -15
- package/dist/chunk-XSTQSKRP.cjs +3 -0
- package/dist/chunk-Y36NEYSP.js +255 -0
- package/dist/chunk-Y3UDKEIY.cjs +3 -0
- package/dist/chunk-Y5PAW326.cjs +142 -0
- package/dist/{chunk-2Z4YKJMT.js → chunk-YEQVN7I3.js} +24 -23
- package/dist/chunk-YI6XXQMC.cjs +275 -0
- package/dist/{chunk-OCIKUJ3U.js → chunk-YJDQ3BQZ.js} +9 -8
- package/dist/{chunk-CGX6YCV6.js → chunk-YJR744JB.js} +12 -11
- package/dist/{chunk-7Y22U2ZF.js → chunk-YN2AVSEN.js} +33 -32
- package/dist/chunk-YNJA4HB2.js +307 -0
- package/dist/{chunk-WSL2OVTO.js → chunk-YRLEGHKB.js} +7 -6
- package/dist/{chunk-VDSMO63G.cjs → chunk-YTAX4ICP.cjs} +11 -10
- package/dist/chunk-YU7IOI63.js +2 -0
- package/dist/chunk-YUG4SGR5.js +68 -0
- package/dist/{chunk-VW32EE3I.js → chunk-YVGWCNLQ.js} +10 -9
- package/dist/chunk-Z6SMSENC.js +107 -0
- package/dist/{chunk-3NQ776G6.cjs → chunk-ZAQJBIYI.cjs} +19 -18
- package/dist/chunk-ZGKDMG7N.cjs +3 -0
- package/dist/{chunk-FGJDDSUJ.js → chunk-ZHGVBALA.js} +21 -20
- package/dist/chunk-ZIGUJXZM.js +2 -0
- package/dist/chunk-ZPYGXDFU.js +2 -0
- package/dist/{chunk-XUBFOAT4.js → chunk-ZSD56XUT.js} +17 -16
- package/dist/{chunk-2PABDSNH.cjs → chunk-ZX6JRBPY.cjs} +21 -20
- package/dist/components/accordion.cjs +8 -7
- package/dist/components/accordion.d.cts +1 -41
- package/dist/components/accordion.d.ts +1 -41
- package/dist/components/accordion.js +4 -3
- package/dist/components/ai.cjs +79 -0
- package/dist/components/ai.d.cts +1 -0
- package/dist/components/ai.d.ts +1 -0
- package/dist/components/ai.js +10 -0
- package/dist/components/alert.cjs +14 -0
- package/dist/components/alert.d.cts +1 -0
- package/dist/components/alert.d.ts +1 -0
- package/dist/components/alert.js +5 -0
- package/dist/components/avatar.cjs +21 -0
- package/dist/components/avatar.d.cts +1 -0
- package/dist/components/avatar.d.ts +1 -0
- package/dist/components/avatar.js +4 -0
- package/dist/components/badge.cjs +13 -0
- package/dist/components/badge.d.cts +1 -0
- package/dist/components/badge.d.ts +1 -0
- package/dist/components/badge.js +4 -0
- package/dist/components/bar-chart.cjs +17 -0
- package/dist/components/bar-chart.d.cts +1 -0
- package/dist/components/bar-chart.d.ts +1 -0
- package/dist/components/bar-chart.js +8 -0
- package/dist/components/breadcrumbs.cjs +17 -0
- package/dist/components/breadcrumbs.d.cts +1 -0
- package/dist/components/breadcrumbs.d.ts +1 -0
- package/dist/components/breadcrumbs.js +4 -0
- package/dist/components/button.cjs +18 -0
- package/dist/components/button.d.cts +1 -0
- package/dist/components/button.d.ts +1 -0
- package/dist/components/button.js +5 -0
- package/dist/components/calendar.cjs +6 -4
- package/dist/components/calendar.d.cts +1 -41
- package/dist/components/calendar.d.ts +1 -41
- package/dist/components/calendar.js +5 -3
- package/dist/components/card.cjs +25 -0
- package/dist/components/card.d.cts +1 -0
- package/dist/components/card.d.ts +1 -0
- package/dist/components/card.js +4 -0
- package/dist/components/chart.cjs +84 -0
- package/dist/components/chart.d.cts +1 -0
- package/dist/components/chart.d.ts +1 -0
- package/dist/components/chart.js +7 -0
- package/dist/components/checkbox.cjs +6 -4
- package/dist/components/checkbox.d.cts +1 -27
- package/dist/components/checkbox.d.ts +1 -27
- package/dist/components/checkbox.js +5 -3
- package/dist/components/chip-select.cjs +5 -4
- package/dist/components/chip-select.d.cts +1 -31
- package/dist/components/chip-select.d.ts +1 -31
- package/dist/components/chip-select.js +4 -3
- package/dist/components/clock.cjs +4 -3
- package/dist/components/clock.d.cts +1 -25
- package/dist/components/clock.d.ts +1 -25
- package/dist/components/clock.js +3 -2
- package/dist/components/color-picker.cjs +4 -3
- package/dist/components/color-picker.d.cts +1 -23
- package/dist/components/color-picker.d.ts +1 -23
- package/dist/components/color-picker.js +3 -2
- package/dist/components/command-palette.cjs +8 -7
- package/dist/components/command-palette.d.cts +1 -53
- package/dist/components/command-palette.d.ts +1 -53
- package/dist/components/command-palette.js +6 -5
- package/dist/components/date-picker.cjs +12 -8
- package/dist/components/date-picker.d.cts +1 -40
- package/dist/components/date-picker.d.ts +1 -40
- package/dist/components/date-picker.js +11 -7
- package/dist/components/dialog.cjs +23 -0
- package/dist/components/dialog.d.cts +1 -0
- package/dist/components/dialog.d.ts +1 -0
- package/dist/components/dialog.js +10 -0
- package/dist/components/donut-chart.cjs +21 -0
- package/dist/components/donut-chart.d.cts +1 -0
- package/dist/components/donut-chart.d.ts +1 -0
- package/dist/components/donut-chart.js +8 -0
- package/dist/components/drawer.cjs +7 -6
- package/dist/components/drawer.d.cts +1 -22
- package/dist/components/drawer.d.ts +1 -22
- package/dist/components/drawer.js +6 -5
- package/dist/components/empty-state.cjs +25 -0
- package/dist/components/empty-state.d.cts +1 -0
- package/dist/components/empty-state.d.ts +1 -0
- package/dist/components/empty-state.js +4 -0
- package/dist/components/floating-panel.cjs +5 -4
- package/dist/components/floating-panel.d.cts +1 -25
- package/dist/components/floating-panel.d.ts +1 -25
- package/dist/components/floating-panel.js +4 -3
- package/dist/components/heatmap.cjs +17 -0
- package/dist/components/heatmap.d.cts +1 -0
- package/dist/components/heatmap.d.ts +1 -0
- package/dist/components/heatmap.js +8 -0
- package/dist/components/hold-button.cjs +5 -4
- package/dist/components/hold-button.d.cts +1 -30
- package/dist/components/hold-button.d.ts +1 -30
- package/dist/components/hold-button.js +4 -3
- package/dist/components/knob.cjs +5 -4
- package/dist/components/knob.d.cts +1 -33
- package/dist/components/knob.d.ts +1 -33
- package/dist/components/knob.js +4 -3
- package/dist/components/line-chart.cjs +17 -0
- package/dist/components/line-chart.d.cts +1 -0
- package/dist/components/line-chart.d.ts +1 -0
- package/dist/components/line-chart.js +8 -0
- package/dist/components/magnetic-button.cjs +5 -4
- package/dist/components/magnetic-button.d.cts +1 -23
- package/dist/components/magnetic-button.d.ts +1 -23
- package/dist/components/magnetic-button.js +4 -3
- package/dist/components/mascots.cjs +33 -0
- package/dist/components/mascots.d.cts +1 -0
- package/dist/components/mascots.d.ts +1 -0
- package/dist/components/mascots.js +4 -0
- package/dist/components/menu.cjs +23 -0
- package/dist/components/menu.d.cts +1 -0
- package/dist/components/menu.d.ts +1 -0
- package/dist/components/menu.js +10 -0
- package/dist/components/morph-button.cjs +5 -4
- package/dist/components/morph-button.d.cts +1 -34
- package/dist/components/morph-button.d.ts +1 -34
- package/dist/components/morph-button.js +4 -3
- package/dist/components/morph-dialog.cjs +11 -10
- package/dist/components/morph-dialog.d.cts +1 -30
- package/dist/components/morph-dialog.d.ts +1 -30
- package/dist/components/morph-dialog.js +6 -5
- package/dist/components/number-field.cjs +5 -4
- package/dist/components/number-field.d.cts +1 -32
- package/dist/components/number-field.d.ts +1 -32
- package/dist/components/number-field.js +4 -3
- package/dist/components/pagination.cjs +19 -0
- package/dist/components/pagination.d.cts +1 -0
- package/dist/components/pagination.d.ts +1 -0
- package/dist/components/pagination.js +6 -0
- package/dist/components/pin-input.cjs +6 -4
- package/dist/components/pin-input.d.cts +1 -29
- package/dist/components/pin-input.d.ts +1 -29
- package/dist/components/pin-input.js +5 -3
- package/dist/components/popover.cjs +9 -6
- package/dist/components/popover.d.cts +1 -26
- package/dist/components/popover.d.ts +1 -26
- package/dist/components/popover.js +8 -5
- package/dist/components/progress.cjs +5 -4
- package/dist/components/progress.d.cts +1 -39
- package/dist/components/progress.d.ts +1 -39
- package/dist/components/progress.js +3 -2
- package/dist/components/radial-menu.cjs +6 -5
- package/dist/components/radial-menu.d.cts +1 -31
- package/dist/components/radial-menu.d.ts +1 -31
- package/dist/components/radial-menu.js +5 -4
- package/dist/components/radio-group.cjs +5 -4
- package/dist/components/radio-group.d.cts +1 -34
- package/dist/components/radio-group.d.ts +1 -34
- package/dist/components/radio-group.js +4 -3
- package/dist/components/resizable-panels.cjs +6 -5
- package/dist/components/resizable-panels.d.cts +1 -24
- package/dist/components/resizable-panels.d.ts +1 -24
- package/dist/components/resizable-panels.js +4 -3
- package/dist/components/segmented-control.cjs +6 -4
- package/dist/components/segmented-control.d.cts +1 -34
- package/dist/components/segmented-control.d.ts +1 -34
- package/dist/components/segmented-control.js +5 -3
- package/dist/components/select.cjs +20 -0
- package/dist/components/select.d.cts +1 -0
- package/dist/components/select.d.ts +1 -0
- package/dist/components/select.js +11 -0
- package/dist/components/skeleton.cjs +17 -0
- package/dist/components/skeleton.d.cts +1 -0
- package/dist/components/skeleton.d.ts +1 -0
- package/dist/components/skeleton.js +4 -0
- package/dist/components/slider.cjs +5 -4
- package/dist/components/slider.d.cts +1 -39
- package/dist/components/slider.d.ts +1 -39
- package/dist/components/slider.js +4 -3
- package/dist/components/sortable-list.cjs +5 -4
- package/dist/components/sortable-list.d.cts +1 -24
- package/dist/components/sortable-list.d.ts +1 -24
- package/dist/components/sortable-list.js +4 -3
- package/dist/components/sparkline.cjs +5 -4
- package/dist/components/sparkline.d.cts +1 -28
- package/dist/components/sparkline.d.ts +1 -28
- package/dist/components/sparkline.js +4 -3
- package/dist/components/stat.cjs +23 -0
- package/dist/components/stat.d.cts +1 -0
- package/dist/components/stat.d.ts +1 -0
- package/dist/components/stat.js +6 -0
- package/dist/components/stepper.cjs +14 -0
- package/dist/components/stepper.d.cts +1 -0
- package/dist/components/stepper.d.ts +1 -0
- package/dist/components/stepper.js +5 -0
- package/dist/components/swipe-confirm.cjs +5 -4
- package/dist/components/swipe-confirm.d.cts +1 -18
- package/dist/components/swipe-confirm.d.ts +1 -18
- package/dist/components/swipe-confirm.js +4 -3
- package/dist/components/switch.cjs +6 -4
- package/dist/components/switch.d.cts +1 -29
- package/dist/components/switch.d.ts +1 -29
- package/dist/components/switch.js +5 -3
- package/dist/components/tabs.cjs +9 -8
- package/dist/components/tabs.d.cts +1 -29
- package/dist/components/tabs.d.ts +1 -29
- package/dist/components/tabs.js +4 -3
- package/dist/components/tether.cjs +5 -4
- package/dist/components/tether.d.cts +1 -35
- package/dist/components/tether.d.ts +1 -35
- package/dist/components/tether.js +3 -2
- package/dist/components/text-field.cjs +31 -0
- package/dist/components/text-field.d.cts +1 -0
- package/dist/components/text-field.d.ts +1 -0
- package/dist/components/text-field.js +6 -0
- package/dist/components/theme-switch.cjs +5 -4
- package/dist/components/theme-switch.d.cts +1 -24
- package/dist/components/theme-switch.d.ts +1 -24
- package/dist/components/theme-switch.js +4 -3
- package/dist/components/toaster.cjs +7 -6
- package/dist/components/toaster.d.cts +1 -71
- package/dist/components/toaster.d.ts +1 -71
- package/dist/components/toaster.js +4 -3
- package/dist/components/tooltip.cjs +17 -0
- package/dist/components/tooltip.d.cts +1 -0
- package/dist/components/tooltip.d.ts +1 -0
- package/dist/components/tooltip.js +8 -0
- package/dist/components/wheel-picker.cjs +5 -4
- package/dist/components/wheel-picker.d.cts +1 -27
- package/dist/components/wheel-picker.d.ts +1 -27
- package/dist/components/wheel-picker.js +4 -3
- package/dist/css/accordion.css +1 -1
- package/dist/css/ai-chat.css +2 -0
- package/dist/css/ai.css +2 -0
- package/dist/css/alert.css +2 -0
- package/dist/css/app-shell.css +2 -0
- package/dist/css/auth.css +2 -0
- package/dist/css/avatar.css +2 -0
- package/dist/css/badge.css +2 -0
- package/dist/css/base.css +1 -1
- package/dist/css/breadcrumbs.css +2 -0
- package/dist/css/button.css +2 -0
- package/dist/css/calendar.css +1 -1
- package/dist/css/card.css +2 -0
- package/dist/css/chart.css +2 -0
- package/dist/css/checkbox.css +1 -1
- package/dist/css/chip-select.css +1 -1
- package/dist/css/clock.css +1 -1
- package/dist/css/color-picker.css +1 -1
- package/dist/css/command-palette.css +1 -1
- package/dist/css/dashboard.css +2 -0
- package/dist/css/data-table.css +2 -0
- package/dist/css/date-picker.css +1 -1
- package/dist/css/dialog.css +2 -0
- package/dist/css/drawer.css +1 -1
- package/dist/css/empty-state.css +2 -0
- package/dist/css/floating-panel.css +1 -1
- package/dist/css/forms.css +2 -0
- package/dist/css/hold-button.css +1 -1
- package/dist/css/kanban.css +2 -0
- package/dist/css/knob.css +1 -1
- package/dist/css/magnetic-button.css +1 -1
- package/dist/css/mascots.css +2 -0
- package/dist/css/menu.css +2 -0
- package/dist/css/modals.css +2 -0
- package/dist/css/morph-button.css +1 -1
- package/dist/css/morph-dialog.css +1 -1
- package/dist/css/notifications.css +2 -0
- package/dist/css/number-field.css +1 -1
- package/dist/css/pagination.css +2 -0
- package/dist/css/permissions.css +2 -0
- package/dist/css/pin-input.css +1 -1
- package/dist/css/popover.css +1 -1
- package/dist/css/progress.css +1 -1
- package/dist/css/radial-menu.css +1 -1
- package/dist/css/radio-group.css +1 -1
- package/dist/css/resizable-panels.css +1 -1
- package/dist/css/scheduling.css +2 -0
- package/dist/css/segmented-control.css +1 -1
- package/dist/css/select.css +2 -0
- package/dist/css/skeleton.css +2 -0
- package/dist/css/slider.css +1 -1
- package/dist/css/sortable-list.css +1 -1
- package/dist/css/sparkline.css +1 -1
- package/dist/css/stepper.css +2 -0
- package/dist/css/swipe-confirm.css +1 -1
- package/dist/css/switch.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/template-auth.css +2 -0
- package/dist/css/template-calendar.css +2 -0
- package/dist/css/template-crm.css +2 -0
- package/dist/css/template-dashboard.css +2 -0
- package/dist/css/template-orders.css +2 -0
- package/dist/css/template-settings.css +2 -0
- package/dist/css/template-shared.css +2 -0
- package/dist/css/tether.css +1 -1
- package/dist/css/text-field.css +2 -0
- package/dist/css/theme-switch.css +1 -1
- package/dist/css/toaster.css +1 -1
- package/dist/css/tooltip.css +2 -0
- package/dist/css/wheel-picker.css +1 -1
- package/dist/index.cjs +687 -108
- package/dist/index.d.cts +3141 -36
- package/dist/index.d.ts +3141 -36
- package/dist/index.js +120 -37
- package/dist/styles.css +1 -1
- package/dist/templates/auth.cjs +22 -0
- package/dist/templates/auth.d.cts +1 -0
- package/dist/templates/auth.d.ts +1 -0
- package/dist/templates/auth.js +13 -0
- package/dist/templates/calendar.cjs +40 -0
- package/dist/templates/calendar.d.cts +1 -0
- package/dist/templates/calendar.d.ts +1 -0
- package/dist/templates/calendar.js +31 -0
- package/dist/templates/crm.cjs +43 -0
- package/dist/templates/crm.d.cts +1 -0
- package/dist/templates/crm.d.ts +1 -0
- package/dist/templates/crm.js +34 -0
- package/dist/templates/dashboard.cjs +46 -0
- package/dist/templates/dashboard.d.cts +1 -0
- package/dist/templates/dashboard.d.ts +1 -0
- package/dist/templates/dashboard.js +37 -0
- package/dist/templates/orders.cjs +45 -0
- package/dist/templates/orders.d.cts +1 -0
- package/dist/templates/orders.d.ts +1 -0
- package/dist/templates/orders.js +36 -0
- package/dist/templates/settings.cjs +47 -0
- package/dist/templates/settings.d.cts +1 -0
- package/dist/templates/settings.d.ts +1 -0
- package/dist/templates/settings.js +38 -0
- package/package.json +122 -98
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Portal } from './chunk-B5Z4XIIF.js';
|
|
3
|
+
import { useMotionPreset } from './chunk-VDQ3DWO4.js';
|
|
4
|
+
import { cx } from './chunk-K6X6O42N.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { LayoutGroup, motion } from 'motion/react';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function KanbanBoard({ columns, items, renderCard, onMove, onAdd, onItemClick, getItemLabel, className, ...rest }) {
|
|
10
|
+
const { reduced } = useMotionPreset();
|
|
11
|
+
const [drag, setDrag] = React.useState(null);
|
|
12
|
+
const [announce, setAnnounce] = React.useState("");
|
|
13
|
+
const colRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
14
|
+
const cardRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
15
|
+
const boardRef = React.useRef(null);
|
|
16
|
+
const pending = React.useRef(null);
|
|
17
|
+
const instructions = React.useId();
|
|
18
|
+
const groupId = React.useId();
|
|
19
|
+
const byCol = React.useMemo(() => {
|
|
20
|
+
const m = new Map(columns.map((c) => [c.id, []]));
|
|
21
|
+
for (const it of items) m.get(it.columnId)?.push(it);
|
|
22
|
+
return m;
|
|
23
|
+
}, [items, columns]);
|
|
24
|
+
const lists = React.useMemo(() => {
|
|
25
|
+
if (!drag) return byCol;
|
|
26
|
+
const m = /* @__PURE__ */ new Map();
|
|
27
|
+
const card = items.find((i) => i.id === drag.id);
|
|
28
|
+
for (const c of columns) m.set(c.id, (byCol.get(c.id) ?? []).filter((i) => i.id !== drag.id));
|
|
29
|
+
if (card) {
|
|
30
|
+
const list = m.get(drag.col) ?? [];
|
|
31
|
+
list.splice(Math.min(drag.index, list.length), 0, card);
|
|
32
|
+
m.set(drag.col, list);
|
|
33
|
+
}
|
|
34
|
+
return m;
|
|
35
|
+
}, [byCol, drag, items, columns]);
|
|
36
|
+
const titleOf = (colId) => columns.find((c) => c.id === colId)?.title ?? colId;
|
|
37
|
+
const positionText = (colId, index) => `${titleOf(colId)}, position ${index + 1} of ${(lists.get(colId)?.length ?? 0) || 1}`;
|
|
38
|
+
const hitTest = (x, y, d) => {
|
|
39
|
+
let col = d.col;
|
|
40
|
+
for (const [id, el] of colRefs.current) {
|
|
41
|
+
const r = el.getBoundingClientRect();
|
|
42
|
+
if (x >= r.left && x <= r.right) {
|
|
43
|
+
col = id;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const others = (byCol.get(col) ?? []).filter((i) => i.id !== d.id);
|
|
48
|
+
let index = others.length;
|
|
49
|
+
for (let i = 0; i < others.length; i++) {
|
|
50
|
+
const el = cardRefs.current.get(others[i].id);
|
|
51
|
+
if (!el) continue;
|
|
52
|
+
const r = el.getBoundingClientRect();
|
|
53
|
+
if (y < r.top + r.height / 2) {
|
|
54
|
+
index = i;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { col, index };
|
|
59
|
+
};
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
const onMoveEv = (e) => {
|
|
62
|
+
const p = pending.current;
|
|
63
|
+
if (p && !drag) {
|
|
64
|
+
if (Math.hypot(e.clientX - p.x, e.clientY - p.y) < 5) return;
|
|
65
|
+
const r = p.el.getBoundingClientRect();
|
|
66
|
+
const item = items.find((i) => i.id === p.id);
|
|
67
|
+
if (!item) return;
|
|
68
|
+
const index2 = (byCol.get(item.columnId) ?? []).findIndex((i) => i.id === p.id);
|
|
69
|
+
const d = { id: p.id, col: item.columnId, index: index2, x: e.clientX, y: e.clientY, dx: p.x - r.left, dy: p.y - r.top, w: r.width, h: r.height, via: "pointer", originCol: item.columnId, originIndex: index2 };
|
|
70
|
+
pending.current = null;
|
|
71
|
+
setDrag(d);
|
|
72
|
+
setAnnounce(`Picked up ${getItemLabel(item)}.`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!drag || drag.via !== "pointer") return;
|
|
76
|
+
const { col, index } = hitTest(e.clientX, e.clientY, drag);
|
|
77
|
+
const board = boardRef.current;
|
|
78
|
+
if (board) {
|
|
79
|
+
const br = board.getBoundingClientRect();
|
|
80
|
+
if (e.clientX > br.right - 48) board.scrollLeft += 12;
|
|
81
|
+
else if (e.clientX < br.left + 48) board.scrollLeft -= 12;
|
|
82
|
+
}
|
|
83
|
+
setDrag((d) => d ? { ...d, x: e.clientX, y: e.clientY, col, index } : d);
|
|
84
|
+
};
|
|
85
|
+
const onUp = () => {
|
|
86
|
+
const p = pending.current;
|
|
87
|
+
pending.current = null;
|
|
88
|
+
if (p && !drag) {
|
|
89
|
+
const it = items.find((i) => i.id === p.id);
|
|
90
|
+
if (it) onItemClick?.(it);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!drag || drag.via !== "pointer") return;
|
|
94
|
+
finish(drag);
|
|
95
|
+
};
|
|
96
|
+
window.addEventListener("pointermove", onMoveEv);
|
|
97
|
+
window.addEventListener("pointerup", onUp);
|
|
98
|
+
window.addEventListener("pointercancel", onUp);
|
|
99
|
+
return () => {
|
|
100
|
+
window.removeEventListener("pointermove", onMoveEv);
|
|
101
|
+
window.removeEventListener("pointerup", onUp);
|
|
102
|
+
window.removeEventListener("pointercancel", onUp);
|
|
103
|
+
};
|
|
104
|
+
}, [drag, items, byCol]);
|
|
105
|
+
const finish = (d) => {
|
|
106
|
+
const item = items.find((i) => i.id === d.id);
|
|
107
|
+
setDrag(null);
|
|
108
|
+
if (!item) return;
|
|
109
|
+
if (d.col !== d.originCol || d.index !== d.originIndex) {
|
|
110
|
+
onMove(d.id, d.col, d.index);
|
|
111
|
+
setAnnounce(`Dropped ${getItemLabel(item)} in ${positionText(d.col, d.index)}.`);
|
|
112
|
+
} else setAnnounce(`Dropped ${getItemLabel(item)} back in place.`);
|
|
113
|
+
};
|
|
114
|
+
const onCardKey = (e, item) => {
|
|
115
|
+
const k = e.key;
|
|
116
|
+
if (!drag) {
|
|
117
|
+
if (k === "Enter" && onItemClick) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
onItemClick(item);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (k === " " || k === "Enter") {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
const index = (byCol.get(item.columnId) ?? []).findIndex((i) => i.id === item.id);
|
|
125
|
+
setDrag({ id: item.id, col: item.columnId, index, x: 0, y: 0, dx: 0, dy: 0, w: 0, h: 0, via: "keyboard", originCol: item.columnId, originIndex: index });
|
|
126
|
+
setAnnounce(`Picked up ${getItemLabel(item)}. ${positionText(item.columnId, index)}. Use arrow keys to move, Space to drop, Escape to cancel.`);
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (drag.via !== "keyboard" || drag.id !== item.id) return;
|
|
131
|
+
const ci = columns.findIndex((c) => c.id === drag.col);
|
|
132
|
+
const len = (byCol.get(drag.col) ?? []).filter((i) => i.id !== drag.id).length;
|
|
133
|
+
let next = { col: drag.col, index: drag.index };
|
|
134
|
+
if (k === "ArrowDown") next.index = Math.min(len, drag.index + 1);
|
|
135
|
+
else if (k === "ArrowUp") next.index = Math.max(0, drag.index - 1);
|
|
136
|
+
else if (k === "ArrowRight" && ci < columns.length - 1) next = { col: columns[ci + 1].id, index: Math.min(drag.index, (byCol.get(columns[ci + 1].id) ?? []).filter((i) => i.id !== drag.id).length) };
|
|
137
|
+
else if (k === "ArrowLeft" && ci > 0) next = { col: columns[ci - 1].id, index: Math.min(drag.index, (byCol.get(columns[ci - 1].id) ?? []).filter((i) => i.id !== drag.id).length) };
|
|
138
|
+
else if (k === " " || k === "Enter") {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
return finish(drag);
|
|
141
|
+
} else if (k === "Escape") {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
setDrag(null);
|
|
144
|
+
setAnnounce(`Cancelled. ${getItemLabel(item)} returned to ${positionText(drag.originCol, drag.originIndex)}.`);
|
|
145
|
+
return;
|
|
146
|
+
} else return;
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
setDrag({ ...drag, ...next });
|
|
149
|
+
setAnnounce(positionText(next.col, next.index));
|
|
150
|
+
};
|
|
151
|
+
React.useEffect(() => {
|
|
152
|
+
if (drag?.via === "keyboard") cardRefs.current.get(drag.id)?.focus({ preventScroll: false });
|
|
153
|
+
}, [drag?.col, drag?.index]);
|
|
154
|
+
const dragged = drag ? items.find((i) => i.id === drag.id) : void 0;
|
|
155
|
+
const spring = reduced ? { duration: 0 } : { type: "spring", stiffness: 520, damping: 40, mass: 0.8 };
|
|
156
|
+
return /* @__PURE__ */ jsxs(LayoutGroup, { id: groupId, children: [
|
|
157
|
+
/* @__PURE__ */ jsxs("div", { ...rest, ref: boardRef, className: cx("sp-kanban", className), "data-dragging": drag ? drag.via : void 0, role: "group", "aria-roledescription": "board", children: [
|
|
158
|
+
/* @__PURE__ */ jsxs("p", { id: instructions, className: "sp-sr-only", children: [
|
|
159
|
+
"Press Space to pick up a card, arrow keys to move it, Space to drop and Escape to cancel.",
|
|
160
|
+
onItemClick ? " Press Enter to open it." : ""
|
|
161
|
+
] }),
|
|
162
|
+
columns.map((col) => {
|
|
163
|
+
const list = lists.get(col.id) ?? [];
|
|
164
|
+
const count = list.length;
|
|
165
|
+
const over = col.limit != null && count > col.limit;
|
|
166
|
+
const isTarget = drag?.col === col.id;
|
|
167
|
+
return /* @__PURE__ */ jsxs(
|
|
168
|
+
"section",
|
|
169
|
+
{
|
|
170
|
+
ref: (el) => {
|
|
171
|
+
if (el) colRefs.current.set(col.id, el);
|
|
172
|
+
else colRefs.current.delete(col.id);
|
|
173
|
+
},
|
|
174
|
+
className: "sp-kanban__col",
|
|
175
|
+
"data-target": isTarget || void 0,
|
|
176
|
+
"aria-label": `${col.title}, ${count} ${count === 1 ? "card" : "cards"}`,
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsxs("header", { className: "sp-kanban__head", children: [
|
|
179
|
+
/* @__PURE__ */ jsx("span", { className: "sp-kanban__dot", style: { background: col.color ? `var(--sp-chart-${col.color})` : "var(--sp-ink-3)" }, "aria-hidden": true }),
|
|
180
|
+
/* @__PURE__ */ jsx("h3", { className: "sp-kanban__title", children: col.title }),
|
|
181
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-kanban__count", "data-over": over || void 0, children: [
|
|
182
|
+
count,
|
|
183
|
+
col.limit != null && `/${col.limit}`
|
|
184
|
+
] })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsxs("ol", { className: "sp-kanban__list", children: [
|
|
187
|
+
list.map((item) => {
|
|
188
|
+
const isDragged = drag?.id === item.id;
|
|
189
|
+
return /* @__PURE__ */ jsx(
|
|
190
|
+
motion.li,
|
|
191
|
+
{
|
|
192
|
+
layout: reduced ? false : "position",
|
|
193
|
+
layoutId: drag?.via === "pointer" && isDragged ? void 0 : `${groupId}-${item.id}`,
|
|
194
|
+
transition: spring,
|
|
195
|
+
className: "sp-kanban__slot",
|
|
196
|
+
children: isDragged && drag?.via === "pointer" ? /* @__PURE__ */ jsx("div", { className: "sp-kanban__placeholder", style: { height: drag.h } }) : /* @__PURE__ */ jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
ref: (el) => {
|
|
200
|
+
if (el) cardRefs.current.set(item.id, el);
|
|
201
|
+
else cardRefs.current.delete(item.id);
|
|
202
|
+
},
|
|
203
|
+
className: "sp-kanban__card",
|
|
204
|
+
role: "button",
|
|
205
|
+
tabIndex: 0,
|
|
206
|
+
"aria-roledescription": "draggable card",
|
|
207
|
+
"aria-describedby": instructions,
|
|
208
|
+
"aria-pressed": isDragged || void 0,
|
|
209
|
+
"data-lifted": isDragged || void 0,
|
|
210
|
+
onPointerDown: (e) => {
|
|
211
|
+
if (e.button !== 0 || e.target.closest('button, a, input, [role="checkbox"], [data-no-drag]')) return;
|
|
212
|
+
pending.current = { id: item.id, x: e.clientX, y: e.clientY, el: e.currentTarget };
|
|
213
|
+
},
|
|
214
|
+
onKeyDown: (e) => onCardKey(e, item),
|
|
215
|
+
onBlur: () => {
|
|
216
|
+
if (drag?.via === "keyboard" && drag.id === item.id) ;
|
|
217
|
+
},
|
|
218
|
+
children: renderCard(item, { dragging: isDragged, overlay: false })
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
},
|
|
222
|
+
item.id
|
|
223
|
+
);
|
|
224
|
+
}),
|
|
225
|
+
count === 0 && /* @__PURE__ */ jsx("li", { className: "sp-kanban__empty", children: drag ? "Drop here" : "No cards" })
|
|
226
|
+
] }),
|
|
227
|
+
onAdd && /* @__PURE__ */ jsxs("button", { type: "button", className: "sp-reset-button sp-kanban__add", onClick: () => onAdd(col.id), children: [
|
|
228
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M8 3v10M3 8h10" }) }),
|
|
229
|
+
"Add card"
|
|
230
|
+
] })
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
col.id
|
|
234
|
+
);
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ jsx("div", { className: "sp-sr-only", "aria-live": "assertive", children: announce })
|
|
237
|
+
] }),
|
|
238
|
+
drag?.via === "pointer" && dragged && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
239
|
+
motion.div,
|
|
240
|
+
{
|
|
241
|
+
layoutId: `${groupId}-${dragged.id}`,
|
|
242
|
+
className: "sp-kanban__overlay",
|
|
243
|
+
style: { left: drag.x - drag.dx, top: drag.y - drag.dy, width: drag.w },
|
|
244
|
+
initial: false,
|
|
245
|
+
animate: { rotate: reduced ? 0 : 2, scale: reduced ? 1 : 1.03 },
|
|
246
|
+
transition: { layout: { duration: 0 }, type: "spring", stiffness: 400, damping: 26 },
|
|
247
|
+
children: /* @__PURE__ */ jsx("div", { className: "sp-kanban__card", "data-overlay": "", children: renderCard(dragged, { dragging: true, overlay: true }) })
|
|
248
|
+
}
|
|
249
|
+
) })
|
|
250
|
+
] });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { KanbanBoard };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { clamp } from './chunk-344MRWFO.js';
|
|
3
|
-
import { useElementSize } from './chunk-
|
|
4
|
-
import { useMotionPreset
|
|
3
|
+
import { useElementSize } from './chunk-4C7VKLTU.js';
|
|
4
|
+
import { useMotionPreset } from './chunk-VDQ3DWO4.js';
|
|
5
|
+
import { cx } from './chunk-K6X6O42N.js';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { useMotionValue, animate, useMotionValueEvent } from 'motion/react';
|
|
7
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -62,19 +63,19 @@ var Sparkline = React.forwardRef(function Sparkline2({ data, labels, variant = "
|
|
|
62
63
|
const i = bars ? Math.floor(x / step) : Math.round((x - 4) / step);
|
|
63
64
|
setScrub(clamp(i, 0, data.length - 1));
|
|
64
65
|
};
|
|
65
|
-
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: cx("
|
|
66
|
-
(showValue || label) && /* @__PURE__ */ jsxs("div", { className: "
|
|
67
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
68
|
-
showValue && /* @__PURE__ */ jsxs("span", { className: "
|
|
66
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: cx("sp-spark", className), "data-variant": variant, "data-scrubbing": scrub !== null || void 0, children: [
|
|
67
|
+
(showValue || label) && /* @__PURE__ */ jsxs("div", { className: "sp-spark__head", children: [
|
|
68
|
+
/* @__PURE__ */ jsx("span", { className: "sp-spark__label", children: label }),
|
|
69
|
+
showValue && /* @__PURE__ */ jsxs("span", { className: "sp-spark__value", children: [
|
|
69
70
|
/* @__PURE__ */ jsx("strong", { children: formatValue(value) }),
|
|
70
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
71
|
+
/* @__PURE__ */ jsx("span", { className: "sp-spark__meta", children: scrub !== null ? labels?.[scrub] ?? `#${scrub + 1}` : showDelta && data.length > 1 ? `${delta >= 0 ? "\u25B2" : "\u25BC"} ${Math.abs(delta).toFixed(1)}%` : "" })
|
|
71
72
|
] })
|
|
72
73
|
] }),
|
|
73
74
|
/* @__PURE__ */ jsx(
|
|
74
75
|
"div",
|
|
75
76
|
{
|
|
76
77
|
ref: sizeRef,
|
|
77
|
-
className: "
|
|
78
|
+
className: "sp-spark__plot",
|
|
78
79
|
style: { height: H },
|
|
79
80
|
role: "group",
|
|
80
81
|
tabIndex: 0,
|
|
@@ -97,8 +98,8 @@ var Sparkline = React.forwardRef(function Sparkline2({ data, labels, variant = "
|
|
|
97
98
|
setScrub(data.length - 1);
|
|
98
99
|
} else if (e.key === "Escape") setScrub(null);
|
|
99
100
|
},
|
|
100
|
-
children: W > 0 && /* @__PURE__ */ jsxs("svg", { width: W, height: H, "aria-hidden": true, className: "
|
|
101
|
-
/* @__PURE__ */ jsx("line", { className: "
|
|
101
|
+
children: W > 0 && /* @__PURE__ */ jsxs("svg", { width: W, height: H, "aria-hidden": true, className: "sp-spark__svg", children: [
|
|
102
|
+
/* @__PURE__ */ jsx("line", { className: "sp-spark__baseline", x1: 0, x2: W, y1: bars ? base : H - 0.5, y2: bars ? base : H - 0.5 }),
|
|
102
103
|
bars ? shown.map((v, i) => {
|
|
103
104
|
const y = yOf(v);
|
|
104
105
|
const top = Math.min(y, base);
|
|
@@ -107,24 +108,24 @@ var Sparkline = React.forwardRef(function Sparkline2({ data, labels, variant = "
|
|
|
107
108
|
const x = xOf(i) - barW / 2;
|
|
108
109
|
const up = v >= 0;
|
|
109
110
|
const d = up ? `M${x} ${top + h}V${top + r}Q${x} ${top} ${x + r} ${top}H${x + barW - r}Q${x + barW} ${top} ${x + barW} ${top + r}V${top + h}Z` : `M${x} ${top}V${top + h - r}Q${x} ${top + h} ${x + r} ${top + h}H${x + barW - r}Q${x + barW} ${top + h} ${x + barW} ${top + h - r}V${top}Z`;
|
|
110
|
-
return /* @__PURE__ */ jsx("path", { d, className: "
|
|
111
|
+
return /* @__PURE__ */ jsx("path", { d, className: "sp-spark__bar", "data-active": scrub === i || void 0, "data-dim": scrub !== null && scrub !== i || void 0 }, i);
|
|
111
112
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
-
/* @__PURE__ */ jsx("path", { d: area, className: "
|
|
113
|
-
/* @__PURE__ */ jsx("path", { d: line, className: "
|
|
113
|
+
/* @__PURE__ */ jsx("path", { d: area, className: "sp-spark__area" }),
|
|
114
|
+
/* @__PURE__ */ jsx("path", { d: line, className: "sp-spark__line" })
|
|
114
115
|
] }),
|
|
115
|
-
scrub !== null && !bars && /* @__PURE__ */ jsx("line", { className: "
|
|
116
|
-
!bars && n > 0 && /* @__PURE__ */ jsx("circle", { className: "
|
|
116
|
+
scrub !== null && !bars && /* @__PURE__ */ jsx("line", { className: "sp-spark__crosshair", x1: xOf(scrub), x2: xOf(scrub), y1: 0, y2: H }),
|
|
117
|
+
!bars && n > 0 && /* @__PURE__ */ jsx("circle", { className: "sp-spark__dot", cx: xOf(index), cy: yOf(shown[index] ?? 0), r: 4 })
|
|
117
118
|
] })
|
|
118
119
|
}
|
|
119
120
|
),
|
|
120
|
-
/* @__PURE__ */ jsxs("table", { id: tableId, className: "
|
|
121
|
+
/* @__PURE__ */ jsxs("table", { id: tableId, className: "sp-sr-only", children: [
|
|
121
122
|
/* @__PURE__ */ jsx("caption", { children: label }),
|
|
122
123
|
/* @__PURE__ */ jsx("tbody", { children: data.map((v, i) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
123
124
|
/* @__PURE__ */ jsx("th", { scope: "row", children: labels?.[i] ?? `Point ${i + 1}` }),
|
|
124
125
|
/* @__PURE__ */ jsx("td", { children: formatValue(v) })
|
|
125
126
|
] }, i)) })
|
|
126
127
|
] }),
|
|
127
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
128
|
+
/* @__PURE__ */ jsx("span", { className: "sp-sr-only", "aria-live": "polite", children: scrub !== null ? `${labels?.[scrub] ?? `Point ${scrub + 1}`}: ${formatValue(value)}` : "" })
|
|
128
129
|
] });
|
|
129
130
|
});
|
|
130
131
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Tooltip } from './chunk-QYR4WKJI.js';
|
|
3
|
+
import { Button } from './chunk-PDP4YT3H.js';
|
|
4
|
+
import { Checkbox } from './chunk-K2CVKVIF.js';
|
|
5
|
+
import { useMotionPreset } from './chunk-VDQ3DWO4.js';
|
|
6
|
+
import { cx } from './chunk-K6X6O42N.js';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var key = (role, perm) => `${role}::${perm}`;
|
|
12
|
+
function PermissionMatrix({ groups, roles, value, onSave, className, ...rest }) {
|
|
13
|
+
const { reduced } = useMotionPreset();
|
|
14
|
+
const toSet = (g) => new Set(Object.entries(g).flatMap(([r, ps]) => ps.map((p) => key(r, p))));
|
|
15
|
+
const saved = React.useMemo(() => toSet(value), [value]);
|
|
16
|
+
const [draft, setDraft] = React.useState(saved);
|
|
17
|
+
const [pending, setPending] = React.useState(false);
|
|
18
|
+
const [error, setError] = React.useState(null);
|
|
19
|
+
React.useEffect(() => setDraft(toSet(value)), [value]);
|
|
20
|
+
const changes = [.../* @__PURE__ */ new Set([...draft, ...saved])].filter((k) => draft.has(k) !== saved.has(k));
|
|
21
|
+
const toggle = (keys, on) => setDraft((d) => {
|
|
22
|
+
const n = new Set(d);
|
|
23
|
+
for (const k of keys) on ? n.add(k) : n.delete(k);
|
|
24
|
+
return n;
|
|
25
|
+
});
|
|
26
|
+
const save = async () => {
|
|
27
|
+
const next = Object.fromEntries(roles.map((r) => [r.id, groups.flatMap((g) => g.permissions).filter((p) => draft.has(key(r.id, p.id))).map((p) => p.id)]));
|
|
28
|
+
setPending(true);
|
|
29
|
+
setError(null);
|
|
30
|
+
try {
|
|
31
|
+
await onSave(next);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
setError(err instanceof Error ? err.message : "Could not save changes.");
|
|
34
|
+
} finally {
|
|
35
|
+
setPending(false);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, className: cx("sp-perm", className), children: [
|
|
39
|
+
/* @__PURE__ */ jsx("div", { className: "sp-perm__scroll", children: /* @__PURE__ */ jsxs("table", { className: "sp-perm__table", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
41
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "sp-perm__corner", children: "Permission" }),
|
|
42
|
+
roles.map((r) => /* @__PURE__ */ jsxs("th", { scope: "col", className: "sp-perm__role", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-perm__role-name", children: [
|
|
44
|
+
r.name,
|
|
45
|
+
r.locked && /* @__PURE__ */ jsx(Tooltip, { content: "Locked \u2014 this role always has every permission", children: /* @__PURE__ */ jsxs("svg", { tabIndex: 0, viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-label": "Locked", children: [
|
|
46
|
+
/* @__PURE__ */ jsx("rect", { x: "3.5", y: "7", width: "9", height: "6.5", rx: "1.5" }),
|
|
47
|
+
/* @__PURE__ */ jsx("path", { d: "M5.5 7V5.5a2.5 2.5 0 0 1 5 0V7" })
|
|
48
|
+
] }) })
|
|
49
|
+
] }),
|
|
50
|
+
r.description && /* @__PURE__ */ jsx("span", { className: "sp-perm__role-desc", children: r.description })
|
|
51
|
+
] }, r.id))
|
|
52
|
+
] }) }),
|
|
53
|
+
groups.map((g) => /* @__PURE__ */ jsxs("tbody", { children: [
|
|
54
|
+
/* @__PURE__ */ jsxs("tr", { className: "sp-perm__group", children: [
|
|
55
|
+
/* @__PURE__ */ jsx("th", { scope: "rowgroup", children: g.label }),
|
|
56
|
+
roles.map((r) => {
|
|
57
|
+
const keys = g.permissions.map((p) => key(r.id, p.id));
|
|
58
|
+
const n = keys.filter((k) => draft.has(k)).length;
|
|
59
|
+
return /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(
|
|
60
|
+
Checkbox,
|
|
61
|
+
{
|
|
62
|
+
size: "sm",
|
|
63
|
+
"aria-label": `${r.name}: all ${g.label} permissions`,
|
|
64
|
+
checked: n === keys.length ? true : n > 0 ? "indeterminate" : false,
|
|
65
|
+
disabled: r.locked || pending,
|
|
66
|
+
onCheckedChange: () => toggle(keys, n !== keys.length)
|
|
67
|
+
}
|
|
68
|
+
) }, r.id);
|
|
69
|
+
})
|
|
70
|
+
] }),
|
|
71
|
+
g.permissions.map((p) => /* @__PURE__ */ jsxs("tr", { className: "sp-perm__row", children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("th", { scope: "row", children: [
|
|
73
|
+
/* @__PURE__ */ jsx("span", { className: "sp-perm__label", children: p.label }),
|
|
74
|
+
p.description && /* @__PURE__ */ jsx("span", { className: "sp-perm__desc", children: p.description })
|
|
75
|
+
] }),
|
|
76
|
+
roles.map((r) => {
|
|
77
|
+
const k = key(r.id, p.id);
|
|
78
|
+
const changed = draft.has(k) !== saved.has(k);
|
|
79
|
+
return /* @__PURE__ */ jsx("td", { "data-changed": changed || void 0, children: /* @__PURE__ */ jsx(Checkbox, { size: "sm", "aria-label": `${r.name}: ${p.label}`, checked: draft.has(k), disabled: r.locked || pending, onCheckedChange: (c) => toggle([k], c) }) }, r.id);
|
|
80
|
+
})
|
|
81
|
+
] }, p.id))
|
|
82
|
+
] }, g.id))
|
|
83
|
+
] }) }),
|
|
84
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: changes.length > 0 && /* @__PURE__ */ jsxs(
|
|
85
|
+
motion.div,
|
|
86
|
+
{
|
|
87
|
+
className: "sp-perm__bar",
|
|
88
|
+
role: "region",
|
|
89
|
+
"aria-label": "Unsaved changes",
|
|
90
|
+
initial: reduced ? { opacity: 0 } : { opacity: 0, y: 12 },
|
|
91
|
+
animate: { opacity: 1, y: 0 },
|
|
92
|
+
exit: reduced ? { opacity: 0 } : { opacity: 0, y: 12 },
|
|
93
|
+
transition: { type: "spring", stiffness: 520, damping: 38 },
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "sp-perm__bar-text", "aria-live": "polite", children: error ? /* @__PURE__ */ jsx("span", { className: "sp-perm__bar-error", children: error }) : `${changes.length} unsaved ${changes.length === 1 ? "change" : "changes"}` }),
|
|
96
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onClick: () => (setDraft(new Set(saved)), setError(null)), disabled: pending, children: "Discard" }),
|
|
97
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "accent", onClick: save, loading: pending, children: "Save changes" })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
) })
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { PermissionMatrix };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useFloatingPosition, useOutsidePress, getElementRef, enterFrom } from './chunk-7RZVSATZ.js';
|
|
3
|
+
import { useEscape } from './chunk-LD3DXOQ7.js';
|
|
4
|
+
import { Portal } from './chunk-B5Z4XIIF.js';
|
|
5
|
+
import { useControllableState } from './chunk-KPG24YFL.js';
|
|
6
|
+
import { mergeRefs } from './chunk-4C7VKLTU.js';
|
|
7
|
+
import { useMotionPreset } from './chunk-VDQ3DWO4.js';
|
|
8
|
+
import { cx } from './chunk-K6X6O42N.js';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
11
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var isAction = (e) => e.type !== "separator" && e.type !== "label";
|
|
14
|
+
var textOf = (e) => e.textValue ?? (typeof e.label === "string" ? e.label : "");
|
|
15
|
+
function Menu({ items, trigger, anchorPoint, open: openProp, defaultOpen = false, onOpenChange, placement = "bottom-start", container, className, minWidth = 180, ...aria }) {
|
|
16
|
+
const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
17
|
+
const { t, reduced } = useMotionPreset();
|
|
18
|
+
const triggerRef = React.useRef(null);
|
|
19
|
+
const pointRef = React.useRef(null);
|
|
20
|
+
const menuRef = React.useRef(null);
|
|
21
|
+
const [active, setActive] = React.useState(null);
|
|
22
|
+
const id = React.useId();
|
|
23
|
+
pointRef.current = anchorPoint ? { getBoundingClientRect: () => new DOMRect(anchorPoint.x, anchorPoint.y, 0, 0) } : null;
|
|
24
|
+
const anchorRef = anchorPoint ? pointRef : triggerRef;
|
|
25
|
+
const { pos, update } = useFloatingPosition(open, anchorRef, menuRef, anchorPoint ? "bottom-start" : placement, anchorPoint ? 2 : 6);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (open && anchorPoint) update();
|
|
28
|
+
}, [anchorPoint?.x, anchorPoint?.y]);
|
|
29
|
+
const actions = items.filter(isAction).filter((e) => !e.disabled);
|
|
30
|
+
const close = React.useCallback(
|
|
31
|
+
(refocus = true) => {
|
|
32
|
+
setOpen(false);
|
|
33
|
+
setActive(null);
|
|
34
|
+
if (refocus) triggerRef.current?.focus({ preventScroll: true });
|
|
35
|
+
},
|
|
36
|
+
[setOpen]
|
|
37
|
+
);
|
|
38
|
+
useOutsidePress(open, [triggerRef, menuRef], () => close(false));
|
|
39
|
+
useEscape(open, () => close());
|
|
40
|
+
const focusFirst = React.useRef(null);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (!open) return;
|
|
43
|
+
const raf = requestAnimationFrame(() => {
|
|
44
|
+
menuRef.current?.focus({ preventScroll: true });
|
|
45
|
+
if (focusFirst.current) setActive((focusFirst.current === "first" ? actions[0] : actions[actions.length - 1])?.id ?? null);
|
|
46
|
+
focusFirst.current = null;
|
|
47
|
+
});
|
|
48
|
+
return () => cancelAnimationFrame(raf);
|
|
49
|
+
}, [open]);
|
|
50
|
+
const select = (entry) => {
|
|
51
|
+
if (entry.disabled) return;
|
|
52
|
+
if (entry.type === "checkbox") {
|
|
53
|
+
const e2 = entry;
|
|
54
|
+
e2.onCheckedChange(!e2.checked);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const e = entry;
|
|
58
|
+
if (!e.keepOpen) close();
|
|
59
|
+
e.onSelect?.();
|
|
60
|
+
};
|
|
61
|
+
const typed = React.useRef({ text: "", at: 0 });
|
|
62
|
+
const onKeyDown = (e) => {
|
|
63
|
+
const i = actions.findIndex((a) => a.id === active);
|
|
64
|
+
if (e.key === "ArrowDown") {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
setActive(actions[(i + 1) % actions.length]?.id ?? null);
|
|
67
|
+
} else if (e.key === "ArrowUp") {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
setActive(actions[(i - 1 + actions.length) % actions.length]?.id ?? null);
|
|
70
|
+
} else if (e.key === "Home") {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
setActive(actions[0]?.id ?? null);
|
|
73
|
+
} else if (e.key === "End") {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setActive(actions[actions.length - 1]?.id ?? null);
|
|
76
|
+
} else if (e.key === "Enter" || e.key === " ") {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
const entry = actions[i];
|
|
79
|
+
if (entry) select(entry);
|
|
80
|
+
} else if (e.key === "Tab") {
|
|
81
|
+
close(false);
|
|
82
|
+
} else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
83
|
+
const now = Date.now();
|
|
84
|
+
typed.current.text = now - typed.current.at > 600 ? e.key : typed.current.text + e.key;
|
|
85
|
+
typed.current.at = now;
|
|
86
|
+
const q = typed.current.text.toLowerCase();
|
|
87
|
+
const hit = [...actions.slice(i + 1), ...actions.slice(0, i + 1)].find((a) => textOf(a).toLowerCase().startsWith(q));
|
|
88
|
+
if (hit) setActive(hit.id);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
let triggerEl = null;
|
|
92
|
+
if (trigger) {
|
|
93
|
+
const child = trigger;
|
|
94
|
+
triggerEl = React.cloneElement(child, {
|
|
95
|
+
ref: mergeRefs(triggerRef, getElementRef(child)),
|
|
96
|
+
"aria-haspopup": "menu",
|
|
97
|
+
"aria-expanded": open,
|
|
98
|
+
"aria-controls": open ? id : void 0,
|
|
99
|
+
"data-state": open ? "open" : "closed",
|
|
100
|
+
onClick: (e) => {
|
|
101
|
+
child.props.onClick?.(e);
|
|
102
|
+
if (!e.defaultPrevented) open ? close(false) : setOpen(true);
|
|
103
|
+
},
|
|
104
|
+
onKeyDown: (e) => {
|
|
105
|
+
child.props.onKeyDown?.(e);
|
|
106
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
focusFirst.current = e.key === "ArrowDown" ? "first" : "last";
|
|
109
|
+
setOpen(true);
|
|
110
|
+
} else if ((e.key === "Enter" || e.key === " ") && !open) {
|
|
111
|
+
focusFirst.current = "first";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const side = pos?.side ?? "bottom";
|
|
117
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
triggerEl,
|
|
119
|
+
/* @__PURE__ */ jsx(Portal, { container, anchor: triggerRef.current, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(
|
|
120
|
+
motion.div,
|
|
121
|
+
{
|
|
122
|
+
ref: menuRef,
|
|
123
|
+
id,
|
|
124
|
+
role: "menu",
|
|
125
|
+
tabIndex: -1,
|
|
126
|
+
"aria-label": aria["aria-label"],
|
|
127
|
+
"aria-activedescendant": active ? `${id}-${active}` : void 0,
|
|
128
|
+
className: cx("sp-menu", className),
|
|
129
|
+
"data-side": side,
|
|
130
|
+
style: { top: pos?.top ?? -9999, left: pos?.left ?? -9999, minWidth, transformOrigin: pos?.origin, visibility: pos ? "visible" : "hidden" },
|
|
131
|
+
initial: { opacity: 0, scale: reduced ? 1 : 0.96, ...enterFrom(side, reduced ? 0 : 4) },
|
|
132
|
+
animate: { opacity: 1, scale: 1, x: 0, y: 0 },
|
|
133
|
+
exit: { opacity: 0, scale: reduced ? 1 : 0.98, transition: { duration: 0.1 } },
|
|
134
|
+
transition: t({ type: "spring", stiffness: 600, damping: 38, mass: 0.7 }),
|
|
135
|
+
onKeyDown,
|
|
136
|
+
onPointerLeave: () => setActive(null),
|
|
137
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
138
|
+
children: items.map((entry, idx) => {
|
|
139
|
+
if (entry.type === "separator") return /* @__PURE__ */ jsx("div", { role: "separator", className: "sp-menu__sep" }, entry.id ?? `sep-${idx}`);
|
|
140
|
+
if (entry.type === "label")
|
|
141
|
+
return /* @__PURE__ */ jsx("div", { className: "sp-menu__label", role: "presentation", children: entry.label }, entry.id ?? `label-${idx}`);
|
|
142
|
+
const isActive = active === entry.id;
|
|
143
|
+
const checkbox = entry.type === "checkbox";
|
|
144
|
+
const item = entry;
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
id: `${id}-${entry.id}`,
|
|
149
|
+
role: checkbox ? "menuitemcheckbox" : "menuitem",
|
|
150
|
+
"aria-checked": checkbox ? item.checked : void 0,
|
|
151
|
+
"aria-disabled": entry.disabled || void 0,
|
|
152
|
+
"data-active": isActive || void 0,
|
|
153
|
+
"data-danger": item.danger || void 0,
|
|
154
|
+
className: "sp-menu__item",
|
|
155
|
+
style: { ["--i"]: Math.min(idx, 12) },
|
|
156
|
+
onPointerMove: () => !entry.disabled && !isActive && setActive(entry.id),
|
|
157
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
158
|
+
onClick: () => select(entry),
|
|
159
|
+
children: [
|
|
160
|
+
isActive && /* @__PURE__ */ jsx(motion.span, { layoutId: `${id}-hl`, className: "sp-menu__highlight", transition: t({ type: "spring", stiffness: 700, damping: 45 }) }),
|
|
161
|
+
checkbox ? /* @__PURE__ */ jsx("span", { className: "sp-menu__check", "data-checked": item.checked || void 0, "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx(motion.path, { d: "m3.5 8.3 2.9 2.8 6.1-6.2", initial: false, animate: { pathLength: item.checked ? 1 : 0 }, transition: t({ duration: 0.18 }) }) }) }) : item.icon ? /* @__PURE__ */ jsx("span", { className: "sp-menu__icon", children: item.icon }) : null,
|
|
162
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-menu__text", children: [
|
|
163
|
+
/* @__PURE__ */ jsx("span", { children: entry.label }),
|
|
164
|
+
item.description && /* @__PURE__ */ jsx("span", { className: "sp-menu__desc", children: item.description })
|
|
165
|
+
] }),
|
|
166
|
+
item.shortcut && /* @__PURE__ */ jsx("span", { className: "sp-menu__shortcut", children: item.shortcut })
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
entry.id
|
|
170
|
+
);
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
) }) })
|
|
174
|
+
] });
|
|
175
|
+
}
|
|
176
|
+
function ContextMenu({ children, disabled, ...menu }) {
|
|
177
|
+
const [point, setPoint] = React.useState(null);
|
|
178
|
+
const child = children;
|
|
179
|
+
const area = React.cloneElement(child, {
|
|
180
|
+
onContextMenu: (e) => {
|
|
181
|
+
child.props.onContextMenu?.(e);
|
|
182
|
+
if (disabled || e.defaultPrevented) return;
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
setPoint({ x: e.clientX, y: e.clientY });
|
|
185
|
+
},
|
|
186
|
+
onKeyDown: (e) => {
|
|
187
|
+
child.props.onKeyDown?.(e);
|
|
188
|
+
if (disabled) return;
|
|
189
|
+
if (e.key === "ContextMenu" || e.shiftKey && e.key === "F10") {
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
192
|
+
setPoint({ x: r.left + 12, y: r.top + r.height / 2 });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
197
|
+
area,
|
|
198
|
+
/* @__PURE__ */ jsx(Menu, { ...menu, anchorPoint: point, open: !!point, onOpenChange: (o) => !o && setPoint(null) })
|
|
199
|
+
] });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export { ContextMenu, Menu };
|