@stfrigerio/sito-template 0.1.99 → 0.1.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/charts/BooleansHeatmap/BooleansHeatmap.d.ts.map +1 -1
- package/dist/components/organisms/charts/ChordDiagram/ChordDiagram.d.ts +20 -0
- package/dist/components/organisms/charts/ChordDiagram/ChordDiagram.d.ts.map +1 -0
- package/dist/components/organisms/charts/ChordDiagram/ChordDiagram.stories.d.ts +9 -0
- package/dist/components/organisms/charts/ChordDiagram/ChordDiagram.stories.d.ts.map +1 -0
- package/dist/components/organisms/charts/HabitTimeOfDayChart/HabitTimeOfDayChart.d.ts.map +1 -1
- package/dist/components/organisms/charts/PieChart/PieChart.d.ts.map +1 -1
- package/dist/components/organisms/charts/PolarHeatmap/PolarHeatmap.d.ts +30 -0
- package/dist/components/organisms/charts/PolarHeatmap/PolarHeatmap.d.ts.map +1 -0
- package/dist/components/organisms/charts/PolarHeatmap/PolarHeatmap.stories.d.ts +9 -0
- package/dist/components/organisms/charts/PolarHeatmap/PolarHeatmap.stories.d.ts.map +1 -0
- package/dist/components/organisms/charts/ProgressRings/ProgressRings.d.ts +20 -0
- package/dist/components/organisms/charts/ProgressRings/ProgressRings.d.ts.map +1 -0
- package/dist/components/organisms/charts/ProgressRings/ProgressRings.stories.d.ts +9 -0
- package/dist/components/organisms/charts/ProgressRings/ProgressRings.stories.d.ts.map +1 -0
- package/dist/components/organisms/charts/QuantifiableHabitsChart/QuantifiableHabitsChart.d.ts.map +1 -1
- package/dist/components/organisms/charts/RadialDayChart/RadialDayChart.d.ts +30 -0
- package/dist/components/organisms/charts/RadialDayChart/RadialDayChart.d.ts.map +1 -0
- package/dist/components/organisms/charts/RadialDayChart/RadialDayChart.stories.d.ts +9 -0
- package/dist/components/organisms/charts/RadialDayChart/RadialDayChart.stories.d.ts.map +1 -0
- package/dist/components/organisms/charts/SleepChart/SleepChart.d.ts.map +1 -1
- package/dist/components/organisms/charts/SunburstChart/SunburstChart.d.ts.map +1 -1
- package/dist/components/organisms/charts/index.d.ts +7 -0
- package/dist/components/organisms/charts/index.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +7 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/index.esm.js +969 -305
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +975 -307
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/storybook-static/assets/{ASCIIText.stories-DSI7g-mB.js → ASCIIText.stories-tIaR8-30.js} +1 -1
- package/storybook-static/assets/{AllAtoms.stories-JflUIS5e.js → AllAtoms.stories-wjImSAbw.js} +1 -1
- package/storybook-static/assets/{AnimatedContent.stories-YR7SgIxb.js → AnimatedContent.stories-2qC-fkJI.js} +1 -1
- package/storybook-static/assets/{AnimatedList.stories-GR75O93H.js → AnimatedList.stories-CylIt0ba.js} +1 -1
- package/storybook-static/assets/{Antigravity.stories-B2MVCdRl.js → Antigravity.stories-ium_rPSJ.js} +1 -1
- package/storybook-static/assets/{ArrayInput.stories-BI_3D81-.js → ArrayInput.stories-CnVg06MK.js} +1 -1
- package/storybook-static/assets/{Aurora.stories-C_w705rr.js → Aurora.stories-DuFv0_k8.js} +1 -1
- package/storybook-static/assets/{Beams.stories-D1L26zBi.js → Beams.stories-DIEOjIBe.js} +1 -1
- package/storybook-static/assets/{BlobCursor.stories-BjywoQ5q.js → BlobCursor.stories-DvG-koWY.js} +1 -1
- package/storybook-static/assets/{BlurText.stories-CSpGTebR.js → BlurText.stories-sWy214Q2.js} +1 -1
- package/storybook-static/assets/BooleansHeatmap.stories-mxTxY_p5.js +63 -0
- package/storybook-static/assets/{BorderGlow.stories-BadihHiQ.js → BorderGlow.stories-E4gpGeWQ.js} +1 -1
- package/storybook-static/assets/{BubbleMenu.stories-Up_UUIWc.js → BubbleMenu.stories-W43-ioFH.js} +1 -1
- package/storybook-static/assets/{Button-DtiJJxMy.js → Button-CTnNAnoF.js} +1 -1
- package/storybook-static/assets/{Button.stories-BG9uxBwH.js → Button.stories-ACvBbIR1.js} +1 -1
- package/storybook-static/assets/{Calendar.stories-CUZikQRy.js → Calendar.stories-iQkvrvgz.js} +1 -1
- package/storybook-static/assets/{Card-BrvmNtM2.js → Card-6j0993HS.js} +1 -1
- package/storybook-static/assets/{Card.stories-Bf_EtMxA.js → Card.stories-DZzRMcRM.js} +1 -1
- package/storybook-static/assets/{CardNav.stories-OiwfVEn3.js → CardNav.stories-BqXRGPFR.js} +1 -1
- package/storybook-static/assets/{Carousel.stories-Gw1aPaNl.js → Carousel.stories-Z9HYvNS6.js} +1 -1
- package/storybook-static/assets/{Checkbox-CJhut6rk.js → Checkbox-6Z_EEcoe.js} +1 -1
- package/storybook-static/assets/{Checkbox.stories-tIqU6B-y.js → Checkbox.stories-CkXxAAOM.js} +1 -1
- package/storybook-static/assets/ChordDiagram-Bk6idINH.css +1 -0
- package/storybook-static/assets/ChordDiagram.stories-BoGS9mXW.js +25 -0
- package/storybook-static/assets/{ChromaGrid.stories-DbsrxAuC.js → ChromaGrid.stories-DZWtESDP.js} +1 -1
- package/storybook-static/assets/{CircularGallery.stories-0ffqgfyn.js → CircularGallery.stories-DQHz7F4g.js} +1 -1
- package/storybook-static/assets/{CircularText.stories-o46bAR53.js → CircularText.stories-hAb1lSel.js} +1 -1
- package/storybook-static/assets/{ClickSpark.stories-Ci-BtpH_.js → ClickSpark.stories-BjzCHr3X.js} +1 -1
- package/storybook-static/assets/{ColorBends.stories-CAiI7Gmw.js → ColorBends.stories-VFe9q7SG.js} +1 -1
- package/storybook-static/assets/{CountUp.stories-CFiYranp.js → CountUp.stories-DMfEJ2_X.js} +1 -1
- package/storybook-static/assets/{Counter.stories-BfaVu_y6.js → Counter.stories-Ddufg4zF.js} +1 -1
- package/storybook-static/assets/{Crosshair.stories-_Hh1nKQp.js → Crosshair.stories-C6quKu3e.js} +1 -1
- package/storybook-static/assets/{Cubes.stories-DXBS_f8J.js → Cubes.stories-B7vxZouX.js} +1 -1
- package/storybook-static/assets/{CurvedLoop.stories-jcgMeMsw.js → CurvedLoop.stories-BGet8MMP.js} +1 -1
- package/storybook-static/assets/{DarkVeil.stories-BwtU9vKO.js → DarkVeil.stories-Bu0Tnu-6.js} +1 -1
- package/storybook-static/assets/{DateInput-6Jn_FyvO.js → DateInput-BuyblN2J.js} +1 -1
- package/storybook-static/assets/{DateInput.stories-C_XBRwB3.js → DateInput.stories-CyRv7sjg.js} +1 -1
- package/storybook-static/assets/{DecayCard.stories-D6kTH79t.js → DecayCard.stories-BD2h63Yc.js} +1 -1
- package/storybook-static/assets/{DecryptedText.stories-B4xWEvyF.js → DecryptedText.stories-BR5w3WHS.js} +1 -1
- package/storybook-static/assets/{Dither.stories-DmAOxBWe.js → Dither.stories-aUCUDBCz.js} +1 -1
- package/storybook-static/assets/{Dock.stories-AHZywNVf.js → Dock.stories-B9c2txIi.js} +1 -1
- package/storybook-static/assets/{EditFAB.stories-BJ5P85ZN.js → EditFAB.stories-DMOijRLx.js} +1 -1
- package/storybook-static/assets/{EvilEye.stories-D0CBPfm1.js → EvilEye.stories-CsOG_d0o.js} +1 -1
- package/storybook-static/assets/{FadeContent.stories-D1capsBJ.js → FadeContent.stories-BR6tybqY.js} +1 -1
- package/storybook-static/assets/{FaultyTerminal.stories-BxqqRf0S.js → FaultyTerminal.stories-DS5Tyv6l.js} +1 -1
- package/storybook-static/assets/{Fbo-DvyLCJ1Y.js → Fbo-CW8HnzJ0.js} +1 -1
- package/storybook-static/assets/{FloatingLines.stories-7ze9ddpl.js → FloatingLines.stories-DpsTsF-M.js} +1 -1
- package/storybook-static/assets/{FlowingMenu.stories-BX9PD8x2.js → FlowingMenu.stories-C7Yw24v8.js} +1 -1
- package/storybook-static/assets/{FluidGlass.stories-DynD7GVO.js → FluidGlass.stories-DL7gsIvR.js} +1 -1
- package/storybook-static/assets/{Folder.stories-DDktLoEO.js → Folder.stories-oUQTik2D.js} +1 -1
- package/storybook-static/assets/{FuzzyText.stories-D9tRARUX.js → FuzzyText.stories-3sz8Ql2j.js} +1 -1
- package/storybook-static/assets/{Galaxy.stories-aSApGekp.js → Galaxy.stories-DNKl8sLe.js} +1 -1
- package/storybook-static/assets/{GhostCursor.stories-5l0di532.js → GhostCursor.stories-BwKhRvGF.js} +1 -1
- package/storybook-static/assets/{GlareHover.stories-Dc69-LbU.js → GlareHover.stories-HqLH7vCz.js} +1 -1
- package/storybook-static/assets/{GlassSurface.stories-DETLyc0H.js → GlassSurface.stories-BI3VNUMA.js} +1 -1
- package/storybook-static/assets/{GlitchText.stories-Bzb3ZMSY.js → GlitchText.stories-DAJVj_2t.js} +1 -1
- package/storybook-static/assets/{GooeyNav.stories-rxdxJjAy.js → GooeyNav.stories-DC9dqubb.js} +1 -1
- package/storybook-static/assets/{GradientBlinds.stories-03LkBbo8.js → GradientBlinds.stories-FtL2FczL.js} +1 -1
- package/storybook-static/assets/{GradientText.stories-CGo9FyNH.js → GradientText.stories-sKX4wnrF.js} +1 -1
- package/storybook-static/assets/{Grainient.stories-CzGAEJr-.js → Grainient.stories-LOYPnd1b.js} +1 -1
- package/storybook-static/assets/{GridMotion.stories-BzeBDaK8.js → GridMotion.stories-D56B4vk1.js} +1 -1
- package/storybook-static/assets/HabitTimeOfDayChart.stories-CSb9GUPx.js +49 -0
- package/storybook-static/assets/{ImageSlideshow.stories-hoGOc1Gf.js → ImageSlideshow.stories-B74RIe-i.js} +1 -1
- package/storybook-static/assets/{Iridescence.stories-CQTjQ1lh.js → Iridescence.stories-CTwtY8eT.js} +1 -1
- package/storybook-static/assets/{LaserFlow.stories-DzkVWskc.js → LaserFlow.stories-BLmaf3AB.js} +1 -1
- package/storybook-static/assets/{LetterGlitch.stories-0wcxCpnJ.js → LetterGlitch.stories-DH37XF0t.js} +1 -1
- package/storybook-static/assets/{LightPillar.stories-C3jRtdg9.js → LightPillar.stories-Ck3qeiN0.js} +1 -1
- package/storybook-static/assets/{LightRays.stories-C52kBsnd.js → LightRays.stories-ua2gmYoU.js} +1 -1
- package/storybook-static/assets/{Lightning.stories-BFVGqmMh.js → Lightning.stories-aH3grKDv.js} +1 -1
- package/storybook-static/assets/{LineWaves.stories-DNdwRrSd.js → LineWaves.stories-Dny9m17l.js} +1 -1
- package/storybook-static/assets/{LiquidChrome.stories-DFTBXxI6.js → LiquidChrome.stories-DhhNq7hu.js} +1 -1
- package/storybook-static/assets/{LiquidEther.stories-BGYmyfDI.js → LiquidEther.stories-QrTDJF0k.js} +1 -1
- package/storybook-static/assets/{LoadingSpinner-D3Kx-V7J.js → LoadingSpinner-1TPKggI4.js} +1 -1
- package/storybook-static/assets/{LoadingSpinner.stories-CP70BGAb.js → LoadingSpinner.stories-hbHHmRIN.js} +1 -1
- package/storybook-static/assets/{MagicRings.stories-BA9xv5mB.js → MagicRings.stories-DVVFiIUt.js} +1 -1
- package/storybook-static/assets/{Magnet.stories-cqBYCb-D.js → Magnet.stories-BbdHeWMA.js} +1 -1
- package/storybook-static/assets/{MagnetLines.stories-QkoPnGKj.js → MagnetLines.stories-DuFdunF1.js} +1 -1
- package/storybook-static/assets/{Masonry.stories-CiGXRf3O.js → Masonry.stories-eCIUqf99.js} +1 -1
- package/storybook-static/assets/{MetaBalls.stories-3l0pQiKn.js → MetaBalls.stories-Dv6jUd7Z.js} +1 -1
- package/storybook-static/assets/{MetallicPaint.stories-DgZJfMr5.js → MetallicPaint.stories-DAVRhJNS.js} +1 -1
- package/storybook-static/assets/MoodChart.stories-Cu2L9ctb.js +40 -0
- package/storybook-static/assets/{MotionConfigContext-BWFxZgdN.js → MotionConfigContext-BOce3hkw.js} +1 -1
- package/storybook-static/assets/{Navbar.stories-C_Zyfhqr.js → Navbar.stories-CA4HG5LC.js} +1 -1
- package/storybook-static/assets/{Noise.stories-Cg7CucgT.js → Noise.stories-CzRiztMU.js} +1 -1
- package/storybook-static/assets/{NumberStepper-DpOu7xmF.js → NumberStepper-CA99F71z.js} +1 -1
- package/storybook-static/assets/{NumberStepper.stories-CvG9oY5Q.js → NumberStepper.stories-BaedWrxw.js} +1 -1
- package/storybook-static/assets/{Orb.stories-BR92tgyW.js → Orb.stories-C3AvU6Ck.js} +1 -1
- package/storybook-static/assets/{OrbitImages.stories-D_-2HcAd.js → OrbitImages.stories-CUQtYBoA.js} +1 -1
- package/storybook-static/assets/PieChart.stories-CuDdoiKR.js +91 -0
- package/storybook-static/assets/{PixelBlast.stories-B6FXuNf4.js → PixelBlast.stories-BZMMgPnx.js} +1 -1
- package/storybook-static/assets/{PixelCard.stories-Dq4CP2Qj.js → PixelCard.stories-BGHIfRb9.js} +1 -1
- package/storybook-static/assets/{PixelSnow.stories-BoQSOear.js → PixelSnow.stories-BxIpxPJS.js} +1 -1
- package/storybook-static/assets/{PixelTransition.stories-CtQQ070z.js → PixelTransition.stories-Do2T23Se.js} +1 -1
- package/storybook-static/assets/{Plasma.stories-D-421jzZ.js → Plasma.stories-SQXqI75y.js} +1 -1
- package/storybook-static/assets/PolarHeatmap.stories-CDFci1PA.js +26 -0
- package/storybook-static/assets/{Prism.stories-BuibpwdU.js → Prism.stories-Ba_UAm8c.js} +1 -1
- package/storybook-static/assets/{PrismaticBurst.stories-CwYzdBlM.js → PrismaticBurst.stories-NskKboMg.js} +1 -1
- package/storybook-static/assets/{ProfileCard.stories-Dj4oJCxw.js → ProfileCard.stories-nhGFawW1.js} +1 -1
- package/storybook-static/assets/ProgressRings-CR8t1see.css +1 -0
- package/storybook-static/assets/ProgressRings.stories-Dq2WYOU1.js +67 -0
- package/storybook-static/assets/QuantifiableHabitsChart.stories-treJexAd.js +125 -0
- package/storybook-static/assets/{Radar.stories-DxNmoYV3.js → Radar.stories-DN8oMfe1.js} +1 -1
- package/storybook-static/assets/RadialDayChart-CjNQ36HL.css +1 -0
- package/storybook-static/assets/RadialDayChart.stories-C_GY1oKa.js +26 -0
- package/storybook-static/assets/{RecurrencePicker.stories-BAicSNhQ.js → RecurrencePicker.stories-yUASJJzk.js} +1 -1
- package/storybook-static/assets/{Ribbons.stories-usN1kCyI.js → Ribbons.stories-2PD9Q7CT.js} +1 -1
- package/storybook-static/assets/{RippleGrid.stories-nTLGHPV6.js → RippleGrid.stories-Bmz86N8L.js} +1 -1
- package/storybook-static/assets/{RotatingText.stories-8CShs_WJ.js → RotatingText.stories-Db0Kj4fU.js} +1 -1
- package/storybook-static/assets/{ScrollFloat.stories-Dp9YyvHK.js → ScrollFloat.stories-BvS3cLTO.js} +1 -1
- package/storybook-static/assets/{ScrollReveal.stories-Dy4JUrqi.js → ScrollReveal.stories-BRz9n7Qk.js} +1 -1
- package/storybook-static/assets/{ScrollVelocity.stories-CUf-OHNp.js → ScrollVelocity.stories-TeCcq0Yc.js} +1 -1
- package/storybook-static/assets/{SearchBar.stories-BKfuRnlK.js → SearchBar.stories-Bu7toOZA.js} +1 -1
- package/storybook-static/assets/{SearchableDropdown-Ctnh_PVq.js → SearchableDropdown-BKDA92Db.js} +1 -1
- package/storybook-static/assets/{SearchableDropdown.stories-1d-goy0G.js → SearchableDropdown.stories-oT9buOsg.js} +1 -1
- package/storybook-static/assets/{SelectInput-C94OHQIl.js → SelectInput-Cej6AIrC.js} +1 -1
- package/storybook-static/assets/{SelectInput.stories-DPV5iKcs.js → SelectInput.stories--hmbh-1I.js} +1 -1
- package/storybook-static/assets/{ShapeBlur.stories-CdASN24B.js → ShapeBlur.stories-BrPB9Dgq.js} +1 -1
- package/storybook-static/assets/{ShapeGrid.stories-Duzq6qpW.js → ShapeGrid.stories-A41-DtIq.js} +1 -1
- package/storybook-static/assets/{ShinyText.stories-Dgqps29_.js → ShinyText.stories-BFTU8GJP.js} +1 -1
- package/storybook-static/assets/{Silk.stories-DWnaBFZp.js → Silk.stories-BxpLiRNx.js} +1 -1
- package/storybook-static/assets/SleepChart.stories-ywhx7_91.js +58 -0
- package/storybook-static/assets/{Slider-C69QbwVa.js → Slider-CuNmEDiZ.js} +1 -1
- package/storybook-static/assets/{Slider.stories-DDhTLU2g.js → Slider.stories-CsQAkQAf.js} +1 -1
- package/storybook-static/assets/{SoftAurora.stories-C5OSOqjj.js → SoftAurora.stories-taxcnhT9.js} +1 -1
- package/storybook-static/assets/{SoundDemo.stories-sb4V9P8H.js → SoundDemo.stories-zh_F_pgW.js} +1 -1
- package/storybook-static/assets/{SplashCursor.stories-PeC0-y78.js → SplashCursor.stories-CmqWbAt-.js} +1 -1
- package/storybook-static/assets/{SpotlightCard.stories-BCCdQhIJ.js → SpotlightCard.stories-CuO7WGGH.js} +1 -1
- package/storybook-static/assets/{Stack.stories-DJekNsdu.js → Stack.stories-7-b3bhlI.js} +1 -1
- package/storybook-static/assets/{StaggeredMenu.stories-BU-AxZRv.js → StaggeredMenu.stories-DBTBz-bp.js} +1 -1
- package/storybook-static/assets/{StarBorder.stories-Dw9LDvMk.js → StarBorder.stories-eXdZPyrG.js} +1 -1
- package/storybook-static/assets/SunburstChart.stories-CMSDNzoY.js +285 -0
- package/storybook-static/assets/{Table.stories-IhtnLV5J.js → Table.stories-SylwgEpv.js} +1 -1
- package/storybook-static/assets/{Tabs.stories-F_Q4-xiR.js → Tabs.stories-DbAMtL9i.js} +1 -1
- package/storybook-static/assets/{TargetCursor.stories-B-Tl1DdA.js → TargetCursor.stories-BRd8eVe6.js} +1 -1
- package/storybook-static/assets/{TextArea-Bb148SaD.js → TextArea-DBXLzMeZ.js} +1 -1
- package/storybook-static/assets/{TextArea.stories-5-dHoUPL.js → TextArea.stories-udebbAVJ.js} +1 -1
- package/storybook-static/assets/{TextCursor.stories-O-EIx7Nu.js → TextCursor.stories-BUDlvRvw.js} +1 -1
- package/storybook-static/assets/{TextInput-BQ78htqq.js → TextInput-Df0ECj-K.js} +1 -1
- package/storybook-static/assets/{TextInput.stories-Bjjfu_5O.js → TextInput.stories-FtH8T5-_.js} +1 -1
- package/storybook-static/assets/{TextPressure.stories-BvXWcayn.js → TextPressure.stories-Dooijbiu.js} +1 -1
- package/storybook-static/assets/{TextType.stories-DL92625c.js → TextType.stories-ClLVvVVk.js} +1 -1
- package/storybook-static/assets/{ThemeSwitcher.stories-BUUyb12v.js → ThemeSwitcher.stories-CwegSINw.js} +1 -1
- package/storybook-static/assets/{Threads.stories-C_LDNe0R.js → Threads.stories-BuN-AxUr.js} +1 -1
- package/storybook-static/assets/{TimeInput.stories-Tj2LrCtN.js → TimeInput.stories-B5IUTUV2.js} +1 -1
- package/storybook-static/assets/{Toggle-BgFXbOVy.js → Toggle-B5sCmBg4.js} +1 -1
- package/storybook-static/assets/{Toggle.stories-voNeGmVh.js → Toggle.stories-BmSHf5DP.js} +1 -1
- package/storybook-static/assets/{ToggleButton-CQLM9369.js → ToggleButton-CP739hB6.js} +1 -1
- package/storybook-static/assets/{ToggleButton.stories-CLdG94qe.js → ToggleButton.stories-m2eCrn7I.js} +1 -1
- package/storybook-static/assets/{TrueFocus.stories-CEC_mKz7.js → TrueFocus.stories-ATT_gCYY.js} +1 -1
- package/storybook-static/assets/{VariableProximity.stories-CoB68xuF.js → VariableProximity.stories-CjhZaqvP.js} +1 -1
- package/storybook-static/assets/{Waves.stories-Cpn9tv6C.js → Waves.stories-l6P0auFd.js} +1 -1
- package/storybook-static/assets/{arc-DgcIQOLP.js → arc--Q2xWRUA.js} +1 -1
- package/storybook-static/assets/back-BxPoHLz2.js +1 -0
- package/storybook-static/assets/{band-Cq25-Mh7.js → band-D-svgzWl.js} +1 -1
- package/storybook-static/assets/{calendar-B90N4a5g.js → calendar-DtZXr8CJ.js} +1 -1
- package/storybook-static/assets/{chart-column-Qn3KVlVm.js → chart-column-Bc8_bGZY.js} +1 -1
- package/storybook-static/assets/{check-BdgefYk0.js → check-pQLEHzEB.js} +1 -1
- package/storybook-static/assets/{chevron-down-rAxqUK0f.js → chevron-down-BwWfy_sP.js} +1 -1
- package/storybook-static/assets/{chevron-right-BQYLOSGD.js → chevron-right-D2pOUpcG.js} +1 -1
- package/storybook-static/assets/client-DyHGB6m6.js +1 -0
- package/storybook-static/assets/{createLucideIcon-CanksmPJ.js → createLucideIcon-B-jPBnP1.js} +1 -1
- package/storybook-static/assets/descending-BO6OmMcj.js +1 -0
- package/storybook-static/assets/{download-BoPCl2gy.js → download-DnhuO1Ek.js} +1 -1
- package/storybook-static/assets/{folder-B0zTnOfo.js → folder-B0kHgyRN.js} +1 -1
- package/storybook-static/assets/{iconBase-jWAd7fUM.js → iconBase-Do-FwLpb.js} +1 -1
- package/storybook-static/assets/{iframe-BTbLpgFM.js → iframe-ClorXKAj.js} +3 -3
- package/storybook-static/assets/{index-D9A3yXPP.js → index-Bs1dRoHq.js} +1 -1
- package/storybook-static/assets/{index-8orVvKs3.js → index-CBJggPN9.js} +1 -1
- package/storybook-static/assets/{index-Dnnp7mc9.js → index-CezVs6bU.js} +1 -1
- package/storybook-static/assets/linear-BTA54h8k.js +1 -0
- package/storybook-static/assets/monotone-Ca9yXB0X.js +1 -0
- package/storybook-static/assets/path-CSVzDSO0.js +1 -0
- package/storybook-static/assets/{proxy-DHiOkbBq.js → proxy-3BlM6Jc4.js} +1 -1
- package/storybook-static/assets/{react-18-RyhzFaVZ.js → react-18-wzICuHUq.js} +1 -1
- package/storybook-static/assets/{react-three-fiber.esm-DyDueq1t.js → react-three-fiber.esm-BmUFa1-S.js} +1 -1
- package/storybook-static/assets/{search-C2F8ucQI.js → search-BKi-6XDz.js} +1 -1
- package/storybook-static/assets/{settings-B4F4kfld.js → settings-BzEV0s0L.js} +1 -1
- package/storybook-static/assets/{sun-CbGl2Vwt.js → sun-C9Sm1WQX.js} +1 -1
- package/storybook-static/assets/{transform-v7fcW145.js → transform-DaumkFRH.js} +1 -1
- package/storybook-static/assets/{trash-2-CNCXZ0wH.js → trash-2-Bb1H8yHr.js} +1 -1
- package/storybook-static/assets/{use-animation-frame-DY1VsI4g.js → use-animation-frame-D9hLiIrP.js} +1 -1
- package/storybook-static/assets/{use-in-view-Cawxv_UZ.js → use-in-view-DKEXTXQI.js} +1 -1
- package/storybook-static/assets/{use-motion-value-BKT0PPfP.js → use-motion-value-BABvebXq.js} +1 -1
- package/storybook-static/assets/{use-spring-CDH8BIpQ.js → use-spring-C8_4zIh_.js} +1 -1
- package/storybook-static/assets/{use-transform-Bj0aHFrd.js → use-transform-CcGdha8D.js} +1 -1
- package/storybook-static/assets/{useSound-OlKqgJtL.js → useSound-BS8g02XJ.js} +1 -1
- package/storybook-static/assets/{users-Oy8C2tFC.js → users-CL9_RODb.js} +1 -1
- package/storybook-static/assets/value-CMZJhU-O.js +1 -0
- package/storybook-static/assets/{x-CR0CkM0G.js → x-BgxSkyBO.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/assets/BooleansHeatmap.stories-CKYZW8W5.js +0 -63
- package/storybook-static/assets/HabitTimeOfDayChart.stories-CbMqUfq0.js +0 -49
- package/storybook-static/assets/MoodChart.stories-UXaQU4EG.js +0 -40
- package/storybook-static/assets/PieChart.stories-CjtEiSJY.js +0 -91
- package/storybook-static/assets/QuantifiableHabitsChart.stories-ZY1-WQ1g.js +0 -125
- package/storybook-static/assets/SleepChart.stories-C1n9aK7B.js +0 -58
- package/storybook-static/assets/SunburstChart.stories-CE4d4r8-.js +0 -285
- package/storybook-static/assets/client-Chg03P_H.js +0 -1
- package/storybook-static/assets/linear-9syG7RFK.js +0 -1
- package/storybook-static/assets/monotone-B6BFTqpP.js +0 -1
- package/storybook-static/assets/path-CbwjOpE9.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1778146213010,"userSince":1751553154248,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@chromatic-com/storybook":"4.1.0","@testing-library/jest-dom":"6.9.1","@testing-library/react":"16.3.2","@testing-library/user-event":null,"vitest":"4.1.4"},"hasRouterPackage":true,"packageManager":{"type":"npm","agent":"npm","nodeLinker":"node_modules"},"preview":{"usesGlobals":true},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"9.1.2","language":"typescript","storybookPackages":{"@chromatic-com/storybook":{"version":"4.1.0"},"@storybook/addon-docs":{"version":"9.1.2"},"@storybook/addon-onboarding":{"version":"9.1.2"},"@storybook/react-vite":{"version":"9.1.2"},"eslint-plugin-storybook":{"version":"9.1.2"},"storybook":{"version":"9.1.2"}},"addons":{"@storybook/addon-links":{"version":"9.1.2"}}}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import{r as T,j as d}from"./iframe-BTbLpgFM.js";import{s as I}from"./transform-v7fcW145.js";import{t as K}from"./defaultLocale-DJ2q5QjE.js";import"./preload-helper-C1FmrZbK.js";const X="_container_anirc_1",Q="_title_anirc_8",U="_habitEmoji_anirc_18",Z="_chart_anirc_23",tt="_monthLabel_anirc_28",et="_dayLabel_anirc_34",at="_cell_anirc_39",nt="_legend_anirc_51",ot="_legendItem_anirc_58",rt="_legendColor_anirc_66",st="_tooltip_anirc_73",o={container:X,title:Q,habitEmoji:U,chart:Z,monthLabel:tt,dayLabel:et,cell:at,legend:nt,legendItem:ot,legendColor:rt,tooltip:st},it=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ct=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Y=({data:a,habitName:e,width:r=800,height:s=200,habitColor:i="#6BCB77",habitEmoji:w="✓"})=>{const x=T.useRef(null),{startDate:p,endDate:k,weeksToShow:u}=T.useMemo(()=>{const m=Object.keys(a).sort();if(m.length===0){const h=new Date;return{startDate:h,endDate:h,weeksToShow:1}}const c=new Date(m[0]),g=new Date(m[m.length-1]),v=Math.ceil((g.getTime()-c.getTime())/(1e3*60*60*24))+1,l=Math.ceil(v/7);return{startDate:c,endDate:g,weeksToShow:l}},[a]);return T.useEffect(()=>{if(!x.current)return;const m=I(x.current);m.selectAll("*").remove();const c={top:40,right:20,bottom:20,left:40},g=r-c.left-c.right,v=s-c.top-c.bottom,l=Math.min(Math.floor(v/7)-1,Math.floor(g/u)-1,20),h=2,E=m.append("g").attr("transform",`translate(${c.left},${c.top})`),M=(p.getDay()+6)%7,S=new Map;let f=p.getMonth();S.set(f,0);for(let n=0;n<u;n++){const t=new Date(p);t.setDate(t.getDate()+n*7-M),t.getMonth()!==f&&(f=t.getMonth(),S.set(f,n))}S.forEach((n,t)=>{E.append("text").attr("x",n*(l+h)).attr("y",-10).attr("class",o.monthLabel).text(ct[t])}),it.forEach((n,t)=>{E.append("text").attr("x",-10).attr("y",t*(l+h)+l/2).attr("class",o.dayLabel).attr("text-anchor","end").attr("alignment-baseline","middle").text(n)});const b=I("body").append("div").attr("class",o.tooltip).style("opacity",0).style("position","absolute"),V=u*7;for(let n=0;n<V;n++){const t=new Date(p);if(t.setDate(t.getDate()+n-M),t<p||t>k)continue;const j=t.toISOString().split("T")[0],J=(t.getDay()+6)%7,P=Math.floor((n+M)/7),N=j in a&&a[j];E.append("rect").attr("x",P*(l+h)).attr("y",J*(l+h)).attr("width",l).attr("height",l).attr("rx",3).attr("class",o.cell).attr("data-date",j).attr("data-value",N?"true":"false").style("fill",N?i:"#4D4D4DFF").on("mouseover",function(O){b.transition().duration(200).style("opacity",1);const z=K("%b %d, %Y"),G=N?`${w} Done`:"✗ Not done";b.html(`
|
|
2
|
-
<div><strong>${e}</strong></div>
|
|
3
|
-
<div>${z(t)}</div>
|
|
4
|
-
<div>${G}</div>
|
|
5
|
-
`).style("left",O.pageX+10+"px").style("top",O.pageY-28+"px")}).on("mouseout",function(){b.transition().duration(500).style("opacity",0)})}return()=>{b.remove()}},[a,e,r,s,p,k,u,i,w]),d.jsxs("div",{className:o.container,children:[d.jsxs("h3",{className:o.title,children:[d.jsx("span",{className:o.habitEmoji,children:w}),e]}),d.jsx("svg",{ref:x,width:r,height:s,className:o.chart}),d.jsxs("div",{className:o.legend,children:[d.jsxs("span",{className:o.legendItem,children:[d.jsx("span",{className:o.legendColor,style:{backgroundColor:i}}),"Done"]}),d.jsxs("span",{className:o.legendItem,children:[d.jsx("span",{className:o.legendColor,style:{backgroundColor:"#4D4D4DFF"}}),"Not done"]})]})]})};Y.__docgenInfo={description:"",methods:[],displayName:"BooleansHeatmap",props:{data:{required:!0,tsType:{name:"signature",type:"object",raw:"{ [date: string]: boolean }",signature:{properties:[{key:{name:"string"},value:{name:"boolean",required:!0}}]}},description:""},habitName:{required:!0,tsType:{name:"string"},description:""},width:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"800",computed:!1}},height:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"200",computed:!1}},habitColor:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'#6BCB77'",computed:!1}},habitEmoji:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'✓'",computed:!1}}}};const ut={title:"Organisms/Charts/BooleansHeatmap",component:Y,parameters:{layout:"centered"},argTypes:{width:{control:{type:"number",min:400,max:1200,step:50}},height:{control:{type:"number",min:150,max:400,step:50}},habitColor:{control:{type:"color"}},habitEmoji:{control:{type:"text"}}}},C=a=>{const e=[],r=new Date;for(let s=a-1;s>=0;s--){const i=new Date(r);i.setDate(i.getDate()-s),e.push(i.toISOString().split("T")[0])}return e},y={args:{data:(()=>{const a=C(90),e={};return a.forEach(r=>{e[r]=Math.random()>.3}),e})(),habitName:"Daily Exercise",width:900,height:200,habitColor:"#10b981",habitEmoji:"💪"}},D={args:{data:(()=>{const a=C(365),e={};return a.forEach(r=>{const s=new Date(r).getMonth(),i=s>=5&&s<=8;e[r]=Math.random()>(i?.25:.45)}),e})(),habitName:"Outdoor Activity",width:1100,height:250,habitColor:"#10b981",habitEmoji:"🏃"}},_={args:{data:(()=>{const a=C(60),e={};return a.forEach(r=>{Math.random()>.3&&(e[r]=Math.random()>.6)}),e})(),habitName:"Side Project Work",width:800,height:200,habitColor:"#7c3aed",habitEmoji:"💻"}};var F,L,q;y.parameters={...y.parameters,docs:{...(F=y.parameters)==null?void 0:F.docs,source:{originalSource:`{
|
|
6
|
-
args: {
|
|
7
|
-
data: (() => {
|
|
8
|
-
const dates = generateDateRange(90);
|
|
9
|
-
const data: {
|
|
10
|
-
[date: string]: boolean;
|
|
11
|
-
} = {};
|
|
12
|
-
dates.forEach(date => {
|
|
13
|
-
data[date] = Math.random() > 0.3;
|
|
14
|
-
});
|
|
15
|
-
return data;
|
|
16
|
-
})(),
|
|
17
|
-
habitName: 'Daily Exercise',
|
|
18
|
-
width: 900,
|
|
19
|
-
height: 200,
|
|
20
|
-
habitColor: '#10b981',
|
|
21
|
-
habitEmoji: '💪'
|
|
22
|
-
}
|
|
23
|
-
}`,...(q=(L=y.parameters)==null?void 0:L.docs)==null?void 0:q.source}}};var B,R,A;D.parameters={...D.parameters,docs:{...(B=D.parameters)==null?void 0:B.docs,source:{originalSource:`{
|
|
24
|
-
args: {
|
|
25
|
-
data: (() => {
|
|
26
|
-
const dates = generateDateRange(365);
|
|
27
|
-
const data: {
|
|
28
|
-
[date: string]: boolean;
|
|
29
|
-
} = {};
|
|
30
|
-
dates.forEach(date => {
|
|
31
|
-
const month = new Date(date).getMonth();
|
|
32
|
-
const isSummer = month >= 5 && month <= 8;
|
|
33
|
-
data[date] = Math.random() > (isSummer ? 0.25 : 0.45);
|
|
34
|
-
});
|
|
35
|
-
return data;
|
|
36
|
-
})(),
|
|
37
|
-
habitName: 'Outdoor Activity',
|
|
38
|
-
width: 1100,
|
|
39
|
-
height: 250,
|
|
40
|
-
habitColor: '#10b981',
|
|
41
|
-
habitEmoji: '🏃'
|
|
42
|
-
}
|
|
43
|
-
}`,...(A=(R=D.parameters)==null?void 0:R.docs)==null?void 0:A.source}}};var W,$,H;_.parameters={..._.parameters,docs:{...(W=_.parameters)==null?void 0:W.docs,source:{originalSource:`{
|
|
44
|
-
args: {
|
|
45
|
-
data: (() => {
|
|
46
|
-
const dates = generateDateRange(60);
|
|
47
|
-
const data: {
|
|
48
|
-
[date: string]: boolean;
|
|
49
|
-
} = {};
|
|
50
|
-
dates.forEach(date => {
|
|
51
|
-
if (Math.random() > 0.3) {
|
|
52
|
-
data[date] = Math.random() > 0.6;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return data;
|
|
56
|
-
})(),
|
|
57
|
-
habitName: 'Side Project Work',
|
|
58
|
-
width: 800,
|
|
59
|
-
height: 200,
|
|
60
|
-
habitColor: '#7c3aed',
|
|
61
|
-
habitEmoji: '💻'
|
|
62
|
-
}
|
|
63
|
-
}`,...(H=($=_.parameters)==null?void 0:$.docs)==null?void 0:H.source}}};const gt=["Default","YearlyOverview","SparseData"];export{y as Default,_ as SparseData,D as YearlyOverview,gt as __namedExportsOrder,ut as default};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import{r as u,j as o}from"./iframe-BTbLpgFM.js";import{s as Ct}from"./transform-v7fcW145.js";import{l as et}from"./linear-9syG7RFK.js";import{b as at,r as jt}from"./band-Cq25-Mh7.js";import{C as Et}from"./chart-column-Qn3KVlVm.js";import{c as Mt}from"./createLucideIcon-CanksmPJ.js";import{a as ot,b as rt}from"./axis-D3QohQNI.js";import"./preload-helper-C1FmrZbK.js";/**
|
|
2
|
-
* @license lucide-react v0.539.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const kt=[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]],St=Mt("chart-scatter",kt),Ft="_container_19rfu_1",Dt="_controls_19rfu_19",Nt="_viewToggle_19rfu_27",Tt="_viewButton_19rfu_36",$t="_active_19rfu_57",Ht="_viewIcon_19rfu_63",At="_viewLabel_19rfu_68",Bt="_legend_19rfu_78",Vt="_compactLegend_19rfu_89",Lt="_legendItem_19rfu_94",Kt="_legendEmoji_19rfu_99",Rt="_legendLabel_19rfu_103",It="_inactive_19rfu_127",qt="_legendColor_19rfu_137",Ot="_chart_19rfu_163",Wt="_dot_19rfu_171",Ut="_bar_19rfu_179",Pt="_gridLine_19rfu_183",zt="_xAxis_19rfu_189",Yt="_yAxis_19rfu_190",Gt="_tooltip_19rfu_209",Jt="_visible_19rfu_228",Qt="_tooltipHeader_19rfu_233",Xt="_tooltipInfo_19rfu_244",Zt="_tooltipValue_19rfu_250",te="_tooltipUnits_19rfu_259",ee="_tooltipBreakdown_19rfu_265",ae="_tooltipBreakdownRow_19rfu_273",oe="_tooltipDot_19rfu_283",re="_tooltipCount_19rfu_290",a={container:Ft,controls:Dt,viewToggle:Nt,viewButton:Tt,active:$t,viewIcon:Ht,viewLabel:At,legend:Bt,compactLegend:Vt,legendItem:Lt,legendEmoji:Kt,legendLabel:Rt,inactive:It,legendColor:qt,chart:Ot,dot:Wt,bar:Ut,gridLine:Pt,xAxis:zt,yAxis:Yt,tooltip:Gt,visible:Jt,tooltipHeader:Qt,tooltipInfo:Xt,tooltipValue:Zt,tooltipUnits:te,tooltipBreakdown:ee,tooltipBreakdownRow:ae,tooltipDot:oe,tooltipCount:re},ne={Exercise:"#6BCB77",Meditation:"#4D96FF",Reading:"#FFB319",Water:"#00D9FF",Steps:"#FF6B6B",Sleep:"#9B59B6",Calories:"#FF9F1C",Study:"#C774E8"},xt=d=>{const p=d.getFullYear(),f=String(d.getMonth()+1).padStart(2,"0"),b=String(d.getDate()).padStart(2,"0");return`${p}-${f}-${b}`},G=d=>{const p=(d%24+24)%24;return`${String(p).padStart(2,"0")}:00`},se=(d,p)=>{const f=(d%24+24)%24;return`${String(f).padStart(2,"0")}:${String(p).padStart(2,"0")}`},nt=(d,p)=>{const f=[],[b,E,w]=d.split("-").map(Number),[v,A,D]=p.split("-").map(Number),C=new Date(b,E-1,w),_=new Date(v,A-1,D);for(;C<=_;)f.push(xt(C)),C.setDate(C.getDate()+1);return f},_t=({events:d,width:p=800,height:f=400,startDate:b,endDate:E,habitColors:w={},habitEmojis:v={},defaultView:A="scatter",hideControls:D=!1,compactLegend:C=!1})=>{const _=u.useRef(null),[B,z]=u.useState(A),[N,J]=u.useState([]),[V,Q]=u.useState(null),[i,T]=u.useState(null),x=u.useMemo(()=>({top:20,right:20,bottom:50,left:70}),[]),I=p-x.left-x.right,M=f-x.top-x.bottom,$=u.useCallback(t=>w[t]||ne[t]||`hsl(${Math.abs(t.split("").reduce((e,r)=>e+r.charCodeAt(0),0))%360}, 70%, 50%)`,[w]),k=u.useMemo(()=>d.map(t=>{const e=new Date(t.loggedAt);if(Number.isNaN(e.getTime()))return null;const r=e.getHours(),l=e.getMinutes(),s=e.getSeconds();return{habitKey:t.habitKey,date:xt(e),hour:r,minute:l,hourFraction:r+l/60+s/3600}}).filter(t=>t!==null),[d]),q=u.useMemo(()=>{const t=new Set;return k.forEach(e=>t.add(e.habitKey)),Array.from(t).sort()},[k]);u.useEffect(()=>{J(q)},[q]),u.useEffect(()=>{const t=()=>T(null);return window.addEventListener("scroll",t,!0),()=>window.removeEventListener("scroll",t,!0)},[]);const H=u.useMemo(()=>{if(b&&E)return nt(b,E);if(k.length===0)return[];const t=[...k].map(e=>e.date).sort();return nt(t[0],t[t.length-1])},[k,b,E]),L=u.useMemo(()=>{const t=new Set(N);return k.filter(e=>t.has(e.habitKey))},[k,N]),X=u.useMemo(()=>{const t=new Map;L.forEach(s=>{const n=Math.round(s.hourFraction*60)/60,m=Math.round(n*60)%60,j=Math.floor(n),h=`${s.date}|${s.habitKey}|${n}`,g=t.get(h);g?g.count+=1:t.set(h,{habitKey:s.habitKey,date:s.date,hour:j,minute:m,hourFraction:n,count:1,xOffsetPx:0})});const e=new Map;t.forEach(s=>{const n=`${s.date}|${s.hourFraction}`,m=e.get(n);m?m.push(s):e.set(n,[s])});const r=[],l=10;return e.forEach(s=>{s.sort((m,j)=>m.habitKey.localeCompare(j.habitKey));const n=(s.length-1)/2;s.forEach((m,j)=>{r.push({...m,xOffsetPx:(j-n)*l})})}),r},[L]),O=u.useMemo(()=>{const t=Array.from({length:24},(e,r)=>({hour:r,total:0,byHabit:new Map}));return L.forEach(e=>{const r=t[e.hour];r.total+=1,r.byHabit.set(e.habitKey,(r.byHabit.get(e.habitKey)||0)+1)}),t},[L]),Z=u.useMemo(()=>O.reduce((t,e)=>Math.max(t,e.total),0),[O]),vt=t=>{J(e=>e.includes(t)?e.filter(r=>r!==t):[...e,t])};u.useEffect(()=>{if(!_.current)return;const t=Ct(_.current);t.selectAll("*").remove(),t.append("rect").attr("width",p).attr("height",f).attr("fill","transparent").style("pointer-events","all").on("mouseleave",()=>T(null));const e=t.append("g").attr("transform",`translate(${x.left},${x.top})`);if(B==="scatter"){if(H.length===0)return;const r=et().domain([0,24]).range([0,I]),l=at().domain(H).range([0,M]).padding(.1);e.selectAll("line.xgrid").data([0,3,6,9,12,15,18,21,24]).enter().append("line").attr("class",a.gridLine).attr("x1",c=>r(c)).attr("x2",c=>r(c)).attr("y1",0).attr("y2",M);const s=l.bandwidth(),n=Math.min(5,Math.max(2,s/2)),m=n*2.2;e.selectAll("circle.dot").data(X).enter().append("circle").attr("class",a.dot).attr("cx",c=>r(c.hourFraction)+c.xOffsetPx).attr("cy",c=>(l(c.date)??0)+s/2).attr("r",c=>Math.min(m,n*Math.sqrt(c.count))).attr("fill",c=>$(c.habitKey)).attr("opacity",c=>V&&V!==c.habitKey?.15:.8).style("cursor","pointer").on("mouseenter",function(c,y){var tt;const K=(tt=_.current)==null?void 0:tt.getBoundingClientRect();K&&T({x:r(y.hourFraction)+y.xOffsetPx+x.left+K.left,y:(l(y.date)??0)+x.top+K.top,habit:y.habitKey,hour:y.hour,minute:y.minute,date:y.date,count:y.count})}).on("mouseleave",()=>T(null));const j=ot(r).tickValues([0,3,6,9,12,15,18,21]).tickFormat(c=>G(c));e.append("g").attr("class",a.xAxis).attr("transform",`translate(0,${M})`).call(j);const h=Math.min(8,H.length),g=Math.max(1,Math.floor(H.length/h)),S=H.filter((c,y)=>y%g===0),F=rt(l).tickValues(S).tickFormat(c=>{const[,y,K]=c.split("-");return`${y}/${K}`});e.append("g").attr("class",a.yAxis).call(F)}else{const r=at().domain(jt(24)).range([0,I]).padding(.15),l=et().domain([0,Math.max(1,Z)]).nice().range([M,0]);e.selectAll("line.grid").data(l.ticks(5)).enter().append("line").attr("class",a.gridLine).attr("x1",0).attr("x2",I).attr("y1",n=>l(n)).attr("y2",n=>l(n)),O.forEach(n=>{let m=0;Array.from(n.byHabit.entries()).sort(([h],[g])=>h.localeCompare(g)).forEach(([h,g])=>{const S=l(m+g),F=Math.max(0,l(m)-l(m+g));e.append("rect").attr("class",a.bar).attr("x",r(n.hour)??0).attr("y",S).attr("width",r.bandwidth()).attr("height",F).attr("fill",$(h)).attr("opacity",V&&V!==h?.3:1),m+=g}),n.total>0&&e.append("rect").attr("x",r(n.hour)??0).attr("y",0).attr("width",r.bandwidth()).attr("height",M).attr("fill","transparent").style("cursor","pointer").on("mouseenter",function(){var g;const h=(g=_.current)==null?void 0:g.getBoundingClientRect();h&&T({x:(r(n.hour)??0)+r.bandwidth()/2+x.left+h.left,y:l(n.total)+x.top+h.top,hour:n.hour,count:n.total,breakdown:Array.from(n.byHabit.entries()).map(([S,F])=>({habit:S,count:F})).sort((S,F)=>F.count-S.count)})}).on("mouseleave",()=>T(null))});const s=ot(r).tickValues([0,3,6,9,12,15,18,21]).tickFormat(n=>G(n));e.append("g").attr("class",a.xAxis).attr("transform",`translate(0,${M})`).call(s),e.append("g").attr("class",a.yAxis).call(rt(l).ticks(5))}},[B,L,X,O,H,Z,I,M,x,p,f,V,$]);const Y={scatter:{icon:o.jsx(St,{size:16}),label:"Scatter"},totals:{icon:o.jsx(Et,{size:16}),label:"Totals"}},wt=t=>{const[e,r,l]=t.split("-").map(Number);return new Date(e,r-1,l).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})};return o.jsxs("div",{className:a.container,children:[!D&&o.jsx("div",{className:a.controls,children:o.jsx("div",{className:a.viewToggle,children:["scatter","totals"].map(t=>o.jsxs("button",{className:`${a.viewButton} ${B===t?a.active:""}`,onClick:()=>z(t),title:Y[t].label,children:[o.jsx("span",{className:a.viewIcon,children:Y[t].icon}),o.jsx("span",{className:a.viewLabel,children:Y[t].label})]},t))})}),q.length>0&&o.jsx("div",{className:`${a.legend}${C?` ${a.compactLegend}`:""}`,children:q.map(t=>o.jsxs("button",{className:`${a.legendItem} ${N.includes(t)?"":a.inactive}`,onClick:()=>vt(t),onMouseEnter:()=>Q(t),onMouseLeave:()=>Q(null),children:[o.jsx("span",{className:a.legendEmoji,children:v[t]||"📊"}),o.jsx("span",{className:a.legendColor,style:{backgroundColor:$(t)}}),o.jsx("span",{className:a.legendLabel,children:t})]},t))}),o.jsx("svg",{ref:_,viewBox:`0 0 ${p} ${f}`,preserveAspectRatio:"xMidYMid meet",className:a.chart}),i&&o.jsx("div",{className:`${a.tooltip} ${a.visible}`,style:{left:`${i.x}px`,top:`${i.y-70}px`},children:i.habit?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:a.tooltipHeader,children:[o.jsx("span",{className:a.tooltipDot,style:{backgroundColor:$(i.habit)}}),o.jsxs("span",{children:[v[i.habit]||""," ",i.habit]})]}),o.jsxs("div",{className:a.tooltipInfo,children:[o.jsxs("div",{className:a.tooltipDate,children:[i.date?wt(i.date):"",i.minute!==void 0?` · ${se(i.hour,i.minute)}`:""]}),i.count>1&&o.jsxs("div",{className:a.tooltipValue,children:[o.jsx("strong",{children:i.count}),o.jsx("span",{className:a.tooltipUnits,children:"events"})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:a.tooltipHeader,children:o.jsx("span",{children:G(i.hour)})}),o.jsxs("div",{className:a.tooltipInfo,children:[o.jsxs("div",{className:a.tooltipValue,children:[o.jsx("strong",{children:i.count}),o.jsxs("span",{className:a.tooltipUnits,children:["event",i.count===1?"":"s"]})]}),i.breakdown&&i.breakdown.length>1&&o.jsx("div",{className:a.tooltipBreakdown,children:i.breakdown.map(({habit:t,count:e})=>o.jsxs("div",{className:a.tooltipBreakdownRow,children:[o.jsx("span",{className:a.tooltipDot,style:{backgroundColor:$(t)}}),o.jsxs("span",{children:[v[t]||""," ",t]}),o.jsx("span",{className:a.tooltipCount,children:e})]},t))})]})]})})]})};_t.__docgenInfo={description:"",methods:[],displayName:"HabitTimeOfDayChart",props:{events:{required:!0,tsType:{name:"Array",elements:[{name:"HabitEvent"}],raw:"HabitEvent[]"},description:""},width:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"800",computed:!1}},height:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"400",computed:!1}},startDate:{required:!1,tsType:{name:"string"},description:""},endDate:{required:!1,tsType:{name:"string"},description:""},habitColors:{required:!1,tsType:{name:"signature",type:"object",raw:"{ [key: string]: string }",signature:{properties:[{key:{name:"string"},value:{name:"string",required:!0}}]}},description:"",defaultValue:{value:"{}",computed:!1}},habitEmojis:{required:!1,tsType:{name:"signature",type:"object",raw:"{ [key: string]: string }",signature:{properties:[{key:{name:"string"},value:{name:"string",required:!0}}]}},description:"",defaultValue:{value:"{}",computed:!1}},defaultView:{required:!1,tsType:{name:"union",raw:"'scatter' | 'totals'",elements:[{name:"literal",value:"'scatter'"},{name:"literal",value:"'totals'"}]},description:"",defaultValue:{value:"'scatter'",computed:!1}},hideControls:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},compactLegend:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};const he={title:"Organisms/Charts/HabitTimeOfDayChart",component:_t,parameters:{layout:"centered"},argTypes:{width:{control:{type:"number",min:400,max:1200,step:50}},height:{control:{type:"number",min:200,max:600,step:50}},defaultView:{control:{type:"select"},options:["scatter","totals"]}}},bt=(d,p)=>{const f=[],b=new Date,E={Water:[8,10,13,16,19],Coffee:[7,8,9,14],Exercise:p==="evening"?[18,19,20]:[6,7,17,18],Reading:[21,22]};for(let w=0;w<d;w++){const v=new Date(b);v.setDate(v.getDate()-w),Object.entries(E).forEach(([A,D])=>{const C=Math.floor(Math.random()*4);for(let _=0;_<C;_++){const B=D[Math.floor(Math.random()*D.length)],z=Math.floor(Math.random()*60),N=new Date(v);N.setHours(B,z,0,0),f.push({loggedAt:N.toISOString(),habitKey:A})}})}return f},R={args:{events:bt(30,"all"),width:900,height:420,defaultView:"scatter",habitColors:{Water:"#00D9FF",Coffee:"#8B5E3C",Exercise:"#10b981",Reading:"#FFB319"},habitEmojis:{Water:"💧",Coffee:"☕",Exercise:"🏃",Reading:"📚"}}},W={args:{...R.args,defaultView:"totals"}},U={args:{events:bt(14,"morning").filter(d=>d.habitKey==="Water"),width:900,height:360,defaultView:"scatter",habitColors:{Water:"#00D9FF"},habitEmojis:{Water:"💧"}}},P={args:{events:[],width:900,height:360}};var st,it,lt;R.parameters={...R.parameters,docs:{...(st=R.parameters)==null?void 0:st.docs,source:{originalSource:`{
|
|
7
|
-
args: {
|
|
8
|
-
events: generateEvents(30, 'all'),
|
|
9
|
-
width: 900,
|
|
10
|
-
height: 420,
|
|
11
|
-
defaultView: 'scatter',
|
|
12
|
-
habitColors: {
|
|
13
|
-
Water: '#00D9FF',
|
|
14
|
-
Coffee: '#8B5E3C',
|
|
15
|
-
Exercise: '#10b981',
|
|
16
|
-
Reading: '#FFB319'
|
|
17
|
-
},
|
|
18
|
-
habitEmojis: {
|
|
19
|
-
Water: '💧',
|
|
20
|
-
Coffee: '☕',
|
|
21
|
-
Exercise: '🏃',
|
|
22
|
-
Reading: '📚'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}`,...(lt=(it=R.parameters)==null?void 0:it.docs)==null?void 0:lt.source}}};var ct,ut,dt;W.parameters={...W.parameters,docs:{...(ct=W.parameters)==null?void 0:ct.docs,source:{originalSource:`{
|
|
26
|
-
args: {
|
|
27
|
-
...Default.args,
|
|
28
|
-
defaultView: 'totals'
|
|
29
|
-
}
|
|
30
|
-
}`,...(dt=(ut=W.parameters)==null?void 0:ut.docs)==null?void 0:dt.source}}};var mt,pt,ft;U.parameters={...U.parameters,docs:{...(mt=U.parameters)==null?void 0:mt.docs,source:{originalSource:`{
|
|
31
|
-
args: {
|
|
32
|
-
events: generateEvents(14, 'morning').filter(e => e.habitKey === 'Water'),
|
|
33
|
-
width: 900,
|
|
34
|
-
height: 360,
|
|
35
|
-
defaultView: 'scatter',
|
|
36
|
-
habitColors: {
|
|
37
|
-
Water: '#00D9FF'
|
|
38
|
-
},
|
|
39
|
-
habitEmojis: {
|
|
40
|
-
Water: '💧'
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}`,...(ft=(pt=U.parameters)==null?void 0:pt.docs)==null?void 0:ft.source}}};var ht,gt,yt;P.parameters={...P.parameters,docs:{...(ht=P.parameters)==null?void 0:ht.docs,source:{originalSource:`{
|
|
44
|
-
args: {
|
|
45
|
-
events: [],
|
|
46
|
-
width: 900,
|
|
47
|
-
height: 360
|
|
48
|
-
}
|
|
49
|
-
}`,...(yt=(gt=P.parameters)==null?void 0:gt.docs)==null?void 0:yt.source}}};const ge=["Default","TotalsView","SingleHabit","Empty"];export{R as Default,P as Empty,U as SingleHabit,W as TotalsView,ge as __namedExportsOrder,he as default};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{r as p,j as y}from"./iframe-BTbLpgFM.js";import{s as I,c as C}from"./transform-v7fcW145.js";import{l as ot,b as Et}from"./linear-9syG7RFK.js";import{c as kt,x as Lt,y as Pt,l as _t,e as Bt,t as Ct,m as rt,b as st,p as Ht}from"./monotone-B6BFTqpP.js";import{a as Ft}from"./array-BKyUJesY.js";import{w as It,c as f}from"./path-CbwjOpE9.js";import{a as Ot,b as Vt}from"./axis-D3QohQNI.js";import{t as Xt}from"./defaultLocale-DJ2q5QjE.js";import"./preload-helper-C1FmrZbK.js";function zt(n,s,l){var d=null,x=f(!0),M=null,v=kt,c=null,E=It(a);n=typeof n=="function"?n:n===void 0?Lt:f(+n),s=typeof s=="function"?s:s===void 0?f(0):f(+s),l=typeof l=="function"?l:l===void 0?Pt:f(+l);function a(t){var i,k,w,u=(t=Ft(t)).length,g,h=!1,m,R=new Array(u),r=new Array(u);for(M==null&&(c=v(m=E())),i=0;i<=u;++i){if(!(i<u&&x(g=t[i],i,t))===h)if(h=!h)k=i,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),w=i-1;w>=k;--w)c.point(R[w],r[w]);c.lineEnd(),c.areaEnd()}h&&(R[i]=+n(g,i,t),r[i]=+s(g,i,t),c.point(d?+d(g,i,t):R[i],l?+l(g,i,t):r[i]))}if(m)return c=null,m+""||null}function T(){return _t().defined(x).curve(v).context(M)}return a.x=function(t){return arguments.length?(n=typeof t=="function"?t:f(+t),d=null,a):n},a.x0=function(t){return arguments.length?(n=typeof t=="function"?t:f(+t),a):n},a.x1=function(t){return arguments.length?(d=t==null?null:typeof t=="function"?t:f(+t),a):d},a.y=function(t){return arguments.length?(s=typeof t=="function"?t:f(+t),l=null,a):s},a.y0=function(t){return arguments.length?(s=typeof t=="function"?t:f(+t),a):s},a.y1=function(t){return arguments.length?(l=t==null?null:typeof t=="function"?t:f(+t),a):l},a.lineX0=a.lineY0=function(){return T().x(n).y(s)},a.lineY1=function(){return T().x(n).y(l)},a.lineX1=function(){return T().x(d).y(s)},a.defined=function(t){return arguments.length?(x=typeof t=="function"?t:f(!!t),a):x},a.curve=function(t){return arguments.length?(v=t,M!=null&&(c=v(M)),a):v},a.context=function(t){return arguments.length?(t==null?M=c=null:c=v(M=t),a):M},a}const Wt="_container_ynor3_1",qt="_chart_ynor3_11",Yt="_gridLine_ynor3_17",Qt="_line_ynor3_23",Gt="_area_ynor3_32",Zt="_areaStopTop_ynor3_36",Jt="_areaStopBottom_ynor3_41",Kt="_crosshair_ynor3_46",Ut="_halo_ynor3_53",te="_overlay_ynor3_58",ee="_xAxis_ynor3_63",ae="_yAxis_ynor3_64",ne="_dataPoint_ynor3_83",oe="_tooltip_ynor3_88",re="_tooltipHeader_ynor3_113",se="_tooltipDate_ynor3_122",ie="_tooltipRating_ynor3_128",le="_ratingValue_ynor3_138",ce="_ratingMax_ynor3_143",de="_tooltipTags_ynor3_148",pe="_tag_ynor3_155",ue="_tooltipComment_ynor3_173",o={container:Wt,chart:qt,gridLine:Yt,line:Qt,area:Gt,areaStopTop:Zt,areaStopBottom:Jt,crosshair:Kt,halo:Ut,overlay:te,xAxis:ee,yAxis:ae,dataPoint:ne,tooltip:oe,tooltipHeader:re,tooltipDate:se,tooltipRating:ie,ratingValue:le,ratingMax:ce,tooltipTags:de,tag:pe,tooltipComment:ue},Mt=({moodData:n,width:s=800,height:l=400})=>{const d=p.useRef(null),x=p.useRef(null),M=p.useRef(null),v=p.useRef(!1),c=p.useId(),E=p.useMemo(()=>`mood-area-${c.replace(/[^a-zA-Z0-9]/g,"_")}`,[c]),[a,T]=p.useState(null),[t,i]=p.useState({x:0,y:0}),[k,w]=p.useState(!1);p.useEffect(()=>{v.current=k},[k]);const u=p.useMemo(()=>({top:20,right:20,bottom:50,left:40}),[]),g=s-u.left-u.right,h=l-u.top-u.bottom,m=p.useMemo(()=>n.map(r=>{const A=r.tag?r.tag.split(",").map($=>$.trim()).filter($=>$):[];return{date:new Date(r.date),rating:r.rating,tags:A,comment:r.comment}}).filter(r=>!isNaN(r.date.getTime())&&isFinite(r.rating)).sort((r,A)=>r.date.getTime()-A.date.getTime()),[n]),R=p.useMemo(()=>ot().domain([1,5,10]).range(["#FF6B6B","#FFD93D","#6BCB77"]).clamp(!0),[]);return p.useEffect(()=>{if(!d.current||m.length===0)return;const r=I(d.current);r.selectAll("*").remove();const $=r.append("defs").append("linearGradient").attr("id",E).attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%");$.append("stop").attr("offset","0%").attr("class",o.areaStopTop),$.append("stop").attr("offset","100%").attr("class",o.areaStopBottom);const D=r.append("g").attr("transform",`translate(${u.left},${u.top})`),L=Bt(m,e=>e.date);if(!L[0]||!L[1])return;const S=Ct().domain(L).range([0,g]),N=ot().domain([1,10]).range([h,0]),vt=_t().x(e=>S(e.date)).y(e=>N(e.rating)).curve(rt),Dt=zt().x(e=>S(e.date)).y0(h).y1(e=>N(e.rating)).curve(rt);D.selectAll(".grid-line-y").data(N.ticks(5)).enter().append("line").attr("class",o.gridLine).attr("x1",0).attr("y1",e=>N(e)).attr("x2",g).attr("y2",e=>N(e)).style("opacity",0).transition().duration(500).ease(C).style("opacity",1),D.append("g").attr("class",o.xAxis).attr("transform",`translate(0,${h})`).style("opacity",0).call(Ot(S).tickFormat(e=>Xt("%m/%d")(e))).transition().duration(600).delay(100).style("opacity",1),D.append("g").attr("class",o.yAxis).style("opacity",0).call(Vt(N)).transition().duration(600).delay(100).style("opacity",1);const St=D.append("path").datum(m).attr("class",o.area).attr("fill",`url(#${E})`).attr("d",Dt).style("opacity",0),W=D.append("path").datum(m).attr("class",o.line).attr("d",vt),q=W.node(),H=q&&typeof q.getTotalLength=="function"?q.getTotalLength():0,Y=1200;H>0&&W.attr("stroke-dasharray",`${H} ${H}`).attr("stroke-dashoffset",H).transition().duration(Y).ease(C).attr("stroke-dashoffset",0).on("end",()=>{W.attr("stroke-dasharray",null)}),St.transition().delay(Y*.4).duration(800).ease(C).style("opacity",1);const U=D.append("line").attr("class",o.crosshair).attr("y1",0).attr("y2",h).style("opacity",0).style("pointer-events","none"),Q=D.append("circle").attr("class",o.halo).attr("r",0).style("opacity",0).style("pointer-events","none"),tt=S(L[0]),Tt=S(L[1]),wt=Math.max(1,Tt-tt),et=D.selectAll(".mood-circle").data(m).enter().append("circle").attr("class",o.dataPoint).attr("cx",e=>S(e.date)).attr("cy",e=>N(e.rating)).attr("r",0).attr("fill",e=>R(e.rating)).style("opacity",0).style("pointer-events","none");et.transition().delay(e=>100+Y*((S(e.date)-tt)/wt)).duration(380).ease(st.overshoot(2)).attr("r",5).style("opacity",1);const G=et.nodes();let b=null;const Nt=(e,j,P)=>{Q.interrupt("halo-pulse").interrupt("halo-out").attr("cx",e).attr("cy",j).attr("fill",P);const _=()=>{Q.attr("r",5).style("opacity",.55).transition("halo-pulse").duration(900).ease(C).attr("r",20).style("opacity",0).on("end",_)};_()},Rt=()=>{Q.interrupt("halo-pulse").transition("halo-out").duration(180).style("opacity",0).attr("r",0)},bt=(e,j,P)=>{var at;const _=m[e];if(!_)return;const Z=S(_.date),jt=N(_.rating),F=(at=d.current)==null?void 0:at.getBoundingClientRect();if(F){let B=j-F.left+12,J=P-F.top-12;const nt=280;B+nt>g+u.left-20&&(B=j-F.left-nt-12,B<0&&(B=10)),J<0&&(J=10),i({x:B,y:J})}T(_),U.attr("x1",Z).attr("x2",Z).interrupt("crosshair-fade").transition("crosshair-fade").duration(120).style("opacity",1),b!==e&&(b!==null&&I(G[b]).transition("point-scale").duration(180).ease(C).attr("r",5),I(G[e]).transition("point-scale").duration(180).ease(st.overshoot(2)).attr("r",8),Nt(Z,jt,R(_.rating)),b=e)},At=()=>{U.interrupt("crosshair-fade").transition("crosshair-fade").duration(180).style("opacity",0),b!==null&&(I(G[b]).transition("point-scale").duration(180).attr("r",5),b=null),Rt(),T(null)},$t=Et(e=>e.date).center;D.append("rect").attr("class",o.overlay).attr("width",g).attr("height",h).on("mousemove",function(e){const[j]=Ht(e,this),P=S.invert(j),_=Math.max(0,Math.min(m.length-1,$t(m,P)));bt(_,e.clientX,e.clientY)}).on("mouseleave",()=>{window.setTimeout(()=>{v.current||At()},220)})},[m,g,h,R,u,E]),p.useEffect(()=>()=>{T(null)},[]),y.jsxs("div",{className:o.container,ref:x,children:[y.jsx("svg",{ref:d,width:s,height:l,className:o.chart}),a&&y.jsxs("div",{ref:M,className:o.tooltip,style:{position:"absolute",pointerEvents:"auto",left:t.x,top:t.y,zIndex:1e3},onMouseEnter:()=>w(!0),onMouseLeave:()=>{w(!1),T(null)},children:[y.jsxs("div",{className:o.tooltipHeader,children:[y.jsx("div",{className:o.tooltipDate,children:a.date.toLocaleDateString()}),y.jsxs("div",{className:o.tooltipRating,children:[y.jsx("span",{className:o.ratingValue,children:a.rating}),y.jsx("span",{className:o.ratingMax,children:"/10"})]})]}),a.tags.length>0&&y.jsx("div",{className:o.tooltipTags,children:a.tags.map((r,A)=>y.jsx("span",{className:o.tag,children:r},A))}),a.comment&&y.jsx("div",{className:o.tooltipComment,children:a.comment})]})]})};Mt.__docgenInfo={description:"",methods:[],displayName:"MoodChart",props:{moodData:{required:!0,tsType:{name:"Array",elements:[{name:"MoodNoteData"}],raw:"MoodNoteData[]"},description:""},width:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"800",computed:!1}},height:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"400",computed:!1}}}};const De={title:"Organisms/Charts/MoodChart",component:Mt,parameters:{layout:"centered"},argTypes:{width:{control:{type:"number",min:300,max:1200,step:50}},height:{control:{type:"number",min:200,max:800,step:50}}}},K=n=>{const s=[],l=new Date;for(let d=n-1;d>=0;d--){const x=new Date(l);x.setDate(x.getDate()-d),s.push(x.toISOString().split("T")[0])}return s},O={args:{moodData:K(30).map(n=>({date:n,rating:Math.floor(Math.random()*10)+1,tag:["happy","excited","calm","focused"][Math.floor(Math.random()*4)],comment:`Feeling ${Math.random()>.5?"good":"okay"} today`})),width:800,height:400}},V={args:{moodData:K(7).map(n=>({date:n,rating:Math.floor(Math.random()*10)+1,tag:["happy","calm","energetic","focused"][Math.floor(Math.random()*4)],comment:`Day ${n.split("-")[2]} mood note`})),width:600,height:300}},X={args:{moodData:K(90).map(n=>({date:n,rating:Math.floor(Math.random()*10)+1,tag:["productive","creative","stressed","relaxed","motivated"][Math.floor(Math.random()*5)],comment:Math.random()>.7?`Notable day - ${n}`:void 0})),width:1e3,height:400}},z={args:{moodData:[],width:800,height:400}};var it,lt,ct;O.parameters={...O.parameters,docs:{...(it=O.parameters)==null?void 0:it.docs,source:{originalSource:`{
|
|
2
|
-
args: {
|
|
3
|
-
moodData: generateDateRange(30).map(date => ({
|
|
4
|
-
date,
|
|
5
|
-
rating: Math.floor(Math.random() * 10) + 1,
|
|
6
|
-
tag: ['happy', 'excited', 'calm', 'focused'][Math.floor(Math.random() * 4)],
|
|
7
|
-
comment: \`Feeling \${Math.random() > 0.5 ? 'good' : 'okay'} today\`
|
|
8
|
-
})),
|
|
9
|
-
width: 800,
|
|
10
|
-
height: 400
|
|
11
|
-
}
|
|
12
|
-
}`,...(ct=(lt=O.parameters)==null?void 0:lt.docs)==null?void 0:ct.source}}};var dt,pt,ut;V.parameters={...V.parameters,docs:{...(dt=V.parameters)==null?void 0:dt.docs,source:{originalSource:`{
|
|
13
|
-
args: {
|
|
14
|
-
moodData: generateDateRange(7).map(date => ({
|
|
15
|
-
date,
|
|
16
|
-
rating: Math.floor(Math.random() * 10) + 1,
|
|
17
|
-
tag: ['happy', 'calm', 'energetic', 'focused'][Math.floor(Math.random() * 4)],
|
|
18
|
-
comment: \`Day \${date.split('-')[2]} mood note\`
|
|
19
|
-
})),
|
|
20
|
-
width: 600,
|
|
21
|
-
height: 300
|
|
22
|
-
}
|
|
23
|
-
}`,...(ut=(pt=V.parameters)==null?void 0:pt.docs)==null?void 0:ut.source}}};var mt,ft,gt;X.parameters={...X.parameters,docs:{...(mt=X.parameters)==null?void 0:mt.docs,source:{originalSource:`{
|
|
24
|
-
args: {
|
|
25
|
-
moodData: generateDateRange(90).map(date => ({
|
|
26
|
-
date,
|
|
27
|
-
rating: Math.floor(Math.random() * 10) + 1,
|
|
28
|
-
tag: ['productive', 'creative', 'stressed', 'relaxed', 'motivated'][Math.floor(Math.random() * 5)],
|
|
29
|
-
comment: Math.random() > 0.7 ? \`Notable day - \${date}\` : undefined
|
|
30
|
-
})),
|
|
31
|
-
width: 1000,
|
|
32
|
-
height: 400
|
|
33
|
-
}
|
|
34
|
-
}`,...(gt=(ft=X.parameters)==null?void 0:ft.docs)==null?void 0:gt.source}}};var ht,yt,xt;z.parameters={...z.parameters,docs:{...(ht=z.parameters)==null?void 0:ht.docs,source:{originalSource:`{
|
|
35
|
-
args: {
|
|
36
|
-
moodData: [],
|
|
37
|
-
width: 800,
|
|
38
|
-
height: 400
|
|
39
|
-
}
|
|
40
|
-
}`,...(xt=(yt=z.parameters)==null?void 0:yt.docs)==null?void 0:xt.source}}};const Se=["Default","Weekly","Quarterly","EmptyState"];export{O as Default,z as EmptyState,X as Quarterly,V as Weekly,Se as __namedExportsOrder,De as default};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import{r as q,j as v}from"./iframe-BTbLpgFM.js";import{s as S,i as K,a as X}from"./transform-v7fcW145.js";import{a as H}from"./array-BKyUJesY.js";import{c as b}from"./path-CbwjOpE9.js";import{t as z,a as P}from"./arc-DgcIQOLP.js";import"./preload-helper-C1FmrZbK.js";function Q(n,a){let l=0;if(a===void 0)for(let c of n)(c=+c)&&(l+=c);else{let c=-1;for(let g of n)(g=+a(g,++c,n))&&(l+=g)}return l}function W(n,a){return a<n?-1:a>n?1:a>=n?0:NaN}function Z(n){return n}function ee(){var n=Z,a=W,l=null,c=b(0),g=b(z),w=b(0);function s(e){var r,i=(e=H(e)).length,m,L,C=0,_=new Array(i),u=new Array(i),A=+c.apply(this,arguments),h=Math.min(z,Math.max(-z,g.apply(this,arguments)-A)),T,x=Math.min(Math.abs(h)/i,w.apply(this,arguments)),R=x*(h<0?-1:1),d;for(r=0;r<i;++r)(d=u[_[r]=r]=+n(e[r],r,e))>0&&(C+=d);for(a!=null?_.sort(function(t,o){return a(u[t],u[o])}):l!=null&&_.sort(function(t,o){return l(e[t],e[o])}),r=0,L=C?(h-i*R)/C:0;r<i;++r,A=T)m=_[r],d=u[m],T=A+(d>0?d*L:0)+R,u[m]={data:e[m],index:r,value:d,startAngle:A,endAngle:T,padAngle:x};return u}return s.value=function(e){return arguments.length?(n=typeof e=="function"?e:b(+e),s):n},s.sortValues=function(e){return arguments.length?(a=e,l=null,s):a},s.sort=function(e){return arguments.length?(l=e,a=null,s):l},s.startAngle=function(e){return arguments.length?(c=typeof e=="function"?e:b(+e),s):c},s.endAngle=function(e){return arguments.length?(g=typeof e=="function"?e:b(+e),s):g},s.padAngle=function(e){return arguments.length?(w=typeof e=="function"?e:b(+e),s):w},s}const te="_container_1d3zv_1",ne="_title_1d3zv_7",ae="_chartContainer_1d3zv_15",re="_chart_1d3zv_15",oe="_legend_1d3zv_26",le="_legendItem_1d3zv_31",se="_legendColor_1d3zv_45",ie="_legendLabel_1d3zv_52",ce="_legendValue_1d3zv_59",ue="_tooltip_1d3zv_65",p={container:te,title:ne,chartContainer:ae,chart:re,legend:oe,legendItem:le,legendColor:se,legendLabel:ie,legendValue:ce,tooltip:ue},f=["#6366f1","#8b5cf6","#06b6d4","#10b981","#f59e0b","#ef4444","#ec4899","#84cc16","#f97316","#3b82f6","#8b5cf6","#14b8a6","#f59e0b","#ef4444","#06b6d4","#10b981"],$=n=>{const a=X(n);if(!a)return"#ffffff";const l=a.rgb();return(.299*l.r+.587*l.g+.114*l.b)/255>.5?"#000000":"#ffffff"},G=({data:n,width:a=400,height:l=400,title:c="Distribution",showLegend:g=!0,unit:w="items",centerLabel:s})=>{const e=q.useRef(null),r=Math.min(a,l)/2-20;return q.useEffect(()=>{if(!e.current||!n.length)return;const i=S(e.current);i.selectAll("*").remove();const m=i.append("g").attr("transform",`translate(${a/2},${l/2})`),L=ee().value(t=>t.value).sort(null),C=P().innerRadius(r*.4).outerRadius(r).cornerRadius(4),_=P().innerRadius(r*.7).outerRadius(r*.7),u=S("body").append("div").attr("class",p.tooltip).style("opacity",0).style("position","absolute"),A=L(n),h=Q(n,t=>t.value),T=m.selectAll(".arc").data(A).enter().append("g").attr("class","arc");T.append("path").attr("d",t=>C(t)).attr("fill",(t,o)=>t.data.color||f[o%f.length]).attr("stroke","var(--bg-primary)").attr("stroke-width",3).style("cursor","pointer").style("filter","drop-shadow(0 2px 8px rgba(0,0,0,0.15))").on("mouseover",function(t,o){const y=P().innerRadius(r*.4).outerRadius(r*1.05).cornerRadius(4);S(this).transition().duration(200).attr("d",M=>y(M)).style("filter","drop-shadow(0 4px 12px rgba(0,0,0,0.25))"),u.transition().duration(200).style("opacity",1);const V=(o.data.value/h*100).toFixed(1);u.html(`
|
|
2
|
-
<div><strong>${o.data.name}</strong></div>
|
|
3
|
-
<div>Value: ${o.data.value.toLocaleString()}</div>
|
|
4
|
-
<div>${V}% of total</div>
|
|
5
|
-
`).style("left",t.pageX+10+"px").style("top",t.pageY-28+"px")}).on("mouseout",function(t,o){S(this).transition().duration(200).attr("d",y=>C(y)).style("filter","drop-shadow(0 2px 8px rgba(0,0,0,0.15))"),u.transition().duration(500).style("opacity",0)});const x=n.map((t,o)=>t.color||f[o%f.length]),R=x.length>=2?K.gamma(2.2)(x[0],x[1])(.5):x[0]||"#ffffff",d=$(R);return m.append("text").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("font-size","20px").attr("font-weight","bold").attr("fill",d).style("text-shadow",d==="#ffffff"?"0 1px 3px rgba(0,0,0,0.5)":"0 1px 3px rgba(255,255,255,0.5)").text(s||"Total"),m.append("text").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("y",22).attr("font-size","16px").attr("font-weight","600").attr("fill",d).style("text-shadow",d==="#ffffff"?"0 1px 2px rgba(0,0,0,0.4)":"0 1px 2px rgba(255,255,255,0.4)").text(`${h.toLocaleString()} ${w}`),T.filter(t=>t.endAngle-t.startAngle>.2).append("text").attr("transform",t=>`translate(${_.centroid(t)})`).attr("text-anchor","middle").attr("alignment-baseline","middle").attr("font-size","13px").attr("fill",(t,o)=>{const y=t.data.color||f[o%f.length];return $(y)}).attr("font-weight","600").style("pointer-events","none").style("text-shadow",(t,o)=>{const y=t.data.color||f[o%f.length];return`0 1px 2px ${$(y)==="#ffffff"?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.4)"}`}).text(t=>{const o=t.data.value/h*100;return o>8?`${o.toFixed(0)}%`:""}),()=>{u.remove()}},[n,a,l,r,s,w]),v.jsxs("div",{className:p.container,children:[v.jsx("h3",{className:p.title,children:c}),v.jsxs("div",{className:p.chartContainer,children:[v.jsx("svg",{ref:e,width:a,height:l,className:p.chart}),g&&v.jsx("div",{className:p.legend,children:n.map((i,m)=>v.jsxs("div",{className:p.legendItem,children:[v.jsx("span",{className:p.legendColor,style:{backgroundColor:i.color||f[m%f.length]}}),v.jsx("span",{className:p.legendLabel,children:i.name}),v.jsx("span",{className:p.legendValue,children:i.value.toLocaleString()})]},i.name))})]})]})};G.__docgenInfo={description:"",methods:[],displayName:"PieChart",props:{data:{required:!0,tsType:{name:"Array",elements:[{name:"PieDataPoint"}],raw:"PieDataPoint[]"},description:""},width:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"400",computed:!1}},height:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"400",computed:!1}},title:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'Distribution'",computed:!1}},showLegend:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},unit:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'items'",computed:!1}},centerLabel:{required:!1,tsType:{name:"string"},description:""}}};const he={title:"Organisms/Charts/PieChart",component:G,parameters:{layout:"centered"},argTypes:{width:{control:{type:"number",min:300,max:700,step:50}},height:{control:{type:"number",min:300,max:700,step:50}},title:{control:{type:"text"}},showLegend:{control:{type:"boolean"}}}},j={args:{data:[{name:"Frontend Development",value:35,color:"#8b5cf6"},{name:"Backend Development",value:25,color:"#3b82f6"},{name:"Meetings",value:15,color:"#10b981"},{name:"Code Review",value:10,color:"#f59e0b"},{name:"Documentation",value:8,color:"#ec4899"},{name:"Testing",value:7,color:"#14b8a6"}],width:500,height:500,title:"Project Time Allocation",showLegend:!0}},D={args:{data:[{name:"Yes",value:73,color:"#10b981"},{name:"No",value:27,color:"#ef4444"}],width:350,height:350,title:"Survey Results",showLegend:!1}},N={args:{data:[{name:"JavaScript",value:25},{name:"Python",value:20},{name:"Java",value:15},{name:"TypeScript",value:12},{name:"C++",value:8},{name:"C#",value:6},{name:"Go",value:5},{name:"Rust",value:4},{name:"Swift",value:3},{name:"Kotlin",value:2}],width:600,height:600,title:"Programming Language Usage",showLegend:!0}};var k,E,F;j.parameters={...j.parameters,docs:{...(k=j.parameters)==null?void 0:k.docs,source:{originalSource:`{
|
|
6
|
-
args: {
|
|
7
|
-
data: [{
|
|
8
|
-
name: 'Frontend Development',
|
|
9
|
-
value: 35,
|
|
10
|
-
color: '#8b5cf6'
|
|
11
|
-
}, {
|
|
12
|
-
name: 'Backend Development',
|
|
13
|
-
value: 25,
|
|
14
|
-
color: '#3b82f6'
|
|
15
|
-
}, {
|
|
16
|
-
name: 'Meetings',
|
|
17
|
-
value: 15,
|
|
18
|
-
color: '#10b981'
|
|
19
|
-
}, {
|
|
20
|
-
name: 'Code Review',
|
|
21
|
-
value: 10,
|
|
22
|
-
color: '#f59e0b'
|
|
23
|
-
}, {
|
|
24
|
-
name: 'Documentation',
|
|
25
|
-
value: 8,
|
|
26
|
-
color: '#ec4899'
|
|
27
|
-
}, {
|
|
28
|
-
name: 'Testing',
|
|
29
|
-
value: 7,
|
|
30
|
-
color: '#14b8a6'
|
|
31
|
-
}],
|
|
32
|
-
width: 500,
|
|
33
|
-
height: 500,
|
|
34
|
-
title: 'Project Time Allocation',
|
|
35
|
-
showLegend: true
|
|
36
|
-
}
|
|
37
|
-
}`,...(F=(E=j.parameters)==null?void 0:E.docs)==null?void 0:F.source}}};var I,J,O;D.parameters={...D.parameters,docs:{...(I=D.parameters)==null?void 0:I.docs,source:{originalSource:`{
|
|
38
|
-
args: {
|
|
39
|
-
data: [{
|
|
40
|
-
name: 'Yes',
|
|
41
|
-
value: 73,
|
|
42
|
-
color: '#10b981'
|
|
43
|
-
}, {
|
|
44
|
-
name: 'No',
|
|
45
|
-
value: 27,
|
|
46
|
-
color: '#ef4444'
|
|
47
|
-
}],
|
|
48
|
-
width: 350,
|
|
49
|
-
height: 350,
|
|
50
|
-
title: 'Survey Results',
|
|
51
|
-
showLegend: false
|
|
52
|
-
}
|
|
53
|
-
}`,...(O=(J=D.parameters)==null?void 0:J.docs)==null?void 0:O.source}}};var U,Y,B;N.parameters={...N.parameters,docs:{...(U=N.parameters)==null?void 0:U.docs,source:{originalSource:`{
|
|
54
|
-
args: {
|
|
55
|
-
data: [{
|
|
56
|
-
name: 'JavaScript',
|
|
57
|
-
value: 25
|
|
58
|
-
}, {
|
|
59
|
-
name: 'Python',
|
|
60
|
-
value: 20
|
|
61
|
-
}, {
|
|
62
|
-
name: 'Java',
|
|
63
|
-
value: 15
|
|
64
|
-
}, {
|
|
65
|
-
name: 'TypeScript',
|
|
66
|
-
value: 12
|
|
67
|
-
}, {
|
|
68
|
-
name: 'C++',
|
|
69
|
-
value: 8
|
|
70
|
-
}, {
|
|
71
|
-
name: 'C#',
|
|
72
|
-
value: 6
|
|
73
|
-
}, {
|
|
74
|
-
name: 'Go',
|
|
75
|
-
value: 5
|
|
76
|
-
}, {
|
|
77
|
-
name: 'Rust',
|
|
78
|
-
value: 4
|
|
79
|
-
}, {
|
|
80
|
-
name: 'Swift',
|
|
81
|
-
value: 3
|
|
82
|
-
}, {
|
|
83
|
-
name: 'Kotlin',
|
|
84
|
-
value: 2
|
|
85
|
-
}],
|
|
86
|
-
width: 600,
|
|
87
|
-
height: 600,
|
|
88
|
-
title: 'Programming Language Usage',
|
|
89
|
-
showLegend: true
|
|
90
|
-
}
|
|
91
|
-
}`,...(B=(Y=N.parameters)==null?void 0:Y.docs)==null?void 0:B.source}}};const xe=["Default","TwoCategories","ManyCategories"];export{j as Default,N as ManyCategories,D as TwoCategories,xe as __namedExportsOrder,he as default};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import{r as d,j as r}from"./iframe-BTbLpgFM.js";import{s as y,c as _t,f as ee}from"./transform-v7fcW145.js";import{t as ae,e as ne,l as re,m as oe,b as Mt,p as wt}from"./monotone-B6BFTqpP.js";import{l as se}from"./linear-9syG7RFK.js";import{C as ie}from"./chart-column-Qn3KVlVm.js";import{c as nt}from"./createLucideIcon-CanksmPJ.js";import{C as le}from"./calendar-B90N4a5g.js";import{t as mt}from"./defaultLocale-DJ2q5QjE.js";import{a as ce,b as de}from"./axis-D3QohQNI.js";import"./preload-helper-C1FmrZbK.js";import"./array-BKyUJesY.js";import"./path-CbwjOpE9.js";/**
|
|
2
|
-
* @license lucide-react v0.539.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ue=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],pe=nt("calendar-days",ue);/**
|
|
7
|
-
* @license lucide-react v0.539.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const he=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],me=nt("calendar-range",he);/**
|
|
12
|
-
* @license lucide-react v0.539.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ge=[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]],ye=nt("divide",ge);/**
|
|
17
|
-
* @license lucide-react v0.539.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const fe=[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]],ve=nt("sigma",fe),be="_container_frpma_1",xe="_controls_frpma_19",_e="_viewToggle_frpma_27",Me="_viewButton_frpma_36",we="_active_frpma_57",ke="_viewIcon_frpma_63",Se="_viewLabel_frpma_68",Te="_aggregationToggle_frpma_78",qe="_aggregationButton_frpma_87",je="_aggregationIcon_frpma_114",Ee="_aggregationLabel_frpma_119",Le="_legend_frpma_129",Ce="_compactLegend_frpma_140",De="_legendItem_frpma_145",Ae="_legendEmoji_frpma_150",$e="_legendLabel_frpma_154",Ne="_inactive_frpma_178",Ie="_legendColor_frpma_188",Ve="_chart_frpma_227",Re="_gridLine_frpma_235",He="_line_frpma_241",We="_crosshair_frpma_248",Fe="_halo_frpma_255",Be="_overlay_frpma_260",Oe="_xAxis_frpma_265",ze="_yAxis_frpma_266",Ge="_dataPoint_frpma_285",Pe="_tooltip_frpma_289",Ye="_visible_frpma_310",Qe="_tooltipHeader_frpma_315",Ue="_tooltipEmoji_frpma_326",Xe="_tooltipDot_frpma_331",Ke="_tooltipInfo_frpma_338",Je="_tooltipDate_frpma_344",Ze="_tooltipValue_frpma_350",e={container:be,controls:xe,viewToggle:_e,viewButton:Me,active:we,viewIcon:ke,viewLabel:Se,aggregationToggle:Te,aggregationButton:qe,aggregationIcon:je,aggregationLabel:Ee,legend:Le,compactLegend:Ce,legendItem:De,legendEmoji:Ae,legendLabel:$e,inactive:Ne,legendColor:Ie,chart:Ve,gridLine:Re,line:He,crosshair:We,halo:Fe,overlay:Be,xAxis:Oe,yAxis:ze,dataPoint:Ge,tooltip:Pe,visible:Ye,tooltipHeader:Qe,tooltipEmoji:Ue,tooltipDot:Xe,tooltipInfo:Ke,tooltipDate:Je,tooltipValue:Ze},ta={Exercise:"#6BCB77",Meditation:"#4D96FF",Reading:"#FFB319",Water:"#00D9FF",Steps:"#FF6B6B",Sleep:"#9B59B6",Calories:"#FF9F1C",Study:"#C774E8"},kt="http://www.w3.org/2000/svg",ea=(n,v,f=80)=>{const L=n&&n.length>0?n:"M0,0",M=v&&v.length>0?v:"M0,0",C=document.createElementNS(kt,"path"),D=document.createElementNS(kt,"path");C.setAttribute("d",L),D.setAttribute("d",M);const H=typeof C.getTotalLength=="function"?C.getTotalLength():0,U=typeof D.getTotalLength=="function"?D.getTotalLength():0;if(H===0||U===0)return()=>M;const A=[],w=[];for(let q=0;q<f;q++){const k=f===1?0:q/(f-1),h=C.getPointAtLength(k*H),i=D.getPointAtLength(k*U);A.push([h.x,h.y]),w.push([i.x,i.y])}return q=>{let k="";for(let h=0;h<f;h++){const i=A[h][0]+(w[h][0]-A[h][0])*q,ot=A[h][1]+(w[h][1]-A[h][1])*q;k+=(h===0?"M":"L")+i+","+ot}return k}},Vt=({data:n,width:v=800,height:f=400,defaultViewType:L="daily",periodType:M="month",habitColors:C={},habitEmojis:D={},onDataPointClick:H,hideControls:U=!1,compactLegend:A=!1})=>{const w=d.useRef(null),q=d.useRef(null),k=d.useRef(H),h=d.useRef(!1),[i,ot]=d.useState(L),[z,gt]=d.useState([]),[G,yt]=d.useState(null),[S,st]=d.useState(null),[X,ft]=d.useState("average");d.useEffect(()=>{k.current=H},[H]);const $=d.useMemo(()=>({top:20,right:20,bottom:50,left:50}),[]),K=v-$.left-$.right,W=f-$.top-$.bottom,P=d.useMemo(()=>Object.keys(n).filter(a=>a!=="dates"),[n]);d.useEffect(()=>{gt(P)},[P]),d.useEffect(()=>{const a=()=>{st(null)};return window.addEventListener("scroll",a,!0),()=>{window.removeEventListener("scroll",a,!0)}},[]);const Rt=d.useMemo(()=>{switch(M){case"week":return["daily"];case"month":return["daily","weekly"];case"quarter":return["weekly","monthly"];case"year":return["daily","weekly","monthly","quarterly"];case"allTime":return["monthly","quarterly"];default:return["daily"]}},[M]),F=d.useCallback(a=>C[a]||ta[a]||`hsl(${Math.abs(a.split("").reduce((l,s)=>l+s.charCodeAt(0),0))%360}, 70%, 50%)`,[C]),x=d.useMemo(()=>{if(i==="daily"||!n.dates.length)return n;const a={dates:[]},l=new Map;return n.dates.forEach((s,_)=>{const j=new Date(s);let m;switch(i){case"weekly":{const c=new Date(j),g=c.getDay(),E=c.getDate()-g+(g===0?-6:1);c.setDate(E),m=c.toISOString().split("T")[0];break}case"monthly":m=`${j.getFullYear()}-${String(j.getMonth()+1).padStart(2,"0")}-01`;break;case"quarterly":{const g=(Math.floor(j.getMonth()/3)+1-1)*3;m=new Date(j.getFullYear(),g,1).toISOString().split("T")[0];break}default:m=s}l.has(m)||l.set(m,[]),l.get(m).push(_)}),a.dates=Array.from(l.keys()).sort(),P.forEach(s=>{a[s]=a.dates.map(_=>{const m=l.get(_).map(c=>n[s][c]).filter(c=>typeof c=="number"&&!isNaN(c));return m.length===0?0:Math.round(X==="sum"?m.reduce((c,g)=>c+g,0):m.reduce((c,g)=>c+g,0)/m.length)})}),a},[n,i,P,X]),Ht=a=>{gt(l=>l.includes(a)?l.filter(s=>s!==a):[...l,a])};d.useEffect(()=>{if(!w.current||x.dates.length===0)return;const a=y(w.current),l=!h.current;h.current=!0;let s=a.select("g.qhc-root");s.empty()&&(s=a.append("g").attr("class","qhc-root")),s.attr("transform",`translate(${$.left},${$.top})`);const _=t=>{let o=s.select(`g.${t}`);return o.empty()&&(o=s.append("g").attr("class",t)),o},j=_("qhc-grid"),m=_("qhc-lines"),c=_("qhc-points"),g=_("qhc-axes"),E=_("qhc-ui"),N=x.dates.map(t=>new Date(t)),I=ae().domain(ne(N)).range([0,K]),Ot=Math.max(1,...z.flatMap(t=>x[t].filter(o=>typeof o=="number"))),V=se().domain([0,Ot*1.1]).range([W,0]),it=re().x(t=>I(t[0])).y(t=>V(t[1])).curve(oe),lt=j.selectAll("line.qhc-grid-line").data(V.ticks(5),t=>String(t));lt.exit().remove(),lt.enter().append("line").attr("class",`${e.gridLine} qhc-grid-line`).style("opacity",0).merge(lt).attr("x1",0).attr("x2",K).attr("y1",t=>V(t)).attr("y2",t=>V(t)).transition().duration(400).style("opacity",1);const zt=t=>{const o=new Date(t);o.setHours(0,0,0,0),o.setDate(o.getDate()+3-(o.getDay()+6)%7);const u=new Date(o.getFullYear(),0,4);return 1+Math.round(((o.getTime()-u.getTime())/864e5-3+(u.getDay()+6)%7)/7)},Gt=(()=>{switch(i){case"daily":return mt("%m-%d");case"weekly":return t=>`W${zt(t).toString().padStart(2,"0")}`;case"monthly":return mt("%b");case"quarterly":return t=>`Q${Math.floor(t.getMonth()/3)+1}`;default:return mt("%m-%d")}})(),vt=(()=>{switch(i){case"daily":return Math.min(10,x.dates.length);case"weekly":return Math.min(12,x.dates.length);case"monthly":return Math.min(12,x.dates.length);case"quarterly":return x.dates.length;default:return}})(),ct=ce(I).tickFormat(t=>Gt(t));i==="quarterly"?ct.tickValues(N):vt&&ct.ticks(vt);let Y=g.select("g.qhc-x-axis");Y.empty()&&(Y=g.append("g").attr("class",`${e.xAxis} qhc-x-axis`)),Y.attr("transform",`translate(0,${W})`).call(ct),Y.selectAll("text").style("text-anchor",i==="daily"||i==="weekly"?"end":"middle").attr("dx",i==="daily"||i==="weekly"?"-.8em":"0").attr("dy",i==="daily"||i==="weekly"?".15em":".71em").attr("transform",i==="daily"||i==="weekly"?"rotate(-45)":null);let J=g.select("g.qhc-y-axis");J.empty()&&(J=g.append("g").attr("class",`${e.yAxis} qhc-y-axis`)),J.call(de(V)),l&&(Y.style("opacity",0).transition().duration(500).delay(80).style("opacity",1),J.style("opacity",0).transition().duration(500).delay(80).style("opacity",1));const Pt=z.map(t=>{const o=N.map((u,p)=>[u,x[t][p]]).filter(u=>typeof u[1]=="number");return{habit:t,color:F(t),points:o}}),dt=m.selectAll("path.qhc-line").data(Pt,t=>t.habit);dt.exit().transition("line-exit").duration(300).style("opacity",0).remove(),dt.enter().append("path").attr("class",`${e.line} qhc-line`).attr("data-habit",t=>t.habit).attr("fill","none").attr("stroke",t=>t.color).attr("opacity",0).attr("d",t=>it(t.points)||"").each(function(){const t=this,o=typeof t.getTotalLength=="function"?t.getTotalLength():0;o>0&&y(t).attr("stroke-dasharray",`${o} ${o}`).attr("stroke-dashoffset",o)}).transition("line-enter").duration(900).ease(_t).attr("opacity",1).attr("stroke-dashoffset",0).on("end",function(){y(this).attr("stroke-dasharray",null)}),dt.transition("line-update").duration(700).ease(ee).attr("stroke",t=>t.color).attrTween("d",function(t){const o=y(this).attr("d")||"",u=it(t.points)||"";return ea(o,u,90)}).on("end",function(t){y(this).attr("d",it(t.points)||"")}),c.selectAll("*").remove();const ut=[];z.forEach(t=>{const o=F(t);N.forEach((u,p)=>{const b=x[t][p];typeof b=="number"&&!isNaN(b)&&ut.push({habit:t,color:o,date:u,value:b})})});const bt=I(N[0]),Yt=I(N[N.length-1]),Qt=Math.max(1,Yt-bt),Ut=l?100:350,Xt=l?1100:600;c.selectAll("circle.qhc-point").data(ut).enter().append("circle").attr("class",`${e.dataPoint} qhc-point`).attr("data-habit",t=>t.habit).attr("cx",t=>I(t.date)).attr("cy",W).attr("r",0).attr("fill",t=>t.color).style("opacity",0).transition("point-enter").delay(t=>Ut+Xt*((I(t.date)-bt)/Qt)).duration(420).ease(Mt.overshoot(2)).attr("cy",t=>V(t.value)).attr("r",4).style("opacity",1),E.selectAll("*").remove();const xt=E.append("line").attr("class",e.crosshair).attr("y1",0).attr("y2",W).style("opacity",0).style("pointer-events","none"),pt=E.append("circle").attr("class",e.halo).attr("r",0).style("opacity",0).style("pointer-events","none");let ht=null;const Kt=(t,o,u)=>{pt.interrupt("halo-pulse").interrupt("halo-out").attr("cx",t).attr("cy",o).attr("fill",u);const p=()=>{pt.attr("r",4).style("opacity",.55).transition("halo-pulse").duration(900).ease(_t).attr("r",18).style("opacity",0).on("end",p)};p()},Jt=()=>{pt.interrupt("halo-pulse").transition("halo-out").duration(180).style("opacity",0).attr("r",0)},B=ut.map(t=>({habit:t.habit,date:t.date,value:t.value,x:I(t.date),y:V(t.value)})),Zt=(t,o,u)=>{const p=`${t.habit}|${t.date.toISOString()}`,b=F(t.habit);xt.attr("x1",t.x).attr("x2",t.x).interrupt("crosshair-fade").transition("crosshair-fade").duration(120).style("opacity",1),ht!==p&&(c.selectAll("circle.qhc-point").filter(function(){return y(this).attr("data-active")==="true"}).attr("data-active",null).transition("point-scale").duration(150).attr("r",4),c.selectAll("circle.qhc-point").filter(function(){const T=+y(this).attr("cx"),R=+y(this).attr("cy");return y(this).attr("data-habit")===t.habit&&Math.abs(T-t.x)<.5&&Math.abs(R-t.y)<.5}).attr("data-active","true").transition("point-scale").duration(180).ease(Mt.overshoot(2)).attr("r",7),Kt(t.x,t.y,b),ht=p),st({habit:t.habit,date:t.date.toISOString().split("T")[0],value:t.value,x:o,y:u})},te=()=>{xt.interrupt("crosshair-fade").transition("crosshair-fade").duration(180).style("opacity",0),c.selectAll("circle.qhc-point").filter(function(){return y(this).attr("data-active")==="true"}).attr("data-active",null).transition("point-scale").duration(180).attr("r",4),Jt(),ht=null,st(null)};E.append("rect").attr("class",e.overlay).attr("width",K).attr("height",W).on("mousemove",function(t){if(B.length===0)return;const[o,u]=wt(t,this);let p=B[0],b=1/0;for(const T of B){const R=T.x-o,O=T.y-u,Q=R*R+O*O;Q<b&&(b=Q,p=T)}Zt(p,t.clientX,t.clientY)}).on("mouseleave",()=>{te()}).on("click",function(t){if(B.length===0||!k.current)return;const[o,u]=wt(t,this);let p=B[0],b=1/0;for(const T of B){const R=T.x-o,O=T.y-u,Q=R*R+O*O;Q<b&&(b=Q,p=T)}k.current(p.habit,p.date.toISOString().split("T")[0],p.value)}),E.raise()},[x,z,K,W,$,F,i,v,f]),d.useEffect(()=>{if(!w.current)return;const a=y(w.current);a.selectAll("path.qhc-line").each(function(){const l=this.getAttribute("data-habit"),s=G&&G!==l;y(this).transition("hover-dim").duration(180).attr("opacity",s?.25:1)}),a.selectAll("circle.qhc-point").each(function(){const l=this.getAttribute("data-habit"),s=G&&G!==l;y(this).transition("hover-dim").duration(180).attr("opacity",s?.25:1)})},[G]);const Wt=(a,l)=>{const s=new Date(a);switch(l){case"daily":return s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});case"weekly":return`Week of ${s.toLocaleDateString("en-US",{month:"short",day:"numeric"})}`;case"monthly":return s.toLocaleDateString("en-US",{month:"long",year:"numeric"});case"quarterly":return`Q${Math.floor(s.getMonth()/3)+1} ${s.getFullYear()}`;default:return a}},Ft={daily:{Icon:le,label:"Daily"},weekly:{Icon:pe,label:"Weekly"},monthly:{Icon:me,label:"Monthly"},quarterly:{Icon:ie,label:"Quarterly"}},Bt=i!=="daily";return r.jsxs("div",{className:e.container,children:[!U&&r.jsxs("div",{className:e.controls,children:[r.jsx("div",{className:e.viewToggle,children:Rt.map(a=>{const{Icon:l,label:s}=Ft[a];return r.jsxs("button",{className:`${e.viewButton} ${i===a?e.active:""}`,onClick:()=>ot(a),title:s,children:[r.jsx("span",{className:e.viewIcon,children:r.jsx(l,{size:16})}),r.jsx("span",{className:e.viewLabel,children:s})]},a)})}),Bt&&r.jsxs("div",{className:e.aggregationToggle,children:[r.jsxs("button",{className:`${e.aggregationButton} ${X==="average"?e.active:""}`,onClick:()=>ft("average"),title:"Show average values for each period",children:[r.jsx("span",{className:e.aggregationIcon,children:r.jsx(ye,{size:16})}),r.jsx("span",{className:e.aggregationLabel,children:"Average"})]}),r.jsxs("button",{className:`${e.aggregationButton} ${X==="sum"?e.active:""}`,onClick:()=>ft("sum"),title:"Show total values for each period",children:[r.jsx("span",{className:e.aggregationIcon,children:r.jsx(ve,{size:16})}),r.jsx("span",{className:e.aggregationLabel,children:"Sum"})]})]})]}),r.jsx("div",{className:`${e.legend}${A?` ${e.compactLegend}`:""}`,children:P.map(a=>r.jsxs("button",{className:`${e.legendItem} ${z.includes(a)?"":e.inactive}`,onClick:()=>Ht(a),onMouseEnter:()=>yt(a),onMouseLeave:()=>yt(null),children:[r.jsx("span",{className:e.legendEmoji,children:D[a]||"📊"}),r.jsx("span",{className:e.legendColor,style:{backgroundColor:F(a)}}),r.jsx("span",{className:e.legendLabel,children:a})]},a))}),r.jsx("svg",{ref:w,viewBox:`0 0 ${v} ${f}`,preserveAspectRatio:"xMidYMid meet",className:e.chart}),S&&r.jsxs("div",{ref:q,className:`${e.tooltip} ${S?e.visible:""}`,style:{left:`${S.x}px`,top:`${S.y-80}px`},children:[r.jsxs("div",{className:e.tooltipHeader,children:[r.jsx("span",{className:e.tooltipEmoji,children:D[S.habit]||"📊"}),r.jsx("span",{className:e.tooltipDot,style:{backgroundColor:F(S.habit)}}),r.jsx("span",{children:S.habit})]}),r.jsxs("div",{className:e.tooltipInfo,children:[r.jsx("div",{className:e.tooltipDate,children:Wt(S.date,i)}),r.jsxs("div",{className:e.tooltipValue,children:[r.jsx("strong",{children:Math.round(S.value*10)/10}),r.jsx("span",{style:{fontSize:"12px",fontWeight:"normal",opacity:.6},children:"units"})]})]})]})]})};Vt.__docgenInfo={description:"",methods:[],displayName:"QuantifiableHabitsChart",props:{data:{required:!0,tsType:{name:"ChartData"},description:""},width:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"800",computed:!1}},height:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"400",computed:!1}},defaultViewType:{required:!1,tsType:{name:"union",raw:"'daily' | 'weekly' | 'monthly' | 'quarterly'",elements:[{name:"literal",value:"'daily'"},{name:"literal",value:"'weekly'"},{name:"literal",value:"'monthly'"},{name:"literal",value:"'quarterly'"}]},description:"",defaultValue:{value:"'daily'",computed:!1}},periodType:{required:!1,tsType:{name:"union",raw:"'week' | 'month' | 'quarter' | 'year' | 'allTime'",elements:[{name:"literal",value:"'week'"},{name:"literal",value:"'month'"},{name:"literal",value:"'quarter'"},{name:"literal",value:"'year'"},{name:"literal",value:"'allTime'"}]},description:"",defaultValue:{value:"'month'",computed:!1}},habitColors:{required:!1,tsType:{name:"signature",type:"object",raw:"{ [key: string]: string }",signature:{properties:[{key:{name:"string"},value:{name:"string",required:!0}}]}},description:"",defaultValue:{value:"{}",computed:!1}},habitEmojis:{required:!1,tsType:{name:"signature",type:"object",raw:"{ [key: string]: string }",signature:{properties:[{key:{name:"string"},value:{name:"string",required:!0}}]}},description:"",defaultValue:{value:"{}",computed:!1}},onDataPointClick:{required:!1,tsType:{name:"signature",type:"function",raw:"(habit: string, date: string, value: number) => void",signature:{arguments:[{type:{name:"string"},name:"habit"},{type:{name:"string"},name:"date"},{type:{name:"number"},name:"value"}],return:{name:"void"}}},description:""},hideControls:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},compactLegend:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};const ya={title:"Organisms/Charts/QuantifiableHabitsChart",component:Vt,parameters:{layout:"centered"},argTypes:{width:{control:{type:"number",min:400,max:1200,step:50}},height:{control:{type:"number",min:200,max:600,step:50}},defaultViewType:{control:{type:"select"},options:["daily","weekly","monthly","quarterly"]},periodType:{control:{type:"select"},options:["week","month","quarter","year","allTime"]}}},rt=n=>{const v=[],f=new Date;for(let L=n-1;L>=0;L--){const M=new Date(f);M.setDate(M.getDate()-L),v.push(M.toISOString().split("T")[0])}return v},Z={args:{data:(()=>{const n=rt(30);return{dates:n,Exercise:n.map(()=>Math.floor(Math.random()*60)+20),Reading:n.map(()=>Math.floor(Math.random()*120)+30),Water:n.map(()=>Math.floor(Math.random()*8)+2),Steps:n.map(()=>Math.floor(Math.random()*15e3)+5e3)}})(),width:900,height:400,defaultViewType:"daily",periodType:"month",habitColors:{Exercise:"#10b981",Reading:"#8b5cf6",Water:"#3b82f6",Steps:"#f59e0b"},habitEmojis:{Exercise:"🏃",Reading:"📚",Water:"💧",Steps:"👟"}}},tt={args:{data:(()=>{const n=rt(90);return{dates:n,Meditation:n.map(()=>Math.floor(Math.random()*30)+10),Study:n.map(()=>Math.floor(Math.random()*180)+60),Sleep:n.map(()=>Math.floor(Math.random()*3)+6)}})(),width:900,height:400,defaultViewType:"weekly",periodType:"quarter",habitColors:{Meditation:"#a78bfa",Study:"#34d399",Sleep:"#60a5fa"},habitEmojis:{Meditation:"🧘",Study:"📖",Sleep:"😴"}}},et={args:{data:(()=>{const n=rt(365);return{dates:n,Coding:n.map(()=>Math.floor(Math.random()*240)+120),Exercise:n.map(()=>Math.floor(Math.random()*90)+30),Learning:n.map(()=>Math.floor(Math.random()*120)+60),Socializing:n.map(()=>Math.floor(Math.random()*180)+60)}})(),width:1e3,height:450,defaultViewType:"monthly",periodType:"year",habitColors:{Coding:"#7c3aed",Exercise:"#10b981",Learning:"#f59e0b",Socializing:"#ec4899"},habitEmojis:{Coding:"💻",Exercise:"💪",Learning:"🎓",Socializing:"👥"}}},at={args:{data:(()=>{const n=rt(30);return{dates:n,Weight:n.map((v,f)=>70+Math.sin(f/5)*2+Math.random())}})(),width:800,height:300,defaultViewType:"daily",periodType:"month",habitColors:{Weight:"#3b82f6"},habitEmojis:{Weight:"⚖️"}}};var St,Tt,qt;Z.parameters={...Z.parameters,docs:{...(St=Z.parameters)==null?void 0:St.docs,source:{originalSource:`{
|
|
22
|
-
args: {
|
|
23
|
-
data: (() => {
|
|
24
|
-
const dates = generateDateRange(30);
|
|
25
|
-
return {
|
|
26
|
-
dates,
|
|
27
|
-
Exercise: dates.map(() => Math.floor(Math.random() * 60) + 20),
|
|
28
|
-
Reading: dates.map(() => Math.floor(Math.random() * 120) + 30),
|
|
29
|
-
Water: dates.map(() => Math.floor(Math.random() * 8) + 2),
|
|
30
|
-
Steps: dates.map(() => Math.floor(Math.random() * 15000) + 5000)
|
|
31
|
-
};
|
|
32
|
-
})(),
|
|
33
|
-
width: 900,
|
|
34
|
-
height: 400,
|
|
35
|
-
defaultViewType: 'daily',
|
|
36
|
-
periodType: 'month',
|
|
37
|
-
habitColors: {
|
|
38
|
-
Exercise: '#10b981',
|
|
39
|
-
Reading: '#8b5cf6',
|
|
40
|
-
Water: '#3b82f6',
|
|
41
|
-
Steps: '#f59e0b'
|
|
42
|
-
},
|
|
43
|
-
habitEmojis: {
|
|
44
|
-
Exercise: '🏃',
|
|
45
|
-
Reading: '📚',
|
|
46
|
-
Water: '💧',
|
|
47
|
-
Steps: '👟'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}`,...(qt=(Tt=Z.parameters)==null?void 0:Tt.docs)==null?void 0:qt.source}}};var jt,Et,Lt;tt.parameters={...tt.parameters,docs:{...(jt=tt.parameters)==null?void 0:jt.docs,source:{originalSource:`{
|
|
51
|
-
args: {
|
|
52
|
-
data: (() => {
|
|
53
|
-
const dates = generateDateRange(90);
|
|
54
|
-
return {
|
|
55
|
-
dates,
|
|
56
|
-
Meditation: dates.map(() => Math.floor(Math.random() * 30) + 10),
|
|
57
|
-
Study: dates.map(() => Math.floor(Math.random() * 180) + 60),
|
|
58
|
-
Sleep: dates.map(() => Math.floor(Math.random() * 3) + 6)
|
|
59
|
-
};
|
|
60
|
-
})(),
|
|
61
|
-
width: 900,
|
|
62
|
-
height: 400,
|
|
63
|
-
defaultViewType: 'weekly',
|
|
64
|
-
periodType: 'quarter',
|
|
65
|
-
habitColors: {
|
|
66
|
-
Meditation: '#a78bfa',
|
|
67
|
-
Study: '#34d399',
|
|
68
|
-
Sleep: '#60a5fa'
|
|
69
|
-
},
|
|
70
|
-
habitEmojis: {
|
|
71
|
-
Meditation: '🧘',
|
|
72
|
-
Study: '📖',
|
|
73
|
-
Sleep: '😴'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}`,...(Lt=(Et=tt.parameters)==null?void 0:Et.docs)==null?void 0:Lt.source}}};var Ct,Dt,At;et.parameters={...et.parameters,docs:{...(Ct=et.parameters)==null?void 0:Ct.docs,source:{originalSource:`{
|
|
77
|
-
args: {
|
|
78
|
-
data: (() => {
|
|
79
|
-
const dates = generateDateRange(365);
|
|
80
|
-
return {
|
|
81
|
-
dates,
|
|
82
|
-
Coding: dates.map(() => Math.floor(Math.random() * 240) + 120),
|
|
83
|
-
Exercise: dates.map(() => Math.floor(Math.random() * 90) + 30),
|
|
84
|
-
Learning: dates.map(() => Math.floor(Math.random() * 120) + 60),
|
|
85
|
-
Socializing: dates.map(() => Math.floor(Math.random() * 180) + 60)
|
|
86
|
-
};
|
|
87
|
-
})(),
|
|
88
|
-
width: 1000,
|
|
89
|
-
height: 450,
|
|
90
|
-
defaultViewType: 'monthly',
|
|
91
|
-
periodType: 'year',
|
|
92
|
-
habitColors: {
|
|
93
|
-
Coding: '#7c3aed',
|
|
94
|
-
Exercise: '#10b981',
|
|
95
|
-
Learning: '#f59e0b',
|
|
96
|
-
Socializing: '#ec4899'
|
|
97
|
-
},
|
|
98
|
-
habitEmojis: {
|
|
99
|
-
Coding: '💻',
|
|
100
|
-
Exercise: '💪',
|
|
101
|
-
Learning: '🎓',
|
|
102
|
-
Socializing: '👥'
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}`,...(At=(Dt=et.parameters)==null?void 0:Dt.docs)==null?void 0:At.source}}};var $t,Nt,It;at.parameters={...at.parameters,docs:{...($t=at.parameters)==null?void 0:$t.docs,source:{originalSource:`{
|
|
106
|
-
args: {
|
|
107
|
-
data: (() => {
|
|
108
|
-
const dates = generateDateRange(30);
|
|
109
|
-
return {
|
|
110
|
-
dates,
|
|
111
|
-
Weight: dates.map((_, i) => 70 + Math.sin(i / 5) * 2 + Math.random())
|
|
112
|
-
};
|
|
113
|
-
})(),
|
|
114
|
-
width: 800,
|
|
115
|
-
height: 300,
|
|
116
|
-
defaultViewType: 'daily',
|
|
117
|
-
periodType: 'month',
|
|
118
|
-
habitColors: {
|
|
119
|
-
Weight: '#3b82f6'
|
|
120
|
-
},
|
|
121
|
-
habitEmojis: {
|
|
122
|
-
Weight: '⚖️'
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}`,...(It=(Nt=at.parameters)==null?void 0:Nt.docs)==null?void 0:It.source}}};const fa=["DailyHabits","WeeklyAverages","YearlyOverview","SingleHabit"];export{Z as DailyHabits,at as SingleHabit,tt as WeeklyAverages,et as YearlyOverview,fa as __namedExportsOrder,ya as default};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{r as x,j as n}from"./iframe-BTbLpgFM.js";import{s as B,c as L}from"./transform-v7fcW145.js";import{l as it}from"./linear-9syG7RFK.js";import{b as dt,r as q}from"./band-Cq25-Mh7.js";import{a as ct,b as pt}from"./axis-D3QohQNI.js";import"./preload-helper-C1FmrZbK.js";const ht="_container_1yktd_1",mt="_header_1yktd_7",ut="_eyebrow_1yktd_15",gt="_title_1yktd_23",ft="_chart_1yktd_38",_t="_gridLine_1yktd_43",Mt="_gridLineAccent_1yktd_50",St="_sleepBar_1yktd_55",yt="_sleepBarHover_1yktd_59",kt="_squiggle_1yktd_59",xt="_endpoint_1yktd_76",$t="_endpointSleep_1yktd_80",wt="_endpointWake_1yktd_84",vt="_xAxis_1yktd_88",bt="_yAxis_1yktd_89",Dt="_tooltip_1yktd_103",Tt="_visible_1yktd_117",At="_tooltipDate_1yktd_121",Ht="_tooltipBody_1yktd_132",jt="_tooltipRow_1yktd_138",Bt="_tooltipTotal_1yktd_162",a={container:ht,header:mt,eyebrow:ut,title:gt,chart:ft,gridLine:_t,gridLineAccent:Mt,sleepBar:St,sleepBarHover:yt,squiggle:kt,endpoint:xt,endpointSleep:$t,endpointWake:wt,xAxis:vt,yAxis:bt,tooltip:Dt,visible:Tt,tooltipDate:At,tooltipBody:Ht,tooltipRow:jt,tooltipTotal:Bt},I=t=>{const[o,r]=t.split(":").map(Number);return o+r/60},O=t=>{const o=Math.floor(t%24),r=Math.round(t%1*60);return`${o.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},Lt=t=>{const o=Math.floor(t),r=Math.round(t%1*60);return`${o}h ${r.toString().padStart(2,"0")}m`},Rt=(t,o,r,l,p)=>{const i=Math.max(0,o-t);if(i===0)return`M ${t} ${r}`;const g=Math.max(1,Math.round(i/p)),h=i/(g*2);let k=`M ${t} ${r}`;for(let m=0;m<g*2;m++){const f=t+(m+.5)*h,S=r+(m%2===0?-l:l),u=t+(m+1)*h;k+=` Q ${f} ${S} ${u} ${r}`}return k},at=({sleepData:t,width:o=800,height:r=400,onDateClick:l})=>{const p=x.useRef(null),[i,g]=x.useState(null),h=x.useMemo(()=>({top:12,right:16,bottom:32,left:64}),[]),k=o-h.left-h.right,m=r-h.top-h.bottom;return x.useEffect(()=>{const f=()=>g(null);return window.addEventListener("scroll",f,!0),()=>window.removeEventListener("scroll",f,!0)},[]),x.useEffect(()=>{if(!p.current||t.length===0)return;const f=B(p.current);f.selectAll("*").remove(),f.append("rect").attr("width",o).attr("height",r).attr("fill","transparent").style("pointer-events","all").on("mouseleave",()=>g(null));const S=f.append("g").attr("transform",`translate(${h.left},${h.top})`),u=it().domain([18,42]).range([0,k]),H=t.map(e=>e.date),j=dt().domain(H).range([0,m]).paddingInner(.35).paddingOuter(.1);S.selectAll(".grid-line-x").data(q(18,43,3)).enter().append("line").attr("class",a.gridLine).attr("x1",e=>u(e)).attr("y1",0).attr("x2",e=>u(e)).attr("y2",m).classed(a.gridLineAccent,e=>{const s=e%24;return s===0||s===12}),t.forEach(e=>{const s=j(e.date);if(s===void 0)return;const y=j.bandwidth(),$=S.append("g").attr("class",a.sleepBar).style("cursor",l?"pointer":"default").on("click",()=>l==null?void 0:l(e.date));let d=null,c=null;if(e.sleep_time&&(d=I(e.sleep_time),d<18&&(d+=24)),e.wake_hour&&(c=I(e.wake_hour),d!==null?(c<d||d>=18&&c<18)&&(c+=24):c<12&&(c+=24)),d!==null&&c!==null){const _=u(d),M=u(c),nt=s+y/2,st=Math.min(y/2.2,7),lt=Rt(_,M,nt,st,14),N=$.append("path").attr("class",a.squiggle).attr("d",lt).attr("fill","none"),E=N.node(),W=typeof E.getTotalLength=="function"?E.getTotalLength():(M-_)*1.8;N.attr("stroke-dasharray",W).attr("stroke-dashoffset",W).transition().duration(540).ease(L).attr("stroke-dashoffset",0)}d!==null&&$.append("circle").attr("class",`${a.endpoint} ${a.endpointSleep}`).attr("cx",u(d)).attr("cy",s+y/2).attr("r",0).transition().duration(280).delay(160).ease(L).attr("r",3.5),c!==null&&$.append("circle").attr("class",`${a.endpoint} ${a.endpointWake}`).attr("cx",u(c)).attr("cy",s+y/2).attr("r",0).transition().duration(280).delay(220).ease(L).attr("r",3.5),$.on("mouseenter",function(_){B(this).classed(a.sleepBarHover,!0);const M=d!==null&&c!==null?c-d:null;g({date:e.date,sleepTime:d!==null?O(d):null,wakeTime:c!==null?O(c):null,duration:M!==null?Math.round(M*100)/100:null,x:_.pageX,y:_.pageY-12})}).on("mouseleave",function(){B(this).classed(a.sleepBarHover,!1),g(null)}).on("mousemove",function(_){g(M=>M?{...M,x:_.pageX,y:_.pageY-12}:null)})});const R=q(18,43,3).map(e=>({value:e,label:`${(e%24).toString().padStart(2,"0")}:00`}));S.append("g").attr("class",a.xAxis).attr("transform",`translate(0,${m})`).call(ct(u).tickValues(R.map(e=>e.value)).tickFormat(e=>{const s=R.find(y=>y.value===e);return s?s.label:""}).tickSize(0).tickPadding(10)).select(".domain").remove();const ot=Math.max(1,Math.ceil(H.length/8)),rt=H.filter((e,s)=>s%ot===0);S.append("g").attr("class",a.yAxis).call(pt(j).tickValues(rt).tickFormat(e=>{const s=new Date(e);return`${(s.getMonth()+1).toString().padStart(2,"0")}/${s.getDate().toString().padStart(2,"0")}`}).tickSize(0).tickPadding(12)).select(".domain").remove()},[t,k,m,h,l,r,o]),n.jsxs("div",{className:a.container,children:[n.jsxs("header",{className:a.header,children:[n.jsx("span",{className:a.eyebrow,children:"the night"}),n.jsxs("h3",{className:a.title,children:[n.jsx("em",{children:"Sleep"})," pattern"]})]}),n.jsx("svg",{ref:p,width:o,height:r,className:a.chart}),i&&n.jsxs("div",{className:`${a.tooltip} ${a.visible}`,style:{left:`${i.x}px`,top:`${i.y}px`},children:[n.jsx("div",{className:a.tooltipDate,children:new Date(i.date).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),n.jsxs("div",{className:a.tooltipBody,children:[i.sleepTime&&n.jsxs("div",{className:a.tooltipRow,children:[n.jsx("em",{children:"sleep"}),n.jsx("time",{children:i.sleepTime})]}),i.wakeTime&&n.jsxs("div",{className:a.tooltipRow,children:[n.jsx("em",{children:"wake"}),n.jsx("time",{children:i.wakeTime})]}),i.duration!==null&&n.jsxs("div",{className:`${a.tooltipRow} ${a.tooltipTotal}`,children:[n.jsx("em",{children:"total"}),n.jsx("time",{children:Lt(i.duration)})]})]})]})]})};at.__docgenInfo={description:"",methods:[],displayName:"SleepChart",props:{sleepData:{required:!0,tsType:{name:"Array",elements:[{name:"SleepData"}],raw:"SleepData[]"},description:""},width:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"800",computed:!1}},height:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"400",computed:!1}},onDateClick:{required:!1,tsType:{name:"signature",type:"function",raw:"(date: string) => void",signature:{arguments:[{type:{name:"string"},name:"date"}],return:{name:"void"}}},description:""}}};const Ft={title:"Organisms/Charts/SleepChart",component:at,parameters:{layout:"centered"},argTypes:{width:{control:{type:"number",min:400,max:1200,step:50}},height:{control:{type:"number",min:200,max:600,step:50}},onDateClick:{action:"dateClicked"}}},A=t=>{const o=[],r=new Date;for(let l=t-1;l>=0;l--){const p=new Date(r);p.setDate(p.getDate()-l),o.push(p.toISOString().split("T")[0])}return o},w={args:{sleepData:A(7).map(t=>{const o=Math.floor(Math.random()*3)+22,r=Math.floor(Math.random()*3)+6;return{date:t,sleep_time:`${o%24}:${Math.floor(Math.random()*60).toString().padStart(2,"0")}`,wake_hour:`${r}:${Math.floor(Math.random()*60).toString().padStart(2,"0")}`}}),width:800,height:400}},v={args:{sleepData:A(30).map(t=>({date:t,sleep_time:`${(Math.floor(Math.random()*3)+22)%24}:${Math.floor(Math.random()*60).toString().padStart(2,"0")}`,wake_hour:`${Math.floor(Math.random()*2)+7}:${Math.floor(Math.random()*60).toString().padStart(2,"0")}`})),width:900,height:400}},b={args:{sleepData:A(14).map((t,o)=>{const r=o%7===5||o%7===6,l=r?Math.floor(Math.random()*4)+24:Math.floor(Math.random()*2)+22,p=r?Math.floor(Math.random()*3)+9:Math.floor(Math.random()*2)+6;return{date:t,sleep_time:`${l%24}:${Math.floor(Math.random()*60).toString().padStart(2,"0")}`,wake_hour:`${p}:${Math.floor(Math.random()*60).toString().padStart(2,"0")}`}}),width:850,height:400}},D={args:{sleepData:A(14).map((t,o)=>({date:t,sleep_time:o%3===0?null:`${(Math.floor(Math.random()*3)+22)%24}:30`,wake_hour:o%3===0?null:`${Math.floor(Math.random()*2)+7}:00`})),width:800,height:400}},T={args:{sleepData:[],width:800,height:400}};var V,P,z;w.parameters={...w.parameters,docs:{...(V=w.parameters)==null?void 0:V.docs,source:{originalSource:`{
|
|
2
|
-
args: {
|
|
3
|
-
sleepData: generateDateRange(7).map(date => {
|
|
4
|
-
const bedHour = Math.floor(Math.random() * 3) + 22;
|
|
5
|
-
const wakeHour = Math.floor(Math.random() * 3) + 6;
|
|
6
|
-
return {
|
|
7
|
-
date,
|
|
8
|
-
sleep_time: \`\${bedHour % 24}:\${Math.floor(Math.random() * 60).toString().padStart(2, '0')}\`,
|
|
9
|
-
wake_hour: \`\${wakeHour}:\${Math.floor(Math.random() * 60).toString().padStart(2, '0')}\`
|
|
10
|
-
};
|
|
11
|
-
}),
|
|
12
|
-
width: 800,
|
|
13
|
-
height: 400
|
|
14
|
-
}
|
|
15
|
-
}`,...(z=(P=w.parameters)==null?void 0:P.docs)==null?void 0:z.source}}};var F,X,Y;v.parameters={...v.parameters,docs:{...(F=v.parameters)==null?void 0:F.docs,source:{originalSource:`{
|
|
16
|
-
args: {
|
|
17
|
-
sleepData: generateDateRange(30).map(date => ({
|
|
18
|
-
date,
|
|
19
|
-
sleep_time: \`\${(Math.floor(Math.random() * 3) + 22) % 24}:\${Math.floor(Math.random() * 60).toString().padStart(2, '0')}\`,
|
|
20
|
-
wake_hour: \`\${Math.floor(Math.random() * 2) + 7}:\${Math.floor(Math.random() * 60).toString().padStart(2, '0')}\`
|
|
21
|
-
})),
|
|
22
|
-
width: 900,
|
|
23
|
-
height: 400
|
|
24
|
-
}
|
|
25
|
-
}`,...(Y=(X=v.parameters)==null?void 0:X.docs)==null?void 0:Y.source}}};var C,G,Q;b.parameters={...b.parameters,docs:{...(C=b.parameters)==null?void 0:C.docs,source:{originalSource:`{
|
|
26
|
-
args: {
|
|
27
|
-
sleepData: generateDateRange(14).map((date, i) => {
|
|
28
|
-
// Simulate irregular sleep pattern
|
|
29
|
-
const isWeekend = i % 7 === 5 || i % 7 === 6;
|
|
30
|
-
const bedHour = isWeekend ? Math.floor(Math.random() * 4) + 24 : Math.floor(Math.random() * 2) + 22;
|
|
31
|
-
const wakeHour = isWeekend ? Math.floor(Math.random() * 3) + 9 : Math.floor(Math.random() * 2) + 6;
|
|
32
|
-
return {
|
|
33
|
-
date,
|
|
34
|
-
sleep_time: \`\${bedHour % 24}:\${Math.floor(Math.random() * 60).toString().padStart(2, '0')}\`,
|
|
35
|
-
wake_hour: \`\${wakeHour}:\${Math.floor(Math.random() * 60).toString().padStart(2, '0')}\`
|
|
36
|
-
};
|
|
37
|
-
}),
|
|
38
|
-
width: 850,
|
|
39
|
-
height: 400
|
|
40
|
-
}
|
|
41
|
-
}`,...(Q=(G=b.parameters)==null?void 0:G.docs)==null?void 0:Q.source}}};var U,J,K;D.parameters={...D.parameters,docs:{...(U=D.parameters)==null?void 0:U.docs,source:{originalSource:`{
|
|
42
|
-
args: {
|
|
43
|
-
sleepData: generateDateRange(14).map((date, i) => ({
|
|
44
|
-
date,
|
|
45
|
-
// Some days have missing data
|
|
46
|
-
sleep_time: i % 3 === 0 ? null : \`\${(Math.floor(Math.random() * 3) + 22) % 24}:30\`,
|
|
47
|
-
wake_hour: i % 3 === 0 ? null : \`\${Math.floor(Math.random() * 2) + 7}:00\`
|
|
48
|
-
})),
|
|
49
|
-
width: 800,
|
|
50
|
-
height: 400
|
|
51
|
-
}
|
|
52
|
-
}`,...(K=(J=D.parameters)==null?void 0:J.docs)==null?void 0:K.source}}};var Z,tt,et;T.parameters={...T.parameters,docs:{...(Z=T.parameters)==null?void 0:Z.docs,source:{originalSource:`{
|
|
53
|
-
args: {
|
|
54
|
-
sleepData: [],
|
|
55
|
-
width: 800,
|
|
56
|
-
height: 400
|
|
57
|
-
}
|
|
58
|
-
}`,...(et=(tt=T.parameters)==null?void 0:tt.docs)==null?void 0:et.source}}};const Xt=["WeeklySleep","MonthlySleep","IrregularSleep","MissingSleepData","EmptyState"];export{T as EmptyState,b as IrregularSleep,D as MissingSleepData,v as MonthlySleep,w as WeeklySleep,Xt as __namedExportsOrder,Ft as default};
|