efficient-shell 13.15.0 → 13.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/dist/Browser-547OGMQH.js +44 -0
- package/dist/Calculator-4UBMDAJO.js +29 -0
- package/dist/CurrencyConverter-H3HHXXKT.js +21 -0
- package/dist/{Files-EN4DDZYV.js → Files-GPPTZPDS.js} +80 -80
- package/dist/Notepad-GAZ7CZQB.js +24 -0
- package/dist/PdfViewer-EELX35ZI.js +1 -0
- package/dist/PomodoroTimer-JVCYYGRD.js +91 -0
- package/dist/{Preview-OSQHIS3Z.js → Preview-GSD54EUE.js} +33 -33
- package/dist/Sidebar-UCCVJFSY.js +44 -0
- package/dist/{Stock-2P4NWUNB.js → Stock-S266KGAF.js} +4 -4
- package/dist/{Weather-7LIQ4POB.js → Weather-TE4TTTQA.js} +22 -22
- package/dist/{WorldClock-KHBYIJQZ.js → WorldClock-5TPBHBYA.js} +7 -7
- package/dist/ai/index.js +118 -118
- package/dist/apps/ImageAnnotator.js +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/charts/FunnelChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RadialBarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/{chunk-JNSRDEB6.js → chunk-2J3C2RR4.js} +10 -10
- package/dist/{chunk-D3T3JCUC.js → chunk-34HRPEQD.js} +1 -1
- package/dist/{chunk-PT4GMPUB.js → chunk-3SIRRK3F.js} +3 -3
- package/dist/{chunk-OWAYSIQH.js → chunk-42DF7CDB.js} +5 -5
- package/dist/{chunk-4OBSVO6U.js → chunk-4G7PJ325.js} +1 -1
- package/dist/{chunk-3OUG6QAD.js → chunk-5EHIWKUZ.js} +1 -1
- package/dist/chunk-5URXJCNC.js +2 -0
- package/dist/{chunk-OEPQIIYL.js → chunk-63E4ZZYI.js} +1 -1
- package/dist/{chunk-CKTFXTJL.js → chunk-6OCA7RKQ.js} +1 -1
- package/dist/{chunk-HVHIXX6O.js → chunk-6OGX7V7L.js} +10 -10
- package/dist/{chunk-WP43XYL6.js → chunk-6QH7I2V5.js} +2 -2
- package/dist/{chunk-G53Y6EPJ.js → chunk-7CBWSLCW.js} +13 -13
- package/dist/{chunk-DVVB2CY5.js → chunk-7I5RJPY7.js} +1 -1
- package/dist/{chunk-22N3KA7A.js → chunk-7IXU4YT4.js} +4 -4
- package/dist/{chunk-VYHVIKP6.js → chunk-7SVSHJOO.js} +10 -10
- package/dist/{chunk-XEPA5J6K.js → chunk-A7VNKVZO.js} +4 -4
- package/dist/{chunk-I6JTDAOB.js → chunk-BNPWUCZX.js} +1 -1
- package/dist/{chunk-M5K4AX4E.js → chunk-BUFAJJDZ.js} +1 -1
- package/dist/{chunk-WJ7U6TGK.js → chunk-BVX7LUAW.js} +4 -4
- package/dist/chunk-BWQHABH7.js +4 -0
- package/dist/{chunk-G4D2WM3J.js → chunk-BZRFD4DK.js} +3 -3
- package/dist/{chunk-U6DRRCCG.js → chunk-C5OPAULN.js} +1 -1
- package/dist/{chunk-MEF4JVXP.js → chunk-CCLK2RPQ.js} +14 -14
- package/dist/{chunk-IJNQ2BUY.js → chunk-CILE3ZCC.js} +2 -2
- package/dist/{chunk-KC3EX26K.js → chunk-DPFEQQQU.js} +1 -1
- package/dist/{chunk-ZYU5HAIC.js → chunk-E7BQZL7X.js} +1 -1
- package/dist/{chunk-XHD6Q6JV.js → chunk-EFO72DEI.js} +1 -1
- package/dist/{chunk-YM2Z4LZ2.js → chunk-EFVQQF6F.js} +17 -17
- package/dist/{chunk-GO2TZ35U.js → chunk-EJOKROMB.js} +1 -1
- package/dist/{chunk-4IYHQNKZ.js → chunk-ENDYHUUR.js} +1 -1
- package/dist/{chunk-4F3SUYN5.js → chunk-ETQ45TBW.js} +1 -1
- package/dist/chunk-EX3DARI3.js +7 -0
- package/dist/{chunk-JPCPO4MX.js → chunk-EZYXY67W.js} +8 -8
- package/dist/chunk-F2RAIGCG.js +6 -0
- package/dist/{chunk-ZDMZM7HD.js → chunk-FBZUEZK7.js} +2 -2
- package/dist/{chunk-GURY4WS5.js → chunk-FFRJ6QZK.js} +1 -1
- package/dist/{chunk-F5B5WOQ7.js → chunk-FKMARSJZ.js} +2 -2
- package/dist/chunk-FMLUQCFB.js +2 -0
- package/dist/chunk-FRTDUHQF.js +1 -0
- package/dist/{chunk-AWWNMSDN.js → chunk-FXSGIT53.js} +10 -10
- package/dist/{chunk-YMHCLK3F.js → chunk-FZYUTZEV.js} +10 -10
- package/dist/chunk-G2JPTPRS.js +13 -0
- package/dist/{chunk-YDFDTRZF.js → chunk-G7SILKUY.js} +5 -5
- package/dist/{chunk-DEYVAMJQ.js → chunk-GEITUFYK.js} +13 -13
- package/dist/{chunk-GSLZ46DJ.js → chunk-GMLOMLCS.js} +13 -13
- package/dist/{chunk-6LS6Q77E.js → chunk-GUSENWAH.js} +1 -1
- package/dist/{chunk-YDQBELHJ.js → chunk-H5PSCQJ2.js} +6 -6
- package/dist/{chunk-J6QC45OS.js → chunk-HC5KQZFG.js} +5 -5
- package/dist/{chunk-LXPDURUL.js → chunk-HMOKKMIV.js} +2 -2
- package/dist/{chunk-RFR2K7JO.js → chunk-HPHDLN6E.js} +2 -2
- package/dist/{chunk-I5EVMLPB.js → chunk-IJ4JX6WP.js} +4 -4
- package/dist/{chunk-UGEX7SVM.js → chunk-IUQJGFEO.js} +8 -8
- package/dist/{chunk-5HBAJ2UA.js → chunk-J4CVYOY3.js} +13 -13
- package/dist/{chunk-CUZQVBPC.js → chunk-JDLJ7DHV.js} +1 -1
- package/dist/chunk-JPE4TYRQ.js +14 -0
- package/dist/{chunk-4Q2CZ4US.js → chunk-JPSWWIBW.js} +6 -6
- package/dist/{chunk-XOQGBU25.js → chunk-K2FVP22A.js} +1 -1
- package/dist/{chunk-7RGHV3J5.js → chunk-KGAYYSFE.js} +6 -6
- package/dist/{chunk-KLUCEASW.js → chunk-KQCJWK55.js} +6 -6
- package/dist/{chunk-OLSA36VX.js → chunk-KSK4VZIM.js} +6 -6
- package/dist/{chunk-ZNKZ6J65.js → chunk-L4ZQY4ZG.js} +3 -3
- package/dist/chunk-LADP6AJY.js +9 -0
- package/dist/{chunk-W6NGPSMM.js → chunk-LGGATDPH.js} +17 -17
- package/dist/{chunk-PALWXHBQ.js → chunk-LKAGXURQ.js} +20 -20
- package/dist/chunk-LNCAIY64.js +15 -0
- package/dist/chunk-LQCNIQ3I.js +8 -0
- package/dist/{chunk-QQK7HKNK.js → chunk-LUCO5PS6.js} +1 -1
- package/dist/chunk-M6UKCZHT.js +2 -0
- package/dist/{chunk-QVQO3EFL.js → chunk-MHQW6NAE.js} +11 -11
- package/dist/{chunk-VCR3RADH.js → chunk-MVOYVN3S.js} +1 -1
- package/dist/{chunk-N2FX4O3H.js → chunk-MZ3JADHG.js} +1 -1
- package/dist/{chunk-SV5RRBVA.js → chunk-NWS5G7FE.js} +1 -1
- package/dist/{chunk-UXGNF3OG.js → chunk-OF5X4HKC.js} +1 -1
- package/dist/{chunk-JFRBUVHX.js → chunk-OIEFMLYI.js} +3 -3
- package/dist/{chunk-A4WNUFLT.js → chunk-OOGUQEPT.js} +1 -1
- package/dist/chunk-OUYGLDQN.js +24 -0
- package/dist/chunk-OXWBSZL2.js +23 -0
- package/dist/{chunk-NISLELJF.js → chunk-P4J26R5P.js} +1 -1
- package/dist/{chunk-TTLVTJR6.js → chunk-POQUUMRS.js} +2 -2
- package/dist/{chunk-2YK6ZB7C.js → chunk-PPLPDP6D.js} +1 -1
- package/dist/chunk-PTYB2GGI.js +1 -0
- package/dist/{chunk-QIPO4EVJ.js → chunk-Q4MOT7TY.js} +1 -1
- package/dist/{chunk-7TJZ5AJE.js → chunk-QNXTVDIC.js} +6 -6
- package/dist/{chunk-7JG64RQW.js → chunk-QSJMLHBD.js} +1 -1
- package/dist/{chunk-7NO4IENQ.js → chunk-R5WBDXI2.js} +1 -1
- package/dist/{chunk-NYKOATR5.js → chunk-RDETBXMP.js} +1 -1
- package/dist/{chunk-I6QVXM2M.js → chunk-RDVC32EV.js} +15 -15
- package/dist/chunk-RJVIKGHJ.js +4 -0
- package/dist/{chunk-ZOCE74ED.js → chunk-SF4IIV5Z.js} +2 -2
- package/dist/{chunk-RZ3OQFOD.js → chunk-SHHRC5XK.js} +8 -8
- package/dist/{chunk-OBZZLLMQ.js → chunk-SLEA47VA.js} +1 -1
- package/dist/chunk-SM3N5UJ2.js +69 -0
- package/dist/{chunk-F6UJLCMI.js → chunk-SUSJFGXN.js} +9 -9
- package/dist/{chunk-FTKLODQK.js → chunk-SXHV5OLA.js} +1 -1
- package/dist/{chunk-65FZQ572.js → chunk-SZFULV7I.js} +6 -6
- package/dist/{chunk-HZ7TUMNL.js → chunk-TB2ARUE2.js} +1 -1
- package/dist/{chunk-G67CJAQ2.js → chunk-TD3ZQD5R.js} +1 -1
- package/dist/chunk-THAPVKEJ.js +15 -0
- package/dist/{chunk-GKNF53YM.js → chunk-TKCCJRPE.js} +1 -1
- package/dist/{chunk-HNIIDDLJ.js → chunk-TNALBYLY.js} +1 -1
- package/dist/{chunk-6CDWPEND.js → chunk-TPKNHQIE.js} +8 -8
- package/dist/{chunk-42RCQEEJ.js → chunk-U5RG34NE.js} +11 -11
- package/dist/{chunk-VADWTS7H.js → chunk-UFWBPTCM.js} +5 -5
- package/dist/{chunk-23LK4PLJ.js → chunk-UGEA3C5C.js} +5 -5
- package/dist/{chunk-EVYD6UFQ.js → chunk-UTISUEO4.js} +2 -2
- package/dist/chunk-UTQN5AIO.js +6 -0
- package/dist/chunk-UVHXVSB2.js +1 -0
- package/dist/{chunk-QMBMK6PP.js → chunk-VKZC3NPM.js} +2 -2
- package/dist/chunk-VLX7L2AM.js +1 -0
- package/dist/{chunk-UZFFSZFI.js → chunk-VQBKRBBR.js} +1 -1
- package/dist/{chunk-GLUJS42B.js → chunk-VY3UA6AR.js} +1 -1
- package/dist/chunk-WCCS4VFE.js +1 -0
- package/dist/{chunk-P5C7DI5A.js → chunk-WPGSU4QG.js} +5 -5
- package/dist/{chunk-WLG7BE55.js → chunk-WRV6QKJN.js} +1 -1
- package/dist/{chunk-LHHJHTWP.js → chunk-WZWSFYXJ.js} +1 -1
- package/dist/{chunk-S6YEPA4I.js → chunk-X4E4RPFE.js} +5 -5
- package/dist/{chunk-M7W63T6H.js → chunk-XAT2MKNU.js} +8 -8
- package/dist/chunk-XD3M5ZXM.js +7 -0
- package/dist/{chunk-QOYKBINM.js → chunk-XQVGBVHC.js} +1 -1
- package/dist/{chunk-CGKY4ZRA.js → chunk-XU4I2DMR.js} +2 -2
- package/dist/{chunk-E6FDUFPH.js → chunk-XVMCSUAV.js} +1 -1
- package/dist/chunk-XXTAMF3O.js +28 -0
- package/dist/{chunk-6HYO2W3O.js → chunk-YCXQDUTW.js} +5 -5
- package/dist/{chunk-WU2ZA6J2.js → chunk-YDJ5IZOU.js} +1 -1
- package/dist/{chunk-LLYMOV4S.js → chunk-YQ5JHHLE.js} +1 -1
- package/dist/{chunk-BWLC56GZ.js → chunk-YT5HMLC7.js} +1 -1
- package/dist/{chunk-G4PPHQ23.js → chunk-YWMCW5BN.js} +1 -1
- package/dist/{chunk-WF4A2HSB.js → chunk-ZCN5BU4U.js} +1 -1
- package/dist/{chunk-HY6CBG4M.js → chunk-ZDFMYAQB.js} +1 -1
- package/dist/chunk-ZDXRSY2Y.js +1 -0
- package/dist/chunk-ZI2FDUYJ.js +99 -0
- package/dist/chunk-ZISKHQZY.js +3 -0
- package/dist/{chunk-DVHRL3G6.js → chunk-ZVDYRXNP.js} +6 -6
- package/dist/{chunk-3DWVSQIJ.js → chunk-ZYKY4Z7R.js} +1 -1
- package/dist/data/DataTable.js +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/Gantt.js +1 -1
- package/dist/data/Kanban.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/data/statusColumn.js +1 -1
- package/dist/data/useColumnConfig.js +1 -1
- package/dist/data/useSort.js +1 -1
- package/dist/forms/AlignmentGrid.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Button.js +1 -1
- package/dist/forms/Calendar.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/IconButton.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/NumericKeypad.js +1 -1
- package/dist/forms/PictureTiles.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/Segmented.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/UnitMenu.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/dropdownPosition.js +1 -1
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useTheme.js +1 -1
- package/dist/icons/brands.node.js +1 -1
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/payment.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.d.ts +4 -40
- package/dist/index.js +335 -335
- package/dist/map/index.js +7 -7
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/FitFrame.d.ts +46 -0
- package/dist/shell/FitFrame.js +2 -0
- package/dist/shell/FloatingBar.js +1 -1
- package/dist/shell/GlobalSearch.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/IconRail.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/ItemCount.js +1 -1
- package/dist/shell/Kbd.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/MilestoneTimeline.js +1 -1
- package/dist/shell/Popover.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/ResizeHandle.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/ShellPrefs.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/StatusBadge.js +1 -1
- package/dist/shell/Tabs.js +1 -1
- package/dist/shell/TimelineTrack.js +1 -1
- package/dist/shell/Tooltip.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -1
- package/dist/Browser-KHMTFVKZ.js +0 -44
- package/dist/Calculator-OKVS4UOJ.js +0 -29
- package/dist/CurrencyConverter-ZA2NGJWI.js +0 -21
- package/dist/Notepad-PHQNEUKW.js +0 -24
- package/dist/PdfViewer-PFQGQRQX.js +0 -1
- package/dist/PomodoroTimer-PW7BRZUJ.js +0 -91
- package/dist/Sidebar-GYGYAXS2.js +0 -44
- package/dist/chunk-3DSGJIC7.js +0 -7
- package/dist/chunk-3J4SFHC7.js +0 -15
- package/dist/chunk-3QNZ7YGZ.js +0 -99
- package/dist/chunk-47UTEV3P.js +0 -23
- package/dist/chunk-6QKTQOEV.js +0 -69
- package/dist/chunk-7KWYVQMX.js +0 -2
- package/dist/chunk-7QSDPSXP.js +0 -1
- package/dist/chunk-AOLJKOO6.js +0 -28
- package/dist/chunk-ASDYAASN.js +0 -3
- package/dist/chunk-CBUBDXJ2.js +0 -1
- package/dist/chunk-D65T4H6J.js +0 -1
- package/dist/chunk-DQTYV6AC.js +0 -9
- package/dist/chunk-EV5BEEVO.js +0 -1
- package/dist/chunk-FHNQC2MA.js +0 -1
- package/dist/chunk-GOAFMGUI.js +0 -15
- package/dist/chunk-HNPJ3V3I.js +0 -6
- package/dist/chunk-KXPXLUNM.js +0 -4
- package/dist/chunk-MHCNQKEK.js +0 -4
- package/dist/chunk-O2PVZC5D.js +0 -8
- package/dist/chunk-QTVE3OSD.js +0 -7
- package/dist/chunk-RDGXSAOD.js +0 -2
- package/dist/chunk-SOZCWT6I.js +0 -6
- package/dist/chunk-WWCAVO3R.js +0 -14
- package/dist/chunk-XMFJDT6Y.js +0 -13
- package/dist/chunk-YGKLZBWC.js +0 -24
- /package/dist/{chunk-HOHHRNCB.js → chunk-FRCTA5FS.js} +0 -0
- /package/dist/{chunk-VG6BT2UG.js → chunk-YRQ5WGOM.js} +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{Segmented as e}from"./chunk-
|
|
2
|
-
return b("div",{className:`flex min-h-0 flex-col ${
|
|
1
|
+
import{Segmented as e}from"./chunk-TNALBYLY.js";import{calendarNames as t,formatDate as n}from"./chunk-NHKT5IH6.js";import{toDateKey as r,fromDateKey as a,DAY_MS as o}from"./chunk-JRQMX4PK.js";import{LoadingSpinner as i}from"./chunk-R2VKEMZH.js";import{useBrowserLayoutEffect as s}from"./chunk-ZDXRSY2Y.js";import{useShellStrings as l,useShellLocale as d}from"./chunk-IUVGHHR3.js";import{useState as c,useRef as u,useId as h,useMemo as m}from"react";import{jsx as f,Fragment as p,jsxs as b}from"react/jsx-runtime";var g={day:32,week:16,month:4},y=44;function w(e){const t="string"==typeof e?a(e.slice(0,10)):null;return t?Math.round(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())/o):null}function x(e){return new Date(e*o).toISOString().slice(0,10)}function v(e){return new Date(e*o)}function k(e){return((e+3)%7+7)%7}function N(e){return e-k(e)}function D(e){const t=v(e);return Math.round(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1)/o)}function M(e){const t=v(e);return Math.round(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,1)/o)}function C(e){return Math.round(Date.UTC(v(e).getUTCFullYear(),0,1)/o)}function $(e){return Math.round(Date.UTC(v(e).getUTCFullYear()+1,0,1)/o)}var T={day:3,week:7,month:14},U={day:28,week:84,month:182};function j(e,t,n){return(e-t.startDay)*g[n]}function P(e,t,n){return j(e,t,n)+g[n]/2}function S(e,t,n,r){const a=[];let o=e.startDay;if(n(o)!==o){const n=Math.min(r(o),e.endDay);a.push({startDay:o,endDay:n,x:j(o,e,t),width:(n-o)*g[t]}),o=n}for(;o<e.endDay;){const n=Math.min(r(o),e.endDay);a.push({startDay:o,endDay:n,x:j(o,e,t),width:(n-o)*g[t]}),o=n}return a}function X(e,t,n,r){if(null===e&&null===t)return{kind:"none"};if(null===e)return{kind:"milestone",day:t,cx:j(t,n,r)+g[r]/2};const a=null===t?e:Math.min(e,t),o=null===t?e:Math.max(e,t);return{kind:"bar",startDay:a,endDay:o,x:j(a,n,r),width:(o-a+1)*g[r]}}function R(e){return"bar"===e.kind?{inX:e.x,outX:e.x+e.width}:"milestone"===e.kind?{inX:e.cx-9,outX:e.cx+9}:null}function Y(e,t,n,r,a=44,o=10){let i;if(n-e>=2*o){const a=e+o;i=[[e,t],[a,t],[a,r],[n,r]]}else{const s=t+(r>=t?1:-1)*a/2,l=e+o,d=n-o;i=[[e,t],[l,t],[l,s],[d,s],[d,r],[n,r]]}return i.filter((e,t)=>0===t||e[0]!==i[t-1][0]||e[1]!==i[t-1][1])}function I(e){return e.map(([e,t],n)=>`${0===n?"M":"L"}${e} ${t}`).join(" ")}function z(e,t,n=5){return`${e},${t} ${e-n},${t-n} ${e-n},${t+n}`}function H(e,t,n,r){if("move"===e)return{start:null===t?null:t+r,end:null===n?null:n+r};if("start"===e){if(null===t)return{start:t,end:n};const e=t+r;return{start:null===n?e:Math.min(e,n),end:n}}if(null===n)return{start:t,end:n};const a=n+r;return{start:t,end:null===t?a:Math.max(a,t)}}var F=24;function L({rows:a,groups:o=[],dependencies:j=[],scale:L,onScaleChange:A,onRowClick:K,onRowChange:Q,readOnly:W=!1,today:E,isLoading:O=!1,emptyState:V,labelHeader:Z,labelWidth:B=240,className:G=""}){const J=l().gantt,q=d(),_=t(q),ee=!!Q&&!W,[te,ne]=c(null),re=u(!1),ae=u(null),oe=h(),ie=w(E)??w(r(/* @__PURE__ */new Date)),se=m(()=>{const e=/* @__PURE__ */new Map;for(const t of a){const n=w(t.start),r=w(t.end);e.set(t.id,te&&te.id===t.id?H(te.mode,te.start,te.end,te.delta):{start:n,end:r})}return e},[a,te]),le=m(()=>{const e=[ie];for(const t of a){const n=w(t.start),r=w(t.end);null!==n&&e.push(n),null!==r&&e.push(r)}return function(e,t){const n=e.filter(e=>Number.isFinite(e)),r=n.length?Math.min(...n):0,a=n.length?Math.max(...n):0;let o=r-T[t],i=a+1+T[t];const s=U[t]-(i-o);return s>0&&(o-=Math.floor(s/2),i+=Math.ceil(s/2)),"week"===t?(o=N(o),i=N(i-1)+7):"month"===t&&(o=D(o),i=M(i-1)),{startDay:o,endDay:i}}(e,L)},[a,L,ie]),de=m(()=>function(e,t){return"day"===t?{major:S(e,t,D,M),minor:S(e,t,e=>e,e=>e+1)}:"week"===t?{major:S(e,t,D,M),minor:S(e,t,N,e=>N(e)+7)}:{major:S(e,t,C,$),minor:S(e,t,D,M)}}(le,L),[le,L]),ce=function(e,t){return(e.endDay-e.startDay)*g[t]}(le,L),ue=m(()=>function(e,t){const n=new Set(t.map(e=>e.id)),r=/* @__PURE__ */new Map,a=[];for(const t of e)if(null!=t.groupId&&n.has(t.groupId)){const e=r.get(t.groupId)??[];e.push(t),r.set(t.groupId,e)}else a.push(t);const o=a.map(e=>({kind:"row",row:e}));for(const e of t){o.push({kind:"group",group:e});for(const t of r.get(e.id)??[])o.push({kind:"row",row:t})}return o}(a,o),[a,o]),he=m(()=>{const e=/* @__PURE__ */new Map;return ue.forEach((t,n)=>{if("row"!==t.kind)return;const r=se.get(t.row.id);e.set(t.row.id,{shape:X(r.start,r.end,le,L),line:n})}),e},[ue,se,le,L]),me=m(()=>{const e=[];for(const t of j){const n=he.get(t.from),r=he.get(t.to);if(!n||!r)continue;const a=R(n.shape),o=R(r.shape);if(!a||!o)continue;const i=n.line*y+22,s=r.line*y+22,l=Y(a.outX,i,o.inX,s);e.push({key:`${t.from}>${t.to}`,d:I(l),head:z(o.inX,s)})}return e},[j,he]),fe=!O&&(a.length>0||o.length>0);s(()=>{const e=ae.current;if(!e)return;const t=e.clientWidth-B;e.scrollLeft=Math.max(0,P(ie,le,L)-t/4)},[L,fe]);if(O)/* @__PURE__ */return f(i,{size:"sm",padding:"p-4",label:J.loading});if(!fe)/* @__PURE__ */return f(p,{children:V??/* @__PURE__ */f("div",{className:"text-sm text-ink-faint p-4",children:J.empty})});const pe=(e,t,n)=>{Q?.(e.id,{start:null===t?null:x(t),end:null===n?null:x(n)})},be=(e,t,n)=>{if(re.current=!1,ee&&0===e.button){e.stopPropagation();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}ne({id:t.id,mode:n,originX:e.clientX,start:w(t.start),end:w(t.end),delta:0})}},ge=e=>{if(!te)return;const t=function(e,t){const n=Math.round(e/g[t]);return 0===n?0:n}(e.clientX-te.originX,L);t!==te.delta&&ne({...te,delta:t})},ye=e=>{if(te){if(0!==te.delta){const t=H(te.mode,te.start,te.end,te.delta);re.current=!0,pe(e,t.start,t.end)}ne(null)}},we=(e,t)=>{if("Enter"===e.key||" "===e.key)return e.preventDefault(),void K?.(t);if(!ee||"ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const n="ArrowRight"===e.key?1:-1,r=H(e.shiftKey?"end":"move",w(t.start),w(t.end),n);pe(t,r.start,r.end)},xe=e=>{re.current?re.current=!1:K?.(e)},ve=e=>n(x(e),{locale:q}),ke=(e,t)=>{const n=v(e.startDay),r=n.getUTCFullYear(),a=n.getUTCMonth();return"major"===t?"month"===L?String(r):"week"===L?_.shortMonthYear(r,a):_.monthYear(r,a):"month"===L?_.monthsShort[a]:String(n.getUTCDate())},Ne=ue.length*y,De=P(ie,le,L),Me=De>=0&&De<=ce,Ce=de.minor.find(e=>e.startDay<=ie&&ie<e.endDay),$e=Ce?De-Ce.x:0,Te=!!Ce&&$e<=Ce.width/2;/* @__PURE__ */
|
|
2
|
+
return b("div",{className:`flex min-h-0 flex-col ${G}`,children:[
|
|
3
3
|
/* @__PURE__ */b("div",{className:"flex items-center justify-end gap-2 pb-2",children:[
|
|
4
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>{const e=ae.current;if(!e)return;const t=e.clientWidth-
|
|
5
|
-
/* @__PURE__ */f("div",{ref:ae,"data-gantt-scroller":"",className:"relative min-h-0 flex-1 overflow-auto grid-scroll rounded-(--radius-card) border border-line bg-surface",children:/* @__PURE__ */b("div",{className:"relative",style:{width:
|
|
4
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>{const e=ae.current;if(!e)return;const t=e.clientWidth-B;e.scrollTo?.({left:Math.max(0,P(ie,le,L)-t/4),behavior:"smooth"})},className:"min-h-8 rounded-(--radius-control) border border-line bg-surface px-3 text-xs font-medium text-ink hover:bg-row-hover",children:J.today}),A&&/* @__PURE__ */f(e,{size:"sm",label:J.scale,value:L,onChange:A,options:[{value:"day",label:J.day},{value:"week",label:J.week},{value:"month",label:J.month}]})]}),
|
|
5
|
+
/* @__PURE__ */f("div",{ref:ae,"data-gantt-scroller":"",className:"relative min-h-0 flex-1 overflow-auto grid-scroll rounded-(--radius-card) border border-line bg-surface",children:/* @__PURE__ */b("div",{className:"relative",style:{width:B+ce,minHeight:48+Ne},children:[
|
|
6
6
|
/* @__PURE__ */b("div",{className:"sticky top-0 z-20 flex border-b border-line bg-surface",style:{height:48},children:[
|
|
7
|
-
/* @__PURE__ */f("div",{className:"sticky left-0 z-10 flex shrink-0 items-end border-r border-line bg-surface px-3 pb-1 text-xs font-medium text-ink-muted",style:{width:
|
|
8
|
-
/* @__PURE__ */b("div",{className:"relative shrink-0",style:{width:ce},"aria-hidden":!0,children:[de.major.map(e=>/* @__PURE__ */f("div",{className:"absolute top-0 border-l border-line-subtle text-xs font-medium leading-6 text-ink",style:{left:e.x,width:e.width,height:F},children:/* @__PURE__ */f("span",{className:"sticky inline-block whitespace-nowrap px-2",style:{left:
|
|
7
|
+
/* @__PURE__ */f("div",{className:"sticky left-0 z-10 flex shrink-0 items-end border-r border-line bg-surface px-3 pb-1 text-xs font-medium text-ink-muted",style:{width:B},children:Z??J.task}),
|
|
8
|
+
/* @__PURE__ */b("div",{className:"relative shrink-0",style:{width:ce},"aria-hidden":!0,children:[de.major.map(e=>/* @__PURE__ */f("div",{className:"absolute top-0 border-l border-line-subtle text-xs font-medium leading-6 text-ink",style:{left:e.x,width:e.width,height:F},children:/* @__PURE__ */f("span",{className:"sticky inline-block whitespace-nowrap px-2",style:{left:B},children:ke(e,"major")})},`M${e.startDay}`)),de.minor.map(e=>/* @__PURE__ */f("div",{"data-gantt-tick":"minor",className:`absolute truncate border-l border-line-subtle text-2xs leading-6 text-ink-faint ${"day"===L?"text-center":"px-1"} ${e.startDay===ie&&"day"===L?"font-semibold text-danger":""}`,style:{left:e.x,width:e.width,top:F,height:F},children:ke(e,"minor")},`m${e.startDay}`)),Me&&Ce&&"day"!==L&&
|
|
9
9
|
/* @__PURE__ */b("div",{className:"pointer-events-none absolute flex items-center text-2xs "+(Te?"":"flex-row-reverse"),style:{left:Te?Ce.x:De-(Ce.width-$e),width:2*(Te?$e:Ce.width-$e),top:F,height:F},children:[Te&&/* @__PURE__ */f("span",{className:"invisible shrink-0 whitespace-nowrap px-1",children:ke(Ce,"minor")}),
|
|
10
10
|
/* @__PURE__ */f("span",{className:"min-w-0 flex-1"}),
|
|
11
|
-
/* @__PURE__ */f("span",{"data-gantt-today-label":"",className:"shrink-0 whitespace-nowrap rounded-(--radius-control) bg-danger px-1 font-medium leading-4 text-on-accent",children:
|
|
11
|
+
/* @__PURE__ */f("span",{"data-gantt-today-label":"",className:"shrink-0 whitespace-nowrap rounded-(--radius-control) bg-danger px-1 font-medium leading-4 text-on-accent",children:J.today}),
|
|
12
12
|
/* @__PURE__ */f("span",{className:"min-w-0 flex-1"}),Te&&/* @__PURE__ */f("span",{className:"invisible min-w-0 shrink overflow-hidden",children:/* @__PURE__ */f("span",{className:"inline-block whitespace-nowrap px-1",children:ke(Ce,"minor")})})]})]})]}),
|
|
13
|
-
/* @__PURE__ */b("div",{className:"pointer-events-none absolute",style:{left:
|
|
13
|
+
/* @__PURE__ */b("div",{className:"pointer-events-none absolute",style:{left:B,top:48,width:ce,height:Ne},"aria-hidden":!0,children:["day"===L&&de.minor.filter(e=>k(e.startDay)>=5).map(e=>/* @__PURE__ */f("div",{className:"absolute inset-y-0 bg-surface-sunken",style:{left:e.x,width:e.width}},`w${e.startDay}`)),de.minor.map(e=>/* @__PURE__ */f("div",{className:"absolute inset-y-0 w-px bg-line-subtle",style:{left:e.x}},`g${e.startDay}`))]}),
|
|
14
14
|
/* @__PURE__ */f("div",{role:"list",children:ue.map(e=>{if("group"===e.kind)/* @__PURE__ */
|
|
15
15
|
return b("div",{role:"listitem",className:"flex",style:{height:y},children:[
|
|
16
|
-
/* @__PURE__ */f("div",{className:"sticky left-0 z-10 flex shrink-0 items-center border-r border-b border-line bg-surface-sunken px-3 text-sm font-semibold text-ink",style:{width:
|
|
17
|
-
/* @__PURE__ */f("div",{className:"shrink-0 border-b border-line-subtle",style:{width:ce}})]},`g:${e.group.id}`);const t=e.row,n=he.get(t.id).shape,r=function(e,t){return e.done?{className:"border text-ink-muted",style:{background:"var(--status-neutral-soft)",borderColor:"var(--status-neutral-line)"}}:e.tone?{className:"text-on-accent",style:{background:`var(--status-${e.tone}-solid)`}}:{className:t?"bg-identity-3":"bg-accent-fill text-on-accent"}}(t,"milestone"===n.kind),a=te?.id===t.id,o=t.done?`, ${
|
|
16
|
+
/* @__PURE__ */f("div",{className:"sticky left-0 z-10 flex shrink-0 items-center border-r border-b border-line bg-surface-sunken px-3 text-sm font-semibold text-ink",style:{width:B},children:/* @__PURE__ */f("span",{className:"truncate",children:e.group.label})}),
|
|
17
|
+
/* @__PURE__ */f("div",{className:"shrink-0 border-b border-line-subtle",style:{width:ce}})]},`g:${e.group.id}`);const t=e.row,n=he.get(t.id).shape,r=function(e,t){return e.done?{className:"border text-ink-muted",style:{background:"var(--status-neutral-soft)",borderColor:"var(--status-neutral-line)"}}:e.tone?{className:"text-on-accent",style:{background:`var(--status-${e.tone}-solid)`}}:{className:t?"bg-identity-3":"bg-accent-fill text-on-accent"}}(t,"milestone"===n.kind),a=te?.id===t.id,o=t.done?`, ${J.done}`:"";/* @__PURE__ */
|
|
18
18
|
return b("div",{role:"listitem",className:"flex",style:{height:y},"data-gantt-row":t.id,children:[
|
|
19
|
-
/* @__PURE__ */f("div",{className:"sticky left-0 z-10 flex shrink-0 border-r border-b border-line-subtle bg-surface",style:{width:
|
|
19
|
+
/* @__PURE__ */f("div",{className:"sticky left-0 z-10 flex shrink-0 border-r border-b border-line-subtle bg-surface",style:{width:B},children:/* @__PURE__ */f("button",{type:"button",tabIndex:"none"===n.kind&&K?0:-1,onClick:()=>K?.(t),className:`flex w-full min-w-0 items-center px-3 text-left text-sm hover:bg-row-hover ${t.done?"text-ink-faint line-through":"text-ink"} ${K?"cursor-pointer":"cursor-default"}`,children:/* @__PURE__ */f("span",{className:"truncate",children:t.label})})}),
|
|
20
20
|
/* @__PURE__ */b("div",{className:"relative shrink-0 border-b border-line-subtle",style:{width:ce},children:["bar"===n.kind&&/* @__PURE__ */b(p,{children:[
|
|
21
|
-
/* @__PURE__ */f("div",{role:"button",tabIndex:0,"data-gantt-bar":t.id,"aria-label":
|
|
21
|
+
/* @__PURE__ */f("div",{role:"button",tabIndex:0,"data-gantt-bar":t.id,"aria-label":J.barName(t.label,ve(n.startDay),ve(n.endDay))+o,"aria-describedby":ee?oe:void 0,onKeyDown:e=>we(e,t),onClick:()=>xe(t),onPointerDown:e=>be(e,t,"move"),onPointerMove:ge,onPointerUp:()=>ye(t),onPointerCancel:()=>ne(null),className:`group/bar absolute rounded-(--radius-control) shadow-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] ${r.className} ${ee?a?"cursor-grabbing":"cursor-grab":K?"cursor-pointer":""} ${a?"opacity-80":""}`,style:{...r.style,left:n.x,width:n.width,top:10,height:24,touchAction:ee?"none":void 0},children:ee&&/* @__PURE__ */b(p,{children:[
|
|
22
22
|
/* @__PURE__ */f("span",{"aria-hidden":!0,"data-gantt-handle":"start",className:"absolute inset-y-0 left-0 w-2 cursor-ew-resize rounded-l-(--radius-control) group-hover/bar:bg-scrim-soft",onPointerDown:e=>be(e,t,"start")}),
|
|
23
23
|
/* @__PURE__ */f("span",{"aria-hidden":!0,"data-gantt-handle":"end",className:"absolute inset-y-0 right-0 w-2 cursor-ew-resize rounded-r-(--radius-control) group-hover/bar:bg-scrim-soft",onPointerDown:e=>be(e,t,"end")})]})}),
|
|
24
24
|
/* @__PURE__ */f("span",{"aria-hidden":!0,className:"pointer-events-none absolute whitespace-nowrap text-xs leading-none text-ink-muted",style:{left:n.x+n.width+16,top:16},children:t.label})]}),"milestone"===n.kind&&/* @__PURE__ */b(p,{children:[
|
|
25
|
-
/* @__PURE__ */f("div",{role:"button",tabIndex:0,"data-gantt-bar":t.id,"data-gantt-milestone":"","aria-label":
|
|
25
|
+
/* @__PURE__ */f("div",{role:"button",tabIndex:0,"data-gantt-bar":t.id,"data-gantt-milestone":"","aria-label":J.milestoneName(t.label,ve(n.day))+o,"aria-describedby":ee?oe:void 0,onKeyDown:e=>we(e,t),onClick:()=>xe(t),onPointerDown:e=>be(e,t,"move"),onPointerMove:ge,onPointerUp:()=>ye(t),onPointerCancel:()=>ne(null),className:`absolute rotate-45 rounded-sm shadow-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] ${r.className} ${ee?a?"cursor-grabbing":"cursor-grab":K?"cursor-pointer":""}`,style:{...r.style,left:n.cx-9/Math.SQRT2,top:22-9/Math.SQRT2,width:18/Math.SQRT2,height:18/Math.SQRT2,touchAction:ee?"none":void 0}}),
|
|
26
26
|
/* @__PURE__ */f("span",{"aria-hidden":!0,className:"pointer-events-none absolute whitespace-nowrap text-xs leading-none text-ink-muted",style:{left:n.cx+9+16,top:16},children:t.label})]})]})]},t.id)})}),
|
|
27
|
-
/* @__PURE__ */f("svg",{className:"pointer-events-none absolute overflow-visible text-ink-faint",style:{left:
|
|
27
|
+
/* @__PURE__ */f("svg",{className:"pointer-events-none absolute overflow-visible text-ink-faint",style:{left:B,top:48,width:ce,height:Ne},width:ce,height:Ne,"aria-hidden":!0,children:me.map(e=>/* @__PURE__ */b("g",{"data-gantt-arrow":e.key,children:[
|
|
28
28
|
/* @__PURE__ */f("path",{d:e.d,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round"}),
|
|
29
|
-
/* @__PURE__ */f("polygon",{points:e.head,fill:"currentColor"})]},e.key))}),Me&&/* @__PURE__ */f("div",{"data-gantt-today":"",className:"pointer-events-none absolute z-0 w-0.5 -translate-x-1/2 bg-danger",style:{left:
|
|
29
|
+
/* @__PURE__ */f("polygon",{points:e.head,fill:"currentColor"})]},e.key))}),Me&&/* @__PURE__ */f("div",{"data-gantt-today":"",className:"pointer-events-none absolute z-0 w-0.5 -translate-x-1/2 bg-danger",style:{left:B+De,top:48,height:Ne},"aria-hidden":!0}),ee&&/* @__PURE__ */f("span",{id:oe,hidden:!0,children:J.moveHint})]})})]})}export{L as Gantt};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useTabLayer as e,focusableIn as t,stopAfter as r}from"./chunk-DWGYC7OD.js";import{DESCRIPTION_TEXT as n}from"./chunk-BWJZTHZ6.js";import{onOverlayOpen as i}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as o}from"./chunk-62LW225J.js";import{popupBounds as a,VIEWPORT_MARGIN as c,placeMenu as s,followAnchor as l}from"./chunk-VY3UA6AR.js";import{useHydrated as u}from"./chunk-WCCS4VFE.js";import{useBrowserLayoutEffect as d}from"./chunk-ZDXRSY2Y.js";import{buttonClasses as m}from"./chunk-UQYNPYF4.js";import{registerModalEscapeInterceptor as p}from"./chunk-TWVUQUUD.js";import{useState as f,useRef as h,useId as g,useCallback as v,useEffect as b}from"react";import{createPortal as w}from"react-dom";import{jsxs as x,jsx as y}from"react/jsx-runtime";var k=/(^|[\s:])!?z-/;function C({trigger:C,children:N,title:j,description:D,"aria-label":E,align:O="start",side:T="bottom",open:W,defaultOpen:$=!1,onOpenChange:S,matchTriggerWidth:Y=!1,maxHeight:H,initialFocus:L,id:P,triggerLabel:M,"aria-describedby":R,disabled:U,className:z="",triggerClassName:F,panelClassName:K=""}){const[B,V]=f($),Z=(W??B)&&!U,A=u(),G=h(null),I=h(null),J=h(null),Q=h(null),X=g(),q=P??X,_=g(),ee=g(),te=g(),re=h(null),ne=h(!1),ie=h({openProp:W,onOpenChange:S});ie.current={openProp:W,onOpenChange:S};const oe=v(e=>{void 0===ie.current.openProp&&V(e),ie.current.onOpenChange?.(e)},[]),ae=v((e=!1)=>{ne.current=e,oe(!1)},[oe]),ce=e=>{re.current=e.nativeEvent},se=v(()=>{const e=J.current,t=I.current;if(!e||!t)return;const r=t.getBoundingClientRect(),n=a(t),i=Math.max(0,n.right-n.left-2*c),o=e.style;o.left="0px",o.top="0px",o.maxWidth=`${i}px`,o.maxHeight="none",o.width=Y?`${Math.min(r.width,i)}px`:"";const l={width:e.offsetWidth,height:e.offsetHeight},u=H??1/0,d=s({trigger:r,menu:{width:l.width,height:Math.min(l.height,u)},bounds:n,align:O,side:T}),m=Math.min(d.maxHeight,u);o.left=`${d.left}px`,o.top=`${d.top}px`,o.maxHeight=`${m}px`,o.overflowY=l.height>m?"auto":"",e.dataset.side=d.side,e.dataset.align=O},[O,T,Y,H]);d(()=>{Z&&A&&se()}),b(()=>{if(!Z||!A)return;const e=l(()=>I.current,se),t=Q.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>se());return r.observe(t),()=>{e(),r.disconnect()}},[Z,A,se]),b(()=>{if(!Z)return;const e=e=>{let t=null,r=0;const n=e=>{t===e&&(t=null,window.clearTimeout(r),(e=>{if(re.current===e)return!1;const t=e.target;return!(t&&(G.current?.contains(t)||J.current?.contains(t)))})(e)&&ae(!0))},i=e=>{t=e,r=window.setTimeout(()=>n(e),0)},o=e=>n(e);return document.addEventListener(e,i,!0),window.addEventListener(e,o),()=>{window.clearTimeout(r),document.removeEventListener(e,i,!0),window.removeEventListener(e,o)}},t=e("pointerdown"),r=e("focusin"),n=i(()=>ae()),o=p(e=>"Escape"===e.key&&(ae(),I.current?.focus(),!0),()=>J.current);return()=>{t(),r(),n(),o()}},[Z,ae]),e(J,Z&&A),d(()=>{if(!Z||!A)return;const e=J.current;return()=>{if(ne.current)return;const t=document.activeElement;t&&t!==document.body&&!e?.contains(t)||I.current?.focus({preventScroll:!0})}},[Z,A]),b(()=>{if(!Z||!A)return;const e=J.current;e&&(ne.current=!1,(L?.current??t(e)[0]??e).focus({preventScroll:!0}))},[Z,A]);const le="function"==typeof N?N({close:()=>ae()}):N,ue=j?{"aria-labelledby":ee}:E?{"aria-label":E}:{"aria-labelledby":q};/* @__PURE__ */
|
|
2
|
+
return x("div",{ref:G,className:`relative inline-flex ${z}`.trim(),children:[
|
|
3
|
+
/* @__PURE__ */y("button",{ref:I,id:q,type:"button","aria-haspopup":"dialog","aria-expanded":Z,"aria-controls":Z&&A?_:void 0,"aria-label":M,"aria-describedby":R,disabled:U,onClick:()=>Z?ae():oe(!0),onKeyDown:e=>{if("Tab"!==e.key||e.shiftKey||!Z)return;const r=(()=>{const e=J.current;return e?t(e)[0]??e:null})();r&&(e.preventDefault(),r.focus({preventScroll:!0}))},className:F??m({variant:"secondary"}),children:C}),Z&&A&&w(
|
|
4
|
+
/* @__PURE__ */y("div",{ref:J,id:_,role:"dialog",...ue,"aria-describedby":D?te:void 0,tabIndex:-1,"data-popover-panel":"",onPointerDownCapture:ce,onFocusCapture:ce,onKeyDown:e=>{const n=J.current,i=I.current;if("Tab"!==e.key||!n||!i||!n.contains(e.target))return;const o=t(n),a=document.activeElement;if(e.shiftKey){if(o.length>0&&a!==o[0]&&a!==n)return;return e.preventDefault(),void i.focus({preventScroll:!0})}if(o.length>0&&a!==o[o.length-1])return;e.preventDefault();const c=r(i,n);ae(!!c),(c??i).focus({preventScroll:!0})},className:`fixed rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${K}`.trim(),style:k.test(K)?void 0:{zIndex:o.popup},children:/* @__PURE__ */x("div",{ref:Q,children:[j&&/* @__PURE__ */y("h2",{id:ee,className:"text-sm font-semibold text-gray-900",children:j}),D&&/* @__PURE__ */y("p",{id:te,className:`mt-1 ${n}`,children:D}),j||D?/* @__PURE__ */y("div",{className:"mt-3",children:le}):le]})}),document.body)]})}export{C as Popover};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getActiveModalId as t}from"./chunk-F3ZOO23R.js";import{Icon as e}from"./chunk-ISVODSRP.js";import{Z_LAYERS as n}from"./chunk-62LW225J.js";import{useBrowserLayoutEffect as i}from"./chunk-
|
|
2
|
-
return d("button",{type:"button",onClick:t,"aria-label":i.close,className:(n?`${n} `:"")+"rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */d(e,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})}export{j as CloseButton,c as OverlayLayerProvider,v as POPUP_GUTTER,f as isInOverlayOver,k as popupLayerStyle,L as scrimHasCorners,a as useOverlayTarget,x as usePanelPosition,g as usePopupAnchor,
|
|
1
|
+
import{getActiveModalId as t}from"./chunk-F3ZOO23R.js";import{Icon as e}from"./chunk-ISVODSRP.js";import{Z_LAYERS as n}from"./chunk-62LW225J.js";import{useBrowserLayoutEffect as i}from"./chunk-ZDXRSY2Y.js";import{useShellStrings as o}from"./chunk-IUVGHHR3.js";import{createContext as r,useContext as u,useRef as s,useState as l}from"react";import{jsx as d}from"react/jsx-runtime";var h=r(void 0),c=h.Provider;function a(t){const e=u(h);return t?void 0===e?document.body:e:null}function f(t,e){if("undefined"==typeof Element||!(t instanceof Element))return!1;const n=t.closest("[data-overlay-layer]");return null!==n&&!e?.contains(n)}var w="[data-modal-panel], [data-popup-panel]",v=16;function p(t,e){const n=Math.max(0,t.left),i=Math.max(0,t.top),o=Math.min(e.width,t.left+t.width),r=Math.min(e.height,t.top+t.height);return o-n<1||r-i<1?null:{left:n,top:i,width:o-n,height:r-i}}function m(t,e,n){return n<e?e:Math.min(Math.max(t,e),n)}function b(){return{width:window.innerWidth,height:window.innerHeight}}function g(t,e){const n=s(null),o=s(!1);t&&!o.current&&(n.current="undefined"==typeof document?null:document.activeElement),o.current=t;const[r,u]=l(null);return i(()=>{if(!t)return void u(null);const i=(o=e.current,r=n.current,o?.parentElement?.closest(w)??r?.closest(w)??null);var o,r;if(!i)return void u(null);const s=()=>{const t=i.getBoundingClientRect(),e=b(),n=p({left:t.left,top:t.top,width:t.width,height:t.height},e),o=null!==n&&n.width>=e.width-1&&n.height>=e.height-1;u(t=>{const e=o?null:n;return t===e||t&&e&&t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height?t:e})};s(),window.addEventListener("resize",s);const l="undefined"==typeof ResizeObserver?null:new ResizeObserver(s);return l?.observe(i),()=>{window.removeEventListener("resize",s),l?.disconnect()}},[t,e]),r}function x(t,e){const[n,o]=l(null);return i(()=>{const n=e.current;if(!t||!n)return void o(null);const i=()=>{const e=function(t,e,n,i=16){return{left:m(t.left+t.width/2-e.width/2,i,n.width-i-e.width),top:m(t.top+t.height/2-e.height/2,i,n.height-i-e.height)}}(t,{width:n.offsetWidth,height:n.offsetHeight},b());o(t=>t&&t.left===e.left&&t.top===e.top?t:e)};i(),window.addEventListener("resize",i);const r="undefined"==typeof ResizeObserver?null:new ResizeObserver(i);return r?.observe(n),()=>{window.removeEventListener("resize",i),r?.disconnect()}},[t,e]),n}var y=/* @__PURE__ */new WeakMap;function z(t){if(!t)return null;const e=t.closest("[data-overlay-layer]");return e?y.get(e)??null:t.closest("[data-modal-panel]")}var E={host:null,box:null,z:0,hidden:!1};function R(t,e){const n=s(null),o=s(!1);t&&!o.current&&(n.current="undefined"==typeof document?null:document.activeElement),o.current=t;const[r,u]=l(E);return i(()=>{if(!t)return void u(E);const i=(o=e.current,r=n.current,z(o?.parentElement)??z(r));var o,r;if(!i)return void u(E);const s=()=>{const t=i.getBoundingClientRect(),e=getComputedStyle(i),n=p({left:t.left,top:t.top,width:t.width,height:t.height},{width:window.innerWidth,height:window.innerHeight}),o=Number.parseInt(e.zIndex,10),r={host:i,box:n,z:Number.isFinite(o)?o:0,hidden:null===n||"none"===e.display||"hidden"===e.visibility};u(t=>{return n=r,(e=t).host===n.host&&e.z===n.z&&e.hidden===n.hidden&&(e.box===n.box||null!==e.box&&null!==n.box&&e.box.left===n.box.left&&e.box.top===n.box.top&&e.box.width===n.box.width&&e.box.height===n.box.height)?t:r;var e,n})};s(),window.addEventListener("resize",s);const l="undefined"==typeof ResizeObserver?null:new ResizeObserver(s);l?.observe(i);const d="undefined"==typeof MutationObserver?null:new MutationObserver(s);return d?.observe(i,{attributes:!0,attributeFilter:["style","class"]}),()=>{window.removeEventListener("resize",s),l?.disconnect(),d?.disconnect()}},[t,e]),r}function O(e,n){const i=s(null);return i.current=i=>function(t,e,n,i){const o=t.host;if(!o)return!1;if(n&&e?.contains(n))return!1;const r=o.getAttribute("data-modal-id");if(i&&r&&i!==r)return!0;const u=z(n);return null!==u&&u!==o&&!o.contains(u)}(e,n,i,t()),n&&function(t,e){y.set(t,e)}(n,e.host),i}function k(t){return t.host?{zIndex:t.z+1,...t.hidden?{visibility:"hidden"}:{}}:{zIndex:n.overlay}}function M(t){if(!t.host||!t.box)return null;const{left:e,top:n,width:i,height:o}=t.box;return{left:e,top:n,width:i,height:o}}function L(t){return null!==t.host&&!t.host.hasAttribute("data-window-tab")}function j({onClose:t,className:n=""}){const i=o().dialog;/* @__PURE__ */
|
|
2
|
+
return d("button",{type:"button",onClick:t,"aria-label":i.close,className:(n?`${n} `:"")+"rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */d(e,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})}export{j as CloseButton,c as OverlayLayerProvider,v as POPUP_GUTTER,f as isInOverlayOver,k as popupLayerStyle,L as scrimHasCorners,a as useOverlayTarget,x as usePanelPosition,g as usePopupAnchor,R as usePopupLevel,O as usePopupLevelBindings,M as windowScrimStyle};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{copyToClipboard as e,selectionAt as t}from"./chunk-UFX7F3KG.js";import{useTableNav as n}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as r}from"./chunk-G6DKCCWH.js";import{ListFooter as o}from"./chunk-DO3DSSAW.js";import{ListLoadError as l}from"./chunk-
|
|
2
|
-
return x(l,{title:
|
|
3
|
-
/* @__PURE__ */x("div",{ref:
|
|
1
|
+
import{copyToClipboard as e,selectionAt as t}from"./chunk-UFX7F3KG.js";import{useTableNav as n}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as r}from"./chunk-G6DKCCWH.js";import{ListFooter as o}from"./chunk-DO3DSSAW.js";import{ListLoadError as l}from"./chunk-MVOYVN3S.js";import{ResizableTable as i}from"./chunk-J4CVYOY3.js";import{Checkbox_default as a}from"./chunk-CGZBDI6C.js";import{LoadingSpinner as c}from"./chunk-4U5M37SF.js";import{PopupMenu as d,PopupMenuLabel as s,PopupMenuItem as h,PopupMenuDivider as m}from"./chunk-THAPVKEJ.js";import{keepsNativeMenu as u}from"./chunk-5QFPTDQF.js";import{LoadingSpinner as p}from"./chunk-R2VKEMZH.js";import{shellHttp as f}from"./chunk-STKJA4PV.js";import{toast_default as g}from"./chunk-VQ35LXDC.js";import{useShellStrings as y}from"./chunk-IUVGHHR3.js";import{useState as k,useRef as b}from"react";import{jsx as x,Fragment as w,jsxs as C}from"react/jsx-runtime";function j(e){return Array.from(e.children).filter(e=>void 0!==e.dataset?.colKey&&"_select"!==e.dataset.colKey)}function v(e){return("string"==typeof e.innerText?e.innerText:e.textContent??"").replace(/\s+/g," ").trim()}function S(S){const{items:R,isLoading:N,emptyState:L,totalCount:$,isError:A,onRetry:T,errorTitle:K,errorMessage:M,tableId:E,columns:F,renderCell:D,getRowId:P=e=>e.id,sort:U,onSort:V,selected:H,setSelected:I,onRowClick:O,onRowHover:J,getRowClassName:W,footerLabel:G,footerExtra:Y,footerExtraAfter:_,sentinelRef:B,isFetchingNextPage:Q,saveDefaultPerms:X,exportEndpoint:Z,exportFilename:z="export.csv",contextActions:q}=S,[ee,te]=k(null),ne=b(null),re=y(),oe=re.entityList,le=e=>{I(t=>{const n=new Set(t),r=P(e);return n.has(r)?n.delete(r):n.add(r),n})},ie=()=>{I(e=>{const t=R.map(P),n=new Set(e);return t.every(t=>e.has(t))?t.forEach(e=>n.delete(e)):t.forEach(e=>n.add(e)),n})},ae=n(R,O,le,ie,(e,t)=>{I(n=>{const r=new Set(n);for(let n=e;n<=t;n++)r.add(P(R[n]));return r})},ne),ce=R.filter(e=>H.has(P(e))),de=()=>{const e=[...ne.current?.querySelectorAll("tr[data-row-idx]")??[]].filter(e=>{const t=R[Number(e.dataset.rowIdx)];return void 0!==t&&H.has(P(t))}),t=e.length?j(e[0]).map(e=>e.dataset.colKey??""):[],n=new Map(F.map(e=>[e.key,e.label]));return{keys:t,header:t.map(e=>n.get(e)??e),body:e.map(e=>j(e).map(v))}},se=()=>{te(null);const{header:t,body:n}=de();if(!n.length)return;const o=[t,...n].map(e=>e.join("\t")).join("\n"),l="<table><thead><tr>"+t.map(e=>`<th>${r(e)}</th>`).join("")+"</tr></thead><tbody>"+n.map(e=>`<tr>${e.map(e=>`<td>${r(e)}</td>`).join("")}</tr>`).join("")+"</tbody></table>";e(oe.copiedRows(n.length),o,l)},he=async()=>{te(null);const e=ce.map(P);if(!e.length||!Z)return;const t=new URLSearchParams({ids:e.join(",")}),n=(()=>{const e=new Map(F.map(e=>[e.key,e.exportLabel??e.label]));try{const t=localStorage.getItem(`col-config-${E}`);if(t){const n=JSON.parse(t).filter(t=>!t.hidden&&"_select"!==t.key&&e.has(t.key)).map(t=>`${t.key}|${e.get(t.key)}`);if(n.length)return n.join(",")}}catch{}return F.filter(e=>!e.defaultHidden).map(e=>`${e.key}|${e.exportLabel??e.label}`).join(",")})();n&&t.set("cols",n);const r=Z.includes("?")?"&":"?";try{const n=await f.get(`${Z}${r}${t}`,{responseType:"blob"}),o=window.URL.createObjectURL(new Blob([n.data],{type:"text/csv"})),l=document.createElement("a");l.href=o,l.download=z,l.click(),window.URL.revokeObjectURL(o);const i=n.headers??{},a=Number(i["x-row-count"]);if("true"===String(i["x-truncated"]))return void g.notify(Number.isFinite(a)?oe.exportTruncated(a,e.length):oe.exportTruncatedUnknown(e.length));g.success(oe.exported(e.length))}catch{g.error(oe.exportFailed)}};if(N)/* @__PURE__ */return x(c,{});if(A&&0===R.length)/* @__PURE__ */
|
|
2
|
+
return x(l,{title:K,message:M,onRetry:T});if(0===R.length)/* @__PURE__ */return x(w,{children:L});const me=R.length>0&&ce.length===R.length,ue=ce.length>0&&!me,pe=H.size-ce.length,fe=[{key:"_select",label:"",defaultWidth:52,minWidth:52,headerNode:/* @__PURE__ */x(a,{"aria-label":re.table.selectAll,checked:me,indeterminate:ue,onChange:ie,style:{height:14,width:14}})},...F],ge=/* @__PURE__ */x(o,{selectedCount:ce.length,hiddenSelectedCount:pe,loadedCount:R.length,totalCount:$,label:G,isFetchingMore:Q,extra:Y,extraAfter:_}),ye=B?/* @__PURE__ */C(w,{children:[
|
|
3
|
+
/* @__PURE__ */x("div",{ref:B}),Q&&/* @__PURE__ */x(p,{size:"sm",padding:"py-3",label:re.list.loadingMore})]}):void 0;let ke=null;if(ee){const{x:t,y:n,item:r,text:o,firstColumn:l}=ee,i=q?q(ce):[],a=ce.length,c=()=>te(null),u=void 0!==$&&$>R.length;ke=/* @__PURE__ */C(d,{portal:!0,style:{left:t,top:n},onClose:c,minWidth:210,children:[
|
|
4
4
|
/* @__PURE__ */x(s,{children:pe>0?re.list.selectedNotShown(a,pe):re.list.selected(a)}),
|
|
5
5
|
/* @__PURE__ */x(h,{className:"font-medium",onClick:()=>{c(),O(r)},children:oe.open}),
|
|
6
6
|
/* @__PURE__ */x(m,{}),o&&/* @__PURE__ */x(h,{onClick:()=>{c(),e(oe.copiedText,o.text,o.html)},children:oe.copy}),l&&/* @__PURE__ */x(h,{onClick:()=>(t=>{te(null);const{keys:n,body:r}=de(),o=n.indexOf(t.key);o<0||!r.length||e(t.label,r.map(e=>e[o]).join("\n"))})(l),children:oe.copyColumn(l.label)}),
|
|
7
|
-
/* @__PURE__ */x(h,{disabled:0===a,onClick:se,children:oe.copyRows(a)}),
|
|
7
|
+
/* @__PURE__ */x(h,{disabled:0===a,onClick:se,children:oe.copyRows(a)}),Z&&/* @__PURE__ */x(h,{onClick:he,children:oe.exportSelected}),i.map((e,t)=>/* @__PURE__ */C("div",{children:[(e.divider||0===t)&&/* @__PURE__ */x(m,{}),
|
|
8
8
|
/* @__PURE__ */x(h,{danger:e.danger,disabled:e.disabled,onClick:()=>{c(),e.onClick(ce)},children:e.label})]},t)),
|
|
9
|
-
/* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),
|
|
10
|
-
/* @__PURE__ */x(h,{onClick:()=>{c(),
|
|
9
|
+
/* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),I(e=>/* @__PURE__ */new Set([...e,...R.map(P)]))},children:u?oe.selectAllLoaded(R.length):oe.selectAll}),
|
|
10
|
+
/* @__PURE__ */x(h,{onClick:()=>{c(),I(/* @__PURE__ */new Set)},children:oe.clearSelection}),T&&/* @__PURE__ */x(h,{onClick:()=>{c(),T()},children:oe.refresh})]})}/* @__PURE__ */
|
|
11
11
|
return C("div",{className:"flex-1 flex flex-col mb-1 bg-white rounded-lg shadow overflow-hidden",children:[
|
|
12
|
-
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(i,{tableId:
|
|
13
|
-
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":
|
|
12
|
+
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(i,{tableId:E,columns:fe,sort:U,onSort:V,footer:ge,afterBody:ye,saveDefaultPerms:X,children:e=>/* @__PURE__ */x("tbody",{ref:ne,className:"divide-y divide-gray-100",children:R.map((n,r)=>{const o=P(n);/* @__PURE__ */
|
|
13
|
+
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":H.has(o)?"bg-blue-50 hover:bg-blue-100":"hover:bg-gray-50"} ${W?.(n)??""}`,onClick:()=>O(n),onContextMenu:e=>((e,n)=>{if(e.shiftKey||u(e.target))return;e.preventDefault();const r=P(n);H.has(r)||I(/* @__PURE__ */new Set([r]));const o=j(e.currentTarget)[0]?.dataset.colKey,l=o?F.find(e=>e.key===o)?.label:void 0;te({x:e.clientX,y:e.clientY,item:n,text:t(e.target),firstColumn:o&&l?{key:o,label:l}:null})})(e,n),onMouseEnter:J?()=>J(n):void 0,children:e.map(e=>/* @__PURE__ */x("td",{"data-col-key":e.key,className:"px-4 py-3 whitespace-nowrap text-sm overflow-hidden",children:"_select"===e.key?/* @__PURE__ */x(a,{"aria-label":re.table.selectRow,checked:H.has(o),onChange:()=>le(n),onClick:e=>e.stopPropagation(),style:{height:14,width:14}}):D(n,e.key)},e.key))},o)})})})}),ke]})}export{S as EntityList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Tooltip as e}from"./chunk-
|
|
1
|
+
import{Tooltip as e}from"./chunk-F2RAIGCG.js";import{Fragment as r}from"react";import{jsx as l,jsxs as a}from"react/jsx-runtime";var i="58px",t="--picture-tiles-columns";function o(e){let r=0;for(const l of e)for(const e of l.label.split(/\s+/))r=Math.max(r,[...e].length);return r}function s({options:t,value:s,onChange:n,onClear:c,columns:u,captions:p=!1,label:d,className:b="","aria-labelledby":m}){const f=p?{"--picture-tiles-min":i,"--picture-tiles-longest-word":o(t),...u?{"--picture-tiles-default-columns":u}:{}}:{gridTemplateColumns:u?`repeat(${u}, minmax(0, 1fr))`:`repeat(auto-fill, minmax(${i}, 1fr))`};/* @__PURE__ */
|
|
2
2
|
return l("div",{role:"group","aria-label":m?void 0:d,"aria-labelledby":m,style:f,className:`${p?"rosh-picture-tiles rosh-one-height-rows"+(u?"":" rosh-picture-tiles-fit"):"grid"} gap-(--space-8) ${b}`.replace(/\s+/g," ").trim(),children:t.map(i=>{const t=i.value===s,o=/* @__PURE__ */a("button",{type:"button","aria-pressed":t,"aria-label":p?void 0:i.label,disabled:i.disabled||void 0,onClick:()=>{t?c?.():n(i.value)},className:`flex w-full min-w-0 flex-col items-center justify-center gap-(--space-4) rounded-(--radius-control) border transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)] disabled:cursor-not-allowed disabled:opacity-50 ${p?"px-(--space-4) py-(--space-8)":"p-(--space-4)"} ${t?"border-blue-600 bg-surface text-blue-600 ring-2 ring-blue-400/40":"border-line bg-surface text-ink-faint hover:bg-row-hover hover:text-ink"}`,children:[i.picture,p&&/* @__PURE__ */l("span",{className:"max-w-full text-center text-2xs leading-4 break-normal",children:i.label})]});return p?/* @__PURE__ */l(r,{children:o},i.value):/* @__PURE__ */l(e,{content:i.label,describe:!1,className:"relative flex min-w-0",children:o},i.value)})})}export{t as PICTURE_TILES_COLUMNS_VAR,s as PictureTiles};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import{fitBoxScale as e}from"./chunk-M6UKCZHT.js";import{toast_default as t}from"./chunk-VQ35LXDC.js";import{useShellStrings as r}from"./chunk-IUVGHHR3.js";import{forwardRef as n,useRef as o,useState as i,useMemo as a,useEffect as l,useImperativeHandle as s}from"react";import{jsx as c,jsxs as d,Fragment as h}from"react/jsx-runtime";var u=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],p=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],y=()=>Math.random().toString(36).slice(2,9),x=n(function({src:n,filename:x,onApply:g,onCancel:w},N){const z=o(null),D=o(null),P=o(null),$=o(null),E=r().annotator,I=o(E);I.current=E;const[S,W]=i("select"),[B,R]=i(u[0]),[j,H]=i(4),[T,U]=i(24),[F,A]=i(p[0].id),[O,K]=i(!0),[V,Z]=i(!1),[X,G]=i(!1),[q,Y]=i(null),[_,Q]=i(null),[J,ee]=i(6),[te,re]=i(12),[ne,oe]=i([]),[ie,ae]=i(null),[le,se]=i(null),[ce,de]=i(null),[he,ue]=i(1),[pe,ye]=i(null),[xe,me]=i(null),[ge,we]=i(null),fe=o(null),[ve,be]=i(!1),ke=a(()=>ce?{w:ce.w*he,h:ce.h*he}:null,[ce,he]),Me=ke&&le?ke.w/le.w:1,Ce=a(()=>ne.find(e=>e.id===ie)??null,[ne,ie]);l(()=>{"select"===S&&Ce&&("color"in Ce&&R(Ce.color),"stroke"in Ce&&H(Ce.stroke),"rect"===Ce.type&&re(Ce.radius),"text"===Ce.type&&(U(Ce.size),A(Ce.font),K(Ce.bold),Z(Ce.italic),G(Ce.underline),Y(Ce.borderColor),Q(Ce.background),ee(Ce.padding)))},[ie]),l(()=>{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{$.current=e,se({w:e.naturalWidth,h:e.naturalHeight}),oe([]),ae(null)},e.onerror=()=>t.error(I.current.loadFailed),e.src=n},[n]),l(()=>{if(!le)return;const t=()=>{const t=z.current;if(!t)return;const r=t.getBoundingClientRect(),n=Math.max(0,r.width-32),o=Math.max(0,r.height-32);if(0===n||0===o)return;const i=e({width:n,height:o},{width:le.w,height:le.h},1);de({w:le.w*i,h:le.h*i})};t();const r=new ResizeObserver(t);return z.current&&r.observe(z.current),()=>r.disconnect()},[le]);const Ne=a(()=>ne.filter(e=>"mosaic"===e.type),[ne]);l(()=>{const e=$.current,t=D.current;if(!e||!t||!le)return;t.width=le.w,t.height=le.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of Ne)L(r,e)},[le,Ne,ce]);const Le=e=>{const t=P.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},ze=e=>{fe.current=e,be(!0)};l(()=>{if(!ve)return;const e=e=>{const t=fe.current;if(!t)return;const r=Le(e);if("draw"===t.kind)ye(b(S,t.start,r,B,j,te));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),ye({id:"",type:"draw",points:t.points.slice(),color:B,stroke:j}))}else if("crop"===t.kind)we(C(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;oe(r=>r.map(r=>r.id===t.id?k(t.original,e,n):r))}else"resize"===t.kind&&oe(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=C({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=fe.current;if(fe.current=null,be(!1),"draw"===e?.kind)ye(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:y()};return oe(e=>[...e,r]),ae(r.id),W("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void ye(null);const t={id:y(),type:"draw",points:e.points,color:B,stroke:j};oe(e=>[...e,t]),ae(t.id),W("select"),ye(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ve,S,B,j,te]);l(()=>{const e=e=>{if(!document.activeElement||!/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName))return!e.metaKey&&!e.ctrlKey||"z"!==e.key&&"Z"!==e.key||e.shiftKey?void(ie&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),oe(e=>e.filter(e=>e.id!==ie)),ae(null)):"Escape"===e.key&&ae(null))):(e.preventDefault(),oe(e=>e.slice(0,-1)),void ae(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ie]);const De=e=>{const t=!{bold:O,italic:V,underline:X}[e];"bold"===e&&K(t),"italic"===e&&Z(t),"underline"===e&&G(t),ie&&oe(r=>r.map(r=>r.id===ie&&"text"===r.type?{...r,[e]:t}:r))},Pe=e=>{Y(e),ie&&oe(t=>t.map(t=>t.id===ie&&"text"===t.type?{...t,borderColor:e}:t))},$e=e=>{Q(e),ie&&oe(t=>t.map(t=>t.id===ie&&"text"===t.type?{...t,background:e}:t))},Ee=e=>{if(!xe)return;const t=e??xe.value;if(!t.trim())return xe.editingId&&oe(e=>e.filter(e=>e.id!==xe.editingId)),void me(null);if(xe.editingId)oe(e=>e.map(e=>e.id===xe.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:y(),type:"text",x:xe.x,y:xe.y,text:t,color:B,size:T,font:F,bold:O,italic:V,underline:X,borderColor:q,background:_,padding:J};oe(t=>[...t,e]),ae(e.id),W("select")}me(null)},Ie=async()=>{const e=D.current,t=P.current;if(!e||!t||!le)return null;const r=document.createElement("canvas");r.width=le.w,r.height=le.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,le.w,le.h),URL.revokeObjectURL(l),r};s(N,()=>({save:async()=>{const e=await Ie();e&&e.toBlob(e=>{if(!e)return void t.error(I.current.exportFailed);const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r;const o=x.replace(/\.[^.]+$/,"");n.download=`${o}-annotated.png`,n.click(),URL.revokeObjectURL(r)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void t.error(I.current.clipboardUnsupported);const e=await Ie();e&&e.toBlob(async e=>{if(e)try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),t.success(I.current.copied)}catch{t.error(I.current.copyRefused)}else t.error(I.current.copyFailed)},"image/png")}}),[le,x]);const Se=a(()=>[{id:"select",label:E.toolSelect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:E.toolDraw,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:E.toolRect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:E.toolEllipse,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:E.toolArrow,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:E.toolMosaic,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:E.toolText,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:E.toolCrop,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[E]),We=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),Be=Ce?.type??("select"===S?null:S),Re="rect"===Be||"circle"===Be||"arrow"===Be||"draw"===Be,je="rect"===Be,He="text"===Be;/* @__PURE__ */
|
|
2
|
+
return d("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
3
|
+
/* @__PURE__ */d("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Se.map(e=>/* @__PURE__ */c("button",{onClick:()=>{W(e.id),ae(null)},title:e.label,className:We(S===e.id),children:e.icon},e.id)),
|
|
4
|
+
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
5
|
+
/* @__PURE__ */c("div",{className:"flex items-center gap-1",children:u.map(e=>/* @__PURE__ */c("button",{onClick:()=>(e=>{R(e),ie&&oe(t=>t.map(t=>t.id!==ie||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(B===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Re&&/* @__PURE__ */d(h,{children:[
|
|
6
|
+
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
7
|
+
/* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
8
|
+
/* @__PURE__ */c("span",{children:E.weight}),
|
|
9
|
+
/* @__PURE__ */c("input",{type:"range",min:1,max:20,step:1,value:j,onChange:e=>{return t=Number(e.target.value),H(t),void(ie&&oe(e=>e.map(e=>e.id!==ie?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
10
|
+
/* @__PURE__ */c("span",{className:"tabular-nums w-5 text-right",children:j})]})]}),je&&/* @__PURE__ */d(h,{children:[
|
|
11
|
+
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
12
|
+
/* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
13
|
+
/* @__PURE__ */c("span",{children:E.radius}),
|
|
14
|
+
/* @__PURE__ */c("input",{type:"range",min:0,max:48,step:1,value:te,onChange:e=>{return t=Number(e.target.value),re(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
15
|
+
/* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:te})]})]}),He&&/* @__PURE__ */d(h,{children:[
|
|
16
|
+
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
17
|
+
/* @__PURE__ */c("select",{value:F,onChange:e=>{return t=e.target.value,A(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:p.map(e=>/* @__PURE__ */c("option",{value:e.id,children:E[e.name]},e.id))}),
|
|
18
|
+
/* @__PURE__ */c("button",{onClick:()=>De("bold"),className:We(O),title:E.bold,children:/* @__PURE__ */c("span",{className:"font-bold",children:E.boldLetter})}),
|
|
19
|
+
/* @__PURE__ */c("button",{onClick:()=>De("italic"),className:We(V),title:E.italic,children:/* @__PURE__ */c("span",{className:"italic",children:E.italicLetter})}),
|
|
20
|
+
/* @__PURE__ */c("button",{onClick:()=>De("underline"),className:We(X),title:E.underline,children:/* @__PURE__ */c("span",{className:"underline",children:E.underlineLetter})}),
|
|
21
|
+
/* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
22
|
+
/* @__PURE__ */c("span",{children:E.size}),
|
|
23
|
+
/* @__PURE__ */c("input",{type:"range",min:10,max:96,step:1,value:T,onChange:e=>{return t=Number(e.target.value),U(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
24
|
+
/* @__PURE__ */c("span",{className:"tabular-nums w-7 text-right",children:T})]}),
|
|
25
|
+
/* @__PURE__ */d("label",{className:"flex items-center gap-1 text-gray-600",children:[
|
|
26
|
+
/* @__PURE__ */c("span",{children:E.border}),q?/* @__PURE__ */d(h,{children:[
|
|
27
|
+
/* @__PURE__ */c("input",{type:"color",value:q,onChange:e=>Pe(e.target.value),title:E.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
|
|
28
|
+
/* @__PURE__ */c("button",{onClick:()=>Pe(null),title:E.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>Pe(B),title:E.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:E.add})]}),
|
|
29
|
+
/* @__PURE__ */d("label",{className:"flex items-center gap-1 text-gray-600",children:[
|
|
30
|
+
/* @__PURE__ */c("span",{children:E.fill}),_?/* @__PURE__ */d(h,{children:[
|
|
31
|
+
/* @__PURE__ */c("input",{type:"color",value:_,onChange:e=>$e(e.target.value),title:E.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
|
|
32
|
+
/* @__PURE__ */c("button",{onClick:()=>$e(null),title:E.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>$e("#ffffff"),title:E.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:E.add})]}),
|
|
33
|
+
/* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
34
|
+
/* @__PURE__ */c("span",{children:E.padding}),
|
|
35
|
+
/* @__PURE__ */c("input",{type:"range",min:0,max:40,step:1,value:J,onChange:e=>{return t=Number(e.target.value),ee(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
|
|
36
|
+
/* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:J})]})]}),
|
|
37
|
+
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
38
|
+
/* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.max(.25,Math.round(100*(e-.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.zoomOut,children:"−"}),
|
|
39
|
+
/* @__PURE__ */d("span",{className:"text-gray-600 tabular-nums w-10 text-center",children:[Math.round(100*he),"%"]}),
|
|
40
|
+
/* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.min(4,Math.round(100*(e+.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.zoomIn,children:"+"}),
|
|
41
|
+
/* @__PURE__ */c("button",{onClick:()=>ue(1),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.fitHint,children:E.fit}),
|
|
42
|
+
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
43
|
+
/* @__PURE__ */c("button",{onClick:()=>{oe(e=>e.slice(0,-1)),ae(null)},disabled:0===ne.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:E.undo}),
|
|
44
|
+
/* @__PURE__ */d("div",{className:"ml-auto flex items-center gap-2",children:[ge&&/* @__PURE__ */d(h,{children:[
|
|
45
|
+
/* @__PURE__ */c("button",{onClick:()=>{if(!ge||!$.current||!le)return;const e=ge,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=le.w,n.height=le.h;const o=n.getContext("2d");o.drawImage($.current,0,0);for(const e of Ne)L(o,e);r.drawImage(n,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{$.current=i,se({w:i.naturalWidth,h:i.naturalHeight}),oe(t=>t.filter(e=>"mosaic"!==e.type).map(t=>k(t,-e.x,-e.y)).filter(e=>function(e,t,r){const n=M(e);return n.x+n.w>0&&n.y+n.h>0&&n.x<t&&n.y<r}(e,i.naturalWidth,i.naturalHeight))),we(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:E.applyCrop}),
|
|
46
|
+
/* @__PURE__ */c("button",{onClick:()=>we(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:E.cancel})]}),g&&!ge&&/* @__PURE__ */d(h,{children:[w&&/* @__PURE__ */c("button",{onClick:w,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:E.cancel}),
|
|
47
|
+
/* @__PURE__ */c("button",{onClick:async()=>{const e=await Ie();e?e.toBlob(e=>{e?g(e):t.error(I.current.exportFailed)},"image/png"):t.error(I.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:E.apply})]})]})]}),
|
|
48
|
+
/* @__PURE__ */c("div",{ref:z,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:ke&&le&&/* @__PURE__ */d("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:ke.w,height:ke.h},children:[
|
|
49
|
+
/* @__PURE__ */c("canvas",{ref:D,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
|
|
50
|
+
/* @__PURE__ */d("svg",{ref:P,viewBox:`0 0 ${le.w} ${le.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===S?"default":"text"===S?"text":"crosshair"},onPointerDown:e=>{if("select"===S)return void ae(null);if("text"===S){if(xe)return void Ee();const t=Le(e);return void me({x:t.x,y:t.y,value:""})}const t=Le(e);if("crop"!==S){if("draw"===S)return ze({kind:"pen",points:[t]}),void ye({id:"",type:"draw",points:[t],color:B,stroke:j});ye(b(S,t,t,B,j,te)),ze({kind:"draw",start:t})}else ze({kind:"crop",start:t})},children:[ne.map(e=>/* @__PURE__ */c(m,{anno:e,selected:ie===e.id,zoom:he,onPointerDown:t=>((e,t)=>{"select"===S&&(e.stopPropagation(),ae(t.id),ze({kind:"move",id:t.id,start:Le(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&me({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),ze({kind:"resize",id:t.id,corner:r,start:Le(e),original:t})})(t,e,r)},e.id)),pe&&/* @__PURE__ */c(m,{anno:{...pe,id:"__preview"},preview:!0}),ge&&/* @__PURE__ */c(f,{rect:ge,imageSize:le})]}),xe&&/* @__PURE__ */c(v,{pendingText:xe,color:B,size:T,font:p.find(e=>e.id===F)?.css??p[0].css,bold:O,italic:V,underline:X,borderColor:q,background:_,padding:J,scale:Me,onChange:e=>me({...xe,value:e}),onCommit:Ee,onCancel:()=>me(null)})]})}),
|
|
51
|
+
/* @__PURE__ */c("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===S?ie?E.hintSelected:E.hintSelect:"text"===S?E.hintText:"crop"===S?E.hintCrop:"draw"===S?E.hintDraw:E.hintShape})]})});function m({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=M(e),s=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},u=i?{onDoubleClick:i}:{};let y;if("rect"===e.type)y=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("circle"===e.type)y=/* @__PURE__ */c("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...s});else if("arrow"===e.type)y=/* @__PURE__ */c(w,{anno:e,interactive:s});else if("draw"===e.type)y=/* @__PURE__ */c("path",{d:N(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("mosaic"===e.type)y=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...s,style:t?{...s.style,stroke:"var(--rosh-annotator-selection)"}:s.style});else{const t=p.find(t=>t.id===e.font)?.css??p[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=M(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;y=/* @__PURE__ */d("g",{...s,...u,children:[n&&/* @__PURE__ */c("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
|
|
52
|
+
/* @__PURE__ */c("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */c("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
|
|
53
|
+
return d("g",{children:[y,t&&!r&&/* @__PURE__ */d(h,{children:[
|
|
54
|
+
/* @__PURE__ */c("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",strokeWidth:2/n,strokeDasharray:`${6/n},${4/n}`,pointerEvents:"none",style:{stroke:"var(--rosh-annotator-selection)"}}),a&&/* @__PURE__ */c(g,{anno:e,zoom:n,onHandlePointerDown:a})]})]})}function g({anno:e,zoom:t,onHandlePointerDown:r}){const n=6/t,o=1.5/t,i=e=>({fill:"white",strokeWidth:o,pointerEvents:"all",style:{cursor:e,stroke:"var(--rosh-annotator-selection)"},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
|
|
55
|
+
return d(h,{children:[
|
|
56
|
+
/* @__PURE__ */c("circle",{cx:e.x1,cy:e.y1,r:n,...i("grab"),onPointerDown:e=>r(e,"start")}),
|
|
57
|
+
/* @__PURE__ */c("circle",{cx:e.x2,cy:e.y2,r:n,...i("grab"),onPointerDown:e=>r(e,"end")})]});if("text"===e.type||"draw"===e.type)return null;const a=e.x,l=e.y,s=e.w,u=e.h;/* @__PURE__ */
|
|
58
|
+
return d(h,{children:[
|
|
59
|
+
/* @__PURE__ */c("circle",{cx:a,cy:l,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"nw")}),
|
|
60
|
+
/* @__PURE__ */c("circle",{cx:a+s,cy:l,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"ne")}),
|
|
61
|
+
/* @__PURE__ */c("circle",{cx:a+s,cy:l+u,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"se")}),
|
|
62
|
+
/* @__PURE__ */c("circle",{cx:a,cy:l+u,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"sw")})]})}function w({anno:e,interactive:t}){const r=Math.max(12,4*e.stroke),n=Math.atan2(e.y2-e.y1,e.x2-e.x1),o=n+Math.PI-Math.PI/7,i=n+Math.PI+Math.PI/7,a=`M${e.x2},${e.y2} L${e.x2+r*Math.cos(o)},${e.y2+r*Math.sin(o)} L${e.x2+r*Math.cos(i)},${e.y2+r*Math.sin(i)} Z`;/* @__PURE__ */
|
|
63
|
+
return d("g",{...t,children:[
|
|
64
|
+
/* @__PURE__ */c("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round"}),
|
|
65
|
+
/* @__PURE__ */c("path",{d:a,fill:e.color})]})}function f({rect:e,imageSize:t}){/* @__PURE__ */
|
|
66
|
+
return d("g",{pointerEvents:"none",children:[
|
|
67
|
+
/* @__PURE__ */c("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fillRule:"evenodd",style:{fill:"var(--rosh-annotator-crop-scrim)"}}),
|
|
68
|
+
/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"white",strokeWidth:2,strokeDasharray:"8,6"})]})}function v({pendingText:e,color:t,size:n,font:i,bold:a,italic:s,underline:d,borderColor:h,background:u,padding:p,scale:y,onChange:x,onCommit:m,onCancel:g}){const w=o(null),f=r().annotator;l(()=>{const e=requestAnimationFrame(()=>{w.current?.focus(),w.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const v=()=>m(w.current?.value),b=h?Math.max(1,Math.round(n/12)):0;/* @__PURE__ */
|
|
69
|
+
return c("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */c("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:v,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),v())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:t,fontSize:n*y+"px",fontFamily:i,fontWeight:a?700:400,fontStyle:s?"italic":"normal",textDecoration:d?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:h?`${b*y}px solid ${h}`:"1px dashed var(--rosh-annotator-edit-hint)",background:u??"var(--rosh-annotator-edit-surface)"}})})}function b(e,t,r,n,o,i){if("rect"===e){const e=C(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=C(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=C(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function k(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function M(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function C(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function N(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function L(e,t){const r=Math.round(Math.max(0,t.x)),n=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-r,t.w)),i=Math.round(Math.min(e.canvas.height-n,t.h));if(o<2||i<2)return;const a=e.getImageData(r,n,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let r=0,n=0,l=0,s=0,c=0;const d=Math.min(12,o-t),h=Math.min(12,i-e);for(let i=0;i<h;i++)for(let h=0;h<d;h++){const d=4*((e+i)*o+(t+h));r+=a.data[d],n+=a.data[d+1],l+=a.data[d+2],s+=a.data[d+3],c++}r=Math.round(r/c),n=Math.round(n/c),l=Math.round(l/c),s=Math.round(s/c);for(let i=0;i<h;i++)for(let c=0;c<d;c++){const d=4*((e+i)*o+(t+c));a.data[d]=r,a.data[d+1]=n,a.data[d+2]=l,a.data[d+3]=s}}e.putImageData(a,r,n)}export{x as ImageAnnotator_default};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{textWidth as e}from"./chunk-UVCMV2TL.js";import{escapeHtml as t}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as n}from"./chunk-
|
|
2
|
-
return d("div",{...n,dangerouslySetInnerHTML:r})}function f({columns:t,data:f,onChange:p,onColumnsChange:b,fixedRows:y=!1,minRows:v=15,maxHeight:x="260px",cellStyles:M,onFocusChange:D,onSelectionChange:k}){const C=l(null),E=o().grid,[L
|
|
1
|
+
import{textWidth as e}from"./chunk-UVCMV2TL.js";import{escapeHtml as t}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as n}from"./chunk-TD3ZQD5R.js";import{useBrowserLayoutEffect as r}from"./chunk-ZDXRSY2Y.js";import{useShellStrings as o}from"./chunk-IUVGHHR3.js";import{useRef as l,useState as c,useEffect as a,useCallback as s,useMemo as i}from"react";import{createPortal as u}from"react-dom";import{jsxs as h,jsx as d,Fragment as w}from"react/jsx-runtime";function m(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:e,...n}){const r=i(()=>({__html:t(e)}),[e]);/* @__PURE__ */
|
|
2
|
+
return d("div",{...n,dangerouslySetInnerHTML:r})}function f({columns:t,data:f,onChange:p,onColumnsChange:b,fixedRows:y=!1,minRows:v=15,maxHeight:x="260px",cellStyles:M,onFocusChange:D,onSelectionChange:k}){const C=l(null),E=o().grid,[L,S]=c(null);a(()=>{D?.(L)},[L,D]);const[$,z]=c({}),N=l(null),[A,R]=c({}),O=l(null),[K,T]=c(null),[P,F]=c(null),[H,I]=c(null),[Y,j]=c(null),[X,W]=c(null),q=l(null);r(()=>{const e=q.current;if(!e||e.row!==X?.row||e.col!==X?.col)return;q.current=null;const t=C.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[X]);const[V,B]=c(null),[U,G]=c(null);a(()=>{k?.(V&&U?{anchor:V,end:U}:null)},[V,U,k]);const Z=l(!1),[_,Q]=c(null),J=l(!1),ee=l({a:null,e:null});ee.current={a:V,e:U};const te=V&&U&&(V.row!==U.row||V.col!==U.col),ne=[...f];if(!y)for(;ne.length<v;)ne.push(Array(t.length).fill(""));const re=s((e,n,r)=>{const o=ne.map(e=>[...e]);for(;o.length<=e;)o.push(Array(t.length).fill(""));for(;o[e].length<t.length;)o[e].push("");o[e][n]=r,p(o)},[ne,t.length,p]),oe=s((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ne[e]?.[t]||"")){const r=ne.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}Z.current=!0,e.shiftKey&&V||B({row:t,col:n}),G({row:t,col:n})},[ne,p,V]),le=s((e,t)=>{Z.current&&G({row:e,col:t})},[]);a(()=>{const e=()=>{Z.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),a(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!V||!U)return;const t=window.getSelection();if(t&&t.toString().length>0&&!te)return;const n=Math.min(V.row,U.row),r=Math.max(V.row,U.row),o=Math.min(V.col,U.col),l=Math.max(V.col,U.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ne[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[V,U,ne,te]),a(()=>{const e=e=>{if(!L)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!C.current?.contains(n))return;const r=e.clipboardData?.getData("text/plain");if(!r)return;e.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ne.map(e=>[...e]);for(let e=0;e<o.length;e++){const n=L.row+e;for(;l.length<=n;)l.push(Array(t.length).fill(""));for(;l[n].length<t.length;)l[n].push("");for(let r=0;r<o[e].length;r++){const c=L.col+r;if(c>=t.length)break;t[c].readOnly||(l[n][c]=o[e][r].trim())}}p(y?l:m(l,t.length)),B({row:L.row,col:L.col}),G({row:Math.min(L.row+o.length-1,l.length-1),col:Math.min(L.col+(o[0]?.length||1)-1,t.length-1)})};return window.addEventListener("paste",e),()=>window.removeEventListener("paste",e)},[L,ne,t,p,y]);const ce=s((e,n,r)=>{const o=e.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;e.preventDefault();const c=ne.map(e=>[...e]);for(let e=0;e<l.length;e++){const o=n+e;for(;c.length<=o;)c.push(Array(t.length).fill(""));for(;c[o].length<t.length;)c[o].push("");for(let n=0;n<l[e].length;n++){const a=r+n;if(a>=t.length)break;t[a].readOnly||(c[o][a]=l[e][n].trim())}}p(y?c:m(c,t.length))},[ne,t,p,y]),ae=s((e,n,r)=>{let o=n,l=r;if("Tab"===e.key)e.preventDefault(),l=e.shiftKey?r-1:r+1,l>=t.length&&(l=0,o=n+1),l<0&&(l=t.length-1,o=n-1);else if("Enter"===e.key)e.preventDefault(),o=e.shiftKey?n-1:n+1;else if("ArrowDown"===e.key)e.preventDefault(),o=n+1;else if("ArrowUp"===e.key)e.preventDefault(),o=n-1;else if("ArrowLeft"===e.key)e.preventDefault(),l=r-1;else{if("ArrowRight"!==e.key){if("Delete"===e.key||"Backspace"===e.key){const o=e.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(e.preventDefault(),re(n,r,"")));if(e.preventDefault(),V&&U){const e=Math.min(V.row,U.row),n=Math.max(V.row,U.row),r=Math.min(V.col,U.col),o=Math.max(V.col,U.col),l=ne.map(e=>[...e]);for(let c=e;c<=n;c++)for(let e=r;e<=o;e++)l[c]&&!t[e]?.readOnly&&(l[c][e]="");p(l)}else re(n,r,"");return}return}e.preventDefault(),l=r+1}for(;l>=0&&l<t.length&&t[l].readOnly;)l+="Tab"===e.key&&e.shiftKey?-1:1;if(o>=0&&o<ne.length&&l>=0&&l<t.length){const e=C.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),S({row:o,col:l}),W(null),B({row:o,col:l}),G({row:o,col:l}))}},[t,ne,ne.length,re,V,U,p]),se=s(e=>{if(!y&&e>=ne.length-2){const e=ne.map(e=>[...e]);for(let n=0;n<5;n++)e.push(Array(t.length).fill(""));p(e)}},[y,ne,t.length,p]),[ie,ue]=c(null);a(()=>{if(!ie)return;const e=()=>ue(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ie]);const he=s(e=>{const n=ne.map(e=>[...e]);n.splice(e,0,Array(t.length).fill("")),p(n)},[ne,t.length,p]),de=s(e=>{if(ne.length<=1)return;const t=ne.filter((t,n)=>n!==e);p(t)},[ne,p]),we=s(e=>{const t=ne.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[ne,p]),me=s(e=>{if(t.length<=1)return;const n=ne.map(t=>{const n=[...t];return n.splice(e,1),n});p(n)},[ne,t.length,p]),ge=s((e,t)=>{e.preventDefault(),y||ue({x:e.clientX,y:e.clientY,items:[{label:E.insertRowAbove,onClick:()=>{he(t),ue(null)}},{label:E.insertRowBelow,onClick:()=>{he(t+1),ue(null)}},{label:E.deleteRow(t+1),onClick:()=>{de(t),ue(null)}}]})},[y,he,de,E]),fe=s((e,n)=>{e.preventDefault(),y||ue({x:e.clientX,y:e.clientY,items:[{label:E.insertColumnLeft,onClick:()=>{we(n),ue(null)}},{label:E.insertColumnRight,onClick:()=>{we(n+1),ue(null)}},{label:E.deleteColumn(String(t[n]?.title||n+1)),onClick:()=>{me(n),ue(null)}}]})},[y,t,we,me,E]),pe=e=>$[e]??t[e]?.width??150;a(()=>{const e=e=>{if(!N.current)return;const t=e.clientX-N.current.startX,n=Math.max(40,N.current.startW+t);z(e=>({...e,[N.current.col]:n}))},n=()=>{if(N.current&&b){const e=t.map((e,t)=>({...e,width:$[t]??e.width}));e[N.current.col]={...e[N.current.col],width:$[N.current.col]??t[N.current.col].width},b(e)}N.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)}},[t,$,b]);const be=e=>A[e]??28;a(()=>{const e=e=>{if(!O.current)return;const t=e.clientY-O.current.startY,n=Math.max(20,O.current.startH+t);R(e=>({...e,[O.current.row]:n}))},t=()=>{O.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=s(n=>{const r="12px ui-monospace, SFMono-Regular, Menlo, monospace";if(null===e("",r))return;let o=0;for(const t of ne){const l=String(t[n]??"").replace(/<[^>]*>/g,""),c=e(l,r)??0;c>o&&(o=c)}const l=e(t[n]?.title??"",r)??0;l>o&&(o=l);const c=Math.max(40,Math.ceil(o+24));if(z(e=>({...e,[n]:c})),b){const e=t.map((e,t)=>({...e,width:t===n?c:$[t]??e.width}));b(e)}},[ne,t,$,b]),ve=s(e=>{R(t=>{const n={...t};return delete n[e],n})},[]),xe=s(e=>{const{a:n,e:r}=ee.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,h=a;e.row>l?i=e.row:e.row<o&&(s=e.row),e.col>a?h=e.col:e.col<c&&(u=e.col);const d=l-o+1,w=a-c+1,m=ne.map(e=>[...e]);for(;m.length<=i;)m.push(Array(t.length).fill(""));for(const e of m)for(;e.length<=h;)e.push("");function g(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=g(Array.from({length:d},(e,n)=>m[o+n]?.[t]??""));if(r){const c=parseFloat(m[l]?.[t]??"0"),a=parseFloat(m[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=m[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=g(Array.from({length:w},(t,n)=>m[e]?.[c+n]??""));if(r){const o=parseFloat(m[e]?.[a]??"0"),l=parseFloat(m[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=m[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=m[o+r]?.[c+l]??""}m[e][t]=n}p(m),B({row:s,col:u}),G({row:i,col:h})},[ne,t.length,p]);a(()=>{const e=e=>{if(!J.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);Q({row:r,col:o})},t=()=>{J.current&&_&&xe(_),J.current=!1,Q(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[_,xe]);const Me=e=>{e.preventDefault(),e.stopPropagation(),J.current=!0,document.body.style.cursor="crosshair"},De=l(null),[ke,Ce]=c(0),[Ee,Le]=c(800);a(()=>{const e=De.current;if(!e)return;const t=()=>Le(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Se=ne.length>100,$e=Se?Math.max(0,Math.floor(ke/28)-20):0,ze=Se?Math.min(ne.length,Math.ceil((ke+Ee)/28)+20):ne.length,Ne=i(()=>ne.slice($e,ze),[ne,$e,ze]),Ae=28*$e,Re=28*(ne.length-ze),Oe="px-2 h-8 text-left text-xs font-medium text-ink-faint uppercase bg-gray-100 border-b border-r border-line select-none";/* @__PURE__ */
|
|
3
3
|
return h("div",{ref:De,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:x,height:x},onScroll:e=>Ce(e.target.scrollTop),children:[
|
|
4
4
|
/* @__PURE__ */h("table",{ref:C,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+t.reduce((e,n)=>e+pe(t.indexOf(n)),0)},children:[
|
|
5
5
|
/* @__PURE__ */h("colgroup",{children:[
|
|
6
6
|
/* @__PURE__ */d("col",{style:{width:36}}),t.map((e,t)=>/* @__PURE__ */d("col",{style:{width:pe(t)}},e.key))]}),
|
|
7
7
|
/* @__PURE__ */d("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */h("tr",{children:[
|
|
8
|
-
/* @__PURE__ */d("th",{className:`${n} ${
|
|
9
|
-
return h("th",{className:`${n} ${
|
|
10
|
-
/* @__PURE__ */d("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),
|
|
11
|
-
/* @__PURE__ */h("tbody",{children:[
|
|
8
|
+
/* @__PURE__ */d("th",{className:`${n} ${Oe} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{B({row:0,col:0}),G({row:ne.length-1,col:t.length-1})},title:E.selectAll,children:"#"}),t.map((e,r)=>{const o=V&&U&&Math.min(V.col,U.col)<=r&&r<=Math.max(V.col,U.col)&&0===Math.min(V.row,U.row)&&Math.max(V.row,U.row)===ne.length-1;/* @__PURE__ */
|
|
9
|
+
return h("th",{className:`${n} ${Oe} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${Y===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>I(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),j(t)})(e,r),onDrop:()=>(e=>{if(null===H||H===e)return I(null),void j(null);const n=ne.map(t=>{const n=[...t],[r]=n.splice(H,1);return n.splice(e,0,r),n});if(p(n),b){const n=[...t],[r]=n.splice(H,1);n.splice(e,0,r),b(n)}I(null),j(null)})(r),onDragEnd:()=>{I(null),j(null)},onClick:e=>{e.shiftKey&&V||B({row:0,col:r}),G({row:ne.length-1,col:r})},onContextMenu:e=>fe(e,r),children:[e.title,
|
|
10
|
+
/* @__PURE__ */d("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),N.current={col:t,startX:e.clientX,startW:pe(t)},document.body.style.cursor="col-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:E.resize})]},e.key)})]})}),
|
|
11
|
+
/* @__PURE__ */h("tbody",{children:[Ae>0&&/* @__PURE__ */d("tr",{style:{height:Ae}}),Ne.map((e,n)=>{const r=$e+n,o=V&&U&&Math.min(V.row,U.row)<=r&&r<=Math.max(V.row,U.row)&&0===Math.min(V.col,U.col)&&Math.max(V.col,U.col)===t.length-1;/* @__PURE__ */
|
|
12
12
|
return h("tr",{style:{height:be(r)},children:[
|
|
13
|
-
/* @__PURE__ */h("td",{className:`relative px-1 py-1 text-center text-2xs text-ink-faintest border-b border-r border-line bg-surface-sunken select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${
|
|
14
|
-
/* @__PURE__ */d("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),
|
|
13
|
+
/* @__PURE__ */h("td",{className:`relative px-1 py-1 text-center text-2xs text-ink-faintest border-b border-r border-line bg-surface-sunken select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${P===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>T(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),F(t)})(e,r),onDrop:()=>(e=>{if(null===K||K===e)return T(null),void F(null);const t=ne.map(e=>[...e]),[n]=t.splice(K,1);t.splice(e,0,n),p(t),T(null),F(null)})(r),onDragEnd:()=>{T(null),F(null)},onClick:e=>{e.shiftKey&&V||B({row:r,col:0}),G({row:r,col:t.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
|
|
14
|
+
/* @__PURE__ */d("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),O.current={row:t,startY:e.clientY,startH:be(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ve(r)},title:E.resize})]}),t.map((t,n)=>{const o=V&&U&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(V,U,r,n),l=X?.row===r&&X?.col===n&&!t.readOnly,c=L?.row===r&&L?.col===n,a=M?.[`${r}:${n}`],s=V&&U?Math.max(V.row,U.row):-1,i=V&&U?Math.max(V.col,U.col):-1,u=V&&U&&r===s&&n===i,w=J.current&&_&&V&&U&&(()=>{const e=Math.min(V.row,U.row),t=Math.max(V.row,U.row),o=Math.min(V.col,U.col),l=Math.max(V.col,U.col);let c=e,a=t,s=o,i=l;return _.row>t?a=_.row:_.row<e&&(c=_.row),_.col>l?i=_.col:_.col<o&&(s=_.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",f=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
|
|
15
15
|
return h("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${t.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${w?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){oe(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>le(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:e=>{e.target!==e.currentTarget||t.readOnly||W({row:r,col:n})},children:[
|
|
16
|
-
/* @__PURE__ */d(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===t.align?"text-right":"center"===t.align?"text-center":""} ${t.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>oe(e,r,n),onMouseEnter:()=>le(r,n),onDoubleClick:()=>{t.readOnly||W({row:r,col:n})},onFocus:()=>{
|
|
16
|
+
/* @__PURE__ */d(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===t.align?"text-right":"center"===t.align?"text-center":""} ${t.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>oe(e,r,n),onMouseEnter:()=>le(r,n),onDoubleClick:()=>{t.readOnly||W({row:r,col:n})},onFocus:()=>{S({row:r,col:n}),Z.current||(B({row:r,col:n}),G({row:r,col:n}))},onBlur:t=>{const o=t.currentTarget.textContent||"";o!==(e[n]||"")&&re(r,n,o),W(null)},onInput:()=>se(r),onPaste:e=>ce(e,r,n),onKeyDown:e=>{if(!(l||t.readOnly||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey))return e.preventDefault(),re(r,n,e.key),q.current={row:r,col:n},void W({row:r,col:n});ae(e,r,n)},text:e[n]||""}),u&&/* @__PURE__ */d("div",{onMouseDown:Me,title:E.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Re>0&&/* @__PURE__ */d("tr",{style:{height:Re}})]})]}),ie&&u(
|
|
17
17
|
/* @__PURE__ */h(w,{children:[
|
|
18
18
|
/* @__PURE__ */d("div",{className:"fixed inset-0 z-(--z-popup)",onPointerDown:()=>ue(null)}),
|
|
19
19
|
/* @__PURE__ */d("div",{className:"fixed z-(--z-popup) bg-surface rounded-lg shadow-lg border border-line py-1 min-w-[160px]",style:{left:ie.x,top:ie.y},children:ie.items.map((e,t)=>/* @__PURE__ */d("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-ink hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{f as EditableGrid,m as withSpareRow};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Tooltip as n}from"./chunk-
|
|
1
|
+
import{Tooltip as n}from"./chunk-F2RAIGCG.js";import{useShellStrings as r,useShellLocale as e}from"./chunk-IUVGHHR3.js";import{formatPlain as t}from"./chunk-C3QOHMR6.js";import{jsx as i,jsxs as o}from"react/jsx-runtime";var a=["inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-md px-1","text-2xs font-medium normal-case leading-none tabular-nums tracking-normal","ring-1 ring-inset ring-[color:color-mix(in_srgb,currentColor_20%,transparent)]"].join(" ");function s({count:s,label:c,active:l=!1,showZero:m=!1,className:u=""}){const d=r().count,h=e();if(!(s>0||0===s&&m))return null;const f=c??d.items(s);/* @__PURE__ */
|
|
2
2
|
return i(n,{content:f,describe:!1,className:`relative inline-flex shrink-0 ${u}`.trim(),children:/* @__PURE__ */o("span",{"data-item-count":"",className:`${a} ${l?"bg-blue-100 text-blue-700":"bg-[color:color-mix(in_srgb,var(--ink-faint)_14%,transparent)] text-gray-600"}`,children:[
|
|
3
3
|
/* @__PURE__ */i("span",{"aria-hidden":"true",children:t(s,h)}),
|
|
4
4
|
/* @__PURE__ */i("span",{className:"sr-only",children:f})]})})}export{s as ItemCount};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{AccessibleTable as t}from"./chunk-
|
|
1
|
+
import{AccessibleTable as t}from"./chunk-ZDFMYAQB.js";import{arcPath as e}from"./chunk-VFC6QUEN.js";import{useHighlight as o}from"./chunk-CNYAHYE6.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{CHART_INK as r,resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as l,useShellLocale as i}from"./chunk-IUVGHHR3.js";import{formatPlain as s}from"./chunk-C3QOHMR6.js";import{useState as c}from"react";import{jsx as d,jsxs as m}from"react/jsx-runtime";function h(t,e,o,n){const r=(t,o)=>{const n=e[t]?.[o];return"number"==typeof n&&Number.isFinite(n)?n:0},a=t.map((e,o)=>t.reduce((t,e,n)=>t+r(o,n)+r(n,o),0)),l=Math.max(2,o),i=t.length>l,s=i?t.map((t,e)=>e).sort((t,e)=>a[e]-a[t]).slice(0,l-1).sort((t,e)=>t-e):t.map((t,e)=>e),c=new Map(s.map((t,e)=>[t,e])),d=i?s.length:-1,m=i?[...s.map(e=>t[e]),n]:[...t],h=m.map(()=>m.map(()=>0));let u=0;t.forEach((e,o)=>t.forEach((t,e)=>{const n=c.get(o)??d,a=c.get(e)??d;n!==d||a!==d?h[n][a]+=r(o,e):u+=r(o,e)}));const f=m.map((t,e)=>m.reduce((t,o,n)=>t+h[e][n]+h[n][e],0));return d>=0&&(f[d]+=u),{labels:m,matrix:h,totals:f,otherIndex:d,foldedCount:i?t.length-s.length:0}}function u({labels:u,matrix:f,size:p=340,maxNodes:x=8,padAngle:g=.04,arcWidth:b=12,formatValue:k,className:v,emptyLabel:M}){const $=l().charts,w=i(),N=k??(t=>s(t,w)),F=M??$.noFlows,[j,y]=c(null),{highlighted:E}=o(),C=h(u,f,x,$.other),{labels:I,matrix:A,otherIndex:Q,foldedCount:z}=C,H=(t,e)=>A[t]?.[e]??0,V=t=>t===Q?r.muted:a(t),L=C.totals,O=I.map((t,e)=>e).sort((t,e)=>L[e]-L[t]),R=O.reduce((t,e)=>t+L[e],0);if(R<=0)/* @__PURE__ */return d("p",{className:`text-sm text-gray-500 ${v??""}`,children:F});const U=p/2,W=p/2,Y=p/2-44,B=Y-b,D=g*O.length,P=/* @__PURE__ */new Map;let T=-Math.PI/2;O.forEach((t,e)=>{const o=L[t]/R*(2*Math.PI-D);P.set(t,{start:T,end:T+o,slot:e}),T+=o+g});const Z=/* @__PURE__ */new Map,G=[];for(const t of O)for(const e of O){const o=H(t,e);if(o<=0)continue;const n=P.get(t),r=o/Math.max(1,L[t])*(n.end-n.start),a=Z.get(t)??0;Z.set(t,a+r),G.push({from:t,to:e,value:o,a:n.start+a+r/2,b:P.get(e).start+(P.get(e).end-P.get(e).start)/2})}const S=(t,e)=>[U+e*Math.cos(t),W+e*Math.sin(t)],q="arc"===j?.kind?j.index:void 0,J="ribbon"===j?.kind?G[j.index]:void 0;/* @__PURE__ */
|
|
2
2
|
return m("div",{className:`relative ${v??""}`,children:[
|
|
3
|
-
/* @__PURE__ */m("svg",{width:"100%",height:p,viewBox:`0 0 ${p} ${p}`,role:"img","aria-label":$.chord(O.length),onMouseLeave:()=>
|
|
4
|
-
return d("path",{d:`M${o},${n} Q${U},${W} ${r},${a}`,fill:"none",stroke:l,strokeWidth:Math.max(1,t.value/R*p*.9),strokeOpacity:null===i||i?.34:.07,strokeLinecap:"round",onMouseEnter:()=>
|
|
5
|
-
return m("g",{onMouseEnter:()=>
|
|
3
|
+
/* @__PURE__ */m("svg",{width:"100%",height:p,viewBox:`0 0 ${p} ${p}`,role:"img","aria-label":$.chord(O.length),onMouseLeave:()=>y(null),children:[G.map((t,e)=>{const[o,n]=S(t.a,B),[r,a]=S(t.b,B),l=V(t.from),i=((t,e)=>j?"ribbon"===j.kind?j.index===e:j.index===t.from||j.index===t.to:null!==E?I[t.from]===E||I[t.to]===E:null)(t,e);/* @__PURE__ */
|
|
4
|
+
return d("path",{d:`M${o},${n} Q${U},${W} ${r},${a}`,fill:"none",stroke:l,strokeWidth:Math.max(1,t.value/R*p*.9),strokeOpacity:null===i||i?.34:.07,strokeLinecap:"round",onMouseEnter:()=>y({kind:"ribbon",index:e})},`${I[t.from]}→${I[t.to]}`)}),O.map(t=>{const o=P.get(t),n=(o.start+o.end)/2,[a,l]=S(n,Y+16),i=(t=>j?"arc"===j.kind?j.index===t:G[j.index].from===t||G[j.index].to===t:null!==E?I[t]===E:null)(t);/* @__PURE__ */
|
|
5
|
+
return m("g",{onMouseEnter:()=>y({kind:"arc",index:t}),children:[
|
|
6
6
|
/* @__PURE__ */d("path",{d:e(U,W,B,Y,o.start,o.end),fill:V(t),fillOpacity:null===i||i?1:.45}),
|
|
7
|
-
/* @__PURE__ */d("text",{x:a,y:l+4,fontSize:11,fill:r.label,textAnchor:Math.cos(n)>.15?"start":Math.cos(n)<-.15?"end":"middle",children:I[t]})]},t)})]}),
|
|
8
|
-
/* @__PURE__ */d(t,{caption:$.chord(O.length),head:[$.tableFrom,$.tableTo,$.value],rows:
|
|
7
|
+
/* @__PURE__ */d("text",{x:a,y:l+4,fontSize:11,fill:r.label,textAnchor:Math.cos(n)>.15?"start":Math.cos(n)<-.15?"end":"middle",children:I[t]})]},t)})]}),z>0&&/* @__PURE__ */d("p",{className:"mt-1 text-xs text-ink-faint",children:$.chordFolded(z)}),void 0!==q&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:I[q],rows:[{key:"total",label:$.totalFlow,color:V(q),value:N(L[q])}]})}),J&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:`${I[J.from]} → ${I[J.to]}`,rows:[{key:"value",label:$.flow,color:V(J.from),value:N(J.value)}]})}),
|
|
8
|
+
/* @__PURE__ */d(t,{caption:$.chord(O.length),head:[$.tableFrom,$.tableTo,$.value],rows:G.map(t=>[I[t.from],I[t.to],N(t.value)])})]})}export{u as ChordChart,h as foldChord};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{swallowPress as e,describedByWith as i,OffWithReason as r}from"./chunk-
|
|
1
|
+
import{swallowPress as e,describedByWith as i,OffWithReason as r}from"./chunk-BUFAJJDZ.js";import{Icon as a}from"./chunk-ISVODSRP.js";import{OneLineLabel as o}from"./chunk-TD3ZQD5R.js";import{Tooltip as s}from"./chunk-F2RAIGCG.js";import{useShellStrings as n}from"./chunk-IUVGHHR3.js";import{useId as l,Fragment as d}from"react";import{jsx as t,jsxs as c}from"react/jsx-runtime";function b({items:b,onChange:h,label:m,className:u="","aria-labelledby":f,"aria-describedby":p}){const w=n().displayChips,g=l();/* @__PURE__ */
|
|
2
2
|
return t("div",{role:"group","aria-label":f?void 0:m,"aria-labelledby":f,"aria-describedby":p,className:`flex flex-wrap gap-2 ${u}`.trim(),children:b.map((n,l)=>{const b=`${g}-${l}-state`,m=`${g}-${l}-reason`,u=Boolean(n.disabled)&&null!=n.disabledReason&&""!==n.disabledReason,f=/* @__PURE__ */c("button",{type:"button","aria-pressed":n.shown,disabled:!(!n.disabled||u)||void 0,"aria-disabled":!!u||void 0,"aria-describedby":i(b,u?m:void 0),onClick:u?e:()=>h(n.id,!n.shown),className:"inline-flex h-6 max-w-full shrink-0 items-center gap-1 whitespace-nowrap rounded-full border pl-2 pr-3 text-xs font-medium transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(n.shown?"border-blue-200 bg-accent-tint text-blue-700 hover:bg-blue-100":"border-line bg-surface text-ink-faint hover:bg-row-hover hover:text-ink-strongest"),children:[
|
|
3
3
|
/* @__PURE__ */t(a,{name:n.shown?"eye":"eye-off",className:"h-4 w-4 shrink-0",strokeWidth:"1.75"}),
|
|
4
4
|
/* @__PURE__ */t(o,{children:n.label})]}),p=/* @__PURE__ */t("span",{id:b,className:"sr-only",children:n.shown?w.shown:w.hidden});/* @__PURE__ */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useInsideTooltip as e,Tooltip as n}from"./chunk-
|
|
1
|
+
import{useInsideTooltip as e,Tooltip as n}from"./chunk-F2RAIGCG.js";import{useRef as r,useState as t}from"react";import{jsx as c}from"react/jsx-runtime";var i="whitespace-nowrap";function l({children:i}){const l=e(),o=r(null),[a,s]=t(!1),m=/* @__PURE__ */c("span",{ref:o,className:"min-w-0 truncate",onMouseEnter:()=>{const e=o.current;s(!!e&&e.scrollWidth>e.clientWidth+1)},children:i});return l?m:/* @__PURE__ */c(n,{content:a?i:null,describe:!1,className:"relative inline-flex min-w-0 max-w-full",children:m})}export{l as OneLineLabel,i as TH_ONE_LINE};
|