@12-apps/ui 6.38.0 → 6.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/components/data-display/DataGrid/DataGrid.body.js +3 -2
- package/dist/_internal/components/data-display/DataGrid/DataGrid.cells.js +2 -1
- package/dist/_internal/components/data-display/DataGrid/DataGrid.js +4 -4
- package/dist/_internal/components/data-display/DataGrid/DataGrid.model.js +2 -1
- package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +19 -19
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +26 -26
- package/dist/_internal/components/data-display/DataViews/SaveViewModal.js +5 -5
- package/dist/_internal/components/data-display/DataViews/base-list-card-geometry.js +4 -4
- package/dist/_internal/components/data-display/DataViews/base-list-card-slots.js +3 -3
- package/dist/_internal/components/data-display/DataViews/base-list-card.js +5 -5
- package/dist/_internal/components/data-display/DataViews/data-views-columns.js +2 -2
- package/dist/_internal/components/data-display/DataViews/data-views-display-panel.js +3 -3
- package/dist/_internal/components/data-display/DataViews/data-views-display-tabs.js +2 -2
- package/dist/_internal/components/data-display/DataViews/data-views-grid-bodies.js +8 -8
- package/dist/_internal/components/data-display/DataViews/data-views-grid-helpers.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +16 -16
- package/dist/_internal/components/data-display/DataViews/data-views-layout-context.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-overflow-costs.js +4 -3
- package/dist/_internal/components/data-display/DataViews/data-views-overflow.js +3 -2
- package/dist/_internal/components/data-display/DataViews/data-views-scope-tabs.js +2 -2
- package/dist/_internal/components/data-display/DataViews/data-views-shell-toolbar.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-toolbar.js +5 -5
- package/dist/_internal/components/data-display/DataViews/list-card-rails.js +2 -2
- package/dist/_internal/components/data-display/DataViews/use-data-views-state.js +3 -3
- package/dist/_internal/components/data-display/FleetMap/FleetBody.js +9 -9
- package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js +8 -8
- package/dist/_internal/components/data-display/FleetMap/FleetMap.js +10 -10
- package/dist/_internal/components/data-display/LazyImage/LazyImage.js +1 -1
- package/dist/_internal/components/data-display/MapPreview/MapDecorations.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/MapPreview.hooks.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/MapPreview.js +7 -7
- package/dist/_internal/components/data-display/MapPreview/MapTiles.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/StaticMapView.js +4 -4
- package/dist/_internal/components/data-display/MapPreview/mapProjection.js +3 -3
- package/dist/_internal/components/data-display/MapPreview/useMapPreview.js +3 -3
- package/dist/_internal/components/data-display/Table/Table.helpers.js +5 -3
- package/dist/_internal/components/data-display/Table/Table.hooks.js +2 -1
- package/dist/_internal/components/data-display/Table/Table.js +4 -4
- package/dist/_internal/components/data-display/Table/TableParts.hooks.js +4 -2
- package/dist/_internal/components/data-display/Table/TableParts.js +4 -2
- package/dist/_internal/components/data-display/index.js +19 -19
- package/dist/_internal/components/form/Calendar/Calendar.js +5 -4
- package/dist/_internal/components/form/Calendar/CalendarDay.js +2 -1
- package/dist/_internal/components/form/Calendar/CalendarDayCell.js +3 -2
- package/dist/_internal/components/form/Calendar/CalendarMonth.js +4 -3
- package/dist/_internal/components/form/DateRangePicker/DateRangePicker.js +5 -5
- package/dist/_internal/components/form/Switch/Switch.js +4 -4
- package/dist/_internal/components/form/Switch/Switch.metrics.js +5 -1
- package/dist/_internal/components/form/Switch/Switch.parts.js +3 -3
- package/dist/_internal/components/form/Switch/Switch.styles.js +2 -2
- package/dist/_internal/components/form/index.js +9 -9
- package/dist/_internal/components/index.js +38 -38
- package/dist/_internal/components/layout/CardGrid/CardGrid.js +2 -1
- package/dist/_internal/components/layout/Resizable/Resizable.helpers.js +8 -3
- package/dist/_internal/components/layout/Resizable/Resizable.hooks.js +3 -2
- package/dist/_internal/components/layout/Resizable/Resizable.js +4 -3
- package/dist/_internal/components/layout/ScrollArea/ScrollArea.helpers.js +1 -1
- package/dist/_internal/components/layout/ScrollArea/ScrollArea.js +2 -2
- package/dist/_internal/components/layout/index.js +5 -5
- package/dist/_internal/components/utility/InfiniteScroll/InfiniteScroll.hooks.js +1 -1
- package/dist/_internal/components/utility/InfiniteScroll/InfiniteScroll.js +4 -3
- package/dist/_internal/components/utility/InfiniteScroll/InfiniteScroll.parts.js +2 -1
- package/dist/_internal/components/utility/VirtualList/VirtualList.hooks.js +6 -3
- package/dist/_internal/components/utility/VirtualList/VirtualList.js +3 -2
- package/dist/_internal/components/utility/index.js +5 -5
- package/dist/{chunk-J2DAQQQH.js → chunk-222HN7GK.js} +33 -64
- package/dist/chunk-222HN7GK.js.map +1 -0
- package/dist/{chunk-MR2HKBHS.js → chunk-27LOJVR3.js} +2 -2
- package/dist/{chunk-S3D5VBHW.js → chunk-3YOXVNO4.js} +7 -7
- package/dist/{chunk-CZIX4BW2.js → chunk-4ALF5PB5.js} +3 -3
- package/dist/{chunk-XJPJ6ESI.js → chunk-4OAKGKK5.js} +3 -3
- package/dist/{chunk-4CHROSWR.js → chunk-5ETBB2DG.js} +2 -2
- package/dist/{chunk-ATSHKSSD.js → chunk-5KNDAC24.js} +20 -7
- package/dist/chunk-5KNDAC24.js.map +1 -0
- package/dist/{chunk-ULTOQ6ZV.js → chunk-5LWB4BYX.js} +80 -89
- package/dist/chunk-5LWB4BYX.js.map +1 -0
- package/dist/{chunk-46UPILLK.js → chunk-5NT2M2JI.js} +2 -2
- package/dist/{chunk-H5BEWPEY.js → chunk-6N2EDWMG.js} +2 -2
- package/dist/{chunk-GJQYM3PM.js → chunk-6PU3JYVY.js} +2 -2
- package/dist/{chunk-PUBPZOQJ.js → chunk-AG3DY5TH.js} +8 -5
- package/dist/chunk-AG3DY5TH.js.map +1 -0
- package/dist/{chunk-PPRV4LTM.js → chunk-BWHOCNGW.js} +4 -4
- package/dist/chunk-BWHOCNGW.js.map +1 -0
- package/dist/{chunk-TUBCN4DJ.js → chunk-CB6DTWD5.js} +7 -7
- package/dist/chunk-CB6DTWD5.js.map +1 -0
- package/dist/{chunk-ZAY6OA6F.js → chunk-D4FZ3ANG.js} +15 -5
- package/dist/chunk-D4FZ3ANG.js.map +1 -0
- package/dist/{chunk-Y7F5JBAT.js → chunk-DDRKYNPB.js} +2 -2
- package/dist/{chunk-DLJGBJZW.js → chunk-DGMDQHMI.js} +16 -9
- package/dist/chunk-DGMDQHMI.js.map +1 -0
- package/dist/{chunk-IAGOUTI6.js → chunk-DNT5PZLF.js} +21 -12
- package/dist/chunk-DNT5PZLF.js.map +1 -0
- package/dist/{chunk-DZA7RSLX.js → chunk-DVSO3EG6.js} +19 -11
- package/dist/chunk-DVSO3EG6.js.map +1 -0
- package/dist/{chunk-OS6KPL4D.js → chunk-EHYI2WCJ.js} +4 -4
- package/dist/{chunk-NB3FGWU4.js → chunk-EQXIW5MQ.js} +2 -2
- package/dist/{chunk-C66RGVAS.js → chunk-ERY6D2OV.js} +6 -4
- package/dist/chunk-ERY6D2OV.js.map +1 -0
- package/dist/{chunk-M2JTIH5M.js → chunk-F44R7US6.js} +2 -2
- package/dist/{chunk-AROBXRC5.js → chunk-F7JTIHV5.js} +18 -7
- package/dist/chunk-F7JTIHV5.js.map +1 -0
- package/dist/{chunk-T7DE44SP.js → chunk-FF2D7V7T.js} +6 -4
- package/dist/chunk-FF2D7V7T.js.map +1 -0
- package/dist/{chunk-XJJXBUPN.js → chunk-FX26DAFF.js} +2 -2
- package/dist/{chunk-R6SN73RX.js → chunk-GLHNMTP6.js} +7 -7
- package/dist/{chunk-YU26GBNX.js → chunk-H3AQQOTI.js} +9 -4
- package/dist/chunk-H3AQQOTI.js.map +1 -0
- package/dist/{chunk-HTZNB6IV.js → chunk-H5ZTIELC.js} +23 -8
- package/dist/chunk-H5ZTIELC.js.map +1 -0
- package/dist/{chunk-GSFNH4C5.js → chunk-HBP2OU4Q.js} +15 -8
- package/dist/chunk-HBP2OU4Q.js.map +1 -0
- package/dist/{chunk-I4QA2F4L.js → chunk-HBRQPG7H.js} +5 -5
- package/dist/{chunk-HGMBY5LP.js → chunk-HQWJUHR4.js} +18 -11
- package/dist/chunk-HQWJUHR4.js.map +1 -0
- package/dist/{chunk-CNQUCNEA.js → chunk-I3F4C5SS.js} +3 -3
- package/dist/{chunk-UFJYJHQI.js → chunk-J5VWGQSR.js} +2 -2
- package/dist/{chunk-MTFCPPZ5.js → chunk-JWZJSXI5.js} +3 -2
- package/dist/chunk-JWZJSXI5.js.map +1 -0
- package/dist/{chunk-4JFL62K3.js → chunk-K7FSTB2K.js} +3 -3
- package/dist/{chunk-FFCJ7NR2.js → chunk-KRQUPE4K.js} +4 -4
- package/dist/{chunk-2OYFTSG4.js → chunk-KXLUMEDX.js} +2 -2
- package/dist/{chunk-DVAAUWTC.js → chunk-LCHCE2G5.js} +2 -2
- package/dist/{chunk-G4HBNILE.js → chunk-LEHMWJNZ.js} +3 -3
- package/dist/{chunk-P6TNXBDA.js → chunk-MYKWJCR7.js} +9 -9
- package/dist/chunk-MYKWJCR7.js.map +1 -0
- package/dist/{chunk-TQ6FPOPD.js → chunk-ODW2D5PN.js} +39 -30
- package/dist/chunk-ODW2D5PN.js.map +1 -0
- package/dist/{chunk-RZYSKQTS.js → chunk-PCBZYORN.js} +3 -3
- package/dist/{chunk-5OBXEMQO.js → chunk-PRIBOWX4.js} +3 -3
- package/dist/{chunk-F42MJOHM.js → chunk-PVM7XTLZ.js} +64 -62
- package/dist/chunk-PVM7XTLZ.js.map +1 -0
- package/dist/{chunk-3TDVGZZN.js → chunk-QBTBRJ2Q.js} +37 -13
- package/dist/chunk-QBTBRJ2Q.js.map +1 -0
- package/dist/{chunk-2WFDHFK4.js → chunk-QNCWSDXE.js} +26 -11
- package/dist/chunk-QNCWSDXE.js.map +1 -0
- package/dist/{chunk-PQECNGDE.js → chunk-QSRZOXQI.js} +2 -2
- package/dist/{chunk-RHIDWUK7.js → chunk-QUWK7SYN.js} +1 -2
- package/dist/chunk-QUWK7SYN.js.map +1 -0
- package/dist/{chunk-UN5INW6K.js → chunk-R53ZOW4B.js} +8 -4
- package/dist/chunk-R53ZOW4B.js.map +1 -0
- package/dist/{chunk-DCJSHYE5.js → chunk-RSDYS5B3.js} +4 -4
- package/dist/{chunk-N5GVW6RO.js → chunk-S6IWKDWT.js} +2 -2
- package/dist/{chunk-TKC6WHGB.js → chunk-SBIZXZPP.js} +2 -2
- package/dist/{chunk-D5SZXH7Q.js → chunk-TNBJ4DK4.js} +7 -3
- package/dist/chunk-TNBJ4DK4.js.map +1 -0
- package/dist/{chunk-PMOEG36E.js → chunk-XZJM6EPC.js} +8 -6
- package/dist/chunk-XZJM6EPC.js.map +1 -0
- package/dist/{chunk-QF6LTUCE.js → chunk-Y2X7LYIN.js} +4 -4
- package/dist/chunk-Y2X7LYIN.js.map +1 -0
- package/dist/{chunk-UEVHI62V.js → chunk-YCCY77W5.js} +2 -2
- package/dist/{chunk-DF4K5XVW.js → chunk-YZVR5ROE.js} +14 -6
- package/dist/chunk-YZVR5ROE.js.map +1 -0
- package/dist/{chunk-AUSUCZYR.js → chunk-ZBVU2YWV.js} +5 -5
- package/dist/chunk-ZBVU2YWV.js.map +1 -0
- package/dist/{chunk-VZIB5W5L.js → chunk-ZGCPDA3F.js} +2 -2
- package/dist/data-display/DataGrid.js +4 -4
- package/dist/data-display/DataViews.js +29 -29
- package/dist/data-display/FleetMap.js +10 -10
- package/dist/data-display/LazyImage.js +1 -1
- package/dist/data-display/MapPreview.js +7 -7
- package/dist/data-display/Table.js +4 -4
- package/dist/form/Calendar.js +5 -4
- package/dist/form/DateRangePicker.js +5 -5
- package/dist/form/Switch.js +4 -4
- package/dist/layout/CardGrid.js +2 -1
- package/dist/layout/Resizable.js +4 -3
- package/dist/layout/ScrollArea.js +2 -2
- package/dist/native/form/Switch.js +3 -1
- package/dist/native/form/Switch.js.map +1 -1
- package/dist/types/components/data-display/DataGrid/DataGrid.body.d.ts.map +1 -1
- package/dist/types/components/data-display/DataGrid/DataGrid.cells.d.ts +4 -2
- package/dist/types/components/data-display/DataGrid/DataGrid.cells.d.ts.map +1 -1
- package/dist/types/components/data-display/DataGrid/DataGrid.model.d.ts +7 -1
- package/dist/types/components/data-display/DataGrid/DataGrid.model.d.ts.map +1 -1
- package/dist/types/components/data-display/DataGrid/DataGrid.types.d.ts +10 -4
- package/dist/types/components/data-display/DataGrid/DataGrid.types.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-columns.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-grid-helpers.d.ts +2 -0
- package/dist/types/components/data-display/DataViews/data-views-grid-helpers.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-layout-context.d.ts +7 -3
- package/dist/types/components/data-display/DataViews/data-views-layout-context.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-overflow-costs.d.ts +19 -9
- package/dist/types/components/data-display/DataViews/data-views-overflow-costs.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-overflow.d.ts.map +1 -1
- package/dist/types/components/data-display/LazyImage/LazyImage.d.ts.map +1 -1
- package/dist/types/components/data-display/LazyImage/LazyImage.types.d.ts +3 -1
- package/dist/types/components/data-display/LazyImage/LazyImage.types.d.ts.map +1 -1
- package/dist/types/components/data-display/MapPreview/MapTiles.d.ts.map +1 -1
- package/dist/types/components/data-display/MapPreview/mapProjection.d.ts +6 -1
- package/dist/types/components/data-display/MapPreview/mapProjection.d.ts.map +1 -1
- package/dist/types/components/data-display/Table/Table.helpers.d.ts +6 -0
- package/dist/types/components/data-display/Table/Table.helpers.d.ts.map +1 -1
- package/dist/types/components/data-display/Table/Table.hooks.d.ts +9 -1
- package/dist/types/components/data-display/Table/Table.hooks.d.ts.map +1 -1
- package/dist/types/components/data-display/Table/Table.types.d.ts +6 -2
- package/dist/types/components/data-display/Table/Table.types.d.ts.map +1 -1
- package/dist/types/components/data-display/Table/TableParts.d.ts +2 -0
- package/dist/types/components/data-display/Table/TableParts.d.ts.map +1 -1
- package/dist/types/components/form/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/components/form/Calendar/CalendarDay.d.ts.map +1 -1
- package/dist/types/components/form/Calendar/CalendarMonth.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.metrics.d.ts +13 -3
- package/dist/types/components/form/Switch/Switch.metrics.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.styles.d.ts.map +1 -1
- package/dist/types/components/layout/CardGrid/CardGrid.d.ts +9 -7
- package/dist/types/components/layout/CardGrid/CardGrid.d.ts.map +1 -1
- package/dist/types/components/layout/Resizable/Resizable.d.ts.map +1 -1
- package/dist/types/components/layout/Resizable/Resizable.helpers.d.ts +21 -9
- package/dist/types/components/layout/Resizable/Resizable.helpers.d.ts.map +1 -1
- package/dist/types/components/layout/Resizable/Resizable.hooks.d.ts +13 -3
- package/dist/types/components/layout/Resizable/Resizable.hooks.d.ts.map +1 -1
- package/dist/types/components/layout/Resizable/Resizable.types.d.ts +10 -0
- package/dist/types/components/layout/Resizable/Resizable.types.d.ts.map +1 -1
- package/dist/types/components/layout/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/components/layout/ScrollArea/ScrollArea.helpers.d.ts +1 -1
- package/dist/types/components/layout/ScrollArea/ScrollArea.helpers.d.ts.map +1 -1
- package/dist/types/components/layout/ScrollArea/ScrollArea.types.d.ts +4 -1
- package/dist/types/components/layout/ScrollArea/ScrollArea.types.d.ts.map +1 -1
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.d.ts.map +1 -1
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.hooks.d.ts +3 -2
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.hooks.d.ts.map +1 -1
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.parts.d.ts +3 -2
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.parts.d.ts.map +1 -1
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.types.d.ts +9 -0
- package/dist/types/components/utility/InfiniteScroll/InfiniteScroll.types.d.ts.map +1 -1
- package/dist/types/components/utility/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/types/components/utility/VirtualList/VirtualList.hooks.d.ts +24 -28
- package/dist/types/components/utility/VirtualList/VirtualList.hooks.d.ts.map +1 -1
- package/dist/types/components/utility/VirtualList/VirtualList.types.d.ts +17 -0
- package/dist/types/components/utility/VirtualList/VirtualList.types.d.ts.map +1 -1
- package/dist/types-native/components/form/Switch/Switch.metrics.d.ts +13 -3
- package/dist/types-native/components/form/Switch/Switch.metrics.d.ts.map +1 -1
- package/dist/utility/InfiniteScroll.js +4 -3
- package/dist/utility/VirtualList.js +3 -2
- package/package.json +1 -1
- package/src/components/data-display/DataGrid/DataGrid.body.tsx +27 -7
- package/src/components/data-display/DataGrid/DataGrid.cells.tsx +33 -9
- package/src/components/data-display/DataGrid/DataGrid.model.ts +24 -11
- package/src/components/data-display/DataGrid/DataGrid.types.ts +12 -6
- package/src/components/data-display/DataViews/data-views-columns.ts +14 -3
- package/src/components/data-display/DataViews/data-views-grid-helpers.tsx +5 -3
- package/src/components/data-display/DataViews/data-views-layout-context.tsx +12 -9
- package/src/components/data-display/DataViews/data-views-overflow-costs.ts +32 -14
- package/src/components/data-display/DataViews/data-views-overflow.ts +40 -26
- package/src/components/data-display/LazyImage/LazyImage.tsx +5 -3
- package/src/components/data-display/LazyImage/LazyImage.types.ts +3 -1
- package/src/components/data-display/MapPreview/MapTiles.tsx +16 -9
- package/src/components/data-display/MapPreview/mapProjection.ts +10 -5
- package/src/components/data-display/Table/Table.helpers.ts +7 -1
- package/src/components/data-display/Table/Table.hooks.ts +16 -5
- package/src/components/data-display/Table/Table.types.ts +6 -2
- package/src/components/data-display/Table/TableParts.tsx +38 -42
- package/src/components/form/Calendar/Calendar.tsx +4 -2
- package/src/components/form/Calendar/CalendarDay.tsx +6 -3
- package/src/components/form/Calendar/CalendarMonth.tsx +6 -3
- package/src/components/form/Switch/Switch.metrics.ts +19 -5
- package/src/components/form/Switch/Switch.styles.ts +5 -3
- package/src/components/layout/CardGrid/CardGrid.tsx +37 -24
- package/src/components/layout/Resizable/Resizable.helpers.ts +43 -21
- package/src/components/layout/Resizable/Resizable.hooks.ts +17 -9
- package/src/components/layout/Resizable/Resizable.md +9 -5
- package/src/components/layout/Resizable/Resizable.tsx +20 -8
- package/src/components/layout/Resizable/Resizable.types.ts +10 -0
- package/src/components/layout/ScrollArea/ScrollArea.helpers.ts +0 -2
- package/src/components/layout/ScrollArea/ScrollArea.tsx +5 -3
- package/src/components/layout/ScrollArea/ScrollArea.types.ts +4 -1
- package/src/components/utility/InfiniteScroll/InfiniteScroll.hooks.ts +5 -4
- package/src/components/utility/InfiniteScroll/InfiniteScroll.parts.tsx +29 -12
- package/src/components/utility/InfiniteScroll/InfiniteScroll.tsx +11 -5
- package/src/components/utility/InfiniteScroll/InfiniteScroll.types.ts +10 -2
- package/src/components/utility/VirtualList/VirtualList.hooks.ts +101 -112
- package/src/components/utility/VirtualList/VirtualList.tsx +36 -65
- package/src/components/utility/VirtualList/VirtualList.types.ts +20 -3
- package/dist/chunk-2WFDHFK4.js.map +0 -1
- package/dist/chunk-3TDVGZZN.js.map +0 -1
- package/dist/chunk-AROBXRC5.js.map +0 -1
- package/dist/chunk-ATSHKSSD.js.map +0 -1
- package/dist/chunk-AUSUCZYR.js.map +0 -1
- package/dist/chunk-C66RGVAS.js.map +0 -1
- package/dist/chunk-D5SZXH7Q.js.map +0 -1
- package/dist/chunk-DF4K5XVW.js.map +0 -1
- package/dist/chunk-DLJGBJZW.js.map +0 -1
- package/dist/chunk-DZA7RSLX.js.map +0 -1
- package/dist/chunk-F42MJOHM.js.map +0 -1
- package/dist/chunk-GSFNH4C5.js.map +0 -1
- package/dist/chunk-HGMBY5LP.js.map +0 -1
- package/dist/chunk-HTZNB6IV.js.map +0 -1
- package/dist/chunk-IAGOUTI6.js.map +0 -1
- package/dist/chunk-J2DAQQQH.js.map +0 -1
- package/dist/chunk-MTFCPPZ5.js.map +0 -1
- package/dist/chunk-P6TNXBDA.js.map +0 -1
- package/dist/chunk-PMOEG36E.js.map +0 -1
- package/dist/chunk-PPRV4LTM.js.map +0 -1
- package/dist/chunk-PUBPZOQJ.js.map +0 -1
- package/dist/chunk-QF6LTUCE.js.map +0 -1
- package/dist/chunk-RHIDWUK7.js.map +0 -1
- package/dist/chunk-T7DE44SP.js.map +0 -1
- package/dist/chunk-TQ6FPOPD.js.map +0 -1
- package/dist/chunk-TUBCN4DJ.js.map +0 -1
- package/dist/chunk-ULTOQ6ZV.js.map +0 -1
- package/dist/chunk-UN5INW6K.js.map +0 -1
- package/dist/chunk-YU26GBNX.js.map +0 -1
- package/dist/chunk-ZAY6OA6F.js.map +0 -1
- /package/dist/{chunk-MR2HKBHS.js.map → chunk-27LOJVR3.js.map} +0 -0
- /package/dist/{chunk-S3D5VBHW.js.map → chunk-3YOXVNO4.js.map} +0 -0
- /package/dist/{chunk-CZIX4BW2.js.map → chunk-4ALF5PB5.js.map} +0 -0
- /package/dist/{chunk-XJPJ6ESI.js.map → chunk-4OAKGKK5.js.map} +0 -0
- /package/dist/{chunk-4CHROSWR.js.map → chunk-5ETBB2DG.js.map} +0 -0
- /package/dist/{chunk-46UPILLK.js.map → chunk-5NT2M2JI.js.map} +0 -0
- /package/dist/{chunk-H5BEWPEY.js.map → chunk-6N2EDWMG.js.map} +0 -0
- /package/dist/{chunk-GJQYM3PM.js.map → chunk-6PU3JYVY.js.map} +0 -0
- /package/dist/{chunk-Y7F5JBAT.js.map → chunk-DDRKYNPB.js.map} +0 -0
- /package/dist/{chunk-OS6KPL4D.js.map → chunk-EHYI2WCJ.js.map} +0 -0
- /package/dist/{chunk-NB3FGWU4.js.map → chunk-EQXIW5MQ.js.map} +0 -0
- /package/dist/{chunk-M2JTIH5M.js.map → chunk-F44R7US6.js.map} +0 -0
- /package/dist/{chunk-XJJXBUPN.js.map → chunk-FX26DAFF.js.map} +0 -0
- /package/dist/{chunk-R6SN73RX.js.map → chunk-GLHNMTP6.js.map} +0 -0
- /package/dist/{chunk-I4QA2F4L.js.map → chunk-HBRQPG7H.js.map} +0 -0
- /package/dist/{chunk-CNQUCNEA.js.map → chunk-I3F4C5SS.js.map} +0 -0
- /package/dist/{chunk-UFJYJHQI.js.map → chunk-J5VWGQSR.js.map} +0 -0
- /package/dist/{chunk-4JFL62K3.js.map → chunk-K7FSTB2K.js.map} +0 -0
- /package/dist/{chunk-FFCJ7NR2.js.map → chunk-KRQUPE4K.js.map} +0 -0
- /package/dist/{chunk-2OYFTSG4.js.map → chunk-KXLUMEDX.js.map} +0 -0
- /package/dist/{chunk-DVAAUWTC.js.map → chunk-LCHCE2G5.js.map} +0 -0
- /package/dist/{chunk-G4HBNILE.js.map → chunk-LEHMWJNZ.js.map} +0 -0
- /package/dist/{chunk-RZYSKQTS.js.map → chunk-PCBZYORN.js.map} +0 -0
- /package/dist/{chunk-5OBXEMQO.js.map → chunk-PRIBOWX4.js.map} +0 -0
- /package/dist/{chunk-PQECNGDE.js.map → chunk-QSRZOXQI.js.map} +0 -0
- /package/dist/{chunk-DCJSHYE5.js.map → chunk-RSDYS5B3.js.map} +0 -0
- /package/dist/{chunk-N5GVW6RO.js.map → chunk-S6IWKDWT.js.map} +0 -0
- /package/dist/{chunk-TKC6WHGB.js.map → chunk-SBIZXZPP.js.map} +0 -0
- /package/dist/{chunk-UEVHI62V.js.map → chunk-YCCY77W5.js.map} +0 -0
- /package/dist/{chunk-VZIB5W5L.js.map → chunk-ZGCPDA3F.js.map} +0 -0
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
GAP,
|
|
3
2
|
RESERVED,
|
|
4
3
|
estimateWidth,
|
|
5
4
|
furnitureCost,
|
|
6
5
|
isRangeSet,
|
|
7
6
|
pillText,
|
|
7
|
+
pricesFor,
|
|
8
8
|
rightClusterCost
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DNT5PZLF.js";
|
|
10
10
|
import {
|
|
11
11
|
splitToFit,
|
|
12
12
|
useMeasuredWidth
|
|
13
13
|
} from "./chunk-Y4KKS6WL.js";
|
|
14
|
+
import {
|
|
15
|
+
remPx
|
|
16
|
+
} from "./chunk-YKCAJ2TN.js";
|
|
14
17
|
|
|
15
18
|
// src/components/data-display/DataViews/data-views-overflow.ts
|
|
19
|
+
import { useTheme } from "@mui/material/styles/index.js";
|
|
16
20
|
import { useRef } from "react";
|
|
17
21
|
function toOverflowFields(fields, rangeFields) {
|
|
18
22
|
return [
|
|
@@ -23,27 +27,29 @@ function toOverflowFields(fields, rangeFields) {
|
|
|
23
27
|
function isActiveField(field, pills, ranges) {
|
|
24
28
|
return field.group === "pill" ? (pills[field.id]?.length ?? 0) > 0 : isRangeSet(ranges[field.id]);
|
|
25
29
|
}
|
|
26
|
-
function fieldWidth(field, pills, ranges) {
|
|
27
|
-
if (field.group === "pill") return estimateWidth(pillText(field, pills[field.id] ?? []), 0);
|
|
28
|
-
return estimateWidth(field.label, isRangeSet(ranges[field.id]) ? 100 : 0);
|
|
30
|
+
function fieldWidth(theme, field, pills, ranges) {
|
|
31
|
+
if (field.group === "pill") return estimateWidth(theme, pillText(field, pills[field.id] ?? []), 0);
|
|
32
|
+
return estimateWidth(theme, field.label, isRangeSet(ranges[field.id]) ? 100 : 0);
|
|
29
33
|
}
|
|
30
|
-
function splitFilters(all, pills, ranges, width, furniture, compact) {
|
|
34
|
+
function splitFilters(all, pills, ranges, width, furniture, compact, theme) {
|
|
31
35
|
const active = all.filter((field) => isActiveField(field, pills, ranges));
|
|
32
36
|
const idle = all.filter((field) => !isActiveField(field, pills, ranges));
|
|
33
|
-
const
|
|
37
|
+
const price = pricesFor(theme);
|
|
38
|
+
const gap = remPx(theme, RESERVED.betweenControls);
|
|
39
|
+
const clearCost = active.length > 0 ? price.clearAll + gap : 0;
|
|
34
40
|
const split = splitToFit(all, {
|
|
35
|
-
widthOf: (field) => fieldWidth(field, pills, ranges),
|
|
41
|
+
widthOf: (field) => fieldWidth(theme, field, pills, ranges),
|
|
36
42
|
keyOf: (field) => field.id,
|
|
37
|
-
gap
|
|
43
|
+
gap,
|
|
38
44
|
available: width - furniture - clearCost,
|
|
39
45
|
// The overflow button at the width it will actually have, which on a phone
|
|
40
46
|
// is the icon-and-badge one.
|
|
41
|
-
overflowCost: compact ?
|
|
47
|
+
overflowCost: compact ? price.overflowButtonCompact : price.overflowButton,
|
|
42
48
|
priority: [...active, ...idle]
|
|
43
49
|
});
|
|
44
50
|
return { ...split, used: split.used + clearCost };
|
|
45
51
|
}
|
|
46
|
-
function computeSplit(all, pills, ranges, width, hasExport) {
|
|
52
|
+
function computeSplit(all, pills, ranges, width, hasExport, theme) {
|
|
47
53
|
if (width === 0) {
|
|
48
54
|
return {
|
|
49
55
|
inline: all,
|
|
@@ -55,45 +61,48 @@ function computeSplit(all, pills, ranges, width, hasExport) {
|
|
|
55
61
|
searchTakeover: false
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
let
|
|
64
|
+
const price = pricesFor(theme);
|
|
65
|
+
let budget = furnitureCost(price, UNCOLLAPSED, hasExport);
|
|
66
|
+
let split = splitFilters(all, pills, ranges, width, budget, false, theme);
|
|
67
|
+
let flags = ladderFlags(split, width, hasExport, price);
|
|
61
68
|
for (let pass = 0; pass < 3; pass += 1) {
|
|
62
|
-
const freed = furnitureCost(flags, hasExport);
|
|
69
|
+
const freed = furnitureCost(price, flags, hasExport);
|
|
63
70
|
if (freed >= budget) break;
|
|
64
71
|
budget = freed;
|
|
65
|
-
split = splitFilters(all, pills, ranges, width, budget, flags.compactControls);
|
|
66
|
-
flags = ladderFlags(split, width, hasExport);
|
|
72
|
+
split = splitFilters(all, pills, ranges, width, budget, flags.compactControls, theme);
|
|
73
|
+
flags = ladderFlags(split, width, hasExport, price);
|
|
67
74
|
}
|
|
68
75
|
return { inline: split.inline, overflow: split.overflow, ...flags };
|
|
69
76
|
}
|
|
70
77
|
var UNCOLLAPSED = { searchCollapsed: false, counterHidden: false, compactControls: false };
|
|
71
|
-
function ladderFlags(split, width, hasExport) {
|
|
78
|
+
function ladderFlags(split, width, hasExport, price) {
|
|
72
79
|
const { overflow, used } = split;
|
|
73
|
-
const base = width - used -
|
|
74
|
-
const compactControls = base -
|
|
75
|
-
const rightCost = rightClusterCost(hasExport, compactControls);
|
|
76
|
-
const searchCollapsed = base -
|
|
77
|
-
const counterHidden = searchCollapsed && base -
|
|
80
|
+
const base = width - used - price.chrome;
|
|
81
|
+
const compactControls = base - price.counter - rightClusterCost(price, hasExport, false) < price.search;
|
|
82
|
+
const rightCost = rightClusterCost(price, hasExport, compactControls);
|
|
83
|
+
const searchCollapsed = base - price.counter - rightCost < price.search;
|
|
84
|
+
const counterHidden = searchCollapsed && base - price.counter - rightCost < price.searchIcon;
|
|
78
85
|
const clearAllHidden = counterHidden && overflow.length > 0;
|
|
79
|
-
const overflowButton = compactControls ?
|
|
80
|
-
const shedRoom = width -
|
|
81
|
-
const searchBoxRoom = shedRoom - (counterHidden ? 0 :
|
|
82
|
-
const searchTakeover = searchCollapsed && searchBoxRoom <
|
|
86
|
+
const overflowButton = compactControls ? price.overflowButtonCompact : price.overflowButton;
|
|
87
|
+
const shedRoom = width - price.chrome - (overflow.length > 0 ? overflowButton : 0);
|
|
88
|
+
const searchBoxRoom = shedRoom - (counterHidden ? 0 : price.counter) - rightCost;
|
|
89
|
+
const searchTakeover = searchCollapsed && searchBoxRoom < price.usableSearch;
|
|
83
90
|
return { compactControls, counterHidden, searchCollapsed, clearAllHidden, searchTakeover };
|
|
84
91
|
}
|
|
85
92
|
function useFilterOverflow(all, pills, ranges, frozen = false, hasExport = true) {
|
|
86
93
|
const { ref: barRef, width } = useMeasuredWidth();
|
|
94
|
+
const theme = useTheme();
|
|
87
95
|
const signature = JSON.stringify({
|
|
88
96
|
ids: all.map((field) => field.id),
|
|
89
97
|
pills,
|
|
90
98
|
ranges,
|
|
91
99
|
width,
|
|
92
|
-
hasExport
|
|
100
|
+
hasExport,
|
|
101
|
+
scale: remPx(theme, 1)
|
|
93
102
|
});
|
|
94
103
|
const cache = useRef(null);
|
|
95
104
|
if (cache.current === null || !frozen && cache.current.signature !== signature) {
|
|
96
|
-
cache.current = { signature, split: computeSplit(all, pills, ranges, width, hasExport) };
|
|
105
|
+
cache.current = { signature, split: computeSplit(all, pills, ranges, width, hasExport, theme) };
|
|
97
106
|
}
|
|
98
107
|
return { ...cache.current.split, barRef };
|
|
99
108
|
}
|
|
@@ -102,4 +111,4 @@ export {
|
|
|
102
111
|
toOverflowFields,
|
|
103
112
|
useFilterOverflow
|
|
104
113
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
114
|
+
//# sourceMappingURL=chunk-ODW2D5PN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-overflow.ts"],"sourcesContent":["\"use client\";\n\nimport { useTheme, type Theme } from \"@mui/material/styles/index.js\";\nimport { useRef } from \"react\";\n\nimport { remPx } from \"../../../tokens/relative\";\nimport { splitToFit, useMeasuredWidth } from \"../../utility/Overflow\";\nimport {\n estimateWidth,\n furnitureCost,\n isRangeSet,\n pillText,\n pricesFor,\n RESERVED,\n rightClusterCost,\n type Prices,\n} from \"./data-views-overflow-costs\";\nimport type { FilterFieldConfig, RangeFieldConfig, RangeValue } from \"./data-views-types\";\n\n/**\n * PROGRESSIVE COLLAPSE — which filter controls fit on the toolbar, measured.\n *\n * Two rules, and both come from watching the all-or-nothing version fail:\n *\n * 1. Controls shed ONE AT A TIME into an overflow, never all at once. With four\n * filters and room for three, hiding all four throws away the room that was\n * there.\n * 2. An APPLIED filter is ranked first, not exempt. Applied controls take the\n * visible slots ahead of idle ones, and go into \"Mais\" like anything else\n * when even those slots run out. Exempting them outright — the earlier rule\n * — meant four applied filters on a phone claimed more width than the row\n * had, and the bar painted past its own edge: the pills were reachable only\n * by scrolling the toolbar sideways. Hiding one is safe because \"Mais\" says\n * how many applied filters are behind it; scrolling one off-screen says\n * nothing at all.\n *\n * It MEASURES rather than picking a breakpoint, which is what\n * `FILTERS-CONTRACT.md` asks for: pages declare different numbers of filters\n * with different label lengths, and the same page collapses at a different\n * width in another language. A shared breakpoint is wrong for at least one\n * table by construction.\n *\n * Collapsing is presentation only — nothing here emits a query, drops a filter\n * or changes a rendered row.\n */\n\n/** A filter control on the bar: a multi-select pill or a min/max range. */\nexport interface OverflowField<T extends Record<string, unknown>> {\n id: string;\n label: string;\n /** Which control it is — the caller renders the right one. */\n group: \"pill\" | \"range\";\n pill?: FilterFieldConfig<T>;\n range?: RangeFieldConfig<T>;\n}\n\n/** What the caller renders inline, and what goes behind \"Mais\". */\nexport interface OverflowSplit<T extends Record<string, unknown>> {\n inline: OverflowField<T>[];\n overflow: OverflowField<T>[];\n /**\n * Step 2 — Exibir/Exportar drop their text labels and become icons.\n * Cheap: both keep their icon, their tooltip and their position.\n */\n compactControls: boolean;\n /**\n * Step 5, and the LAST resort — the \"N de N\" counter is dropped.\n *\n * Only once every control has already collapsed and the row STILL does not\n * fit, which on a six-filter table is below about 400px. The counter goes\n * last because it is the only thing left that reports rather than does: an\n * operator can act without knowing the total, but not without the search.\n */\n counterHidden: boolean;\n /**\n * Step 4 — the search collapses to a magnifier that expands on click.\n * The most expensive step, so it is taken last: the search is the one\n * control on the bar that cannot be guessed from an icon's position.\n */\n searchCollapsed: boolean;\n /**\n * Step 6, below even the counter — \"Limpar\" leaves the bar.\n *\n * The one control here with a second home: the overflow panel's footer\n * carries \"Limpar todos os filtros\". So it goes before the search icon or\n * \"Mais\", neither of which has anywhere else to be.\n */\n clearAllHidden: boolean;\n /**\n * Expanding the magnifier must take the whole cluster, filters and all.\n *\n * Only on the rungs where what is left over would be too narrow to read —\n * on a large phone the box simply shrinks and the filters stay, which is why\n * this is its own answer rather than `searchCollapsed` reused.\n */\n searchTakeover: boolean;\n /** Attach to the toolbar row being measured. */\n barRef: React.RefObject<HTMLDivElement | null>;\n}\n\n/** Every declared control, pills first, in the order the bar renders them. */\nexport function toOverflowFields<T extends Record<string, unknown>>(\n fields: FilterFieldConfig<T>[],\n rangeFields: RangeFieldConfig<T>[],\n): OverflowField<T>[] {\n return [\n ...fields.map((pill) => ({ id: pill.id, label: pill.label, group: \"pill\" as const, pill })),\n ...rangeFields.map((range) => ({ id: range.id, label: range.label, group: \"range\" as const, range })),\n ];\n}\n\n\n/** Is this control carrying a value the operator set? */\nfunction isActiveField<T extends Record<string, unknown>>(\n field: OverflowField<T>,\n pills: Record<string, string[]>,\n ranges: Record<string, RangeValue>,\n): boolean {\n return field.group === \"pill\"\n ? (pills[field.id]?.length ?? 0) > 0\n : isRangeSet(ranges[field.id]);\n}\n\n/** Estimated rendered width of one control at its CURRENT value, in px at `theme`'s scale. */\nfunction fieldWidth<T extends Record<string, unknown>>(\n theme: Theme,\n field: OverflowField<T>,\n pills: Record<string, string[]>,\n ranges: Record<string, RangeValue>,\n): number {\n if (field.group === \"pill\") return estimateWidth(theme, pillText(field, pills[field.id] ?? []), 0);\n // A bounded range renders two number inputs (100 design px) beside its label.\n return estimateWidth(theme, field.label, isRangeSet(ranges[field.id]) ? 100 : 0);\n}\n\n/** What one split costs on the bar, so the ladder below can price the next step. */\ntype Split<T extends Record<string, unknown>> = {\n inline: OverflowField<T>[];\n overflow: OverflowField<T>[];\n /** Width the surviving inline controls occupy, incl. the \"Mais\" button. */\n used: number;\n};\n\n/** Step 1 — shed filter controls into the overflow. Pure. */\nfunction splitFilters<T extends Record<string, unknown>>(\n all: OverflowField<T>[],\n pills: Record<string, string[]>,\n ranges: Record<string, RangeValue>,\n width: number,\n /** Search + counter + right cluster + chrome, at the rung being considered. */\n furniture: number,\n /** Is the bar already down to icons? \"Mais\" shrinks with everything else. */\n compact: boolean,\n /** Whose type scale every price is read at — the bar's own. */\n theme: Theme,\n): Split<T> {\n const active = all.filter((field) => isActiveField(field, pills, ranges));\n const idle = all.filter((field) => !isActiveField(field, pills, ranges));\n const price = pricesFor(theme);\n const gap = remPx(theme, RESERVED.betweenControls);\n\n // \"Limpar\" rides the end of the cluster whenever anything is applied.\n const clearCost = active.length > 0 ? price.clearAll + gap : 0;\n // APPLIED FIRST, BUT NOT EXEMPT.\n //\n // Applied controls take the visible slots ahead of idle ones — that part was\n // always right. Exempting them from the overflow entirely was not: applying\n // a value LENGTHENS a control (\"Pagamento (1)\"), so on a phone four applied\n // filters claimed more width than the row had and the bar simply painted\n // past its own edge, leaving pills reachable only by scrolling sideways.\n //\n // An applied filter hidden in \"Mais\" is not lost the way it would be if it\n // vanished silently: the trigger goes to the applied tone and says how many\n // are in there (see `MoreTrigger`), which is the same signal the pill itself\n // was carrying. A control you scroll off-screen carries no signal at all.\n //\n // The keep-what-fits loop itself is `splitToFit` (`utility/Overflow`) — the\n // one part of this that is not filter-shaped, and the part a second cluster\n // in the design system would otherwise have had to reimplement.\n const split = splitToFit(all, {\n widthOf: (field) => fieldWidth(theme, field, pills, ranges),\n keyOf: (field) => field.id,\n gap,\n available: width - furniture - clearCost,\n // The overflow button at the width it will actually have, which on a phone\n // is the icon-and-badge one.\n overflowCost: compact ? price.overflowButtonCompact : price.overflowButton,\n priority: [...active, ...idle],\n });\n return { ...split, used: split.used + clearCost };\n}\n\n/**\n * THE DEGRADATION LADDER — cheapest loss first, and each rung taken only if\n * the one before it did not free enough:\n *\n * 1. filter controls move into the \"Mais\" overflow (`splitFilters`)\n * 2. Exibir / Exportar drop their text labels (`compactControls`)\n * 3. the search shrinks toward its minimum (CSS: it is `flex: 1`)\n * 4. the search itself collapses to an icon (`searchCollapsed`)\n *\n * Step 3 needs no flag — the search is a flex child, so it gives up width on\n * its own until it hits `RESERVED.search`. The flags mark the two steps that\n * change what is RENDERED rather than how wide it is.\n *\n * Measured against what is CURRENTLY on the bar, never a breakpoint: a\n * two-filter page and a five-filter page would otherwise collapse at the same\n * width, and only one of them would be right.\n */\nfunction computeSplit<T extends Record<string, unknown>>(\n all: OverflowField<T>[],\n pills: Record<string, string[]>,\n ranges: Record<string, RangeValue>,\n width: number,\n /** Does the host render \"Exportar\" beside \"Exibir\"? Half the cluster if not. */\n hasExport: boolean,\n theme: Theme,\n): Omit<OverflowSplit<T>, \"barRef\"> {\n // Unmeasured (SSR, or jsdom without a ResizeObserver) ⇒ degrade nothing.\n if (width === 0) {\n return {\n inline: all,\n overflow: [],\n compactControls: false,\n counterHidden: false,\n searchCollapsed: false,\n clearAllHidden: false,\n searchTakeover: false,\n };\n }\n const price = pricesFor(theme);\n // Pass 1 prices the furniture at its widest — no rung has been taken yet.\n let budget = furnitureCost(price, UNCOLLAPSED, hasExport);\n let split = splitFilters(all, pills, ranges, width, budget, false, theme);\n let flags = ladderFlags(split, width, hasExport, price);\n // RE-SPEND WHAT THE LATER RUNGS FREED.\n //\n // Rungs 2/4/5 turn 200 + 96 + 216 of furniture into 44 + 0 + 140, and until\n // this loop existed nobody handed those ~330px back to the filters: the\n // split was decided once, against the uncollapsed row, so a phone shed every\n // control and then sat with a band of empty bar beside \"Mais 5\".\n //\n // Settles rather than oscillates, and cannot overfill: a cheaper furniture\n // can only give the filters MORE room, more filter width can only push the\n // ladder FURTHER down, and a further rung can only make the furniture\n // cheaper again — so the budget decreases monotonically and the loop exits\n // the moment it stops moving. The bound is a backstop, not the exit.\n for (let pass = 0; pass < 3; pass += 1) {\n const freed = furnitureCost(price, flags, hasExport);\n if (freed >= budget) break;\n budget = freed;\n split = splitFilters(all, pills, ranges, width, budget, flags.compactControls, theme);\n flags = ladderFlags(split, width, hasExport, price);\n }\n return { inline: split.inline, overflow: split.overflow, ...flags };\n}\n\n/** The widest the furniture ever is — every rung still untaken. */\nconst UNCOLLAPSED = { searchCollapsed: false, counterHidden: false, compactControls: false };\n\n/** Rungs 2 and 4-6, priced against what the filters actually took. */\nfunction ladderFlags<T extends Record<string, unknown>>(\n split: Split<T>,\n width: number,\n hasExport: boolean,\n price: Prices,\n): Omit<OverflowSplit<T>, \"barRef\" | \"inline\" | \"overflow\"> {\n const { overflow, used } = split;\n const base = width - used - price.chrome;\n\n // Would the search still make its minimum with the labels on?\n const compactControls = base - price.counter - rightClusterCost(price, hasExport, false) < price.search;\n const rightCost = rightClusterCost(price, hasExport, compactControls);\n // …and with them off?\n const searchCollapsed = base - price.counter - rightCost < price.search;\n // Everything has collapsed and the row STILL overflows. The controls cannot\n // shrink further — they are `flexShrink: 0` precisely so an over-packed row\n // sheds rather than squeezes — so without this last rung they simply paint\n // outside the toolbar, which is what a narrow phone was doing.\n const counterHidden =\n searchCollapsed && base - price.counter - rightCost < price.searchIcon;\n // Step 6 — below even that, \"Limpar\" leaves the bar. It is the ONLY control\n // here with a second home: the overflow panel's footer carries \"Limpar todos\n // os filtros\", so nothing is lost, which is exactly why it goes before the\n // search icon or \"Mais\" (neither of which has anywhere else to be). Guarded\n // on there BEING an overflow, because with no panel the footer does not\n // exist and dropping this would strand the operator.\n const clearAllHidden = counterHidden && overflow.length > 0;\n // What the keyword box would get if the operator expanded the magnifier.\n // `searchCollapsed` is a different question — it asks whether the box fits at\n // its PREFERRED 200px, and is deliberately pessimistic — so reusing it to\n // decide the takeover evicted the filters on screens where the box had plenty\n // of room to simply shrink.\n //\n // Asked with the inline filters SHED, because shedding them is exactly what\n // expanding the box does: the row re-splits and they go behind \"Mais\".\n // Measuring against the resting row instead made a filter argue for its own\n // eviction — now that a large phone keeps one, its width came out of `base`,\n // pushed the box under `usableSearch`, and tipped a row that had ample space\n // to share into a full takeover.\n const overflowButton = compactControls\n ? price.overflowButtonCompact\n : price.overflowButton;\n const shedRoom = width - price.chrome - (overflow.length > 0 ? overflowButton : 0);\n const searchBoxRoom = shedRoom - (counterHidden ? 0 : price.counter) - rightCost;\n // Below this a box is too narrow to read what you typed into it, and shrinking\n // further buys nothing; that is the only point at which taking the whole\n // cluster is worth losing the filters.\n const searchTakeover = searchCollapsed && searchBoxRoom < price.usableSearch;\n\n return { compactControls, counterHidden, searchCollapsed, clearAllHidden, searchTakeover };\n}\n\n/**\n * Split the declared filter controls into what fits and what goes behind\n * \"Mais\", measured against the live toolbar width.\n *\n * Cached on a SIGNATURE rather than by `useMemo` over the inputs: hosts declare\n * their fields inline, so `all` is a fresh array on every render while the\n * configuration is unchanged, and a reference-keyed memo would never hit.\n */\nexport function useFilterOverflow<T extends Record<string, unknown>>(\n all: OverflowField<T>[],\n pills: Record<string, string[]>,\n ranges: Record<string, RangeValue>,\n /**\n * A filter control is open — hold the current answer until it closes.\n *\n * Applying a filter changes that control's LABEL (\"Valor\" becomes \"Valor: ≥\n * R$ 1\"), which changes its measured width, which re-runs the whole split\n * while its popover is open on top of it. Measured: setting a minimum moved\n * the trigger 192px left, took the popover with it, and pushed two other\n * controls into a newly-appeared \"Mais 2\" — so reaching for the second bound\n * meant chasing the control across the row. Nobody sets a range that way.\n *\n * Frozen only for the duration: closing re-measures against the new labels,\n * so the row still ends up correct, it just does not rearrange under a hand\n * that is mid-edit.\n */\n frozen = false,\n /** Whether \"Exportar\" is on the bar — see `rightClusterCost`. */\n hasExport = true,\n): OverflowSplit<T> {\n // The measurement is `useMeasuredWidth` (`utility/Overflow`): the same\n // ResizeObserver every collapsing cluster in the design system reads, so\n // there is one loop to get right rather than one per bar. `0` until the\n // first measurement lands (and forever under SSR or jsdom), which\n // `computeSplit` reads as \"degrade nothing\".\n const { ref: barRef, width } = useMeasuredWidth<HTMLDivElement>();\n // The prices follow the theme's type scale, so the answer does too.\n const theme = useTheme();\n const signature = JSON.stringify({\n ids: all.map((field) => field.id),\n pills,\n ranges,\n width,\n hasExport,\n scale: remPx(theme, 1),\n });\n const cache = useRef<{ signature: string; split: ReturnType<typeof computeSplit<T>> } | null>(null);\n if (cache.current === null || (!frozen && cache.current.signature !== signature)) {\n cache.current = { signature, split: computeSplit(all, pills, ranges, width, hasExport, theme) };\n }\n return { ...cache.current.split, barRef };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAA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
|
|
|
18
18
|
import {
|
|
19
19
|
computeActiveFilterCount,
|
|
20
20
|
defaultSortFields
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BWHOCNGW.js";
|
|
22
22
|
import {
|
|
23
23
|
serverDerived,
|
|
24
24
|
useServerQuery
|
|
@@ -172,4 +172,4 @@ function useDataViewsState({
|
|
|
172
172
|
export {
|
|
173
173
|
useDataViewsState
|
|
174
174
|
};
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
175
|
+
//# sourceMappingURL=chunk-PCBZYORN.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GridShell
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GLHNMTP6.js";
|
|
4
4
|
import {
|
|
5
5
|
useDataViewsState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PCBZYORN.js";
|
|
7
7
|
|
|
8
8
|
// src/components/data-display/DataViews/DataViewsGrid.tsx
|
|
9
9
|
import { useEffect, useRef } from "react";
|
|
@@ -27,4 +27,4 @@ function DataViewsGrid(props) {
|
|
|
27
27
|
export {
|
|
28
28
|
DataViewsGrid
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-PRIBOWX4.js.map
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rem,
|
|
3
|
+
remPx
|
|
4
|
+
} from "./chunk-YKCAJ2TN.js";
|
|
5
|
+
|
|
1
6
|
// src/components/utility/VirtualList/VirtualList.hooks.ts
|
|
2
|
-
import {
|
|
7
|
+
import { useTheme } from "@mui/material/styles/index.js";
|
|
8
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
9
|
var scrollOffsets = (event) => {
|
|
4
10
|
const target = event.currentTarget || event.target;
|
|
5
11
|
const element = target;
|
|
6
|
-
return {
|
|
12
|
+
return { scrollTop: element.scrollTop, scrollLeft: element.scrollLeft };
|
|
7
13
|
};
|
|
8
14
|
var useExternalScrollListener = (scrollContainerRef, handleScroll) => {
|
|
9
15
|
useEffect(() => {
|
|
@@ -18,7 +24,7 @@ var useScrollTop = (scrollContainerRef, report) => {
|
|
|
18
24
|
const [scrollTop, setScrollTop] = useState(0);
|
|
19
25
|
const handleScroll = useCallback(
|
|
20
26
|
(event) => {
|
|
21
|
-
const { top, left } = scrollOffsets(event);
|
|
27
|
+
const { scrollTop: top, scrollLeft: left } = scrollOffsets(event);
|
|
22
28
|
setScrollTop(top);
|
|
23
29
|
report(top, left);
|
|
24
30
|
},
|
|
@@ -27,33 +33,21 @@ var useScrollTop = (scrollContainerRef, report) => {
|
|
|
27
33
|
useExternalScrollListener(scrollContainerRef, handleScroll);
|
|
28
34
|
return { scrollTop, handleScroll };
|
|
29
35
|
};
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
itemHeight,
|
|
34
|
-
estimatedItemHeight
|
|
35
|
-
}) => {
|
|
36
|
-
const measured = useRef(/* @__PURE__ */ new Map());
|
|
37
|
-
return useCallback(
|
|
38
|
-
(index) => {
|
|
39
|
-
if (variant !== "variable") {
|
|
40
|
-
return itemHeight;
|
|
41
|
-
}
|
|
42
|
-
return items[index]?.height || measured.current.get(index) || estimatedItemHeight;
|
|
43
|
-
},
|
|
44
|
-
[variant, itemHeight, estimatedItemHeight, items]
|
|
45
|
-
);
|
|
36
|
+
var widthCss = (theme, width) => {
|
|
37
|
+
if (typeof width !== "number") return width;
|
|
38
|
+
return width <= 1 && width !== 0 ? `${width * 100}%` : rem(theme, width);
|
|
46
39
|
};
|
|
47
|
-
var
|
|
48
|
-
if (variant
|
|
49
|
-
return items.length *
|
|
40
|
+
var useDesignHeights = (items, variant, fixed, estimated) => useMemo(() => {
|
|
41
|
+
if (variant !== "variable") {
|
|
42
|
+
return { size: () => fixed, offset: (index) => index * fixed, total: items.length * fixed };
|
|
50
43
|
}
|
|
51
|
-
|
|
44
|
+
const size = (index) => items[index]?.height || estimated;
|
|
45
|
+
const starts = [0];
|
|
52
46
|
for (let i = 0; i < items.length; i++) {
|
|
53
|
-
|
|
47
|
+
starts.push((starts[i] ?? 0) + size(i));
|
|
54
48
|
}
|
|
55
|
-
return
|
|
56
|
-
}, [items
|
|
49
|
+
return { size, offset: (index) => starts[index] ?? 0, total: starts[items.length] ?? 0 };
|
|
50
|
+
}, [items, variant, fixed, estimated]);
|
|
57
51
|
var variableRange = ({ count, scrollTop, height, overscan, getItemHeight }) => {
|
|
58
52
|
let accumulated = 0;
|
|
59
53
|
let startIndex = 0;
|
|
@@ -82,36 +76,29 @@ var fixedRange = ({ count, scrollTop, height, overscan, itemHeight }) => ({
|
|
|
82
76
|
startIndex: Math.max(0, Math.floor(scrollTop / itemHeight) - overscan),
|
|
83
77
|
endIndex: Math.min(count - 1, Math.ceil((scrollTop + height) / itemHeight) + overscan)
|
|
84
78
|
});
|
|
85
|
-
var useItemOffset = (variant, itemHeight, getItemHeight) => useCallback(
|
|
86
|
-
(index) => {
|
|
87
|
-
if (variant === "fixed") {
|
|
88
|
-
return index * itemHeight;
|
|
89
|
-
}
|
|
90
|
-
let offset = 0;
|
|
91
|
-
for (let i = 0; i < index; i++) {
|
|
92
|
-
offset += getItemHeight(i);
|
|
93
|
-
}
|
|
94
|
-
return offset;
|
|
95
|
-
},
|
|
96
|
-
[variant, itemHeight, getItemHeight]
|
|
97
|
-
);
|
|
98
79
|
var useVirtualList = ({
|
|
99
80
|
items,
|
|
100
|
-
variant,
|
|
81
|
+
variant = "fixed",
|
|
101
82
|
height,
|
|
102
83
|
itemHeight,
|
|
103
84
|
estimatedItemHeight,
|
|
104
|
-
overscan,
|
|
85
|
+
overscan = 5,
|
|
105
86
|
onScroll,
|
|
106
87
|
scrollContainerRef
|
|
107
88
|
}) => {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const totalHeight = useTotalHeight(items, variant, itemHeight, getItemHeight);
|
|
89
|
+
const theme = useTheme();
|
|
90
|
+
const design = useDesignHeights(items, variant, itemHeight ?? 40, estimatedItemHeight ?? 40);
|
|
111
91
|
const report = useCallback((top) => onScroll?.(top), [onScroll]);
|
|
112
92
|
const { scrollTop, handleScroll } = useScrollTop(scrollContainerRef, report);
|
|
113
93
|
const visibleItems = useMemo(() => {
|
|
114
|
-
const args = {
|
|
94
|
+
const args = {
|
|
95
|
+
count: items.length,
|
|
96
|
+
scrollTop,
|
|
97
|
+
height: remPx(theme, height),
|
|
98
|
+
overscan,
|
|
99
|
+
itemHeight: remPx(theme, design.size(0)),
|
|
100
|
+
getItemHeight: (index) => remPx(theme, design.size(index))
|
|
101
|
+
};
|
|
115
102
|
const { startIndex, endIndex } = variant === "fixed" ? fixedRange(args) : variableRange(args);
|
|
116
103
|
const result = [];
|
|
117
104
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
@@ -122,16 +109,21 @@ var useVirtualList = ({
|
|
|
122
109
|
index: i,
|
|
123
110
|
style: {
|
|
124
111
|
position: "absolute",
|
|
125
|
-
top:
|
|
112
|
+
top: remPx(theme, design.offset(i)),
|
|
126
113
|
left: 0,
|
|
127
114
|
width: "100%",
|
|
128
|
-
height:
|
|
115
|
+
height: remPx(theme, design.size(i))
|
|
129
116
|
}
|
|
130
117
|
});
|
|
131
118
|
}
|
|
132
119
|
return result;
|
|
133
|
-
}, [items, scrollTop, height, overscan, variant,
|
|
134
|
-
return {
|
|
120
|
+
}, [items, scrollTop, height, overscan, variant, design, theme]);
|
|
121
|
+
return {
|
|
122
|
+
totalHeight: rem(theme, design.total),
|
|
123
|
+
viewportHeight: rem(theme, height),
|
|
124
|
+
visibleItems,
|
|
125
|
+
handleScroll
|
|
126
|
+
};
|
|
135
127
|
};
|
|
136
128
|
var useColumnWidth = (columnWidth, width, columnCount, gap) => useMemo(() => {
|
|
137
129
|
if (columnWidth) return columnWidth;
|
|
@@ -141,27 +133,31 @@ var useColumnWidth = (columnWidth, width, columnCount, gap) => useMemo(() => {
|
|
|
141
133
|
var useVirtualGrid = ({
|
|
142
134
|
items,
|
|
143
135
|
height,
|
|
144
|
-
width,
|
|
136
|
+
width = "100%",
|
|
145
137
|
columnCount,
|
|
146
138
|
rowHeight,
|
|
147
139
|
columnWidth,
|
|
148
|
-
gap,
|
|
149
|
-
overscan,
|
|
140
|
+
gap = 0,
|
|
141
|
+
overscan = 5,
|
|
150
142
|
onScroll,
|
|
151
143
|
scrollContainerRef
|
|
152
144
|
}) => {
|
|
145
|
+
const theme = useTheme();
|
|
153
146
|
const rowCount = Math.ceil(items.length / columnCount);
|
|
154
|
-
const
|
|
155
|
-
const computedColumnWidth = useColumnWidth(columnWidth, width, columnCount, gap);
|
|
147
|
+
const designColumn = useColumnWidth(columnWidth, width, columnCount, gap);
|
|
156
148
|
const report = useCallback(
|
|
157
149
|
(top, left) => onScroll?.(top, left),
|
|
158
150
|
[onScroll]
|
|
159
151
|
);
|
|
160
152
|
const { scrollTop, handleScroll } = useScrollTop(scrollContainerRef, report);
|
|
161
153
|
const visibleItems = useMemo(() => {
|
|
162
|
-
const pitch = rowHeight + gap;
|
|
154
|
+
const pitch = remPx(theme, rowHeight + gap);
|
|
155
|
+
const stride = remPx(theme, designColumn + gap);
|
|
163
156
|
const startRow = Math.max(0, Math.floor(scrollTop / pitch) - overscan);
|
|
164
|
-
const endRow = Math.min(
|
|
157
|
+
const endRow = Math.min(
|
|
158
|
+
rowCount - 1,
|
|
159
|
+
Math.ceil((scrollTop + remPx(theme, height)) / pitch) + overscan
|
|
160
|
+
);
|
|
165
161
|
const firstIndex = startRow * columnCount;
|
|
166
162
|
const lastIndex = Math.min((endRow + 1) * columnCount - 1, items.length - 1);
|
|
167
163
|
const result = [];
|
|
@@ -178,19 +174,25 @@ var useVirtualGrid = ({
|
|
|
178
174
|
style: {
|
|
179
175
|
position: "absolute",
|
|
180
176
|
top: rowIndex * pitch,
|
|
181
|
-
left: columnIndex *
|
|
182
|
-
width:
|
|
183
|
-
height: rowHeight
|
|
177
|
+
left: columnIndex * stride,
|
|
178
|
+
width: remPx(theme, designColumn),
|
|
179
|
+
height: remPx(theme, rowHeight)
|
|
184
180
|
}
|
|
185
181
|
});
|
|
186
182
|
}
|
|
187
183
|
return result;
|
|
188
|
-
}, [items, scrollTop, height, overscan, rowCount, columnCount, rowHeight, gap,
|
|
189
|
-
return {
|
|
184
|
+
}, [items, scrollTop, height, overscan, rowCount, columnCount, rowHeight, gap, designColumn, theme]);
|
|
185
|
+
return {
|
|
186
|
+
totalHeight: rem(theme, rowCount * (rowHeight + gap) - gap),
|
|
187
|
+
viewportHeight: rem(theme, height),
|
|
188
|
+
visibleItems,
|
|
189
|
+
handleScroll
|
|
190
|
+
};
|
|
190
191
|
};
|
|
191
192
|
|
|
192
193
|
export {
|
|
194
|
+
widthCss,
|
|
193
195
|
useVirtualList,
|
|
194
196
|
useVirtualGrid
|
|
195
197
|
};
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
198
|
+
//# sourceMappingURL=chunk-PVM7XTLZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/utility/VirtualList/VirtualList.hooks.ts"],"sourcesContent":["import { useTheme, type Theme } from '@mui/material/styles/index.js';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { rem, remPx } from '../../../tokens/relative';\n\nimport type { VirtualGridProps, VirtualListProps } from './VirtualList.types';\n\ntype ScrollEvent = React.UIEvent<HTMLDivElement> | Event;\ntype ListItems = VirtualListProps['items'];\ntype ListVariant = NonNullable<VirtualListProps['variant']>;\ntype ItemSize = (index: number) => number;\n\n// Handles both React synthetic events and native DOM events, since the same\n// handler serves an internal onScroll and an external container's listener.\nconst scrollOffsets = (event: ScrollEvent) => {\n const target = (event as React.UIEvent<HTMLDivElement>).currentTarget || (event as Event).target;\n const element = target as HTMLElement;\n return { scrollTop: element.scrollTop, scrollLeft: element.scrollLeft };\n};\n\n/**\n * When the caller owns the scroll container, the component cannot attach\n * `onScroll` through JSX and has to subscribe to that element directly.\n */\nconst useExternalScrollListener = (\n scrollContainerRef: VirtualListProps['scrollContainerRef'],\n handleScroll: (event: Event) => void,\n) => {\n useEffect(() => {\n if (!scrollContainerRef?.current) return;\n\n const element = scrollContainerRef.current;\n const scrollHandler = (e: Event) => handleScroll(e);\n\n element.addEventListener('scroll', scrollHandler);\n return () => element.removeEventListener('scroll', scrollHandler);\n }, [scrollContainerRef, handleScroll]);\n};\n\n/**\n * Tracks the scroll offset whether it arrives through our own `onScroll` or\n * through a container the caller owns, and hands both offsets to `report` so a\n * grid can pass on the horizontal one too.\n */\nconst useScrollTop = (\n scrollContainerRef: VirtualListProps['scrollContainerRef'],\n report: (top: number, left: number) => void,\n) => {\n const [scrollTop, setScrollTop] = useState(0);\n\n const handleScroll = useCallback(\n (event: ScrollEvent) => {\n const { scrollTop: top, scrollLeft: left } = scrollOffsets(event);\n setScrollTop(top);\n report(top, left);\n },\n [report],\n );\n\n useExternalScrollListener(scrollContainerRef, handleScroll);\n\n return { scrollTop, handleScroll };\n};\n\n\n/**\n * A `width` prop as CSS. `sx` reads a number of 1 or less as a fraction of the\n * parent, and that stays so; a larger number is design px, through the type\n * scale; a string is as given.\n */\nexport const widthCss = (theme: Theme, width: number | string): string => {\n if (typeof width !== 'number') return width;\n return width <= 1 && width !== 0 ? `${width * 100}%` : rem(theme, width);\n};\n\n/** Every item's height, its offset from the top, and their sum — all in DESIGN px. */\ninterface DesignHeights {\n size: ItemSize;\n offset: ItemSize;\n total: number;\n}\n\n/**\n * Fixed lists know every height up front; variable ones take the item's own\n * declared height and otherwise the estimate.\n *\n * Kept in the caller's DESIGN px on purpose: the CSS draws a height with `rem`\n * and the range maths reads it through `remPx`, so the two are one number at\n * any type scale — never a row drawn at one pitch and positioned at another.\n */\nconst useDesignHeights = (\n items: ListItems,\n variant: ListVariant,\n fixed: number,\n estimated: number,\n): DesignHeights =>\n useMemo(() => {\n if (variant !== 'variable') {\n return { size: () => fixed, offset: (index) => index * fixed, total: items.length * fixed };\n }\n\n const size = (index: number): number => items[index]?.height || estimated;\n // Running sums, so an offset is a lookup rather than a walk from the top.\n const starts = [0];\n for (let i = 0; i < items.length; i++) {\n starts.push((starts[i] ?? 0) + size(i));\n }\n return { size, offset: (index) => starts[index] ?? 0, total: starts[items.length] ?? 0 };\n }, [items, variant, fixed, estimated]);\n\n/** The range maths' inputs, in the px the scroll offset is measured in. */\ninterface RangeArgs {\n count: number;\n scrollTop: number;\n height: number;\n overscan: number;\n itemHeight: number;\n getItemHeight: ItemSize;\n}\n\n// Walks forward accumulating heights until it passes the viewport's top edge, then\n// its bottom edge. Linear in the number of items, which is why fixed lists take\n// the arithmetic shortcut instead.\nconst variableRange = ({ count, scrollTop, height, overscan, getItemHeight }: RangeArgs) => {\n let accumulated = 0;\n let startIndex = 0;\n let endIndex = count - 1;\n\n for (let i = 0; i < count; i++) {\n if (accumulated + getItemHeight(i) > scrollTop) {\n startIndex = Math.max(0, i - overscan);\n break;\n }\n accumulated += getItemHeight(i);\n }\n\n accumulated = 0;\n for (let i = 0; i <= startIndex; i++) {\n accumulated += getItemHeight(i);\n }\n\n for (let i = startIndex; i < count; i++) {\n if (accumulated > scrollTop + height) {\n endIndex = Math.min(count - 1, i + overscan);\n break;\n }\n accumulated += getItemHeight(i);\n }\n\n return { startIndex, endIndex };\n};\n\nconst fixedRange = ({ count, scrollTop, height, overscan, itemHeight }: RangeArgs) => ({\n startIndex: Math.max(0, Math.floor(scrollTop / itemHeight) - overscan),\n endIndex: Math.min(count - 1, Math.ceil((scrollTop + height) / itemHeight) + overscan),\n});\n\n/**\n * `height`, `itemHeight`, `estimatedItemHeight` and an item's own `height` are\n * design px. The range is computed in the px `scrollTop` is measured in\n * (`remPx`), the viewport and the scroll content are drawn in `rem`, and each\n * item's `top`/`height` is the `remPx` of its design offset and height.\n */\nexport const useVirtualList = ({\n items,\n variant = 'fixed',\n height,\n itemHeight,\n estimatedItemHeight,\n overscan = 5,\n onScroll,\n scrollContainerRef,\n}: VirtualListProps) => {\n const theme = useTheme();\n // 40 design px when the caller does not size a row.\n const design = useDesignHeights(items, variant, itemHeight ?? 40, estimatedItemHeight ?? 40);\n\n const report = useCallback((top: number) => onScroll?.(top), [onScroll]);\n const { scrollTop, handleScroll } = useScrollTop(scrollContainerRef, report);\n\n const visibleItems = useMemo(() => {\n const args = {\n count: items.length,\n scrollTop,\n height: remPx(theme, height),\n overscan,\n itemHeight: remPx(theme, design.size(0)),\n getItemHeight: (index: number) => remPx(theme, design.size(index)),\n };\n const { startIndex, endIndex } = variant === 'fixed' ? fixedRange(args) : variableRange(args);\n const result = [];\n\n for (let i = startIndex; i <= endIndex; i++) {\n const item = items[i];\n if (!item) continue;\n\n result.push({\n item,\n index: i,\n style: {\n position: 'absolute' as const,\n top: remPx(theme, design.offset(i)),\n left: 0,\n width: '100%',\n height: remPx(theme, design.size(i)),\n },\n });\n }\n\n return result;\n }, [items, scrollTop, height, overscan, variant, design, theme]);\n\n return {\n totalHeight: rem(theme, design.total),\n viewportHeight: rem(theme, height),\n visibleItems,\n handleScroll,\n };\n};\n\n/** The column width in DESIGN px: the caller's, or an even share of a numeric width. */\nconst useColumnWidth = (\n columnWidth: number | undefined,\n width: number | string,\n columnCount: number,\n gap: number,\n) =>\n useMemo(() => {\n if (columnWidth) return columnWidth;\n\n const containerWidth = typeof width === 'number' ? width : 300; // fallback\n return (containerWidth - (columnCount - 1) * gap) / columnCount;\n }, [columnWidth, width, columnCount, gap]);\n\n/**\n * `height`, `rowHeight`, `columnWidth` and `gap` are design px: the range and\n * every cell's box are computed through `remPx`, the viewport and the content\n * are drawn through `rem`.\n */\nexport const useVirtualGrid = ({\n items,\n height,\n width = '100%',\n columnCount,\n rowHeight,\n columnWidth,\n gap = 0,\n overscan = 5,\n onScroll,\n scrollContainerRef,\n}: VirtualGridProps) => {\n const theme = useTheme();\n const rowCount = Math.ceil(items.length / columnCount);\n const designColumn = useColumnWidth(columnWidth, width, columnCount, gap);\n\n const report = useCallback(\n (top: number, left: number) => onScroll?.(top, left),\n [onScroll],\n );\n const { scrollTop, handleScroll } = useScrollTop(scrollContainerRef, report);\n\n const visibleItems = useMemo(() => {\n const pitch = remPx(theme, rowHeight + gap);\n const stride = remPx(theme, designColumn + gap);\n const startRow = Math.max(0, Math.floor(scrollTop / pitch) - overscan);\n const endRow = Math.min(\n rowCount - 1,\n Math.ceil((scrollTop + remPx(theme, height)) / pitch) + overscan,\n );\n\n // Rows are contiguous in `items`, so the visible block is one index range\n // rather than a row loop wrapping a column loop.\n const firstIndex = startRow * columnCount;\n const lastIndex = Math.min((endRow + 1) * columnCount - 1, items.length - 1);\n const result = [];\n\n for (let index = firstIndex; index <= lastIndex; index++) {\n const item = items[index];\n if (!item) continue;\n\n const rowIndex = Math.floor(index / columnCount);\n const columnIndex = index % columnCount;\n\n result.push({\n item,\n index,\n columnIndex,\n rowIndex,\n style: {\n position: 'absolute' as const,\n top: rowIndex * pitch,\n left: columnIndex * stride,\n width: remPx(theme, designColumn),\n height: remPx(theme, rowHeight),\n },\n });\n }\n\n return result;\n }, [items, scrollTop, height, overscan, rowCount, columnCount, rowHeight, gap, designColumn, theme]);\n\n return {\n totalHeight: rem(theme, rowCount * (rowHeight + gap) - gap),\n viewportHeight: rem(theme, height),\n visibleItems,\n handleScroll,\n };\n};\n"],"mappings":";;;;;;AAAA,SAAS,gBAA4B;AACrC,SAAgB,aAAa,WAAW,SAAS,gBAAgB;AAajE,IAAM,gBAAgB,CAAC,UAAuB;AAC5C,QAAM,SAAU,MAAwC,iBAAkB,MAAgB;AAC1F,QAAM,UAAU;AAChB,SAAO,EAAE,WAAW,QAAQ,WAAW,YAAY,QAAQ,WAAW;AACxE;AAMA,IAAM,4BAA4B,CAChC,oBACA,iBACG;AACH,YAAU,MAAM;AACd,QAAI,CAAC,oBAAoB,QAAS;AAElC,UAAM,UAAU,mBAAmB;AACnC,UAAM,gBAAgB,CAAC,MAAa,aAAa,CAAC;AAElD,YAAQ,iBAAiB,UAAU,aAAa;AAChD,WAAO,MAA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AC;AAEnG,SAAO;AAAA,IACL,aAAa,IAAI,OAAO,YAAY,YAAY,OAAO,GAAG;AAAA,IAC1D,gBAAgB,IAAI,OAAO,MAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rem,
|
|
3
|
+
remPx
|
|
4
|
+
} from "./chunk-YKCAJ2TN.js";
|
|
5
|
+
|
|
1
6
|
// src/components/layout/Resizable/Resizable.helpers.ts
|
|
2
7
|
var defaultHandles = (variant) => {
|
|
3
8
|
switch (variant) {
|
|
@@ -43,16 +48,30 @@ var handleStyle = (theme, handle, active) => {
|
|
|
43
48
|
};
|
|
44
49
|
switch (handle) {
|
|
45
50
|
case "right":
|
|
46
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
...baseStyle,
|
|
53
|
+
top: 0,
|
|
54
|
+
right: rem(theme, -2),
|
|
55
|
+
width: rem(theme, 4),
|
|
56
|
+
height: "100%",
|
|
57
|
+
cursor: "ew-resize"
|
|
58
|
+
};
|
|
47
59
|
case "bottom":
|
|
48
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
...baseStyle,
|
|
62
|
+
bottom: rem(theme, -2),
|
|
63
|
+
left: 0,
|
|
64
|
+
width: "100%",
|
|
65
|
+
height: rem(theme, 4),
|
|
66
|
+
cursor: "ns-resize"
|
|
67
|
+
};
|
|
49
68
|
case "bottomRight":
|
|
50
69
|
return {
|
|
51
70
|
...baseStyle,
|
|
52
|
-
bottom: -2,
|
|
53
|
-
right: -2,
|
|
54
|
-
width: 8,
|
|
55
|
-
height: 8,
|
|
71
|
+
bottom: rem(theme, -2),
|
|
72
|
+
right: rem(theme, -2),
|
|
73
|
+
width: rem(theme, 8),
|
|
74
|
+
height: rem(theme, 8),
|
|
56
75
|
cursor: "nw-resize",
|
|
57
76
|
borderRadius: "50%"
|
|
58
77
|
};
|
|
@@ -62,14 +81,17 @@ var handleStyle = (theme, handle, active) => {
|
|
|
62
81
|
};
|
|
63
82
|
var RESIZABLE_DEFAULTS = {
|
|
64
83
|
variant: "both",
|
|
65
|
-
width: 200,
|
|
66
|
-
height: 200,
|
|
67
|
-
minWidth: 50,
|
|
68
|
-
maxWidth: 1e3,
|
|
69
|
-
minHeight: 50,
|
|
70
|
-
maxHeight: 1e3,
|
|
71
84
|
disabled: false
|
|
72
85
|
};
|
|
86
|
+
var DEFAULT_BOX_PX = { start: 200, min: 50, max: 1e3 };
|
|
87
|
+
var startSizePx = (theme, width, height) => ({
|
|
88
|
+
width: remPx(theme, width ?? DEFAULT_BOX_PX.start),
|
|
89
|
+
height: remPx(theme, height ?? DEFAULT_BOX_PX.start)
|
|
90
|
+
});
|
|
91
|
+
var axisPx = (theme, min, max) => ({
|
|
92
|
+
min: remPx(theme, min ?? DEFAULT_BOX_PX.min),
|
|
93
|
+
max: remPx(theme, max ?? DEFAULT_BOX_PX.max)
|
|
94
|
+
});
|
|
73
95
|
var definedProps = (props) => Object.fromEntries(
|
|
74
96
|
Object.entries(props).filter(([, value]) => value !== void 0)
|
|
75
97
|
);
|
|
@@ -79,6 +101,8 @@ export {
|
|
|
79
101
|
defaultHandles,
|
|
80
102
|
resizedTo,
|
|
81
103
|
handleStyle,
|
|
104
|
+
startSizePx,
|
|
105
|
+
axisPx,
|
|
82
106
|
resolveResizableProps
|
|
83
107
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-QBTBRJ2Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/layout/Resizable/Resizable.helpers.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles/index.js';\n\nimport { rem, remPx } from '../../../tokens/relative';\n\nimport type { ResizableProps, ResizableVariant, ResizeHandle } from './Resizable.types';\n\n/** One axis's clamp, in the px a drag runs in. */\nexport interface Axis {\n min: number;\n max: number;\n}\n\nexport interface Bounds {\n width: Axis;\n height: Axis;\n}\n\nexport const defaultHandles = (variant: ResizableVariant): ResizeHandle[] => {\n switch (variant) {\n case 'horizontal':\n return ['right'];\n case 'vertical':\n return ['bottom'];\n default:\n return ['right', 'bottom', 'bottomRight'];\n }\n};\n\nconst HORIZONTAL_GROW: readonly ResizeHandle[] = ['right', 'topRight', 'bottomRight'];\nconst HORIZONTAL_SHRINK: readonly ResizeHandle[] = ['left', 'topLeft', 'bottomLeft'];\nconst VERTICAL_GROW: readonly ResizeHandle[] = ['bottom', 'bottomLeft', 'bottomRight'];\nconst VERTICAL_SHRINK: readonly ResizeHandle[] = ['top', 'topLeft', 'topRight'];\n\nconst clamp = (value: number, { min, max }: Axis): number =>\n Math.max(min, Math.min(max, value));\n\n/**\n * A handle on the right or bottom edge grows the box by the drag distance; one on\n * the left or top shrinks it by the same amount, because the opposite edge is\n * what stays put. A handle on neither edge of this axis leaves it alone.\n */\nconst alongAxis = (\n handle: ResizeHandle,\n grow: readonly ResizeHandle[],\n shrink: readonly ResizeHandle[],\n start: number,\n delta: number,\n bounds: Axis,\n): number => {\n if (grow.includes(handle)) return clamp(start + delta, bounds);\n if (shrink.includes(handle)) return clamp(start - delta, bounds);\n return start;\n};\n\nexport const resizedTo = (\n handle: ResizeHandle,\n delta: { x: number; y: number },\n start: { width: number; height: number },\n bounds: Bounds,\n) => ({\n width: alongAxis(handle, HORIZONTAL_GROW, HORIZONTAL_SHRINK, start.width, delta.x, bounds.width),\n height: alongAxis(\n handle,\n VERTICAL_GROW,\n VERTICAL_SHRINK,\n start.height,\n delta.y,\n bounds.height,\n ),\n});\n\nexport const handleStyle = (theme: Theme, handle: ResizeHandle, active: boolean) => {\n const baseStyle = {\n position: 'absolute' as const,\n backgroundColor: theme.palette.primary.main,\n opacity: 0,\n transition: theme.transitions.create('opacity'),\n '&:hover': {\n opacity: 0.3,\n },\n ...(active ? { opacity: 0.5 } : {}),\n };\n\n switch (handle) {\n case 'right':\n return {\n ...baseStyle,\n top: 0,\n right: rem(theme, -2),\n width: rem(theme, 4),\n height: '100%',\n cursor: 'ew-resize',\n };\n case 'bottom':\n return {\n ...baseStyle,\n bottom: rem(theme, -2),\n left: 0,\n width: '100%',\n height: rem(theme, 4),\n cursor: 'ns-resize',\n };\n case 'bottomRight':\n return {\n ...baseStyle,\n bottom: rem(theme, -2),\n right: rem(theme, -2),\n width: rem(theme, 8),\n height: rem(theme, 8),\n cursor: 'nw-resize',\n borderRadius: '50%',\n };\n default:\n return baseStyle;\n }\n};\n\ntype ResizableDefaultedKeys = 'variant' | 'disabled';\n\ntype ResolvedResizableProps = ResizableProps &\n Required<Pick<ResizableProps, ResizableDefaultedKeys>>;\n\nconst RESIZABLE_DEFAULTS: Pick<ResizableProps, ResizableDefaultedKeys> = {\n variant: 'both',\n disabled: false,\n};\n\n/** The box's own defaults, in design px: where it starts, and its clamp. */\nconst DEFAULT_BOX_PX = { start: 200, min: 50, max: 1000 } as const;\n\n/**\n * Where the box starts, in the px a drag runs in. The consumer's sizes are\n * design px, like every other size in the package; a drag is pointer pixels,\n * so the live size is px from here on.\n */\nexport const startSizePx = (theme: Theme, width?: number, height?: number) => ({\n width: remPx(theme, width ?? DEFAULT_BOX_PX.start),\n height: remPx(theme, height ?? DEFAULT_BOX_PX.start),\n});\n\n/** One axis's clamp, from the consumer's design px to the px a drag runs in. */\nexport const axisPx = (theme: Theme, min?: number, max?: number): Axis => ({\n min: remPx(theme, min ?? DEFAULT_BOX_PX.min),\n max: remPx(theme, max ?? DEFAULT_BOX_PX.max),\n});\n\n// Strips explicitly-undefined props before the merge, so `minWidth={undefined}`\n// still falls back to the default exactly as a destructuring default would.\nconst definedProps = (props: ResizableProps): Partial<ResizableProps> =>\n Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Partial<ResizableProps>;\n\nexport const resolveResizableProps = (props: ResizableProps): ResolvedResizableProps =>\n ({ ...RESIZABLE_DEFAULTS, ...definedProps(props) }) as ResolvedResizableProps;\n"],"mappings":";;;;;;AAiBO,IAAM,iBAAi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BAAoB,GAAG,aAAa,KAAK,EAAE;","names":[]}
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cn
|
|
3
3
|
} from "./chunk-NHL5ERBM.js";
|
|
4
|
+
import {
|
|
5
|
+
rem
|
|
6
|
+
} from "./chunk-YKCAJ2TN.js";
|
|
4
7
|
|
|
5
8
|
// src/components/layout/CardGrid/CardGrid.tsx
|
|
9
|
+
import { useTheme } from "@mui/material/styles/index.js";
|
|
6
10
|
import { Children } from "react";
|
|
7
11
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
var
|
|
12
|
+
var GRID = {
|
|
13
|
+
/** Between cards: the grid's `gap`, and what the scroll math reserves per gap. */
|
|
14
|
+
gapPx: 16,
|
|
15
|
+
/**
|
|
16
|
+
* `scroll`: the next card left visible past the last whole one — the
|
|
17
|
+
* "there's more, swipe" hint. Wide enough to read as a clipped card (rounded
|
|
18
|
+
* edge + a slice of its photo) rather than as a rendering glitch.
|
|
19
|
+
*/
|
|
20
|
+
peekPx: 28,
|
|
21
|
+
/** Under the row — the tabwoah original's Tailwind `pb-0.5`. */
|
|
22
|
+
paddingBottomPx: 2
|
|
23
|
+
};
|
|
9
24
|
var SCROLL_VISIBLE_CARDS = 2;
|
|
10
|
-
|
|
11
|
-
function scrollTrackWidth(count, max) {
|
|
25
|
+
function scrollTrackWidth(theme, count, max) {
|
|
12
26
|
const tracks = Math.max(1, Math.min(count, SCROLL_VISIBLE_CARDS));
|
|
13
27
|
const overflows = count > tracks;
|
|
14
28
|
const gaps = overflows ? tracks : tracks - 1;
|
|
15
|
-
const reserved = gaps *
|
|
16
|
-
return `min(${max}
|
|
29
|
+
const reserved = gaps * GRID.gapPx + (overflows ? GRID.peekPx : 0);
|
|
30
|
+
return `min(${rem(theme, max)}, calc((100% - ${rem(theme, reserved)}) / ${tracks}))`;
|
|
17
31
|
}
|
|
18
32
|
function CardGrid({
|
|
19
33
|
cardWidth,
|
|
@@ -24,22 +38,23 @@ function CardGrid({
|
|
|
24
38
|
containerRef,
|
|
25
39
|
children
|
|
26
40
|
}) {
|
|
41
|
+
const theme = useTheme();
|
|
27
42
|
const style = {
|
|
28
43
|
display: "grid",
|
|
29
|
-
gap:
|
|
30
|
-
paddingBottom:
|
|
44
|
+
gap: rem(theme, GRID.gapPx),
|
|
45
|
+
paddingBottom: rem(theme, GRID.paddingBottomPx)
|
|
31
46
|
};
|
|
32
47
|
if (variant === "scroll") {
|
|
33
48
|
const max = maxCardWidth ?? Math.round(cardWidth * 1.6);
|
|
34
49
|
style.gridAutoFlow = "column";
|
|
35
|
-
style.gridAutoColumns = scrollTrackWidth(Children.count(children), max);
|
|
50
|
+
style.gridAutoColumns = scrollTrackWidth(theme, Children.count(children), max);
|
|
36
51
|
style.overflowX = "auto";
|
|
37
52
|
style.overflowY = "hidden";
|
|
38
53
|
style.scrollSnapType = "x mandatory";
|
|
39
54
|
} else if (variant === "fluid") {
|
|
40
|
-
style.gridTemplateColumns = `repeat(auto-fill, minmax(${cardWidth}
|
|
55
|
+
style.gridTemplateColumns = `repeat(auto-fill, minmax(${rem(theme, cardWidth)}, 1fr))`;
|
|
41
56
|
} else {
|
|
42
|
-
style.gridTemplateColumns = `repeat(auto-fill, ${cardWidth}
|
|
57
|
+
style.gridTemplateColumns = `repeat(auto-fill, ${rem(theme, cardWidth)})`;
|
|
43
58
|
style.justifyContent = "space-around";
|
|
44
59
|
}
|
|
45
60
|
const content = variant === "scroll" ? Children.map(children, (child) => /* @__PURE__ */ jsx("div", { style: { scrollSnapAlign: "start" }, children: child })) : children;
|
|
@@ -49,4 +64,4 @@ function CardGrid({
|
|
|
49
64
|
export {
|
|
50
65
|
CardGrid
|
|
51
66
|
};
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-QNCWSDXE.js.map
|