seppia 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +116 -2
- 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-2AS3PZ62.js +222 -0
- package/dist/chunk-2DW7PF2P.cjs +116 -0
- package/dist/chunk-2HMUVVUR.cjs +45 -0
- package/dist/chunk-2IBDXUBG.js +2 -0
- package/dist/chunk-2L7GUYB2.js +152 -0
- package/dist/chunk-2MX7EYXA.js +187 -0
- package/dist/chunk-2UB2HKMF.cjs +131 -0
- package/dist/chunk-2YB44UOW.js +2 -0
- package/dist/chunk-32OCNZWB.js +2 -0
- package/dist/chunk-344MRWFO.js +25 -0
- package/dist/chunk-3A2LHCPV.cjs +30 -0
- package/dist/chunk-3BC4NA2C.cjs +126 -0
- package/dist/chunk-3ENS37RT.cjs +373 -0
- package/dist/chunk-3FLWYYDS.js +161 -0
- package/dist/chunk-3GGOAJIG.cjs +176 -0
- package/dist/chunk-3HME5VXL.cjs +3 -0
- package/dist/chunk-3S3MBTXC.cjs +3 -0
- package/dist/chunk-3WWOK2IV.cjs +104 -0
- package/dist/chunk-3YOPOWUB.js +191 -0
- package/dist/chunk-3Z5M2WVW.cjs +3 -0
- package/dist/chunk-43N5QL6C.cjs +3 -0
- package/dist/chunk-4C7VKLTU.js +47 -0
- package/dist/chunk-4GLMIQUX.js +275 -0
- package/dist/chunk-4MTRY6D2.js +288 -0
- package/dist/chunk-4Q6LY3TN.cjs +259 -0
- package/dist/chunk-4STGAE4T.js +2 -0
- package/dist/chunk-4YXWES4C.cjs +81 -0
- package/dist/chunk-54SA4YJ7.js +217 -0
- package/dist/chunk-5A46EAUE.js +42 -0
- package/dist/chunk-5CKY3233.js +2 -0
- package/dist/chunk-5IGY4W4T.cjs +131 -0
- package/dist/chunk-5KNKWEIE.cjs +564 -0
- package/dist/chunk-5OOVB2S5.cjs +244 -0
- package/dist/chunk-64WDKM52.js +191 -0
- package/dist/chunk-6CZIXWOU.js +2 -0
- package/dist/chunk-6HPGI7VU.js +183 -0
- package/dist/chunk-6HZLPZ5A.js +146 -0
- package/dist/chunk-6IH2PZO5.js +122 -0
- package/dist/chunk-6JZYZDCV.cjs +245 -0
- package/dist/chunk-6K3RXUKZ.cjs +239 -0
- package/dist/chunk-6MJYJC3V.cjs +3 -0
- package/dist/chunk-6OA3BX3U.cjs +394 -0
- package/dist/chunk-6PE3ZGPD.cjs +239 -0
- package/dist/chunk-6QQPGNNK.js +2 -0
- package/dist/chunk-6W3OO6DK.cjs +159 -0
- 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-AEQ6DMPS.js +93 -0
- package/dist/chunk-APFW2I3Q.js +38 -0
- package/dist/chunk-AXWQJPZL.js +222 -0
- package/dist/chunk-B3D6KWG3.cjs +11 -0
- package/dist/chunk-B5Z4XIIF.js +26 -0
- package/dist/chunk-BQUUTWTZ.cjs +129 -0
- package/dist/chunk-BRHXMXA7.cjs +3 -0
- package/dist/chunk-CIMKUKAG.cjs +3 -0
- package/dist/chunk-CM7W446Z.cjs +410 -0
- package/dist/chunk-CQZU4EHR.cjs +263 -0
- package/dist/chunk-DKTUKZ5A.cjs +326 -0
- package/dist/chunk-DLS6YGNX.cjs +217 -0
- 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-EAQYTXY7.js +127 -0
- 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-FLLU5FAE.js +121 -0
- package/dist/chunk-FO7ZZP52.cjs +186 -0
- package/dist/chunk-FVVH37UH.js +57 -0
- package/dist/chunk-FXCVPRHV.cjs +52 -0
- package/dist/chunk-FXQKHROS.cjs +3 -0
- package/dist/chunk-G5UZZ2XG.cjs +52 -0
- package/dist/chunk-GASIBRAJ.js +650 -0
- package/dist/chunk-GHC7MKBR.cjs +31 -0
- package/dist/chunk-GK7BIWGS.cjs +149 -0
- package/dist/chunk-GROWBVU5.cjs +140 -0
- package/dist/chunk-GSF7YUXO.js +117 -0
- package/dist/chunk-GTU6TD5Q.cjs +197 -0
- 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-HWHAD4OZ.js +109 -0
- package/dist/chunk-I2QUKJX7.cjs +197 -0
- package/dist/chunk-I2RCFWV3.cjs +174 -0
- package/dist/chunk-I3GJQHNE.cjs +144 -0
- package/dist/chunk-I3HEEAHX.cjs +28 -0
- 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-IT27FHWR.cjs +131 -0
- 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-JUMI5UBA.cjs +143 -0
- package/dist/chunk-JXPOKP66.js +2 -0
- package/dist/chunk-JZUEW7WR.js +2 -0
- package/dist/chunk-K2CVKVIF.js +175 -0
- package/dist/chunk-K6MCWJ35.cjs +180 -0
- package/dist/chunk-K6X6O42N.js +9 -0
- package/dist/chunk-KA24K3XP.js +193 -0
- package/dist/chunk-KEISLNT6.cjs +3 -0
- package/dist/chunk-KLJ4DMH2.cjs +262 -0
- package/dist/chunk-KO5DJXD4.js +2 -0
- package/dist/chunk-KPG24YFL.js +30 -0
- package/dist/chunk-KVDIEAWQ.cjs +3 -0
- package/dist/chunk-KVFBDLSA.cjs +215 -0
- 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-LD3DXOQ7.js +92 -0
- package/dist/chunk-LRI6V2NK.cjs +117 -0
- package/dist/chunk-LVE2WXGB.js +109 -0
- package/dist/chunk-M4U2IWVW.js +54 -0
- package/dist/chunk-MCK6WCG2.cjs +168 -0
- package/dist/chunk-MCQYUABH.cjs +154 -0
- package/dist/chunk-MFFNV55T.cjs +223 -0
- package/dist/chunk-MGUOCT7T.cjs +1047 -0
- package/dist/chunk-MHIFGXVD.cjs +213 -0
- 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-MYTU26NE.js +158 -0
- package/dist/chunk-N4KGLSBT.cjs +85 -0
- package/dist/chunk-N64ZJPCO.cjs +3 -0
- package/dist/chunk-NGKH2EEJ.cjs +326 -0
- package/dist/chunk-NIT46ZG7.cjs +352 -0
- package/dist/chunk-NJEGW6SX.js +386 -0
- package/dist/chunk-NJYCQEIR.js +182 -0
- 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-OLWS65QZ.cjs +276 -0
- 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-POKS6BSL.cjs +166 -0
- package/dist/chunk-PSMIDELA.js +254 -0
- package/dist/chunk-PT736HBJ.js +27 -0
- package/dist/chunk-PWKKLWBX.js +144 -0
- 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-QHFMQWSO.cjs +139 -0
- 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-RZNIXIJU.js +132 -0
- 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-SS6DGMZY.cjs +204 -0
- 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-TLP4LLIX.cjs +157 -0
- 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-UGDDUI2N.js +131 -0
- package/dist/chunk-UORTZAPR.js +2 -0
- package/dist/chunk-UTYMDSOE.cjs +3 -0
- package/dist/chunk-UWQGY3GT.cjs +60 -0
- package/dist/chunk-UZS7VXCA.js +237 -0
- package/dist/chunk-VACQZKYM.cjs +44 -0
- package/dist/chunk-VDQ3DWO4.js +28 -0
- package/dist/chunk-VKYDWRL2.cjs +3 -0
- package/dist/chunk-VRFYJ4BN.js +80 -0
- package/dist/chunk-W3VOEVRS.cjs +74 -0
- package/dist/chunk-W7OZ3DOL.js +14 -0
- package/dist/chunk-WG4KHU2E.cjs +149 -0
- package/dist/chunk-WHM3QKTO.js +1012 -0
- package/dist/chunk-WINVYCMX.js +380 -0
- package/dist/chunk-WPTNMFHO.cjs +310 -0
- 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-XQMLBUHW.js +175 -0
- 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-YEQVN7I3.js +330 -0
- package/dist/chunk-YI6XXQMC.cjs +275 -0
- package/dist/chunk-YJDQ3BQZ.js +118 -0
- package/dist/chunk-YJR744JB.js +131 -0
- package/dist/chunk-YN2AVSEN.js +371 -0
- package/dist/chunk-YNJA4HB2.js +307 -0
- package/dist/chunk-YRLEGHKB.js +137 -0
- package/dist/chunk-YTAX4ICP.cjs +154 -0
- package/dist/chunk-YU7IOI63.js +2 -0
- package/dist/chunk-YUG4SGR5.js +68 -0
- package/dist/chunk-YVGWCNLQ.js +154 -0
- package/dist/chunk-Z6SMSENC.js +107 -0
- package/dist/chunk-ZAQJBIYI.cjs +205 -0
- package/dist/chunk-ZGKDMG7N.cjs +3 -0
- package/dist/chunk-ZHGVBALA.js +304 -0
- package/dist/chunk-ZIGUJXZM.js +2 -0
- package/dist/chunk-ZPYGXDFU.js +2 -0
- package/dist/chunk-ZSD56XUT.js +240 -0
- package/dist/chunk-ZX6JRBPY.cjs +209 -0
- package/dist/components/accordion.cjs +27 -0
- package/dist/components/accordion.d.cts +1 -0
- package/dist/components/accordion.d.ts +1 -0
- package/dist/components/accordion.js +6 -0
- 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 +16 -0
- package/dist/components/calendar.d.cts +1 -0
- package/dist/components/calendar.d.ts +1 -0
- package/dist/components/calendar.js +7 -0
- 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 +16 -0
- package/dist/components/checkbox.d.cts +1 -0
- package/dist/components/checkbox.d.ts +1 -0
- package/dist/components/checkbox.js +7 -0
- package/dist/components/chip-select.cjs +15 -0
- package/dist/components/chip-select.d.cts +1 -0
- package/dist/components/chip-select.d.ts +1 -0
- package/dist/components/chip-select.js +6 -0
- package/dist/components/clock.cjs +13 -0
- package/dist/components/clock.d.cts +1 -0
- package/dist/components/clock.d.ts +1 -0
- package/dist/components/clock.js +4 -0
- package/dist/components/color-picker.cjs +15 -0
- package/dist/components/color-picker.d.cts +1 -0
- package/dist/components/color-picker.d.ts +1 -0
- package/dist/components/color-picker.js +6 -0
- package/dist/components/command-palette.cjs +21 -0
- package/dist/components/command-palette.d.cts +1 -0
- package/dist/components/command-palette.d.ts +1 -0
- package/dist/components/command-palette.js +8 -0
- package/dist/components/date-picker.cjs +22 -0
- package/dist/components/date-picker.d.cts +1 -0
- package/dist/components/date-picker.d.ts +1 -0
- package/dist/components/date-picker.js +13 -0
- 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 +17 -0
- package/dist/components/drawer.d.cts +1 -0
- package/dist/components/drawer.d.ts +1 -0
- package/dist/components/drawer.js +8 -0
- 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 +14 -0
- package/dist/components/floating-panel.d.cts +1 -0
- package/dist/components/floating-panel.d.ts +1 -0
- package/dist/components/floating-panel.js +5 -0
- 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 +14 -0
- package/dist/components/hold-button.d.cts +1 -0
- package/dist/components/hold-button.d.ts +1 -0
- package/dist/components/hold-button.js +5 -0
- package/dist/components/knob.cjs +16 -0
- package/dist/components/knob.d.cts +1 -0
- package/dist/components/knob.d.ts +1 -0
- package/dist/components/knob.js +7 -0
- 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 +14 -0
- package/dist/components/magnetic-button.d.cts +1 -0
- package/dist/components/magnetic-button.d.ts +1 -0
- package/dist/components/magnetic-button.js +5 -0
- 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 +14 -0
- package/dist/components/morph-button.d.cts +1 -0
- package/dist/components/morph-button.d.ts +1 -0
- package/dist/components/morph-button.js +5 -0
- package/dist/components/morph-dialog.cjs +33 -0
- package/dist/components/morph-dialog.d.cts +1 -0
- package/dist/components/morph-dialog.d.ts +1 -0
- package/dist/components/morph-dialog.js +8 -0
- package/dist/components/number-field.cjs +16 -0
- package/dist/components/number-field.d.cts +1 -0
- package/dist/components/number-field.d.ts +1 -0
- package/dist/components/number-field.js +7 -0
- 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 +16 -0
- package/dist/components/pin-input.d.cts +1 -0
- package/dist/components/pin-input.d.ts +1 -0
- package/dist/components/pin-input.js +7 -0
- package/dist/components/popover.cjs +19 -0
- package/dist/components/popover.d.cts +1 -0
- package/dist/components/popover.d.ts +1 -0
- package/dist/components/popover.js +10 -0
- package/dist/components/progress.cjs +18 -0
- package/dist/components/progress.d.cts +1 -0
- package/dist/components/progress.d.ts +1 -0
- package/dist/components/progress.js +5 -0
- package/dist/components/radial-menu.cjs +15 -0
- package/dist/components/radial-menu.d.cts +1 -0
- package/dist/components/radial-menu.d.ts +1 -0
- package/dist/components/radial-menu.js +6 -0
- package/dist/components/radio-group.cjs +15 -0
- package/dist/components/radio-group.d.cts +1 -0
- package/dist/components/radio-group.d.ts +1 -0
- package/dist/components/radio-group.js +6 -0
- package/dist/components/resizable-panels.cjs +19 -0
- package/dist/components/resizable-panels.d.cts +1 -0
- package/dist/components/resizable-panels.d.ts +1 -0
- package/dist/components/resizable-panels.js +6 -0
- package/dist/components/segmented-control.cjs +16 -0
- package/dist/components/segmented-control.d.cts +1 -0
- package/dist/components/segmented-control.d.ts +1 -0
- package/dist/components/segmented-control.js +7 -0
- 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 +16 -0
- package/dist/components/slider.d.cts +1 -0
- package/dist/components/slider.d.ts +1 -0
- package/dist/components/slider.js +7 -0
- package/dist/components/sortable-list.cjs +14 -0
- package/dist/components/sortable-list.d.cts +1 -0
- package/dist/components/sortable-list.d.ts +1 -0
- package/dist/components/sortable-list.js +5 -0
- package/dist/components/sparkline.cjs +15 -0
- package/dist/components/sparkline.d.cts +1 -0
- package/dist/components/sparkline.d.ts +1 -0
- package/dist/components/sparkline.js +6 -0
- 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 +14 -0
- package/dist/components/swipe-confirm.d.cts +1 -0
- package/dist/components/swipe-confirm.d.ts +1 -0
- package/dist/components/swipe-confirm.js +5 -0
- package/dist/components/switch.cjs +17 -0
- package/dist/components/switch.d.cts +1 -0
- package/dist/components/switch.d.ts +1 -0
- package/dist/components/switch.js +8 -0
- package/dist/components/tabs.cjs +31 -0
- package/dist/components/tabs.d.cts +1 -0
- package/dist/components/tabs.d.ts +1 -0
- package/dist/components/tabs.js +6 -0
- package/dist/components/tether.cjs +17 -0
- package/dist/components/tether.d.cts +1 -0
- package/dist/components/tether.d.ts +1 -0
- package/dist/components/tether.js +4 -0
- 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 +15 -0
- package/dist/components/theme-switch.d.cts +1 -0
- package/dist/components/theme-switch.d.ts +1 -0
- package/dist/components/theme-switch.js +6 -0
- package/dist/components/toaster.cjs +22 -0
- package/dist/components/toaster.d.cts +1 -0
- package/dist/components/toaster.d.ts +1 -0
- package/dist/components/toaster.js +5 -0
- 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 +16 -0
- package/dist/components/wheel-picker.d.cts +1 -0
- package/dist/components/wheel-picker.d.ts +1 -0
- package/dist/components/wheel-picker.js +7 -0
- package/dist/css/accordion.css +2 -0
- 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 +2 -0
- package/dist/css/breadcrumbs.css +2 -0
- package/dist/css/button.css +2 -0
- package/dist/css/calendar.css +2 -0
- package/dist/css/card.css +2 -0
- package/dist/css/chart.css +2 -0
- package/dist/css/checkbox.css +2 -0
- package/dist/css/chip-select.css +2 -0
- package/dist/css/clock.css +2 -0
- package/dist/css/color-picker.css +2 -0
- package/dist/css/command-palette.css +2 -0
- package/dist/css/dashboard.css +2 -0
- package/dist/css/data-table.css +2 -0
- package/dist/css/date-picker.css +2 -0
- package/dist/css/dialog.css +2 -0
- package/dist/css/drawer.css +2 -0
- package/dist/css/empty-state.css +2 -0
- package/dist/css/floating-panel.css +2 -0
- package/dist/css/forms.css +2 -0
- package/dist/css/hold-button.css +2 -0
- package/dist/css/kanban.css +2 -0
- package/dist/css/knob.css +2 -0
- package/dist/css/magnetic-button.css +2 -0
- 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 +2 -0
- package/dist/css/morph-dialog.css +2 -0
- package/dist/css/notifications.css +2 -0
- package/dist/css/number-field.css +2 -0
- package/dist/css/pagination.css +2 -0
- package/dist/css/permissions.css +2 -0
- package/dist/css/pin-input.css +2 -0
- package/dist/css/popover.css +2 -0
- package/dist/css/progress.css +2 -0
- package/dist/css/radial-menu.css +2 -0
- package/dist/css/radio-group.css +2 -0
- package/dist/css/resizable-panels.css +2 -0
- package/dist/css/scheduling.css +2 -0
- package/dist/css/segmented-control.css +2 -0
- package/dist/css/select.css +2 -0
- package/dist/css/skeleton.css +2 -0
- package/dist/css/slider.css +2 -0
- package/dist/css/sortable-list.css +2 -0
- package/dist/css/sparkline.css +2 -0
- package/dist/css/stepper.css +2 -0
- package/dist/css/swipe-confirm.css +2 -0
- package/dist/css/switch.css +2 -0
- package/dist/css/tabs.css +2 -0
- 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 +2 -0
- package/dist/css/text-field.css +2 -0
- package/dist/css/theme-switch.css +2 -0
- package/dist/css/toaster.css +2 -0
- package/dist/css/tooltip.css +2 -0
- package/dist/css/wheel-picker.css +2 -0
- package/dist/index.cjs +828 -0
- package/dist/index.d.cts +3182 -0
- package/dist/index.d.ts +3182 -0
- package/dist/index.js +123 -0
- package/dist/styles.css +2 -0
- 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 +120 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { TemplateFrame } from './chunk-5A46EAUE.js';
|
|
3
|
+
import { ActivityFeed } from './chunk-PWV4XF5I.js';
|
|
4
|
+
import { PageHeader } from './chunk-Y36NEYSP.js';
|
|
5
|
+
import { DataTable } from './chunk-ECJ6AOAB.js';
|
|
6
|
+
import { KanbanBoard } from './chunk-RDU664LO.js';
|
|
7
|
+
import { SegmentedControl } from './chunk-MYTU26NE.js';
|
|
8
|
+
import { Dialog } from './chunk-MX54ZBNC.js';
|
|
9
|
+
import { DistributionBar } from './chunk-XL2A3RFS.js';
|
|
10
|
+
import { Button } from './chunk-PDP4YT3H.js';
|
|
11
|
+
import { Avatar } from './chunk-FVVH37UH.js';
|
|
12
|
+
import { Badge } from './chunk-W7OZ3DOL.js';
|
|
13
|
+
import { cx } from './chunk-K6X6O42N.js';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
function CrmTemplate({ chrome, stages, deals, onMoveDeal, onCreateDeal, activityFor, onDealAction, currency = "USD", view: viewProp, onViewChange }) {
|
|
18
|
+
const [innerView, setInnerView] = React.useState("board");
|
|
19
|
+
const view = viewProp ?? innerView;
|
|
20
|
+
const setView = (v) => onViewChange ? onViewChange(v) : setInnerView(v);
|
|
21
|
+
const [openId, setOpenId] = React.useState(null);
|
|
22
|
+
const open = deals.find((d) => d.id === openId) ?? null;
|
|
23
|
+
const money = React.useMemo(() => new Intl.NumberFormat("en", { style: "currency", currency, notation: "compact", maximumFractionDigits: 1 }), [currency]);
|
|
24
|
+
const moneyFull = React.useMemo(() => new Intl.NumberFormat("en", { style: "currency", currency, maximumFractionDigits: 0 }), [currency]);
|
|
25
|
+
const dateFmt = new Intl.DateTimeFormat("en", { month: "short", day: "numeric" });
|
|
26
|
+
const total = deals.reduce((a, d) => a + d.value, 0);
|
|
27
|
+
const weighted = deals.reduce((a, d) => a + d.value * d.probability, 0);
|
|
28
|
+
const stageName = (id) => stages.find((s) => s.id === id)?.title ?? id;
|
|
29
|
+
const columns = [
|
|
30
|
+
{ id: "title", header: "Deal", accessor: "title", sortable: true, cell: (d) => /* @__PURE__ */ jsxs("span", { className: "sp-tpl-crm__deal-name", children: [
|
|
31
|
+
d.title,
|
|
32
|
+
/* @__PURE__ */ jsx("small", { children: d.company })
|
|
33
|
+
] }) },
|
|
34
|
+
{ id: "stage", header: "Stage", accessor: (d) => stageName(d.stage), filter: {}, cell: (d) => /* @__PURE__ */ jsx(Badge, { dot: true, tone: "neutral", children: stageName(d.stage) }) },
|
|
35
|
+
{ id: "owner", header: "Owner", accessor: "owner", filter: {}, cell: (d) => /* @__PURE__ */ jsxs("span", { className: "sp-tpl__person", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Avatar, { name: d.owner, size: 22 }),
|
|
37
|
+
d.owner
|
|
38
|
+
] }) },
|
|
39
|
+
{ id: "close", header: "Close date", accessor: "closeDate", sortable: true, cell: (d) => dateFmt.format(d.closeDate) },
|
|
40
|
+
{ id: "prob", header: "Probability", accessor: "probability", align: "right", sortable: true, cell: (d) => `${Math.round(d.probability * 100)}%` },
|
|
41
|
+
{ id: "value", header: "Value", accessor: "value", align: "right", sortable: true, cell: (d) => moneyFull.format(d.value) }
|
|
42
|
+
];
|
|
43
|
+
return /* @__PURE__ */ jsx(TemplateFrame, { chrome, children: /* @__PURE__ */ jsxs("div", { className: cx("sp-tpl", "sp-tpl-crm"), children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
PageHeader,
|
|
46
|
+
{
|
|
47
|
+
title: "Pipeline",
|
|
48
|
+
description: `${deals.length} open deals \xB7 ${money.format(total)} total \xB7 ${money.format(weighted)} weighted`,
|
|
49
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
SegmentedControl,
|
|
52
|
+
{
|
|
53
|
+
"aria-label": "View",
|
|
54
|
+
size: "sm",
|
|
55
|
+
value: view,
|
|
56
|
+
onValueChange: (v) => setView(v),
|
|
57
|
+
options: [
|
|
58
|
+
{ value: "board", label: "Board" },
|
|
59
|
+
{ value: "table", label: "Table" }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
onCreateDeal && /* @__PURE__ */ jsx(Button, { variant: "accent", size: "sm", onClick: () => onCreateDeal(), children: "New deal" })
|
|
64
|
+
] }),
|
|
65
|
+
children: /* @__PURE__ */ jsx(
|
|
66
|
+
DistributionBar,
|
|
67
|
+
{
|
|
68
|
+
label: "Pipeline value by stage",
|
|
69
|
+
variant: "thin",
|
|
70
|
+
formatValue: (v) => money.format(v),
|
|
71
|
+
data: stages.map((s, i) => ({ key: s.id, label: s.title, value: deals.filter((d) => d.stage === s.id).reduce((a, d) => a + d.value, 0), color: s.color ?? i + 1 }))
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
view === "board" ? /* @__PURE__ */ jsx(
|
|
77
|
+
KanbanBoard,
|
|
78
|
+
{
|
|
79
|
+
columns: stages,
|
|
80
|
+
items: deals.map((d) => ({ ...d, columnId: d.stage })),
|
|
81
|
+
getItemLabel: (d) => `${d.title}, ${moneyFull.format(d.value)}`,
|
|
82
|
+
onMove: onMoveDeal,
|
|
83
|
+
onAdd: onCreateDeal ? (stage) => onCreateDeal(stage) : void 0,
|
|
84
|
+
onItemClick: (d) => setOpenId(d.id),
|
|
85
|
+
renderCard: (d) => /* @__PURE__ */ jsxs("div", { className: "sp-tpl-crm__card", children: [
|
|
86
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-tpl-crm__card-top", children: [
|
|
87
|
+
/* @__PURE__ */ jsx("span", { className: "sp-tpl-crm__card-title", children: d.title }),
|
|
88
|
+
/* @__PURE__ */ jsx(Avatar, { name: d.owner, size: 20 })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: "sp-tpl-crm__card-co", children: d.company }),
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-tpl-crm__card-foot", children: [
|
|
92
|
+
/* @__PURE__ */ jsx("b", { children: money.format(d.value) }),
|
|
93
|
+
/* @__PURE__ */ jsx("span", { children: dateFmt.format(d.closeDate) })
|
|
94
|
+
] })
|
|
95
|
+
] })
|
|
96
|
+
}
|
|
97
|
+
) : /* @__PURE__ */ jsx(DataTable, { label: "Deals", data: deals, columns, getRowId: (d) => d.id, onRowClick: (d) => setOpenId(d.id), selectable: true, initialSort: { id: "close", direction: "asc" }, exportFilename: "deals" }),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
Dialog,
|
|
100
|
+
{
|
|
101
|
+
open: !!open,
|
|
102
|
+
onOpenChange: (o) => !o && setOpenId(null),
|
|
103
|
+
placement: "right",
|
|
104
|
+
size: "md",
|
|
105
|
+
title: open?.title,
|
|
106
|
+
description: open ? `${open.company} \xB7 ${stageName(open.stage)}` : void 0,
|
|
107
|
+
footer: open && onDealAction ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onDealAction(open, "lost"), children: "Mark lost" }),
|
|
109
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => onDealAction(open, "edit"), children: "Edit" }),
|
|
110
|
+
/* @__PURE__ */ jsx(Button, { variant: "accent", onClick: () => onDealAction(open, "won"), children: "Mark won" })
|
|
111
|
+
] }) : void 0,
|
|
112
|
+
children: open && /* @__PURE__ */ jsxs("div", { className: "sp-tpl-crm__sheet", children: [
|
|
113
|
+
/* @__PURE__ */ jsxs("dl", { className: "sp-tpl-crm__facts", children: [
|
|
114
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
115
|
+
/* @__PURE__ */ jsx("dt", { children: "Value" }),
|
|
116
|
+
/* @__PURE__ */ jsx("dd", { children: moneyFull.format(open.value) })
|
|
117
|
+
] }),
|
|
118
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
119
|
+
/* @__PURE__ */ jsx("dt", { children: "Probability" }),
|
|
120
|
+
/* @__PURE__ */ jsxs("dd", { children: [
|
|
121
|
+
Math.round(open.probability * 100),
|
|
122
|
+
"%"
|
|
123
|
+
] })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
126
|
+
/* @__PURE__ */ jsx("dt", { children: "Weighted" }),
|
|
127
|
+
/* @__PURE__ */ jsx("dd", { children: moneyFull.format(open.value * open.probability) })
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
130
|
+
/* @__PURE__ */ jsx("dt", { children: "Close date" }),
|
|
131
|
+
/* @__PURE__ */ jsx("dd", { children: dateFmt.format(open.closeDate) })
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
134
|
+
/* @__PURE__ */ jsx("dt", { children: "Owner" }),
|
|
135
|
+
/* @__PURE__ */ jsxs("dd", { className: "sp-tpl__person", children: [
|
|
136
|
+
/* @__PURE__ */ jsx(Avatar, { name: open.owner, size: 20 }),
|
|
137
|
+
open.owner
|
|
138
|
+
] })
|
|
139
|
+
] })
|
|
140
|
+
] }),
|
|
141
|
+
open.tags?.length ? /* @__PURE__ */ jsx("div", { className: "sp-tpl-crm__tags", children: open.tags.map((t) => /* @__PURE__ */ jsx(Badge, { variant: "outline", children: t }, t)) }) : null,
|
|
142
|
+
activityFor && /* @__PURE__ */ jsxs("section", { children: [
|
|
143
|
+
/* @__PURE__ */ jsx("h3", { className: "sp-tpl__h3", children: "Activity" }),
|
|
144
|
+
/* @__PURE__ */ jsx(ActivityFeed, { events: activityFor(open), groupByDay: false })
|
|
145
|
+
] })
|
|
146
|
+
] })
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }) });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { CrmTemplate };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { rubberClamp } from './chunk-344MRWFO.js';
|
|
3
|
+
import { useControllableState } from './chunk-KPG24YFL.js';
|
|
4
|
+
import { useIsoLayoutEffect, mergeRefs, haptic } from './chunk-4C7VKLTU.js';
|
|
5
|
+
import { useMotionPreset } from './chunk-VDQ3DWO4.js';
|
|
6
|
+
import { cx } from './chunk-K6X6O42N.js';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { useMotionValue, useTransform, animate, motion } from 'motion/react';
|
|
9
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var KNOB_SPRING = { type: "spring", stiffness: 760, damping: 34, mass: 0.75 };
|
|
12
|
+
var STRETCH = 6;
|
|
13
|
+
var INSET = 2;
|
|
14
|
+
var Switch = React.forwardRef(function Switch2({
|
|
15
|
+
checked: checkedProp,
|
|
16
|
+
defaultChecked = false,
|
|
17
|
+
onCheckedChange,
|
|
18
|
+
variant = "toggle",
|
|
19
|
+
size = "md",
|
|
20
|
+
labels = ["Off", "On"],
|
|
21
|
+
name,
|
|
22
|
+
value = "on",
|
|
23
|
+
haptics = true,
|
|
24
|
+
disabled,
|
|
25
|
+
className,
|
|
26
|
+
onClick,
|
|
27
|
+
onPointerDown,
|
|
28
|
+
onKeyDown,
|
|
29
|
+
onKeyUp,
|
|
30
|
+
...rest
|
|
31
|
+
}, forwardedRef) {
|
|
32
|
+
const [checked, setChecked] = useControllableState({ value: checkedProp, defaultValue: defaultChecked, onChange: onCheckedChange });
|
|
33
|
+
const { reduced, t } = useMotionPreset();
|
|
34
|
+
const rootRef = React.useRef(null);
|
|
35
|
+
const [pressed, setPressed] = React.useState(false);
|
|
36
|
+
const [dragging, setDragging] = React.useState(false);
|
|
37
|
+
const [metrics, setMetrics] = React.useState({ travel: 18, knob: 22 });
|
|
38
|
+
const drag = React.useRef(null);
|
|
39
|
+
const suppressClick = React.useRef(false);
|
|
40
|
+
const x = useMotionValue(0);
|
|
41
|
+
const width = useMotionValue(metrics.knob);
|
|
42
|
+
const metricsRef = React.useRef(metrics);
|
|
43
|
+
metricsRef.current = metrics;
|
|
44
|
+
const progress = useTransform(x, (v) => Math.min(1, Math.max(0, v / Math.max(1, metricsRef.current.travel - STRETCH))));
|
|
45
|
+
const rotate = useMotionValue(0);
|
|
46
|
+
const draggable = variant !== "rocker";
|
|
47
|
+
useIsoLayoutEffect(() => {
|
|
48
|
+
const el = rootRef.current;
|
|
49
|
+
if (!el || variant === "rocker") return;
|
|
50
|
+
const h = el.clientHeight;
|
|
51
|
+
const w = el.clientWidth;
|
|
52
|
+
const knob = h - INSET * 2;
|
|
53
|
+
setMetrics({ knob, travel: w - knob - INSET * 2 });
|
|
54
|
+
}, [size, variant]);
|
|
55
|
+
const first = React.useRef(true);
|
|
56
|
+
useIsoLayoutEffect(() => {
|
|
57
|
+
if (variant === "rocker") {
|
|
58
|
+
const base = checked ? -1 : 1;
|
|
59
|
+
const target = pressed ? base * 4 : base * 11;
|
|
60
|
+
if (first.current) rotate.set(target);
|
|
61
|
+
else animate(rotate, target, t(pressed ? { type: "spring", stiffness: 900, damping: 40 } : { type: "spring", stiffness: 560, damping: 18 }));
|
|
62
|
+
first.current = false;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (dragging) return;
|
|
66
|
+
const stretch = pressed ? STRETCH : 0;
|
|
67
|
+
const targetX = checked ? metrics.travel - stretch : 0;
|
|
68
|
+
const targetW = metrics.knob + stretch;
|
|
69
|
+
if (first.current) {
|
|
70
|
+
x.set(targetX);
|
|
71
|
+
width.set(targetW);
|
|
72
|
+
} else {
|
|
73
|
+
animate(x, targetX, t(KNOB_SPRING));
|
|
74
|
+
animate(width, targetW, t(KNOB_SPRING));
|
|
75
|
+
}
|
|
76
|
+
first.current = false;
|
|
77
|
+
}, [checked, pressed, dragging, metrics, variant, reduced]);
|
|
78
|
+
const commit = (next) => {
|
|
79
|
+
if (next !== checked && haptics) haptic(8);
|
|
80
|
+
setChecked(next);
|
|
81
|
+
};
|
|
82
|
+
const handlePointerDown = (event) => {
|
|
83
|
+
onPointerDown?.(event);
|
|
84
|
+
if (disabled || event.defaultPrevented || event.button !== 0) return;
|
|
85
|
+
setPressed(true);
|
|
86
|
+
if (draggable) {
|
|
87
|
+
drag.current = { x0: event.clientX, start: x.get(), moved: false };
|
|
88
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const handlePointerMove = (event) => {
|
|
92
|
+
const d = drag.current;
|
|
93
|
+
if (!d) return;
|
|
94
|
+
const dx = event.clientX - d.x0;
|
|
95
|
+
if (!d.moved && Math.abs(dx) > 3) {
|
|
96
|
+
d.moved = true;
|
|
97
|
+
setDragging(true);
|
|
98
|
+
}
|
|
99
|
+
if (d.moved) {
|
|
100
|
+
const max = metrics.travel - STRETCH;
|
|
101
|
+
x.set(rubberClamp(d.start + dx, 0, max, metrics.travel, 0.4));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const endPointer = (event, cancelled = false) => {
|
|
105
|
+
const d = drag.current;
|
|
106
|
+
drag.current = null;
|
|
107
|
+
setPressed(false);
|
|
108
|
+
if (d?.moved) {
|
|
109
|
+
suppressClick.current = !cancelled;
|
|
110
|
+
setDragging(false);
|
|
111
|
+
if (!cancelled) commit(x.get() > (metrics.travel - STRETCH) / 2);
|
|
112
|
+
}
|
|
113
|
+
if (event.currentTarget.hasPointerCapture?.(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
|
|
114
|
+
};
|
|
115
|
+
const handleClick = (event) => {
|
|
116
|
+
onClick?.(event);
|
|
117
|
+
if (suppressClick.current) {
|
|
118
|
+
suppressClick.current = false;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (disabled || event.defaultPrevented) return;
|
|
122
|
+
commit(!checked);
|
|
123
|
+
};
|
|
124
|
+
const handleKeyDown = (event) => {
|
|
125
|
+
onKeyDown?.(event);
|
|
126
|
+
if ((event.key === " " || event.key === "Enter") && !event.repeat && !disabled) setPressed(true);
|
|
127
|
+
};
|
|
128
|
+
const handleKeyUp = (event) => {
|
|
129
|
+
onKeyUp?.(event);
|
|
130
|
+
if (event.key === " " || event.key === "Enter") setPressed(false);
|
|
131
|
+
};
|
|
132
|
+
const offLabelOpacity = useTransform(progress, [0, 0.6], [1, 0]);
|
|
133
|
+
const offLabelX = useTransform(progress, [0, 1], [0, 10]);
|
|
134
|
+
const onLabelOpacity = useTransform(progress, [0.4, 1], [0, 1]);
|
|
135
|
+
const onLabelX = useTransform(progress, [0, 1], [-10, 0]);
|
|
136
|
+
const shadeLeft = useTransform(rotate, [-11, 11], [1, 0]);
|
|
137
|
+
const shadeRight = useTransform(rotate, [-11, 11], [0, 1]);
|
|
138
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
+
/* @__PURE__ */ jsx(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
...rest,
|
|
143
|
+
ref: mergeRefs(rootRef, forwardedRef),
|
|
144
|
+
type: "button",
|
|
145
|
+
role: "switch",
|
|
146
|
+
"aria-checked": checked,
|
|
147
|
+
disabled,
|
|
148
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
149
|
+
"data-variant": variant,
|
|
150
|
+
"data-size": size,
|
|
151
|
+
"data-pressed": pressed || void 0,
|
|
152
|
+
"data-dragging": dragging || void 0,
|
|
153
|
+
className: cx("sp-reset-button sp-switch", className),
|
|
154
|
+
onClick: handleClick,
|
|
155
|
+
onPointerDown: handlePointerDown,
|
|
156
|
+
onPointerMove: handlePointerMove,
|
|
157
|
+
onPointerUp: (e) => endPointer(e),
|
|
158
|
+
onPointerCancel: (e) => endPointer(e, true),
|
|
159
|
+
onKeyDown: handleKeyDown,
|
|
160
|
+
onKeyUp: handleKeyUp,
|
|
161
|
+
onBlur: () => setPressed(false),
|
|
162
|
+
children: variant === "rocker" ? /* @__PURE__ */ jsx("span", { className: "sp-switch__bezel", "aria-hidden": true, children: /* @__PURE__ */ jsxs(motion.span, { className: "sp-switch__paddle", style: { rotateY: rotate }, children: [
|
|
163
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-switch__half", "data-side": "on", children: [
|
|
164
|
+
/* @__PURE__ */ jsx("span", { className: "sp-switch__glyph", children: labels[1] }),
|
|
165
|
+
/* @__PURE__ */ jsx(motion.span, { className: "sp-switch__shade", style: { opacity: shadeLeft } })
|
|
166
|
+
] }),
|
|
167
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-switch__half", "data-side": "off", children: [
|
|
168
|
+
/* @__PURE__ */ jsx("span", { className: "sp-switch__glyph", children: labels[0] }),
|
|
169
|
+
/* @__PURE__ */ jsx(motion.span, { className: "sp-switch__shade", style: { opacity: shadeRight } })
|
|
170
|
+
] })
|
|
171
|
+
] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
172
|
+
/* @__PURE__ */ jsxs("span", { className: "sp-switch__track", "aria-hidden": true, children: [
|
|
173
|
+
/* @__PURE__ */ jsx(motion.span, { className: "sp-switch__fill", style: { opacity: progress } }),
|
|
174
|
+
variant === "label" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
175
|
+
/* @__PURE__ */ jsx(motion.span, { className: "sp-switch__text", "data-side": "on", style: { opacity: onLabelOpacity, x: onLabelX }, children: labels[1] }),
|
|
176
|
+
/* @__PURE__ */ jsx(motion.span, { className: "sp-switch__text", "data-side": "off", style: { opacity: offLabelOpacity, x: offLabelX }, children: labels[0] })
|
|
177
|
+
] })
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsx(motion.span, { className: "sp-switch__knob", "aria-hidden": true, style: { x, width } })
|
|
180
|
+
] })
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
name && checked ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value }) : null
|
|
184
|
+
] });
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
export { Switch };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkJC6MXMQZ_cjs = require('./chunk-JC6MXMQZ.cjs');
|
|
5
|
+
var chunkLRI6V2NK_cjs = require('./chunk-LRI6V2NK.cjs');
|
|
6
|
+
var chunkI3HEEAHX_cjs = require('./chunk-I3HEEAHX.cjs');
|
|
7
|
+
var chunkG5UZZ2XG_cjs = require('./chunk-G5UZZ2XG.cjs');
|
|
8
|
+
var chunkW3VOEVRS_cjs = require('./chunk-W3VOEVRS.cjs');
|
|
9
|
+
var chunkGHC7MKBR_cjs = require('./chunk-GHC7MKBR.cjs');
|
|
10
|
+
var chunkB3D6KWG3_cjs = require('./chunk-B3D6KWG3.cjs');
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var react = require('motion/react');
|
|
13
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
|
+
|
|
35
|
+
var DialogCtx = React__namespace.createContext(null);
|
|
36
|
+
var useDialog = () => React__namespace.useContext(DialogCtx) ?? { close: () => {
|
|
37
|
+
} };
|
|
38
|
+
var WIDTH = { sm: 400, md: 520, lg: 680, xl: 880 };
|
|
39
|
+
function Dialog({
|
|
40
|
+
open: openProp,
|
|
41
|
+
defaultOpen = false,
|
|
42
|
+
onOpenChange,
|
|
43
|
+
trigger,
|
|
44
|
+
title,
|
|
45
|
+
description,
|
|
46
|
+
footer,
|
|
47
|
+
size = "md",
|
|
48
|
+
placement = "center",
|
|
49
|
+
dismissible = true,
|
|
50
|
+
hideClose = false,
|
|
51
|
+
role = "dialog",
|
|
52
|
+
container,
|
|
53
|
+
className,
|
|
54
|
+
style,
|
|
55
|
+
children,
|
|
56
|
+
...rest
|
|
57
|
+
}) {
|
|
58
|
+
const [open, setOpen] = chunkG5UZZ2XG_cjs.useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
59
|
+
const { t, reduced } = chunkGHC7MKBR_cjs.useMotionPreset();
|
|
60
|
+
const triggerRef = React__namespace.useRef(null);
|
|
61
|
+
const panelRef = React__namespace.useRef(null);
|
|
62
|
+
const id = React__namespace.useId();
|
|
63
|
+
const close = React__namespace.useCallback(() => setOpen(false), [setOpen]);
|
|
64
|
+
chunkLRI6V2NK_cjs.useScrollLock(open);
|
|
65
|
+
chunkLRI6V2NK_cjs.useFocusTrap(panelRef, open);
|
|
66
|
+
chunkLRI6V2NK_cjs.useEscape(open, () => dismissible && close());
|
|
67
|
+
let triggerEl = null;
|
|
68
|
+
if (trigger) {
|
|
69
|
+
const child = trigger;
|
|
70
|
+
triggerEl = React__namespace.cloneElement(child, {
|
|
71
|
+
ref: chunkW3VOEVRS_cjs.mergeRefs(triggerRef, chunkJC6MXMQZ_cjs.getElementRef(child)),
|
|
72
|
+
"aria-haspopup": "dialog",
|
|
73
|
+
"aria-expanded": open,
|
|
74
|
+
onClick: (e) => {
|
|
75
|
+
child.props.onClick?.(e);
|
|
76
|
+
if (!e.defaultPrevented) setOpen(true);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const sheet = placement === "right";
|
|
81
|
+
const panelMotion = sheet ? { initial: { x: reduced ? 0 : "100%", opacity: reduced ? 0 : 1 }, animate: { x: 0, opacity: 1 }, exit: { x: reduced ? 0 : "100%", opacity: reduced ? 0 : 1, transition: t({ type: "spring", visualDuration: 0.28, bounce: 0 }) } } : { initial: { opacity: 0, scale: reduced ? 1 : 0.97, y: reduced ? 0 : 10 }, animate: { opacity: 1, scale: 1, y: 0 }, exit: { opacity: 0, scale: reduced ? 1 : 0.98, y: reduced ? 0 : 4, transition: { duration: 0.14 } } };
|
|
82
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
83
|
+
triggerEl,
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkI3HEEAHX_cjs.Portal, { container, anchor: triggerRef.current, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sp-dialog__root", "data-placement": placement, children: [
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
+
react.motion.div,
|
|
87
|
+
{
|
|
88
|
+
className: "sp-overlay sp-dialog__overlay",
|
|
89
|
+
initial: { opacity: 0 },
|
|
90
|
+
animate: { opacity: 1 },
|
|
91
|
+
exit: { opacity: 0, transition: { duration: 0.18 } },
|
|
92
|
+
transition: { duration: 0.22 },
|
|
93
|
+
onPointerDown: () => dismissible && close(),
|
|
94
|
+
"aria-hidden": true
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
react.motion.div,
|
|
99
|
+
{
|
|
100
|
+
...rest,
|
|
101
|
+
ref: panelRef,
|
|
102
|
+
role,
|
|
103
|
+
"aria-modal": "true",
|
|
104
|
+
"aria-labelledby": title ? `${id}-title` : void 0,
|
|
105
|
+
"aria-describedby": description ? `${id}-desc` : void 0,
|
|
106
|
+
tabIndex: -1,
|
|
107
|
+
className: chunkB3D6KWG3_cjs.cx("sp-dialog", className),
|
|
108
|
+
"data-size": size,
|
|
109
|
+
"data-placement": placement,
|
|
110
|
+
style: { ...style, ["--sp-dialog-w"]: `${WIDTH[size]}px` },
|
|
111
|
+
...panelMotion,
|
|
112
|
+
transition: t(sheet ? { type: "spring", visualDuration: 0.42, bounce: 0.04 } : { type: "spring", visualDuration: 0.36, bounce: 0.12 }),
|
|
113
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(DialogCtx.Provider, { value: { close }, children: [
|
|
114
|
+
(title || !hideClose) && /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "sp-dialog__header", "data-empty": !title && !description ? "" : void 0, children: [
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sp-dialog__titles", children: [
|
|
116
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "sp-dialog__title", id: `${id}-title`, children: title }),
|
|
117
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sp-dialog__description", id: `${id}-desc`, children: description })
|
|
118
|
+
] }),
|
|
119
|
+
!hideClose && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sp-reset-button sp-dialog__close", "aria-label": "Close", onClick: close, disabled: !dismissible, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "15", height: "15", "aria-hidden": true, fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 4.5l7 7M11.5 4.5l-7 7" }) }) })
|
|
120
|
+
] }),
|
|
121
|
+
children != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sp-dialog__body", children }),
|
|
122
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx("footer", { className: "sp-dialog__footer", children: footer })
|
|
123
|
+
] })
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] }) }) })
|
|
127
|
+
] });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
exports.Dialog = Dialog;
|
|
131
|
+
exports.useDialog = useDialog;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// src/internal/math.ts
|
|
3
|
+
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
4
|
+
var decimalsOf = (step) => {
|
|
5
|
+
const s = String(step);
|
|
6
|
+
const i = s.indexOf(".");
|
|
7
|
+
return i === -1 ? 0 : s.length - i - 1;
|
|
8
|
+
};
|
|
9
|
+
var snapToStep = (value, step, min) => {
|
|
10
|
+
if (!step) return value;
|
|
11
|
+
const snapped = Math.round((value - min) / step) * step + min;
|
|
12
|
+
return Number(snapped.toFixed(decimalsOf(step)));
|
|
13
|
+
};
|
|
14
|
+
var rubberband = (overflow, dimension, constant = 0.55) => {
|
|
15
|
+
const sign = Math.sign(overflow);
|
|
16
|
+
const d = Math.abs(overflow);
|
|
17
|
+
return sign * (d * dimension * constant / (dimension + constant * d));
|
|
18
|
+
};
|
|
19
|
+
var rubberClamp = (value, min, max, dimension, constant = 0.55) => {
|
|
20
|
+
if (value < min) return min + rubberband(value - min, dimension, constant);
|
|
21
|
+
if (value > max) return max + rubberband(value - max, dimension, constant);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { clamp, rubberClamp, rubberband, snapToStep };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// src/internal/math.ts
|
|
5
|
+
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
6
|
+
var decimalsOf = (step) => {
|
|
7
|
+
const s = String(step);
|
|
8
|
+
const i = s.indexOf(".");
|
|
9
|
+
return i === -1 ? 0 : s.length - i - 1;
|
|
10
|
+
};
|
|
11
|
+
var snapToStep = (value, step, min) => {
|
|
12
|
+
if (!step) return value;
|
|
13
|
+
const snapped = Math.round((value - min) / step) * step + min;
|
|
14
|
+
return Number(snapped.toFixed(decimalsOf(step)));
|
|
15
|
+
};
|
|
16
|
+
var rubberband = (overflow, dimension, constant = 0.55) => {
|
|
17
|
+
const sign = Math.sign(overflow);
|
|
18
|
+
const d = Math.abs(overflow);
|
|
19
|
+
return sign * (d * dimension * constant / (dimension + constant * d));
|
|
20
|
+
};
|
|
21
|
+
var rubberClamp = (value, min, max, dimension, constant = 0.55) => {
|
|
22
|
+
if (value < min) return min + rubberband(value - min, dimension, constant);
|
|
23
|
+
if (value > max) return max + rubberband(value - max, dimension, constant);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.clamp = clamp;
|
|
28
|
+
exports.rubberClamp = rubberClamp;
|
|
29
|
+
exports.rubberband = rubberband;
|
|
30
|
+
exports.snapToStep = snapToStep;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunk7DCJW7LC_cjs = require('./chunk-7DCJW7LC.cjs');
|
|
5
|
+
var chunkN4KGLSBT_cjs = require('./chunk-N4KGLSBT.cjs');
|
|
6
|
+
var chunkGTU6TD5Q_cjs = require('./chunk-GTU6TD5Q.cjs');
|
|
7
|
+
var chunkGHC7MKBR_cjs = require('./chunk-GHC7MKBR.cjs');
|
|
8
|
+
var chunkB3D6KWG3_cjs = require('./chunk-B3D6KWG3.cjs');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var react = require('motion/react');
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
+
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
+
|
|
33
|
+
var key = (role, perm) => `${role}::${perm}`;
|
|
34
|
+
function PermissionMatrix({ groups, roles, value, onSave, className, ...rest }) {
|
|
35
|
+
const { reduced } = chunkGHC7MKBR_cjs.useMotionPreset();
|
|
36
|
+
const toSet = (g) => new Set(Object.entries(g).flatMap(([r, ps]) => ps.map((p) => key(r, p))));
|
|
37
|
+
const saved = React__namespace.useMemo(() => toSet(value), [value]);
|
|
38
|
+
const [draft, setDraft] = React__namespace.useState(saved);
|
|
39
|
+
const [pending, setPending] = React__namespace.useState(false);
|
|
40
|
+
const [error, setError] = React__namespace.useState(null);
|
|
41
|
+
React__namespace.useEffect(() => setDraft(toSet(value)), [value]);
|
|
42
|
+
const changes = [.../* @__PURE__ */ new Set([...draft, ...saved])].filter((k) => draft.has(k) !== saved.has(k));
|
|
43
|
+
const toggle = (keys, on) => setDraft((d) => {
|
|
44
|
+
const n = new Set(d);
|
|
45
|
+
for (const k of keys) on ? n.add(k) : n.delete(k);
|
|
46
|
+
return n;
|
|
47
|
+
});
|
|
48
|
+
const save = async () => {
|
|
49
|
+
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)]));
|
|
50
|
+
setPending(true);
|
|
51
|
+
setError(null);
|
|
52
|
+
try {
|
|
53
|
+
await onSave(next);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
setError(err instanceof Error ? err.message : "Could not save changes.");
|
|
56
|
+
} finally {
|
|
57
|
+
setPending(false);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...rest, className: chunkB3D6KWG3_cjs.cx("sp-perm", className), children: [
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sp-perm__scroll", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "sp-perm__table", children: [
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "sp-perm__corner", children: "Permission" }),
|
|
64
|
+
roles.map((r) => /* @__PURE__ */ jsxRuntime.jsxs("th", { scope: "col", className: "sp-perm__role", children: [
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sp-perm__role-name", children: [
|
|
66
|
+
r.name,
|
|
67
|
+
r.locked && /* @__PURE__ */ jsxRuntime.jsx(chunk7DCJW7LC_cjs.Tooltip, { content: "Locked \u2014 this role always has every permission", children: /* @__PURE__ */ jsxRuntime.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: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3.5", y: "7", width: "9", height: "6.5", rx: "1.5" }),
|
|
69
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.5 7V5.5a2.5 2.5 0 0 1 5 0V7" })
|
|
70
|
+
] }) })
|
|
71
|
+
] }),
|
|
72
|
+
r.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sp-perm__role-desc", children: r.description })
|
|
73
|
+
] }, r.id))
|
|
74
|
+
] }) }),
|
|
75
|
+
groups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "sp-perm__group", children: [
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "rowgroup", children: g.label }),
|
|
78
|
+
roles.map((r) => {
|
|
79
|
+
const keys = g.permissions.map((p) => key(r.id, p.id));
|
|
80
|
+
const n = keys.filter((k) => draft.has(k)).length;
|
|
81
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
+
chunkGTU6TD5Q_cjs.Checkbox,
|
|
83
|
+
{
|
|
84
|
+
size: "sm",
|
|
85
|
+
"aria-label": `${r.name}: all ${g.label} permissions`,
|
|
86
|
+
checked: n === keys.length ? true : n > 0 ? "indeterminate" : false,
|
|
87
|
+
disabled: r.locked || pending,
|
|
88
|
+
onCheckedChange: () => toggle(keys, n !== keys.length)
|
|
89
|
+
}
|
|
90
|
+
) }, r.id);
|
|
91
|
+
})
|
|
92
|
+
] }),
|
|
93
|
+
g.permissions.map((p) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "sp-perm__row", children: [
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsxs("th", { scope: "row", children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sp-perm__label", children: p.label }),
|
|
96
|
+
p.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sp-perm__desc", children: p.description })
|
|
97
|
+
] }),
|
|
98
|
+
roles.map((r) => {
|
|
99
|
+
const k = key(r.id, p.id);
|
|
100
|
+
const changed = draft.has(k) !== saved.has(k);
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { "data-changed": changed || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(chunkGTU6TD5Q_cjs.Checkbox, { size: "sm", "aria-label": `${r.name}: ${p.label}`, checked: draft.has(k), disabled: r.locked || pending, onCheckedChange: (c) => toggle([k], c) }) }, r.id);
|
|
102
|
+
})
|
|
103
|
+
] }, p.id))
|
|
104
|
+
] }, g.id))
|
|
105
|
+
] }) }),
|
|
106
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: changes.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
107
|
+
react.motion.div,
|
|
108
|
+
{
|
|
109
|
+
className: "sp-perm__bar",
|
|
110
|
+
role: "region",
|
|
111
|
+
"aria-label": "Unsaved changes",
|
|
112
|
+
initial: reduced ? { opacity: 0 } : { opacity: 0, y: 12 },
|
|
113
|
+
animate: { opacity: 1, y: 0 },
|
|
114
|
+
exit: reduced ? { opacity: 0 } : { opacity: 0, y: 12 },
|
|
115
|
+
transition: { type: "spring", stiffness: 520, damping: 38 },
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sp-perm__bar-text", "aria-live": "polite", children: error ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sp-perm__bar-error", children: error }) : `${changes.length} unsaved ${changes.length === 1 ? "change" : "changes"}` }),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkN4KGLSBT_cjs.Button, { variant: "ghost", size: "sm", onClick: () => (setDraft(new Set(saved)), setError(null)), disabled: pending, children: "Discard" }),
|
|
119
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkN4KGLSBT_cjs.Button, { size: "sm", variant: "accent", onClick: save, loading: pending, children: "Save changes" })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
) })
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
exports.PermissionMatrix = PermissionMatrix;
|