@12-apps/ui 6.89.2 → 6.91.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/components-catalog.md +2 -2
- package/dist/_internal/components/data-display/Alert/Alert.js +3 -3
- package/dist/_internal/components/data-display/AsyncStateContainer/AsyncStateContainer.js +3 -3
- package/dist/_internal/components/data-display/Avatar/Avatar.js +3 -3
- package/dist/_internal/components/data-display/Avatar/Avatar.view.js +2 -2
- package/dist/_internal/components/data-display/CardKit/card-actions-context.js +4 -4
- package/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +5 -5
- package/dist/_internal/components/data-display/Carousel/Carousel.chrome.js +4 -3
- package/dist/_internal/components/data-display/Carousel/Carousel.js +5 -4
- package/dist/_internal/components/data-display/Carousel/Carousel.parts.js +3 -2
- package/dist/_internal/components/data-display/Chart/Chart.js +5 -5
- package/dist/_internal/components/data-display/Chart/SpecChart.js +8 -8
- package/dist/_internal/components/data-display/Chart/chart-context.js +2 -2
- package/dist/_internal/components/data-display/Chart/chart-renderers.js +4 -4
- package/dist/_internal/components/data-display/Chart/chart-spec.js +2 -2
- package/dist/_internal/components/data-display/Chip/Chip.js +3 -3
- package/dist/_internal/components/data-display/Chip/Chip.styles.js +2 -2
- package/dist/_internal/components/data-display/DataGrid/DataGrid.js +2 -2
- package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +56 -31
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +64 -39
- package/dist/_internal/components/data-display/DataViews/base-list-card-geometry.js +6 -6
- package/dist/_internal/components/data-display/DataViews/base-list-card-layout.js +7 -7
- package/dist/_internal/components/data-display/DataViews/base-list-card-slots.js +5 -5
- package/dist/_internal/components/data-display/DataViews/base-list-card.js +9 -9
- package/dist/_internal/components/data-display/DataViews/data-views-bar-controls.js +5 -3
- package/dist/_internal/components/data-display/DataViews/data-views-day-input.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +31 -6
- package/dist/_internal/components/data-display/DataViews/data-views-grid-bodies.js +8 -8
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +53 -28
- package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +36 -11
- package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +32 -7
- package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +33 -8
- package/dist/_internal/components/data-display/DataViews/data-views-number-input.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-preset-chips.js +10 -3
- package/dist/_internal/components/data-display/DataViews/data-views-range-bounds.js +47 -0
- package/dist/_internal/components/data-display/DataViews/data-views-range-calendar.js +36 -0
- package/dist/_internal/components/data-display/DataViews/data-views-range-calendar.js.map +1 -0
- package/dist/_internal/components/data-display/DataViews/data-views-range-pill.js +32 -6
- package/dist/_internal/components/data-display/DataViews/data-views-range-summary.js +12 -0
- package/dist/_internal/components/data-display/DataViews/data-views-range-summary.js.map +1 -0
- package/dist/_internal/components/data-display/DataViews/data-views-shell-toolbar.js +3 -3
- package/dist/_internal/components/data-display/DataViews/data-views-still-anchor.js +9 -0
- package/dist/_internal/components/data-display/DataViews/data-views-still-anchor.js.map +1 -0
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +5 -5
- package/dist/_internal/components/data-display/DataViews/data-views-toolbar.js +2 -2
- package/dist/_internal/components/data-display/DataViews/list-card-rails.js +4 -4
- package/dist/_internal/components/data-display/DataViews/use-data-views-state.js +2 -2
- package/dist/_internal/components/data-display/EmptyState/EmptyState.js +2 -2
- package/dist/_internal/components/data-display/FleetMap/FleetBody.js +13 -12
- package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js +12 -11
- package/dist/_internal/components/data-display/FleetMap/FleetMap.fixtures.js +2 -1
- package/dist/_internal/components/data-display/FleetMap/FleetMap.fixtures.js.map +1 -1
- package/dist/_internal/components/data-display/FleetMap/FleetMap.js +15 -15
- package/dist/_internal/components/data-display/InteractiveTooltip/InteractiveTooltip.js +2 -2
- package/dist/_internal/components/data-display/Lightbox/Lightbox.js +7 -7
- package/dist/_internal/components/data-display/Lightbox/LightboxControls.js +2 -2
- package/dist/_internal/components/data-display/Lightbox/LightboxOverlay.js +3 -3
- package/dist/_internal/components/data-display/Lightbox/LightboxThumbnails.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/MapControlBar.js +4 -3
- package/dist/_internal/components/data-display/MapPreview/MapLayers.js +6 -5
- package/dist/_internal/components/data-display/MapPreview/MapMarkers.js +5 -4
- package/dist/_internal/components/data-display/MapPreview/MapPreview.helpers.js +3 -2
- package/dist/_internal/components/data-display/MapPreview/MapPreview.js +11 -10
- package/dist/_internal/components/data-display/RegionMap/RegionMap.hooks.js +2 -1
- package/dist/_internal/components/data-display/RegionMap/RegionMap.js +4 -3
- package/dist/_internal/components/data-display/RegionMap/RegionMap.view.js +19 -0
- package/dist/_internal/components/data-display/RegionMap/RegionMap.view.js.map +1 -0
- package/dist/_internal/components/data-display/RegionMap/RegionMapDrawing.js +1 -1
- package/dist/_internal/components/data-display/SectionOnboarding/SectionOnboarding.js +3 -3
- package/dist/_internal/components/data-display/index.js +67 -61
- package/dist/_internal/components/feedback/NotificationStatusNotice/NotificationStatusNotice.js +4 -4
- package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.js +6 -6
- package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.overview.js +5 -5
- package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.parts.js +4 -4
- package/dist/_internal/components/feedback/index.js +7 -7
- package/dist/_internal/components/form/Calendar/Calendar.js +5 -5
- package/dist/_internal/components/form/Calendar/CalendarDay.js +1 -1
- package/dist/_internal/components/form/Calendar/CalendarDayCell.js +2 -2
- package/dist/_internal/components/form/Calendar/CalendarMonth.js +3 -3
- package/dist/_internal/components/form/Calendar/CalendarSelectorsMonth.js +4 -4
- package/dist/_internal/components/form/DateRangePicker/DateRangePicker.hooks.js +3 -3
- package/dist/_internal/components/form/DateRangePicker/DateRangePicker.js +10 -10
- package/dist/_internal/components/form/DateRangePicker/DateRangePicker.range.js +2 -2
- package/dist/_internal/components/form/DateRangePicker/DateRangePickerFields.js +3 -3
- package/dist/_internal/components/form/index.js +24 -24
- package/dist/_internal/components/index.js +102 -96
- package/dist/_internal/components/layout/SettingCard/SettingCard.js +8 -8
- package/dist/_internal/components/layout/SettingCard/SettingCard.parts.js +4 -4
- package/dist/_internal/components/layout/SettingCard/SettingCard.summary.js +7 -7
- package/dist/_internal/components/layout/SettingCard/SettingGrid.js +5 -5
- package/dist/_internal/components/layout/SettingCard/SettingGroup.js +9 -9
- package/dist/_internal/components/layout/SettingCard/SettingSwitch.js +8 -8
- package/dist/_internal/components/layout/SettingCard/SettingToggle.js +9 -9
- package/dist/_internal/components/layout/index.js +12 -12
- package/dist/_internal/en-US.data-display.js +2 -1
- package/dist/_internal/pt-BR.data-display.js +2 -1
- package/dist/_internal/user-avatar/user-avatar.js +4 -4
- package/dist/charts.js +11 -11
- package/dist/{chunk-FJ3UZ4RC.js → chunk-2FKWKLSC.js} +5 -3
- package/dist/chunk-2FKWKLSC.js.map +1 -0
- package/dist/{chunk-K2VDRODL.js → chunk-3IDL7NK7.js} +2 -2
- package/dist/{chunk-6ATXOJVQ.js → chunk-3JZ3KEQQ.js} +4 -4
- package/dist/{chunk-XHIBFBNP.js → chunk-3ZRK3BRN.js} +4 -2
- package/dist/chunk-3ZRK3BRN.js.map +1 -0
- package/dist/{chunk-EOIRU62W.js → chunk-42D7KBDH.js} +2 -2
- package/dist/{chunk-LXIPBHNJ.js → chunk-42TOCPXB.js} +5 -5
- package/dist/{chunk-WAO7UQRS.js → chunk-4KWDNGMA.js} +3 -3
- package/dist/{chunk-X5OGIT2F.js → chunk-4L54KUZV.js} +22 -4
- package/dist/chunk-4L54KUZV.js.map +1 -0
- package/dist/{chunk-JIEVKHOH.js → chunk-4QR7LM5F.js} +2 -2
- package/dist/{chunk-WJMSND5Q.js → chunk-5E2CRRD4.js} +5 -5
- package/dist/{chunk-ZDAAHCIS.js → chunk-5HADIIWN.js} +3 -3
- package/dist/{chunk-BP3ZKIPE.js → chunk-64UNVW6D.js} +4 -4
- package/dist/{chunk-TRYR424I.js → chunk-6LOWZCH7.js} +15 -1
- package/dist/chunk-6LOWZCH7.js.map +1 -0
- package/dist/{chunk-6WHIJPEF.js → chunk-6PU5P7QT.js} +2 -2
- package/dist/{chunk-7F6D73NL.js → chunk-76DX2IMH.js} +2 -2
- package/dist/chunk-7CUZTWKW.js +52 -0
- package/dist/chunk-7CUZTWKW.js.map +1 -0
- package/dist/{chunk-5RSK5M6M.js → chunk-7NP2JHGM.js} +63 -126
- package/dist/chunk-7NP2JHGM.js.map +1 -0
- package/dist/{chunk-YNZUYZ2O.js → chunk-A3DDEKLV.js} +2 -2
- package/dist/{chunk-FEKWKWGK.js → chunk-ARGVUTTL.js} +15 -1
- package/dist/chunk-ARGVUTTL.js.map +1 -0
- package/dist/{chunk-BMTIBQQC.js → chunk-BBBHPK2Q.js} +6 -6
- package/dist/{chunk-DYHOBKPU.js → chunk-BLZDSCIZ.js} +6 -6
- package/dist/{chunk-EUR2ORTN.js → chunk-CSJ7WNXU.js} +2 -2
- package/dist/{chunk-OWRQOYUE.js → chunk-DA3D5X5Z.js} +5 -5
- package/dist/{chunk-LV6AD6XC.js → chunk-DBI6AMNY.js} +4 -4
- package/dist/{chunk-3YFDGFEK.js → chunk-DVX4HDNP.js} +2 -2
- package/dist/chunk-DY2I6LMX.js +1 -0
- package/dist/chunk-DY2I6LMX.js.map +1 -0
- package/dist/{chunk-QKOJ4637.js → chunk-E6K2UZGR.js} +3 -3
- package/dist/{chunk-7XSCEHGA.js → chunk-EOQ6EKTS.js} +7 -7
- package/dist/chunk-FORAVDJF.js +164 -0
- package/dist/chunk-FORAVDJF.js.map +1 -0
- package/dist/chunk-FWAY2SAI.js +72 -0
- package/dist/chunk-FWAY2SAI.js.map +1 -0
- package/dist/{chunk-Q2ERGAQO.js → chunk-FYAW5GBF.js} +33 -6
- package/dist/chunk-FYAW5GBF.js.map +1 -0
- package/dist/{chunk-GMRQPNG3.js → chunk-G2NVBCF7.js} +20 -25
- package/dist/chunk-G2NVBCF7.js.map +1 -0
- package/dist/{chunk-Z5WUSI47.js → chunk-G3JFESKD.js} +6 -6
- package/dist/{chunk-3EIRRLCQ.js → chunk-HC6OZ7QK.js} +2 -2
- package/dist/{chunk-SKIAWOUC.js → chunk-HOPRZEBM.js} +3 -3
- package/dist/{chunk-OBA75Y5O.js → chunk-HS662RLW.js} +61 -33
- package/dist/chunk-HS662RLW.js.map +1 -0
- package/dist/{chunk-O63ZROSY.js → chunk-IWSTMVCA.js} +7 -7
- package/dist/chunk-J2AVWIMM.js +60 -0
- package/dist/chunk-J2AVWIMM.js.map +1 -0
- package/dist/{chunk-7QKIL5YF.js → chunk-J2GDA64N.js} +4 -4
- package/dist/{chunk-TZC6KIK2.js → chunk-JG733RMP.js} +5 -5
- package/dist/{chunk-CW5Z67NA.js → chunk-JH2XLVWM.js} +2 -2
- package/dist/{chunk-TYXFFNPM.js → chunk-JKZPGCN7.js} +11 -11
- package/dist/{chunk-QRRWLLXW.js → chunk-JN2IANXD.js} +3 -3
- package/dist/{chunk-HQCZT6TO.js → chunk-JVOEVTCZ.js} +5 -5
- package/dist/{chunk-GBB23QLL.js → chunk-KJKD6Y6V.js} +3 -3
- package/dist/{chunk-XLU5WFSY.js → chunk-L3PDY7CJ.js} +2 -2
- package/dist/{chunk-S6D7NOV7.js → chunk-L6JAALMX.js} +3 -3
- package/dist/{chunk-72HOUWAW.js → chunk-L6YTVXGN.js} +5 -3
- package/dist/{chunk-72HOUWAW.js.map → chunk-L6YTVXGN.js.map} +1 -1
- package/dist/chunk-LZNUBQ5I.js +181 -0
- package/dist/chunk-LZNUBQ5I.js.map +1 -0
- package/dist/{chunk-BECKKDYG.js → chunk-M2M4IDFU.js} +2 -2
- package/dist/{chunk-AMLHEKSV.js → chunk-M3XJVD5G.js} +5 -5
- package/dist/{chunk-CSGBHYW6.js → chunk-M5Y42AZ4.js} +2 -2
- package/dist/chunk-MICX23P4.js +122 -0
- package/dist/chunk-MICX23P4.js.map +1 -0
- package/dist/{chunk-5CP5Z3YU.js → chunk-MPWA55CF.js} +4 -4
- package/dist/{chunk-CJUK32UH.js → chunk-MYTV353T.js} +5 -5
- package/dist/{chunk-BO6MT2S2.js → chunk-MZAYIG2I.js} +7 -6
- package/dist/chunk-MZAYIG2I.js.map +1 -0
- package/dist/{chunk-AKE6KVQG.js → chunk-NGXL4R54.js} +5 -1
- package/dist/chunk-NGXL4R54.js.map +1 -0
- package/dist/{chunk-BEHT4IHH.js → chunk-NKEFH3RS.js} +6 -6
- package/dist/{chunk-NI67M453.js → chunk-PGANINQD.js} +5 -5
- package/dist/{chunk-RCTHCXS6.js → chunk-PJNIJIE6.js} +2 -2
- package/dist/{chunk-E2UOEI7N.js → chunk-Q3SILZTQ.js} +2 -2
- package/dist/{chunk-SB2SEGR6.js → chunk-QHIWV55K.js} +3 -3
- package/dist/{chunk-DHAXUVMR.js → chunk-QN7FVZQD.js} +4 -4
- package/dist/{chunk-5S5K73I6.js → chunk-QSOCOXVL.js} +3 -3
- package/dist/{chunk-NQCTANF3.js → chunk-QVDEGBME.js} +7 -7
- package/dist/{chunk-BQBEN44R.js → chunk-RDCIST7P.js} +2 -2
- package/dist/{chunk-HUXAIQC5.js → chunk-RZ3P4X2I.js} +2 -2
- package/dist/{chunk-QLJU7UUI.js → chunk-T7OIVPCO.js} +38 -3
- package/dist/chunk-T7OIVPCO.js.map +1 -0
- package/dist/{chunk-U2ILXZDG.js → chunk-TB5CRHTF.js} +2 -2
- package/dist/{chunk-X2GWR75Q.js → chunk-TSEBMVYY.js} +3 -3
- package/dist/{chunk-OKRITX4S.js → chunk-U2AEM3K4.js} +7 -7
- package/dist/{chunk-EXVCVXFX.js → chunk-U2QXQ7D4.js} +6 -6
- package/dist/{chunk-K6FCSB6T.js → chunk-U2SAW6DH.js} +2 -2
- package/dist/{chunk-DAHSKQBV.js → chunk-UMOHHWXY.js} +2 -2
- package/dist/{chunk-YDIC6LSP.js → chunk-VCQFDQM3.js} +27 -7
- package/dist/chunk-VCQFDQM3.js.map +1 -0
- package/dist/{chunk-P772HCHI.js → chunk-W676GY42.js} +4 -4
- package/dist/{chunk-BAQ3ITZV.js → chunk-WCF56ZCD.js} +2 -2
- package/dist/{chunk-6D5AMANO.js → chunk-WH3LUOCQ.js} +2 -2
- package/dist/{chunk-T2G4LDU5.js → chunk-WLLUARTC.js} +2 -2
- package/dist/{chunk-5BVAUUWL.js → chunk-X37NTEVS.js} +2 -2
- package/dist/{chunk-5KK3I42O.js → chunk-XILMDEGZ.js} +13 -10
- package/dist/chunk-XILMDEGZ.js.map +1 -0
- package/dist/{chunk-MW7P2C2C.js → chunk-YGQM6GFQ.js} +2 -2
- package/dist/{chunk-WW3F7DCX.js → chunk-Z2WZDVGG.js} +2 -2
- package/dist/{chunk-WNNA6YYE.js → chunk-Z7T4EFEC.js} +7 -4
- package/dist/chunk-Z7T4EFEC.js.map +1 -0
- package/dist/{chunk-LOLYBFYY.js → chunk-ZCNR4DN5.js} +5 -5
- package/dist/{chunk-COKPPU42.js → chunk-ZIHSCBMN.js} +12 -12
- package/dist/data-display/Alert.js +3 -3
- package/dist/data-display/AsyncStateContainer.js +3 -3
- package/dist/data-display/Avatar.js +3 -3
- package/dist/data-display/CardKit.js +15 -15
- package/dist/data-display/Carousel.js +5 -4
- package/dist/data-display/Chart.js +11 -11
- package/dist/data-display/Chip.js +3 -3
- package/dist/data-display/DataGrid.js +2 -2
- package/dist/data-display/DataViews.js +75 -50
- package/dist/data-display/DayRuler.js +4 -4
- package/dist/data-display/EmptyState.js +2 -2
- package/dist/data-display/FleetMap.js +15 -15
- package/dist/data-display/InteractiveTooltip.js +2 -2
- package/dist/data-display/Lightbox.js +7 -7
- package/dist/data-display/MapPreview.js +11 -10
- package/dist/data-display/RegionMap.js +11 -5
- package/dist/data-display/SectionOnboarding.js +3 -3
- package/dist/en-US.js +1 -1
- package/dist/feedback/NotificationStatusNotice.js +4 -4
- package/dist/feedback/SequenceResolver.js +6 -6
- package/dist/form/Calendar.js +5 -5
- package/dist/form/DateRangePicker.js +10 -10
- package/dist/layout/SettingCard.js +12 -12
- package/dist/locales.js +5 -5
- package/dist/pt-BR.js +1 -1
- package/dist/types/components/data-display/DataViews/data-views-bar-controls.d.ts +15 -1
- package/dist/types/components/data-display/DataViews/data-views-bar-controls.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-copy.d.ts +35 -0
- package/dist/types/components/data-display/DataViews/data-views-copy.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-day-input.d.ts +7 -1
- package/dist/types/components/data-display/DataViews/data-views-day-input.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-more-fields.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-more-filters.d.ts +5 -3
- package/dist/types/components/data-display/DataViews/data-views-more-filters.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-number-input.d.ts +10 -2
- package/dist/types/components/data-display/DataViews/data-views-number-input.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-preset-chips.d.ts +10 -0
- package/dist/types/components/data-display/DataViews/data-views-preset-chips.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-range-bounds.d.ts +35 -0
- package/dist/types/components/data-display/DataViews/data-views-range-bounds.d.ts.map +1 -0
- package/dist/types/components/data-display/DataViews/data-views-range-calendar.d.ts +35 -0
- package/dist/types/components/data-display/DataViews/data-views-range-calendar.d.ts.map +1 -0
- package/dist/types/components/data-display/DataViews/data-views-range-pill.d.ts +2 -11
- package/dist/types/components/data-display/DataViews/data-views-range-pill.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-range-summary.d.ts +21 -0
- package/dist/types/components/data-display/DataViews/data-views-range-summary.d.ts.map +1 -0
- package/dist/types/components/data-display/DataViews/data-views-still-anchor.d.ts +45 -0
- package/dist/types/components/data-display/DataViews/data-views-still-anchor.d.ts.map +1 -0
- package/dist/types/components/data-display/LazyImage/LazyImage.hooks.d.ts +1 -1
- package/dist/types/components/data-display/RegionMap/RegionMap.d.ts +4 -1
- package/dist/types/components/data-display/RegionMap/RegionMap.d.ts.map +1 -1
- package/dist/types/components/data-display/RegionMap/RegionMap.hooks.d.ts +4 -2
- package/dist/types/components/data-display/RegionMap/RegionMap.hooks.d.ts.map +1 -1
- package/dist/types/components/data-display/RegionMap/RegionMap.types.d.ts +40 -0
- package/dist/types/components/data-display/RegionMap/RegionMap.types.d.ts.map +1 -1
- package/dist/types/components/data-display/RegionMap/RegionMap.view.d.ts +36 -0
- package/dist/types/components/data-display/RegionMap/RegionMap.view.d.ts.map +1 -0
- package/dist/types/components/data-display/RegionMap/RegionMapDrawing.d.ts +4 -1
- package/dist/types/components/data-display/RegionMap/RegionMapDrawing.d.ts.map +1 -1
- package/dist/types/components/data-display/RegionMap/index.d.ts +3 -2
- package/dist/types/components/data-display/RegionMap/index.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 +2 -0
- package/dist/types/components/form/Calendar/CalendarDay.d.ts.map +1 -1
- package/dist/types/components/form/Calendar/CalendarDayCell.d.ts +2 -0
- package/dist/types/components/form/Calendar/CalendarDayCell.d.ts.map +1 -1
- package/dist/types/components/form/Calendar/CalendarMonth.d.ts +5 -0
- package/dist/types/components/form/Calendar/CalendarMonth.d.ts.map +1 -1
- package/dist/types/en-US.data-display.d.ts.map +1 -1
- package/dist/types/pt-BR.data-display.d.ts.map +1 -1
- package/dist/user-avatar.js +4 -4
- package/package.json +1 -1
- package/src/components/data-display/DataViews/RESPONSIVE-BEHAVIOUR.md +59 -0
- package/src/components/data-display/DataViews/data-views-bar-controls.tsx +56 -1
- package/src/components/data-display/DataViews/data-views-copy.ts +36 -0
- package/src/components/data-display/DataViews/data-views-day-input.tsx +9 -1
- package/src/components/data-display/DataViews/data-views-inline-bar.tsx +5 -3
- package/src/components/data-display/DataViews/data-views-more-fields.tsx +1 -0
- package/src/components/data-display/DataViews/data-views-more-filters.tsx +82 -29
- package/src/components/data-display/DataViews/data-views-number-input.tsx +19 -9
- package/src/components/data-display/DataViews/data-views-preset-chips.tsx +165 -16
- package/src/components/data-display/DataViews/data-views-range-bounds.tsx +223 -0
- package/src/components/data-display/DataViews/data-views-range-calendar.tsx +185 -0
- package/src/components/data-display/DataViews/data-views-range-pill.tsx +71 -154
- package/src/components/data-display/DataViews/data-views-range-summary.tsx +66 -0
- package/src/components/data-display/DataViews/data-views-still-anchor.ts +93 -0
- package/src/components/data-display/RegionMap/RegionMap.hooks.ts +24 -33
- package/src/components/data-display/RegionMap/RegionMap.md +27 -0
- package/src/components/data-display/RegionMap/RegionMap.tsx +7 -1
- package/src/components/data-display/RegionMap/RegionMap.types.ts +41 -0
- package/src/components/data-display/RegionMap/RegionMap.view.ts +105 -0
- package/src/components/data-display/RegionMap/RegionMapDrawing.tsx +11 -0
- package/src/components/data-display/RegionMap/index.ts +5 -1
- package/src/components/data-display/RegionMap/tests.md +10 -2
- package/src/components/form/Calendar/Calendar.md +17 -2
- package/src/components/form/Calendar/Calendar.tsx +56 -3
- package/src/components/form/Calendar/CalendarDay.tsx +33 -3
- package/src/components/form/Calendar/CalendarDayCell.tsx +4 -0
- package/src/components/form/Calendar/CalendarMonth.tsx +27 -5
- package/src/en-US.data-display.ts +12 -0
- package/src/pt-BR.data-display.ts +12 -0
- package/dist/chunk-5KK3I42O.js.map +0 -1
- package/dist/chunk-5RSK5M6M.js.map +0 -1
- package/dist/chunk-7D7CJRL7.js +0 -78
- package/dist/chunk-7D7CJRL7.js.map +0 -1
- package/dist/chunk-ACFKPE2T.js +0 -1
- package/dist/chunk-AKE6KVQG.js.map +0 -1
- package/dist/chunk-BO6MT2S2.js.map +0 -1
- package/dist/chunk-FEKWKWGK.js.map +0 -1
- package/dist/chunk-FJ3UZ4RC.js.map +0 -1
- package/dist/chunk-GMRQPNG3.js.map +0 -1
- package/dist/chunk-OBA75Y5O.js.map +0 -1
- package/dist/chunk-Q2ERGAQO.js.map +0 -1
- package/dist/chunk-QLJU7UUI.js.map +0 -1
- package/dist/chunk-TRYR424I.js.map +0 -1
- package/dist/chunk-WNNA6YYE.js.map +0 -1
- package/dist/chunk-X5OGIT2F.js.map +0 -1
- package/dist/chunk-XHIBFBNP.js.map +0 -1
- package/dist/chunk-YDIC6LSP.js.map +0 -1
- /package/dist/{chunk-ACFKPE2T.js.map → _internal/components/data-display/DataViews/data-views-range-bounds.js.map} +0 -0
- /package/dist/{chunk-K2VDRODL.js.map → chunk-3IDL7NK7.js.map} +0 -0
- /package/dist/{chunk-6ATXOJVQ.js.map → chunk-3JZ3KEQQ.js.map} +0 -0
- /package/dist/{chunk-EOIRU62W.js.map → chunk-42D7KBDH.js.map} +0 -0
- /package/dist/{chunk-LXIPBHNJ.js.map → chunk-42TOCPXB.js.map} +0 -0
- /package/dist/{chunk-WAO7UQRS.js.map → chunk-4KWDNGMA.js.map} +0 -0
- /package/dist/{chunk-JIEVKHOH.js.map → chunk-4QR7LM5F.js.map} +0 -0
- /package/dist/{chunk-WJMSND5Q.js.map → chunk-5E2CRRD4.js.map} +0 -0
- /package/dist/{chunk-ZDAAHCIS.js.map → chunk-5HADIIWN.js.map} +0 -0
- /package/dist/{chunk-BP3ZKIPE.js.map → chunk-64UNVW6D.js.map} +0 -0
- /package/dist/{chunk-6WHIJPEF.js.map → chunk-6PU5P7QT.js.map} +0 -0
- /package/dist/{chunk-7F6D73NL.js.map → chunk-76DX2IMH.js.map} +0 -0
- /package/dist/{chunk-YNZUYZ2O.js.map → chunk-A3DDEKLV.js.map} +0 -0
- /package/dist/{chunk-BMTIBQQC.js.map → chunk-BBBHPK2Q.js.map} +0 -0
- /package/dist/{chunk-DYHOBKPU.js.map → chunk-BLZDSCIZ.js.map} +0 -0
- /package/dist/{chunk-EUR2ORTN.js.map → chunk-CSJ7WNXU.js.map} +0 -0
- /package/dist/{chunk-OWRQOYUE.js.map → chunk-DA3D5X5Z.js.map} +0 -0
- /package/dist/{chunk-LV6AD6XC.js.map → chunk-DBI6AMNY.js.map} +0 -0
- /package/dist/{chunk-3YFDGFEK.js.map → chunk-DVX4HDNP.js.map} +0 -0
- /package/dist/{chunk-QKOJ4637.js.map → chunk-E6K2UZGR.js.map} +0 -0
- /package/dist/{chunk-7XSCEHGA.js.map → chunk-EOQ6EKTS.js.map} +0 -0
- /package/dist/{chunk-Z5WUSI47.js.map → chunk-G3JFESKD.js.map} +0 -0
- /package/dist/{chunk-3EIRRLCQ.js.map → chunk-HC6OZ7QK.js.map} +0 -0
- /package/dist/{chunk-SKIAWOUC.js.map → chunk-HOPRZEBM.js.map} +0 -0
- /package/dist/{chunk-O63ZROSY.js.map → chunk-IWSTMVCA.js.map} +0 -0
- /package/dist/{chunk-7QKIL5YF.js.map → chunk-J2GDA64N.js.map} +0 -0
- /package/dist/{chunk-TZC6KIK2.js.map → chunk-JG733RMP.js.map} +0 -0
- /package/dist/{chunk-CW5Z67NA.js.map → chunk-JH2XLVWM.js.map} +0 -0
- /package/dist/{chunk-TYXFFNPM.js.map → chunk-JKZPGCN7.js.map} +0 -0
- /package/dist/{chunk-QRRWLLXW.js.map → chunk-JN2IANXD.js.map} +0 -0
- /package/dist/{chunk-HQCZT6TO.js.map → chunk-JVOEVTCZ.js.map} +0 -0
- /package/dist/{chunk-GBB23QLL.js.map → chunk-KJKD6Y6V.js.map} +0 -0
- /package/dist/{chunk-XLU5WFSY.js.map → chunk-L3PDY7CJ.js.map} +0 -0
- /package/dist/{chunk-S6D7NOV7.js.map → chunk-L6JAALMX.js.map} +0 -0
- /package/dist/{chunk-BECKKDYG.js.map → chunk-M2M4IDFU.js.map} +0 -0
- /package/dist/{chunk-AMLHEKSV.js.map → chunk-M3XJVD5G.js.map} +0 -0
- /package/dist/{chunk-CSGBHYW6.js.map → chunk-M5Y42AZ4.js.map} +0 -0
- /package/dist/{chunk-5CP5Z3YU.js.map → chunk-MPWA55CF.js.map} +0 -0
- /package/dist/{chunk-CJUK32UH.js.map → chunk-MYTV353T.js.map} +0 -0
- /package/dist/{chunk-BEHT4IHH.js.map → chunk-NKEFH3RS.js.map} +0 -0
- /package/dist/{chunk-NI67M453.js.map → chunk-PGANINQD.js.map} +0 -0
- /package/dist/{chunk-RCTHCXS6.js.map → chunk-PJNIJIE6.js.map} +0 -0
- /package/dist/{chunk-E2UOEI7N.js.map → chunk-Q3SILZTQ.js.map} +0 -0
- /package/dist/{chunk-SB2SEGR6.js.map → chunk-QHIWV55K.js.map} +0 -0
- /package/dist/{chunk-DHAXUVMR.js.map → chunk-QN7FVZQD.js.map} +0 -0
- /package/dist/{chunk-5S5K73I6.js.map → chunk-QSOCOXVL.js.map} +0 -0
- /package/dist/{chunk-NQCTANF3.js.map → chunk-QVDEGBME.js.map} +0 -0
- /package/dist/{chunk-BQBEN44R.js.map → chunk-RDCIST7P.js.map} +0 -0
- /package/dist/{chunk-HUXAIQC5.js.map → chunk-RZ3P4X2I.js.map} +0 -0
- /package/dist/{chunk-U2ILXZDG.js.map → chunk-TB5CRHTF.js.map} +0 -0
- /package/dist/{chunk-X2GWR75Q.js.map → chunk-TSEBMVYY.js.map} +0 -0
- /package/dist/{chunk-OKRITX4S.js.map → chunk-U2AEM3K4.js.map} +0 -0
- /package/dist/{chunk-EXVCVXFX.js.map → chunk-U2QXQ7D4.js.map} +0 -0
- /package/dist/{chunk-K6FCSB6T.js.map → chunk-U2SAW6DH.js.map} +0 -0
- /package/dist/{chunk-DAHSKQBV.js.map → chunk-UMOHHWXY.js.map} +0 -0
- /package/dist/{chunk-P772HCHI.js.map → chunk-W676GY42.js.map} +0 -0
- /package/dist/{chunk-BAQ3ITZV.js.map → chunk-WCF56ZCD.js.map} +0 -0
- /package/dist/{chunk-6D5AMANO.js.map → chunk-WH3LUOCQ.js.map} +0 -0
- /package/dist/{chunk-T2G4LDU5.js.map → chunk-WLLUARTC.js.map} +0 -0
- /package/dist/{chunk-5BVAUUWL.js.map → chunk-X37NTEVS.js.map} +0 -0
- /package/dist/{chunk-MW7P2C2C.js.map → chunk-YGQM6GFQ.js.map} +0 -0
- /package/dist/{chunk-WW3F7DCX.js.map → chunk-Z2WZDVGG.js.map} +0 -0
- /package/dist/{chunk-LOLYBFYY.js.map → chunk-ZCNR4DN5.js.map} +0 -0
- /package/dist/{chunk-COKPPU42.js.map → chunk-ZIHSCBMN.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-day-input.tsx"],"sourcesContent":["'use client';\n\n/**\n * A day bound as a MASKED `dd/mm/aaaa` text field, replacing `<input type=\"date\">`.\n *\n * The native control is three separate segments wearing one box. Typing a date\n * means filling a segment, being jumped to the next, and starting over — and\n * which segment comes first is the BROWSER's locale, not ours, so the same\n * field reads `dd/mm/aaaa` for one merchant and `mm/dd/yyyy` for the next with\n * nothing in our code saying which. There is no way to type a date as one\n * continuous run of digits, which is how people actually type dates.\n *\n * A mask gives that back: eight digits straight through, separators inserted as\n * you go, backspace walking back through them.\n *\n * Measured, driving both controls in Chromium with the same eight keystrokes\n * (`01072026`, one `keydown` at a time):\n *\n * native → field ends EMPTY, no filter applied, 0 requests\n * masked → field reads `01/07/2026`, filter applied, 1 request\n *\n * The native result is the whole complaint: you type a date and nothing lands.\n *\n * The second half of the fix is WHEN the bound is written. A partially-typed\n * year is itself a valid date — `2026` passes through `0002`, `0020`, `0202` on\n * the way — so committing on every keystroke would send the grid off to fetch\n * years nobody meant. A bound is written only once the text is a WHOLE, real\n * date, which is what keeps the run above at one request rather than four.\n */\nimport TextField from '@mui/material/TextField/index.js';\nimport React, { useEffect, useId, useState } from 'react';\nimport { fieldTextFieldStyles } from '../../../tokens/field-height';\nimport { sxRem } from '../../../tokens/relative';\n\n\n/**\n * THE MASK IS THE ORDER, and both halves of this file read it.\n *\n * The placeholder a host supplies (`copy.filters.dayMask` — `dd/mm/aaaa` for\n * pt-BR, `mm/dd/yyyy` for en-US) is not decoration: it tells the reader which\n * segment comes first. Everything below therefore derives the segment order\n * FROM that same string, so the shape on screen and the shape the parser\n * expects cannot disagree.\n *\n * They did disagree, and the failure was silent in the worst direction. The\n * mask/parse pair was hardcoded day-first (the `Br` in the old names was\n * accurate) while the placeholder followed the copy pack — so under `en-US` the\n * field ASKED for `mm/dd/yyyy`, and a reader who typed exactly that got a day\n * of 12 and a month of 31, which is not a date, which commits nothing. No\n * error, no filter, a full list that reads like an answer. The en-US pack's own\n * comment already said the mask \"is the shape that gets a date entered\n * backwards\"; nothing enforced it.\n */\n\n/** What one segment of a mask is, and how many digits it takes. */\ntype DaySegment = 'year' | 'month' | 'day';\nconst SEGMENT_WIDTH: Readonly<Record<DaySegment, number>> = { year: 4, month: 2, day: 2 };\n\n/**\n * The segments a mask asks for, in its own order.\n *\n * Keyed on each token's FIRST letter so one rule covers every spelling a host\n * might use — `aaaa`/`yyyy` for the year, `mm` for the month, `dd`/`tt` for the\n * day. An unreadable mask falls back to day-first rather than throwing: this\n * runs on every keystroke, and a field that renders is recoverable where one\n * that crashes the grid is not.\n */\nfunction segmentsOf(mask: string): readonly DaySegment[] {\n const tokens = mask.split(/[^A-Za-z]+/).filter(Boolean);\n if (tokens.length !== 3) return ['day', 'month', 'year'];\n const segments = tokens.map((token): DaySegment => {\n const head = token.slice(0, 1).toLowerCase();\n if (head === 'y' || head === 'a') return 'year';\n return head === 'm' ? 'month' : 'day';\n });\n // A mask naming the same segment twice describes no date. Fall back rather\n // than build a parser that can never succeed.\n return new Set(segments).size === 3 ? segments : ['day', 'month', 'year'];\n}\n\n/** The separator the mask uses, defaulting to `/`. */\nconst separatorOf = (mask: string): string => mask.replace(/[A-Za-z]/g, '').slice(0, 1) || '/';\n\n/** `AAAA-MM-DD` (the wire) → the mask's own order (what the reader sees). */\nexport function isoToMasked(iso: string, mask: string): string {\n const parts = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!parts) return '';\n const value: Record<DaySegment, string> = {\n year: parts[1] as string,\n month: parts[2] as string,\n day: parts[3] as string,\n };\n return segmentsOf(mask)\n .map((segment) => value[segment])\n .join(separatorOf(mask));\n}\n\n/**\n * The mask's order → `AAAA-MM-DD`, but ONLY for a day that exists.\n *\n * `31/02/2026` parses fine as three numbers and is not a date, and `Date` would\n * silently roll it into March rather than reject it — so the round trip through\n * UTC is the check: if the month or day comes back changed, the input was not a\n * day.\n */\nexport function maskedToIso(text: string, mask: string): string {\n const segments = segmentsOf(mask);\n const digits = text.replace(/\\D/g, '');\n if (digits.length !== 8) return '';\n const value = {} as Record<DaySegment, string>;\n let cursor = 0;\n for (const segment of segments) {\n value[segment] = digits.slice(cursor, cursor + SEGMENT_WIDTH[segment]);\n cursor += SEGMENT_WIDTH[segment];\n }\n const year = Number(value.year);\n const month = Number(value.month);\n const day = Number(value.day);\n if (year < 1000) return '';\n const probe = new Date(Date.UTC(year, month - 1, day));\n if (probe.getUTCMonth() !== month - 1 || probe.getUTCDate() !== day) return '';\n return `${value.year}-${value.month}-${value.day}`;\n}\n\n/**\n * Digits only, capped at the mask's width, with the separators put back as you\n * type.\n *\n * Deriving the whole string from the digits — rather than editing the text in\n * place — is what makes backspace behave. Four digits of `dd/mm/aaaa` render as\n * `06/08`, not `06/08/`, so deleting the first digit of the year removes the\n * trailing separator with it instead of leaving a dead keystroke that changes\n * nothing.\n */\nexport function maskDate(raw: string, mask: string): string {\n const segments = segmentsOf(mask);\n const separator = separatorOf(mask);\n const digits = raw.replace(/\\D/g, '').slice(0, 8);\n const out: string[] = [];\n let cursor = 0;\n for (const segment of segments) {\n if (cursor >= digits.length) break;\n out.push(digits.slice(cursor, cursor + SEGMENT_WIDTH[segment]));\n cursor += SEGMENT_WIDTH[segment];\n }\n return out.join(separator);\n}\n\n/** A wire day on its own, as a paste or an autofill delivers it: `2026-10-01`. */\nconst ISO_DAY = /^\\s*(\\d{4}-\\d{2}-\\d{2})\\s*$/;\n\n/**\n * What the field shows for whatever arrived — typed, pasted, autofilled.\n *\n * A whole ISO day (`AAAA-MM-DD`) is READ AS THAT DAY and written in the mask's\n * order. Through `maskDate` alone it is eight digits taken day-first, so a\n * pasted `2026-10-01` came out as `20/26/1001` (FUT-4144). Anything else is\n * masked exactly as typing always was, so the typed and pasted forms of one day\n * land on the same text.\n */\nexport function readDayText(raw: string, mask: string): string {\n const iso = ISO_DAY.exec(raw)?.[1];\n const masked = iso ? isoToMasked(iso, mask) : '';\n return masked || maskDate(raw, mask);\n}\n\n/**\n * Whether `text` is a WHOLE day that does not exist — `31/02/2026`. A partial\n * entry is not impossible, only unfinished, and is never flagged.\n */\nexport function isImpossibleDay(text: string, mask: string): boolean {\n return text.replace(/\\D/g, '').length === 8 && maskedToIso(text, mask) === '';\n}\n\n/**\n * What has to land on the `<input>` itself rather than on the `TextField`.\n *\n * Anything `TextField` does not recognise is spread onto its root `FormControl`\n * div. `inputMode` went up there once: the attribute sat on a non-editable\n * wrapper, meant nothing, and the phone went on offering the letter keyboard\n * for a field that only takes digits (the `dd/mm/aaaa` hint under a QWERTY\n * layout). Only the `<input>` this reaches decides which keypad opens — and the\n * same is true of `aria-describedby`, which on the wrapper points at a\n * description no screen reader will read out for the field.\n *\n * `numeric` and not `tel`: both raise a keypad, but the phone one is a dialler\n * with `+ * #` on it — keys that cannot occur in a date. A paste carrying\n * separators still lands, because the MASK is what filters the text; the keypad\n * only narrows what a thumb can reach for.\n *\n * Autofill off for the same reason: the browser's saved-value strip covers the\n * keypad to suggest names and addresses, none of which are a date, and none of\n * which the mask would keep.\n */\nfunction dayInputProps(testId: string, describedBy: readonly (string | undefined)[]) {\n const ids = describedBy.filter(Boolean).join(' ');\n return {\n 'data-testid': testId,\n maxLength: 10,\n inputMode: 'numeric' as const,\n autoComplete: 'off',\n ...(ids ? { 'aria-describedby': ids } : {}),\n };\n}\n\n/** Props of {@link DayBoundInput}. */\ninterface DayBoundInputProps {\n label: string;\n /** The applied bound, `AAAA-MM-DD`, or undefined when this end is open. */\n value: string | undefined;\n onChange: (bound: string | undefined) => void;\n testId: string;\n /**\n * Paint the field as rejected. It only ever writes a real day by itself, so\n * this is for a caller judging the PAIR: a window whose end precedes its\n * start is two valid days and one impossible period, and the field it was\n * typed into is the only place to say which half is being complained about.\n */\n error?: boolean;\n /** Id of the element carrying that complaint, so it is read WITH the field. */\n describedBy?: string;\n /**\n * The day mask, which IS the placeholder — so the expected ORDER is on\n * screen before the first keystroke rather than discovered by getting it\n * wrong. `dd/mm/aaaa` is one locale's order and one locale's letters.\n *\n * A PROP rather than a context read: this field has two callers, and only\n * one of them is inside DataViews. `DateRangePicker` mounts it standalone\n * with its own message table, so a context read here throws for every host\n * of that picker — which is exactly what it did.\n */\n mask: string;\n /**\n * Said under the field when its eight digits name no day (`31/02/2026`); the\n * field is then marked invalid and KEEPS the text on blur, so the reader sees\n * what was refused instead of the old value quietly coming back (FUT-4144).\n *\n * Opt-in, because the field ships no words of its own: without it an\n * impossible day is still never written, and blur still snaps back.\n */\n invalidMessage?: string;\n}\n\n/** What {@link useDayText} hands the field: its text, its verdict and its handlers. */\ninterface DayText {\n text: string;\n impossible: boolean;\n handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n handlePaste: (event: React.ClipboardEvent<HTMLDivElement>) => void;\n handleBlur: () => void;\n}\n\n/** The typed text of one bound, kept apart from the APPLIED bound it may commit. */\nfunction useDayText(\n applied: string,\n mask: string,\n onChange: (bound: string | undefined) => void,\n judgesImpossible: boolean,\n): DayText {\n const [text, setText] = useState(() => isoToMasked(applied, mask));\n const impossible = judgesImpossible && isImpossibleDay(text, mask);\n\n // Emptying clears the bound. A COMPLETE day applies it. A partial (or an\n // impossible) one does NEITHER — it leaves whatever is applied alone, so\n // typing is never fought and a half-typed year never reaches the backend.\n const enter = (next: string) => {\n setText(next);\n if (next === '') return onChange(undefined);\n const iso = maskedToIso(next, mask);\n if (iso) onChange(iso);\n };\n\n // The bound is the APPLIED filter; `text` is what is being typed. Re-sync only\n // when the applied value moved somewhere the text does not already mean — a\n // \"Limpar\", a saved view, the other pill resetting the pair. Without that\n // guard the field's own write bounces straight back mid-edit and resets the\n // caret, which is the native control's worst habit reproduced by hand.\n //\n // \"Already means\" is a REAL day equal to the bound, or an empty field for an\n // open bound. An impossible day parses to `''` too, so a bare comparison let\n // a \"Limpar\" (applied → `''`) keep `31/02/2026` on screen, red, over a filter\n // that had just been cleared.\n useEffect(() => {\n setText((current) => {\n const iso = maskedToIso(current, mask);\n const means = (iso !== '' || current === '') && iso === applied;\n return means ? current : isoToMasked(applied, mask);\n });\n }, [applied, mask]);\n\n return {\n text,\n impossible,\n handleChange: (event) => enter(readDayText(event.target.value, mask)),\n // A pasted ISO day REPLACES the field whatever it held: inserted at the\n // caret into existing digits it would be read as more digits, and the\n // `maxLength` would cut a padded one before `onChange` ever saw it.\n handlePaste: (event) => {\n const pasted = event.clipboardData.getData('text');\n if (!ISO_DAY.test(pasted)) return;\n event.preventDefault();\n enter(readDayText(pasted, mask));\n },\n // Leaving a half-typed date on screen would show a filter the list is not\n // actually using. On blur the field snaps back to what IS applied; a\n // complete date already equals it, so this only ever tidies. An impossible\n // day the field is SAYING is impossible stays, with its message: snapping\n // it back is the silent forgetting FUT-4144 removed.\n handleBlur: () => {\n if (!impossible) setText(isoToMasked(applied, mask));\n },\n };\n}\n\n/**\n * One end of a day window. The BOUND stays `AAAA-MM-DD` — the form the backend's\n * inclusive day comparison already speaks, and the form the chip label reads —\n * so only the typing surface changes.\n */\nexport function DayBoundInput({\n label,\n value,\n onChange,\n testId,\n error = false,\n describedBy,\n mask,\n invalidMessage,\n}: DayBoundInputProps): React.JSX.Element {\n const id = useId();\n const { text, impossible, handleChange, handlePaste, handleBlur } = useDayText(\n value ?? '',\n mask,\n onChange,\n invalidMessage !== undefined,\n );\n\n return (\n <TextField\n size=\"small\"\n type=\"text\"\n id={id}\n label={label}\n error={error || impossible}\n helperText={impossible ? invalidMessage : undefined}\n placeholder={mask}\n value={text}\n onChange={handleChange}\n onPaste={handlePaste}\n onBlur={handleBlur}\n // The placeholder occupies the space an un-shrunk label would render into.\n InputLabelProps={{ shrink: true }}\n inputProps={dayInputProps(testId, [impossible ? `${id}-helper-text` : undefined, describedBy])}\n sx={[{ width: sxRem(165) }, fieldTextFieldStyles]}\n />\n );\n}\n"],"mappings":";;;;;;;;AA6BA,OAAO,eAAe;AACtB,SAAgB,WAAW,OAAO,gBAAgB;AAoT9C;AA1RJ,IAAM,gBAAsD,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,EAAE;AAWxF,SAAS,WAAW,MAAqC;AACvD,QAAM,SAAS,KAAK,MAAM,YAAY,EAAE,OAAO,OAAO;AACtD,MAAI,OAAO,WAAW,EAAG,QAAO,CAAC,OAAO,SAAS,MAAM;AACvD,QAAM,WAAW,OAAO,IAAI,CAAC,UAAsB;AACjD,UAAM,OAAO,MAAM,MAAM,GAAG,CAAC,EAAE,YAAY;AAC3C,QAAI,SAAS,OAAO,SAAS,IAAK,QAAO;AACzC,WAAO,SAAS,MAAM,UAAU;AAAA,EAClC,CAAC;AAGD,SAAO,IAAI,IAAI,QAAQ,EAAE,SAAS,IAAI,WAAW,CAAC,OAAO,SAAS,MAAM;AAC1E;AAGA,IAAM,cAAc,CAAC,SAAyB,KAAK,QAAQ,aAAa,EAAE,EAAE,MAAM,GAAG,CAAC,KAAK;AAGpF,SAAS,YAAY,KAAa,MAAsB;AAC7D,QAAM,QAAQ,4BAA4B,KAAK,GAAG;AAClD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,QAAoC;AAAA,IACxC,MAAM,MAAM,CAAC;AAAA,IACb,OAAO,MAAM,CAAC;AAAA,IACd,KAAK,MAAM,CAAC;AAAA,EACd;AACA,SAAO,WAAW,IAAI,EACnB,IAAI,CAAC,YAAY,MAAM,OAAO,CAAC,EAC/B,KAAK,YAAY,IAAI,CAAC;AAC3B;AAUO,SAAS,YAAY,MAAc,MAAsB;AAC9D,QAAM,WAAW,WAAW,IAAI;AAChC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AA,IAMA,YAAY,MAAM;AAChB,UAAI,CAAC,WAAY,SAAQ,YAAY,SAAS,IAAI,CAAC;AAAA,IACrD;AAAA,EACF;AACF;AAOO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AACF,GAA0C;AACxC,QAAM,KAAK,MAAM;AACjB,QAAM,EAAE,MAAM,YAAY,cAAc,aAAa,WAAW,IAAI;AAAA,IAClE,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,EACrB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,YAAY,aAAa,iBAAiB;AAAA,MAC1C,aAAa;AAAA,MACb,OAAO;AAAA,MACP,UAAU;AAAA,MACV,SAAS;AAAA,MACT,QAAQ;AAAA,MAER,iBAAiB,EAAE,QAAQ,KAAK;AAAA,MAChC,YAAY,cAAc,QAAQ,CAAC,aAAa,GAAG,EAAE,iBAAiB,QAAW,WAAW,CAAC;AAAA,MAC7F,IAAI,CAAC,EAAE,OAAO,MAAM,GAAG,EAAE,GAAG,oBAAoB;AAAA;AAAA,EAClD;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-day-input.tsx"],"sourcesContent":["'use client';\n\n/**\n * A day bound as a MASKED `dd/mm/aaaa` text field, replacing `<input type=\"date\">`.\n *\n * The native control is three separate segments wearing one box. Typing a date\n * means filling a segment, being jumped to the next, and starting over — and\n * which segment comes first is the BROWSER's locale, not ours, so the same\n * field reads `dd/mm/aaaa` for one merchant and `mm/dd/yyyy` for the next with\n * nothing in our code saying which. There is no way to type a date as one\n * continuous run of digits, which is how people actually type dates.\n *\n * A mask gives that back: eight digits straight through, separators inserted as\n * you go, backspace walking back through them.\n *\n * Measured, driving both controls in Chromium with the same eight keystrokes\n * (`01072026`, one `keydown` at a time):\n *\n * native → field ends EMPTY, no filter applied, 0 requests\n * masked → field reads `01/07/2026`, filter applied, 1 request\n *\n * The native result is the whole complaint: you type a date and nothing lands.\n *\n * The second half of the fix is WHEN the bound is written. A partially-typed\n * year is itself a valid date — `2026` passes through `0002`, `0020`, `0202` on\n * the way — so committing on every keystroke would send the grid off to fetch\n * years nobody meant. A bound is written only once the text is a WHOLE, real\n * date, which is what keeps the run above at one request rather than four.\n */\nimport TextField from '@mui/material/TextField/index.js';\nimport React, { useEffect, useId, useState } from 'react';\nimport { fieldTextFieldStyles } from '../../../tokens/field-height';\nimport { sxRem } from '../../../tokens/relative';\n\n\n/**\n * THE MASK IS THE ORDER, and both halves of this file read it.\n *\n * The placeholder a host supplies (`copy.filters.dayMask` — `dd/mm/aaaa` for\n * pt-BR, `mm/dd/yyyy` for en-US) is not decoration: it tells the reader which\n * segment comes first. Everything below therefore derives the segment order\n * FROM that same string, so the shape on screen and the shape the parser\n * expects cannot disagree.\n *\n * They did disagree, and the failure was silent in the worst direction. The\n * mask/parse pair was hardcoded day-first (the `Br` in the old names was\n * accurate) while the placeholder followed the copy pack — so under `en-US` the\n * field ASKED for `mm/dd/yyyy`, and a reader who typed exactly that got a day\n * of 12 and a month of 31, which is not a date, which commits nothing. No\n * error, no filter, a full list that reads like an answer. The en-US pack's own\n * comment already said the mask \"is the shape that gets a date entered\n * backwards\"; nothing enforced it.\n */\n\n/** What one segment of a mask is, and how many digits it takes. */\ntype DaySegment = 'year' | 'month' | 'day';\nconst SEGMENT_WIDTH: Readonly<Record<DaySegment, number>> = { year: 4, month: 2, day: 2 };\n\n/**\n * The segments a mask asks for, in its own order.\n *\n * Keyed on each token's FIRST letter so one rule covers every spelling a host\n * might use — `aaaa`/`yyyy` for the year, `mm` for the month, `dd`/`tt` for the\n * day. An unreadable mask falls back to day-first rather than throwing: this\n * runs on every keystroke, and a field that renders is recoverable where one\n * that crashes the grid is not.\n */\nfunction segmentsOf(mask: string): readonly DaySegment[] {\n const tokens = mask.split(/[^A-Za-z]+/).filter(Boolean);\n if (tokens.length !== 3) return ['day', 'month', 'year'];\n const segments = tokens.map((token): DaySegment => {\n const head = token.slice(0, 1).toLowerCase();\n if (head === 'y' || head === 'a') return 'year';\n return head === 'm' ? 'month' : 'day';\n });\n // A mask naming the same segment twice describes no date. Fall back rather\n // than build a parser that can never succeed.\n return new Set(segments).size === 3 ? segments : ['day', 'month', 'year'];\n}\n\n/** The separator the mask uses, defaulting to `/`. */\nconst separatorOf = (mask: string): string => mask.replace(/[A-Za-z]/g, '').slice(0, 1) || '/';\n\n/** `AAAA-MM-DD` (the wire) → the mask's own order (what the reader sees). */\nexport function isoToMasked(iso: string, mask: string): string {\n const parts = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!parts) return '';\n const value: Record<DaySegment, string> = {\n year: parts[1] as string,\n month: parts[2] as string,\n day: parts[3] as string,\n };\n return segmentsOf(mask)\n .map((segment) => value[segment])\n .join(separatorOf(mask));\n}\n\n/**\n * The mask's order → `AAAA-MM-DD`, but ONLY for a day that exists.\n *\n * `31/02/2026` parses fine as three numbers and is not a date, and `Date` would\n * silently roll it into March rather than reject it — so the round trip through\n * UTC is the check: if the month or day comes back changed, the input was not a\n * day.\n */\nexport function maskedToIso(text: string, mask: string): string {\n const segments = segmentsOf(mask);\n const digits = text.replace(/\\D/g, '');\n if (digits.length !== 8) return '';\n const value = {} as Record<DaySegment, string>;\n let cursor = 0;\n for (const segment of segments) {\n value[segment] = digits.slice(cursor, cursor + SEGMENT_WIDTH[segment]);\n cursor += SEGMENT_WIDTH[segment];\n }\n const year = Number(value.year);\n const month = Number(value.month);\n const day = Number(value.day);\n if (year < 1000) return '';\n const probe = new Date(Date.UTC(year, month - 1, day));\n if (probe.getUTCMonth() !== month - 1 || probe.getUTCDate() !== day) return '';\n return `${value.year}-${value.month}-${value.day}`;\n}\n\n/**\n * Digits only, capped at the mask's width, with the separators put back as you\n * type.\n *\n * Deriving the whole string from the digits — rather than editing the text in\n * place — is what makes backspace behave. Four digits of `dd/mm/aaaa` render as\n * `06/08`, not `06/08/`, so deleting the first digit of the year removes the\n * trailing separator with it instead of leaving a dead keystroke that changes\n * nothing.\n */\nexport function maskDate(raw: string, mask: string): string {\n const segments = segmentsOf(mask);\n const separator = separatorOf(mask);\n const digits = raw.replace(/\\D/g, '').slice(0, 8);\n const out: string[] = [];\n let cursor = 0;\n for (const segment of segments) {\n if (cursor >= digits.length) break;\n out.push(digits.slice(cursor, cursor + SEGMENT_WIDTH[segment]));\n cursor += SEGMENT_WIDTH[segment];\n }\n return out.join(separator);\n}\n\n/** A wire day on its own, as a paste or an autofill delivers it: `2026-10-01`. */\nconst ISO_DAY = /^\\s*(\\d{4}-\\d{2}-\\d{2})\\s*$/;\n\n/**\n * What the field shows for whatever arrived — typed, pasted, autofilled.\n *\n * A whole ISO day (`AAAA-MM-DD`) is READ AS THAT DAY and written in the mask's\n * order. Through `maskDate` alone it is eight digits taken day-first, so a\n * pasted `2026-10-01` came out as `20/26/1001` (FUT-4144). Anything else is\n * masked exactly as typing always was, so the typed and pasted forms of one day\n * land on the same text.\n */\nexport function readDayText(raw: string, mask: string): string {\n const iso = ISO_DAY.exec(raw)?.[1];\n const masked = iso ? isoToMasked(iso, mask) : '';\n return masked || maskDate(raw, mask);\n}\n\n/**\n * Whether `text` is a WHOLE day that does not exist — `31/02/2026`. A partial\n * entry is not impossible, only unfinished, and is never flagged.\n */\nexport function isImpossibleDay(text: string, mask: string): boolean {\n return text.replace(/\\D/g, '').length === 8 && maskedToIso(text, mask) === '';\n}\n\n/**\n * What has to land on the `<input>` itself rather than on the `TextField`.\n *\n * Anything `TextField` does not recognise is spread onto its root `FormControl`\n * div. `inputMode` went up there once: the attribute sat on a non-editable\n * wrapper, meant nothing, and the phone went on offering the letter keyboard\n * for a field that only takes digits (the `dd/mm/aaaa` hint under a QWERTY\n * layout). Only the `<input>` this reaches decides which keypad opens — and the\n * same is true of `aria-describedby`, which on the wrapper points at a\n * description no screen reader will read out for the field.\n *\n * `numeric` and not `tel`: both raise a keypad, but the phone one is a dialler\n * with `+ * #` on it — keys that cannot occur in a date. A paste carrying\n * separators still lands, because the MASK is what filters the text; the keypad\n * only narrows what a thumb can reach for.\n *\n * Autofill off for the same reason: the browser's saved-value strip covers the\n * keypad to suggest names and addresses, none of which are a date, and none of\n * which the mask would keep.\n */\nfunction dayInputProps(testId: string, describedBy: readonly (string | undefined)[]) {\n const ids = describedBy.filter(Boolean).join(' ');\n return {\n 'data-testid': testId,\n maxLength: 10,\n inputMode: 'numeric' as const,\n autoComplete: 'off',\n ...(ids ? { 'aria-describedby': ids } : {}),\n };\n}\n\n/** Props of {@link DayBoundInput}. */\ninterface DayBoundInputProps {\n label: string;\n /** The applied bound, `AAAA-MM-DD`, or undefined when this end is open. */\n value: string | undefined;\n onChange: (bound: string | undefined) => void;\n testId: string;\n /**\n * Paint the field as rejected. It only ever writes a real day by itself, so\n * this is for a caller judging the PAIR: a window whose end precedes its\n * start is two valid days and one impossible period, and the field it was\n * typed into is the only place to say which half is being complained about.\n */\n error?: boolean;\n /** Id of the element carrying that complaint, so it is read WITH the field. */\n describedBy?: string;\n /**\n * The day mask, which IS the placeholder — so the expected ORDER is on\n * screen before the first keystroke rather than discovered by getting it\n * wrong. `dd/mm/aaaa` is one locale's order and one locale's letters.\n *\n * A PROP rather than a context read: this field has two callers, and only\n * one of them is inside DataViews. `DateRangePicker` mounts it standalone\n * with its own message table, so a context read here throws for every host\n * of that picker — which is exactly what it did.\n */\n mask: string;\n /**\n * Said under the field when its eight digits name no day (`31/02/2026`); the\n * field is then marked invalid and KEEPS the text on blur, so the reader sees\n * what was refused instead of the old value quietly coming back (FUT-4144).\n *\n * Opt-in, because the field ships no words of its own: without it an\n * impossible day is still never written, and blur still snaps back.\n */\n invalidMessage?: string;\n /**\n * Take the width of the box it sits in rather than its own 165px. Set where\n * the pair stands over the range calendar, so the two boxes span the\n * calendar's width instead of leaving a gap beside them (FUT-4144).\n */\n fill?: boolean;\n}\n\n/** What {@link useDayText} hands the field: its text, its verdict and its handlers. */\ninterface DayText {\n text: string;\n impossible: boolean;\n handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n handlePaste: (event: React.ClipboardEvent<HTMLDivElement>) => void;\n handleBlur: () => void;\n}\n\n/** The typed text of one bound, kept apart from the APPLIED bound it may commit. */\nfunction useDayText(\n applied: string,\n mask: string,\n onChange: (bound: string | undefined) => void,\n judgesImpossible: boolean,\n): DayText {\n const [text, setText] = useState(() => isoToMasked(applied, mask));\n const impossible = judgesImpossible && isImpossibleDay(text, mask);\n\n // Emptying clears the bound. A COMPLETE day applies it. A partial (or an\n // impossible) one does NEITHER — it leaves whatever is applied alone, so\n // typing is never fought and a half-typed year never reaches the backend.\n const enter = (next: string) => {\n setText(next);\n if (next === '') return onChange(undefined);\n const iso = maskedToIso(next, mask);\n if (iso) onChange(iso);\n };\n\n // The bound is the APPLIED filter; `text` is what is being typed. Re-sync only\n // when the applied value moved somewhere the text does not already mean — a\n // \"Limpar\", a saved view, the other pill resetting the pair. Without that\n // guard the field's own write bounces straight back mid-edit and resets the\n // caret, which is the native control's worst habit reproduced by hand.\n //\n // \"Already means\" is a REAL day equal to the bound, or an empty field for an\n // open bound. An impossible day parses to `''` too, so a bare comparison let\n // a \"Limpar\" (applied → `''`) keep `31/02/2026` on screen, red, over a filter\n // that had just been cleared.\n useEffect(() => {\n setText((current) => {\n const iso = maskedToIso(current, mask);\n const means = (iso !== '' || current === '') && iso === applied;\n return means ? current : isoToMasked(applied, mask);\n });\n }, [applied, mask]);\n\n return {\n text,\n impossible,\n handleChange: (event) => enter(readDayText(event.target.value, mask)),\n // A pasted ISO day REPLACES the field whatever it held: inserted at the\n // caret into existing digits it would be read as more digits, and the\n // `maxLength` would cut a padded one before `onChange` ever saw it.\n handlePaste: (event) => {\n const pasted = event.clipboardData.getData('text');\n if (!ISO_DAY.test(pasted)) return;\n event.preventDefault();\n enter(readDayText(pasted, mask));\n },\n // Leaving a half-typed date on screen would show a filter the list is not\n // actually using. On blur the field snaps back to what IS applied; a\n // complete date already equals it, so this only ever tidies. An impossible\n // day the field is SAYING is impossible stays, with its message: snapping\n // it back is the silent forgetting FUT-4144 removed.\n handleBlur: () => {\n if (!impossible) setText(isoToMasked(applied, mask));\n },\n };\n}\n\n/**\n * One end of a day window. The BOUND stays `AAAA-MM-DD` — the form the backend's\n * inclusive day comparison already speaks, and the form the chip label reads —\n * so only the typing surface changes.\n */\nexport function DayBoundInput({\n label,\n value,\n onChange,\n testId,\n error = false,\n describedBy,\n mask,\n invalidMessage,\n fill = false,\n}: DayBoundInputProps): React.JSX.Element {\n const id = useId();\n const { text, impossible, handleChange, handlePaste, handleBlur } = useDayText(\n value ?? '',\n mask,\n onChange,\n invalidMessage !== undefined,\n );\n\n return (\n <TextField\n size=\"small\"\n type=\"text\"\n id={id}\n label={label}\n error={error || impossible}\n helperText={impossible ? invalidMessage : undefined}\n placeholder={mask}\n value={text}\n onChange={handleChange}\n onPaste={handlePaste}\n onBlur={handleBlur}\n // The placeholder occupies the space an un-shrunk label would render into.\n InputLabelProps={{ shrink: true }}\n inputProps={dayInputProps(testId, [impossible ? `${id}-helper-text` : undefined, describedBy])}\n fullWidth={fill}\n sx={[{ width: fill ? '100%' : sxRem(165) }, fieldTextFieldStyles]}\n />\n );\n}\n"],"mappings":";;;;;;;;AA6BA,OAAO,eAAe;AACtB,SAAgB,WAAW,OAAO,gBAAgB;AA2T9C;AAjSJ,IAAM,gBAAsD,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,EAAE;AAWxF,SAAS,WAAW,MAAqC;AACvD,QAAM,SAAS,KAAK,MAAM,YAAY,EAAE,OAAO,OAAO;AACtD,MAAI,OAAO,WAAW,EAAG,QAAO,CAAC,OAAO,SAAS,MAAM;AACvD,QAAM,WAAW,OAAO,IAAI,CAAC,UAAsB;AACjD,UAAM,OAAO,MAAM,MAAM,GAAG,CAAC,EA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,OAAO;AAAA,MACP,UAAU;AAAA,MACV,SAAS;AAAA,MACT,QAAQ;AAAA,MAER,iBAAiB,EAAE,QAAQ,KAAK;AAAA,MAChC,YAAY,cAAc,QAAQ,CAAC,aAAa,GAAG,EAAE,iBAAiB,QAAW,WAAW,CAAC;AAAA,MAC7F,WAAW;AAAA,MACX,IAAI,CAAC,EAAE,OAAO,OAAO,SAAS,MAAM,GAAG,EAAE,GAAG,oBAAoB;AAAA;AAAA,EAClE;AAEJ;","names":[]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPresetActive,
|
|
3
|
+
resolvePreset
|
|
4
|
+
} from "./chunk-CBOB5AV6.js";
|
|
5
|
+
import {
|
|
6
|
+
useDataViewsCopy
|
|
7
|
+
} from "./chunk-KHG57NAE.js";
|
|
8
|
+
import {
|
|
9
|
+
EN_US_DATA_VIEWS_COPY
|
|
10
|
+
} from "./chunk-ARGVUTTL.js";
|
|
11
|
+
import {
|
|
12
|
+
sxRem
|
|
13
|
+
} from "./chunk-YKCAJ2TN.js";
|
|
14
|
+
|
|
15
|
+
// src/components/data-display/DataViews/data-views-preset-chips.tsx
|
|
16
|
+
import Box from "@mui/material/Box/index.js";
|
|
17
|
+
import TextField from "@mui/material/TextField/index.js";
|
|
18
|
+
import { useTheme } from "@mui/material/styles/index.js";
|
|
19
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
function PresetChip({
|
|
22
|
+
preset,
|
|
23
|
+
active,
|
|
24
|
+
onSelect,
|
|
25
|
+
testId
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Box,
|
|
29
|
+
{
|
|
30
|
+
component: "button",
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: onSelect,
|
|
33
|
+
"aria-pressed": active,
|
|
34
|
+
"data-testid": testId,
|
|
35
|
+
sx: {
|
|
36
|
+
px: 1.25,
|
|
37
|
+
py: 0.5,
|
|
38
|
+
border: 1,
|
|
39
|
+
borderStyle: "solid",
|
|
40
|
+
borderColor: active ? "primary.main" : "divider",
|
|
41
|
+
borderRadius: 999,
|
|
42
|
+
bgcolor: active ? "action.selected" : "background.paper",
|
|
43
|
+
color: active ? "primary.main" : "text.secondary",
|
|
44
|
+
cursor: "pointer",
|
|
45
|
+
font: "inherit",
|
|
46
|
+
fontSize: sxRem(12),
|
|
47
|
+
fontWeight: 600,
|
|
48
|
+
whiteSpace: "nowrap",
|
|
49
|
+
overflow: "hidden",
|
|
50
|
+
textOverflow: "ellipsis",
|
|
51
|
+
minWidth: 0,
|
|
52
|
+
"&:hover": { borderColor: active ? "primary.main" : "text.primary" }
|
|
53
|
+
},
|
|
54
|
+
children: preset.label
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
var MEASURE_SX = {
|
|
59
|
+
display: "inline-block",
|
|
60
|
+
px: 1.25,
|
|
61
|
+
border: 1,
|
|
62
|
+
font: "inherit",
|
|
63
|
+
fontSize: sxRem(12),
|
|
64
|
+
fontWeight: 600,
|
|
65
|
+
whiteSpace: "nowrap"
|
|
66
|
+
};
|
|
67
|
+
function presetsFitOneLine(width, widest, count, gap) {
|
|
68
|
+
if (width === null) return true;
|
|
69
|
+
return widest * count + gap * (count - 1) <= width;
|
|
70
|
+
}
|
|
71
|
+
function useElementWidth(ref) {
|
|
72
|
+
const [width, setWidth] = useState(null);
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
const element = ref.current;
|
|
75
|
+
if (element === null || typeof ResizeObserver === "undefined") return void 0;
|
|
76
|
+
const observer = new ResizeObserver((entries) => {
|
|
77
|
+
const measured = entries[0]?.contentRect.width;
|
|
78
|
+
if (measured !== void 0 && measured > 0) setWidth(measured);
|
|
79
|
+
});
|
|
80
|
+
observer.observe(element);
|
|
81
|
+
return () => observer.disconnect();
|
|
82
|
+
}, [ref]);
|
|
83
|
+
return width;
|
|
84
|
+
}
|
|
85
|
+
function useWidestLabel(ref, labels, width) {
|
|
86
|
+
const [widest, setWidest] = useState(0);
|
|
87
|
+
useLayoutEffect(() => {
|
|
88
|
+
const measure = () => {
|
|
89
|
+
const spans = ref.current?.querySelectorAll("[data-preset-measure]") ?? [];
|
|
90
|
+
setWidest(Math.max(0, ...Array.from(spans, (span) => span.offsetWidth + 1)));
|
|
91
|
+
};
|
|
92
|
+
measure();
|
|
93
|
+
let live = true;
|
|
94
|
+
void document.fonts?.ready.then(() => {
|
|
95
|
+
if (live) measure();
|
|
96
|
+
});
|
|
97
|
+
return () => {
|
|
98
|
+
live = false;
|
|
99
|
+
};
|
|
100
|
+
}, [ref, labels, width]);
|
|
101
|
+
return widest;
|
|
102
|
+
}
|
|
103
|
+
function PresetSelect({
|
|
104
|
+
presets,
|
|
105
|
+
value,
|
|
106
|
+
onChange,
|
|
107
|
+
testId
|
|
108
|
+
}) {
|
|
109
|
+
const copy = useDataViewsCopy().filters.presetSelect ?? EN_US_DATA_VIEWS_COPY.filters.presetSelect;
|
|
110
|
+
const active = presets.find((preset) => isPresetActive(preset, value))?.id ?? "";
|
|
111
|
+
return /* @__PURE__ */ jsxs(
|
|
112
|
+
TextField,
|
|
113
|
+
{
|
|
114
|
+
select: true,
|
|
115
|
+
size: "small",
|
|
116
|
+
fullWidth: true,
|
|
117
|
+
label: copy?.label,
|
|
118
|
+
value: active,
|
|
119
|
+
onChange: (event) => {
|
|
120
|
+
const picked = presets.find((preset) => preset.id === event.target.value);
|
|
121
|
+
onChange(picked ? resolvePreset(picked) : {});
|
|
122
|
+
},
|
|
123
|
+
SelectProps: { native: true },
|
|
124
|
+
InputLabelProps: { shrink: true },
|
|
125
|
+
inputProps: { "data-testid": `${testId}-presets-select` },
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsx("option", { value: "", children: copy?.none }),
|
|
128
|
+
presets.map((preset) => /* @__PURE__ */ jsx("option", { value: preset.id, children: preset.label }, preset.id))
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function RangePresets({
|
|
134
|
+
presets,
|
|
135
|
+
value,
|
|
136
|
+
onChange,
|
|
137
|
+
testId
|
|
138
|
+
}) {
|
|
139
|
+
const theme = useTheme();
|
|
140
|
+
const box = useRef(null);
|
|
141
|
+
const width = useElementWidth(box);
|
|
142
|
+
const widest = useWidestLabel(box, presets.map((preset) => preset.label).join("|"), width);
|
|
143
|
+
if (presets.length === 0) return null;
|
|
144
|
+
const fits = presetsFitOneLine(width, widest, presets.length, parseFloat(theme.spacing(0.75)));
|
|
145
|
+
return /* @__PURE__ */ jsxs(Box, { ref: box, sx: { position: "relative", minWidth: 0 }, children: [
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
Box,
|
|
148
|
+
{
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
sx: { position: "absolute", top: 0, left: 0, width: "max-content", height: 0, overflow: "hidden", visibility: "hidden" },
|
|
151
|
+
children: presets.map((preset) => /* @__PURE__ */ jsx(Box, { component: "span", "data-preset-measure": "", sx: MEASURE_SX, children: preset.label }, preset.id))
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
fits ? /* @__PURE__ */ jsx(
|
|
155
|
+
Box,
|
|
156
|
+
{
|
|
157
|
+
"data-testid": `${testId}-presets`,
|
|
158
|
+
sx: { display: "grid", gridTemplateColumns: `repeat(${presets.length}, minmax(0, 1fr))`, gap: 0.75 },
|
|
159
|
+
children: presets.map((preset) => {
|
|
160
|
+
const active = isPresetActive(preset, value);
|
|
161
|
+
return /* @__PURE__ */ jsx(
|
|
162
|
+
PresetChip,
|
|
163
|
+
{
|
|
164
|
+
preset,
|
|
165
|
+
active,
|
|
166
|
+
onSelect: () => onChange(active ? {} : resolvePreset(preset)),
|
|
167
|
+
testId: `${testId}-preset-${preset.id}`
|
|
168
|
+
},
|
|
169
|
+
preset.id
|
|
170
|
+
);
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
) : /* @__PURE__ */ jsx(Box, { "data-testid": `${testId}-presets`, children: /* @__PURE__ */ jsx(PresetSelect, { presets, value, onChange, testId }) })
|
|
174
|
+
] });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export {
|
|
178
|
+
presetsFitOneLine,
|
|
179
|
+
RangePresets
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=chunk-LZNUBQ5I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-preset-chips.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * THE ONE-CLICK WINDOWS ABOVE A RANGE'S `De`/`Até` INPUTS.\n *\n * \"Filter by last month\" is two date pickers, four gestures and a mental\n * calculation of which day the month ended on. It is also the overwhelmingly\n * common case. So the common windows get a chip each, and the inputs stay for\n * the windows nobody could enumerate.\n *\n * Clicking an active preset CLEARS it. A chip that reads as pressed and does\n * nothing when pressed again is a dead control, and the alternative — hunting\n * for the pill's ✕ — is the gesture this row exists to remove.\n *\n * ONE LINE at every width (ADR 0190 in the host, FUT-4144): the presets are\n * the options of one question, and as wrapping chips \"Este ano\" fell onto a\n * second line at 320, 390 and 600, where it read as a second question. Where\n * the row is wide enough they are a segmented control of equal parts; where it\n * is not, the same question is a select.\n */\nimport Box from \"@mui/material/Box/index.js\";\nimport TextField from \"@mui/material/TextField/index.js\";\nimport { useTheme } from \"@mui/material/styles/index.js\";\nimport React, { useLayoutEffect, useRef, useState, type RefObject } from \"react\";\n\nimport { EN_US_DATA_VIEWS_COPY } from \"../../../en-US.data-display\";\nimport { useDataViewsCopy } from \"./data-views-copy-context\";\nimport { isPresetActive, resolvePreset } from \"./data-views-range-presets\";\nimport type { RangePreset, RangeValue } from \"./data-views-types\";\nimport { sxRem } from \"../../../tokens/relative\";\n\n/** One preset, styled as the same pill-shaped chip the filter bar uses. */\nfunction PresetChip({\n preset,\n active,\n onSelect,\n testId,\n}: {\n preset: RangePreset;\n active: boolean;\n onSelect: () => void;\n testId: string;\n}): React.JSX.Element {\n return (\n <Box\n component=\"button\"\n type=\"button\"\n onClick={onSelect}\n aria-pressed={active}\n data-testid={testId}\n sx={{\n px: 1.25,\n py: 0.5,\n border: 1,\n borderStyle: \"solid\",\n borderColor: active ? \"primary.main\" : \"divider\",\n borderRadius: 999,\n bgcolor: active ? \"action.selected\" : \"background.paper\",\n color: active ? \"primary.main\" : \"text.secondary\",\n cursor: \"pointer\",\n font: \"inherit\",\n fontSize: sxRem(12),\n fontWeight: 600,\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n minWidth: 0,\n \"&:hover\": { borderColor: active ? \"primary.main\" : \"text.primary\" },\n }}\n >\n {preset.label}\n </Box>\n );\n}\n\n/** The chip look, for the hidden row that measures each label at its natural width. */\nconst MEASURE_SX = {\n display: \"inline-block\",\n px: 1.25,\n border: 1,\n font: \"inherit\",\n fontSize: sxRem(12),\n fontWeight: 600,\n whiteSpace: \"nowrap\",\n} as const;\n\n/**\n * Whether `count` equal parts, each as wide as the widest label, fit `width`\n * with `gap` between them. Unmeasured (`null`: the server, jsdom) counts as\n * fitting, so the row renders the buttons it always rendered.\n */\nexport function presetsFitOneLine(width: number | null, widest: number, count: number, gap: number): boolean {\n if (width === null) return true;\n return widest * count + gap * (count - 1) <= width;\n}\n\n/** The element's own width as it changes; `null` until measured, or where nothing can measure. */\nfunction useElementWidth(ref: RefObject<HTMLElement | null>): number | null {\n const [width, setWidth] = useState<number | null>(null);\n useLayoutEffect(() => {\n const element = ref.current;\n if (element === null || typeof ResizeObserver === \"undefined\") return undefined;\n const observer = new ResizeObserver((entries) => {\n const measured = entries[0]?.contentRect.width;\n if (measured !== undefined && measured > 0) setWidth(measured);\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref]);\n return width;\n}\n\n/**\n * The widest label at the chip's own type, padding and border, read off the\n * hidden measuring row.\n *\n * `offsetWidth`, the LAYOUT width, never the bounding box: a popover grows in\n * from 75% scale, and a box read during that transition is a quarter short —\n * which judged \"Acima de R$ 10\" to fit a third of the \"Mais\" panel and cut it\n * to \"Acima de …\" (FUT-4144 UI review round 2). Measured again when the row's\n * width changes and once the web fonts have loaded, since a fallback face is\n * narrower than the one the parts will be drawn in.\n */\nfunction useWidestLabel(ref: RefObject<HTMLElement | null>, labels: string, width: number | null): number {\n const [widest, setWidest] = useState(0);\n useLayoutEffect(() => {\n const measure = (): void => {\n const spans = ref.current?.querySelectorAll<HTMLElement>(\"[data-preset-measure]\") ?? [];\n // +1: `offsetWidth` rounds, so a label laid out at 80.4px reads 80 and\n // would be judged to fit half a pixel short, behind an ellipsis.\n setWidest(Math.max(0, ...Array.from(spans, (span) => span.offsetWidth + 1)));\n };\n measure();\n let live = true;\n void document.fonts?.ready.then(() => {\n if (live) measure();\n });\n return () => {\n live = false;\n };\n }, [ref, labels, width]);\n return widest;\n}\n\n/** The same question as a select, for a row too narrow for its parts. */\nfunction PresetSelect({\n presets,\n value,\n onChange,\n testId,\n}: {\n presets: RangePreset[];\n value: RangeValue;\n onChange: (range: RangeValue) => void;\n testId: string;\n}): React.JSX.Element {\n const copy = useDataViewsCopy().filters.presetSelect ?? EN_US_DATA_VIEWS_COPY.filters.presetSelect;\n const active = presets.find((preset) => isPresetActive(preset, value))?.id ?? \"\";\n return (\n <TextField\n select\n size=\"small\"\n fullWidth\n label={copy?.label}\n value={active}\n onChange={(event) => {\n const picked = presets.find((preset) => preset.id === event.target.value);\n // \"None\" is the select's way of tapping the active chip again.\n onChange(picked ? resolvePreset(picked) : {});\n }}\n SelectProps={{ native: true }}\n InputLabelProps={{ shrink: true }}\n inputProps={{ \"data-testid\": `${testId}-presets-select` }}\n >\n <option value=\"\">{copy?.none}</option>\n {presets.map((preset) => (\n <option key={preset.id} value={preset.id}>\n {preset.label}\n </option>\n ))}\n </TextField>\n );\n}\n\n/**\n * The preset row. Renders nothing when a field declares none, so a numeric\n * range without host-configured windows keeps the popover it had.\n *\n * Carries no outer margin — the three surfaces that host it (the pill's\n * popover, the slide-in panel, the \"Mais\" overflow) each sit it in a different\n * stack, and a baked-in margin would be wrong in two of them.\n *\n * What is measured is the row's OWN width, not the window's: the same row\n * lives in a 670px popover, a 300px panel and a phone-wide sheet.\n */\nexport function RangePresets({\n presets,\n value,\n onChange,\n testId,\n}: {\n presets: RangePreset[];\n value: RangeValue;\n onChange: (range: RangeValue) => void;\n testId: string;\n}): React.JSX.Element | null {\n const theme = useTheme();\n const box = useRef<HTMLDivElement>(null);\n const width = useElementWidth(box);\n const widest = useWidestLabel(box, presets.map((preset) => preset.label).join(\"|\"), width);\n if (presets.length === 0) return null;\n const fits = presetsFitOneLine(width, widest, presets.length, parseFloat(theme.spacing(0.75)));\n return (\n <Box ref={box} sx={{ position: \"relative\", minWidth: 0 }}>\n <Box\n aria-hidden=\"true\"\n sx={{ position: \"absolute\", top: 0, left: 0, width: \"max-content\", height: 0, overflow: \"hidden\", visibility: \"hidden\" }}\n >\n {presets.map((preset) => (\n <Box key={preset.id} component=\"span\" data-preset-measure=\"\" sx={MEASURE_SX}>\n {preset.label}\n </Box>\n ))}\n </Box>\n {fits ? (\n <Box\n data-testid={`${testId}-presets`}\n sx={{ display: \"grid\", gridTemplateColumns: `repeat(${presets.length}, minmax(0, 1fr))`, gap: 0.75 }}\n >\n {presets.map((preset) => {\n const active = isPresetActive(preset, value);\n return (\n <PresetChip\n key={preset.id}\n preset={preset}\n active={active}\n onSelect={() => onChange(active ? {} : resolvePreset(preset))}\n testId={`${testId}-preset-${preset.id}`}\n />\n );\n })}\n </Box>\n ) : (\n <Box data-testid={`${testId}-presets`}>\n <PresetSelect presets={presets} value={value} onChange={onChange} testId={testId} />\n </Box>\n )}\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,OAAO,SAAS;AAChB,OAAO,eAAe;AACtB,SAAS,gBAAgB;AACzB,SAAgB,iBAAiB,QAAQ,gBAAgC;AAqBrE,cAmHA,YAnH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,QAAQ,KAAK;AAC3C,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA;AAAA,cACA,UAAU,MAAM,SAAS,SAAS,CAAC,IAAI,cAAc,MAAM,CAAC;AAAA,cAC5D,QAAQ,GAAG,MAAM,WAAW,OAAO,EAAE;AAAA;AAAA,YAJhC,OAAO;AAAA,UAKd;AAAA,QAEJ,CAAC;AAAA;AAAA,IACH,IAEA,oBAAC,OAAI,eAAa,GAAG,MAAM,YACzB,8BAAC,gBAAa,SAAkB,OAAc,UAAoB,QAAgB,GACpF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EN_US_CAROUSEL_COPY
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ARGVUTTL.js";
|
|
4
4
|
import {
|
|
5
5
|
withDefaults
|
|
6
6
|
} from "./chunk-HPK33ACY.js";
|
|
@@ -330,4 +330,4 @@ export {
|
|
|
330
330
|
CarouselArrows,
|
|
331
331
|
CarouselThumbnails
|
|
332
332
|
};
|
|
333
|
-
//# sourceMappingURL=chunk-
|
|
333
|
+
//# sourceMappingURL=chunk-M2M4IDFU.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderChartByType
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3JZ3KEQQ.js";
|
|
4
|
+
import {
|
|
5
|
+
ChartContainer
|
|
6
|
+
} from "./chunk-RIRTW5EU.js";
|
|
4
7
|
import {
|
|
5
8
|
getSizeStyles,
|
|
6
9
|
getVariantStyles,
|
|
7
10
|
plotHeightPx
|
|
8
11
|
} from "./chunk-TCWISGSS.js";
|
|
9
|
-
import {
|
|
10
|
-
ChartContainer
|
|
11
|
-
} from "./chunk-RIRTW5EU.js";
|
|
12
12
|
import {
|
|
13
13
|
muiColor
|
|
14
14
|
} from "./chunk-7ZPUN7TV.js";
|
|
@@ -111,4 +111,4 @@ var Chart = (props) => {
|
|
|
111
111
|
export {
|
|
112
112
|
Chart
|
|
113
113
|
};
|
|
114
|
-
//# sourceMappingURL=chunk-
|
|
114
|
+
//# sourceMappingURL=chunk-M3XJVD5G.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-H2J2MTRE.js";
|
|
4
4
|
import {
|
|
5
5
|
EN_US_MAP_PREVIEW_COPY
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ARGVUTTL.js";
|
|
7
7
|
import {
|
|
8
8
|
rem
|
|
9
9
|
} from "./chunk-YKCAJ2TN.js";
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
resolveMapPreviewProps,
|
|
47
47
|
glassStyles
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-M5Y42AZ4.js.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDataViewsCopy
|
|
3
|
+
} from "./chunk-KHG57NAE.js";
|
|
4
|
+
import {
|
|
5
|
+
toDayString,
|
|
6
|
+
toLocalDay
|
|
7
|
+
} from "./chunk-SUTOAW7I.js";
|
|
8
|
+
import {
|
|
9
|
+
Calendar
|
|
10
|
+
} from "./chunk-FYAW5GBF.js";
|
|
11
|
+
import {
|
|
12
|
+
EN_US_DATA_VIEWS_COPY
|
|
13
|
+
} from "./chunk-ARGVUTTL.js";
|
|
14
|
+
import {
|
|
15
|
+
rem,
|
|
16
|
+
sxRem
|
|
17
|
+
} from "./chunk-YKCAJ2TN.js";
|
|
18
|
+
|
|
19
|
+
// src/components/data-display/DataViews/data-views-range-calendar.tsx
|
|
20
|
+
import Box from "@mui/material/Box/index.js";
|
|
21
|
+
import Typography from "@mui/material/Typography/index.js";
|
|
22
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
var CALENDAR_CLASS = "data-views-range-calendar";
|
|
24
|
+
var ROOT_SX = (theme) => ({
|
|
25
|
+
mt: { xs: 1, sm: 1.5 },
|
|
26
|
+
// Below `sm` the caption and the weekday row give up their bottom margins,
|
|
27
|
+
// so the whole popover fits a 320×568 screen under its pill (FUT-4144).
|
|
28
|
+
'& :has(> * > [data-testid="calendar-month-select"])': { mb: { xs: 0.5, sm: 2 } },
|
|
29
|
+
'& :has(> [role="columnheader"])': { mb: { xs: 0, sm: 1 } },
|
|
30
|
+
'& [role="columnheader"]': { height: { xs: rem(theme, 24), sm: rem(theme, 32) } },
|
|
31
|
+
// The days carry no column gap of their own (`Calendar`, FUT-4162), so the
|
|
32
|
+
// seven columns are what a day's 40px target is carved from below `sm`; the
|
|
33
|
+
// range band and its round endpoints are the Calendar's, untouched here.
|
|
34
|
+
// The month/year caption on ONE row at 320: the selectors give up the slack
|
|
35
|
+
// around their text before the arrows are pushed onto a second row.
|
|
36
|
+
'& [data-testid="calendar-month-select"], & [data-testid="calendar-year-select"]': { px: 0.5, minWidth: 0 },
|
|
37
|
+
[`& .${CALENDAR_CLASS}`]: {
|
|
38
|
+
p: 0,
|
|
39
|
+
boxShadow: "none",
|
|
40
|
+
backgroundColor: "transparent",
|
|
41
|
+
backgroundImage: "none",
|
|
42
|
+
// A tapped day already rings itself; the whole grid framed in the primary
|
|
43
|
+
// colour after every tap is noise in a popover. The frame stays for the
|
|
44
|
+
// keyboard reaching the grid itself.
|
|
45
|
+
"&:focus-within": { outline: "none" },
|
|
46
|
+
"&:focus-visible": {
|
|
47
|
+
outline: (theme2) => `${rem(theme2, 2)} solid`,
|
|
48
|
+
outlineColor: "primary.main",
|
|
49
|
+
outlineOffset: sxRem(2)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function rangeOf(value) {
|
|
54
|
+
return {
|
|
55
|
+
start: toLocalDay(typeof value.min === "string" ? value.min : null),
|
|
56
|
+
end: toLocalDay(typeof value.max === "string" ? value.max : null)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function rangeFromCalendar(previous, picked) {
|
|
60
|
+
const min = dayOf(picked.start);
|
|
61
|
+
const max = dayOf(picked.end) ?? keptEnd(previous, min);
|
|
62
|
+
return { ...min ? { min } : {}, ...max ? { max } : {} };
|
|
63
|
+
}
|
|
64
|
+
var dayOf = (date) => date ? toDayString(date) : void 0;
|
|
65
|
+
function keptEnd(previous, min) {
|
|
66
|
+
if (previous.min != null || typeof previous.max !== "string") return void 0;
|
|
67
|
+
return min && min <= previous.max ? previous.max : void 0;
|
|
68
|
+
}
|
|
69
|
+
function openingMonth(value, months) {
|
|
70
|
+
const end = toLocalDay(typeof value.max === "string" ? value.max : null);
|
|
71
|
+
const anchor = end ?? /* @__PURE__ */ new Date();
|
|
72
|
+
return new Date(anchor.getFullYear(), anchor.getMonth() - (months > 1 ? 1 : 0), 1);
|
|
73
|
+
}
|
|
74
|
+
function DayRangeCalendar({
|
|
75
|
+
fieldLabel,
|
|
76
|
+
value,
|
|
77
|
+
onChange,
|
|
78
|
+
months,
|
|
79
|
+
viewKey,
|
|
80
|
+
testId
|
|
81
|
+
}) {
|
|
82
|
+
const copy = useDataViewsCopy().filters.dayCalendar ?? EN_US_DATA_VIEWS_COPY.filters.dayCalendar;
|
|
83
|
+
const range = rangeOf(value);
|
|
84
|
+
const pick = (picked) => onChange(rangeFromCalendar(value, picked));
|
|
85
|
+
const waitingForEnd = Boolean(range.start && !range.end);
|
|
86
|
+
return /* @__PURE__ */ jsxs(Box, { sx: ROOT_SX, "data-testid": `${testId}-calendar`, children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
Calendar,
|
|
89
|
+
{
|
|
90
|
+
ariaLabel: copy.label(fieldLabel),
|
|
91
|
+
className: CALENDAR_CLASS,
|
|
92
|
+
selectionMode: "range",
|
|
93
|
+
locale: copy.locale,
|
|
94
|
+
labels: copy.caption,
|
|
95
|
+
firstDayOfWeek: 0,
|
|
96
|
+
numberOfMonths: months,
|
|
97
|
+
showOutsideDays: months === 1,
|
|
98
|
+
captionLayout: months > 1 ? "arrows" : "selectors",
|
|
99
|
+
defaultMonth: openingMonth(value, months),
|
|
100
|
+
range,
|
|
101
|
+
onIntermediateRangeChange: pick
|
|
102
|
+
},
|
|
103
|
+
viewKey
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
Typography,
|
|
107
|
+
{
|
|
108
|
+
component: "p",
|
|
109
|
+
"aria-live": "polite",
|
|
110
|
+
"data-testid": `${testId}-calendar-hint`,
|
|
111
|
+
sx: { mt: { xs: 0.25, sm: 1 }, fontSize: sxRem(12), color: "text.secondary" },
|
|
112
|
+
children: waitingForEnd ? copy.pickEnd : copy.pickStart
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
rangeFromCalendar,
|
|
120
|
+
DayRangeCalendar
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=chunk-MICX23P4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-range-calendar.tsx"],"sourcesContent":["'use client';\n\n/**\n * The range calendar under a day filter's `De`/`Até` boxes (FUT-4144).\n *\n * The owner picked it ALWAYS OPEN (option B of the prototype): a period is\n * three taps — open the filter, the first day, the last day — against five for\n * a calendar button in each box and four for a link to a separate sheet. It\n * sits BELOW the boxes, with no button of its own, so the typed path is not one\n * keystroke longer than it was.\n *\n * The boxes and the calendar are two views of ONE range: a tap writes the\n * boxes, a typed day moves and repaints the calendar, an impossible typed day\n * (which writes nothing) leaves it alone, and \"Limpar\" empties both.\n *\n * It is `Calendar` in `selectionMode=\"range\"`, the same one `DateRangePicker`\n * mounts — not a second calendar. Its own rule picks the period: the first tap\n * starts it, the second closes it, and a second tap BEFORE the first swaps the\n * two, so the boxes never show a period backwards.\n */\nimport Box from '@mui/material/Box/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport React from 'react';\n\nimport { EN_US_DATA_VIEWS_COPY } from '../../../en-US.data-display';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport { Calendar, type DateRange } from '../../form/Calendar';\nimport { toDayString, toLocalDay } from '../../form/DateRangePicker/DateRangePicker.dates';\nimport type { DataViewsDayCalendarCopy } from './data-views-copy';\nimport { useDataViewsCopy } from './data-views-copy-context';\nimport type { RangeValue } from './data-views-types';\n\nconst CALENDAR_CLASS = 'data-views-range-calendar';\n\n/**\n * `Calendar` draws its own `Paper` with 24px of padding and a shadow. Inside\n * the filter's popover that reads as a card inside a card, so the inner frame\n * is flattened through the class hook the component offers for this — the\n * same thing `DateRangePicker` does.\n */\nconst ROOT_SX = (theme: Theme) => ({\n mt: { xs: 1, sm: 1.5 },\n // Below `sm` the caption and the weekday row give up their bottom margins,\n // so the whole popover fits a 320×568 screen under its pill (FUT-4144).\n '& :has(> * > [data-testid=\"calendar-month-select\"])': { mb: { xs: 0.5, sm: 2 } },\n '& :has(> [role=\"columnheader\"])': { mb: { xs: 0, sm: 1 } },\n '& [role=\"columnheader\"]': { height: { xs: rem(theme, 24), sm: rem(theme, 32) } },\n // The days carry no column gap of their own (`Calendar`, FUT-4162), so the\n // seven columns are what a day's 40px target is carved from below `sm`; the\n // range band and its round endpoints are the Calendar's, untouched here.\n // The month/year caption on ONE row at 320: the selectors give up the slack\n // around their text before the arrows are pushed onto a second row.\n '& [data-testid=\"calendar-month-select\"], & [data-testid=\"calendar-year-select\"]': { px: 0.5, minWidth: 0 },\n [`& .${CALENDAR_CLASS}`]: {\n p: 0,\n boxShadow: 'none',\n backgroundColor: 'transparent',\n backgroundImage: 'none',\n // A tapped day already rings itself; the whole grid framed in the primary\n // colour after every tap is noise in a popover. The frame stays for the\n // keyboard reaching the grid itself.\n '&:focus-within': { outline: 'none' },\n '&:focus-visible': {\n outline: (theme: Theme) => `${rem(theme, 2)} solid`,\n outlineColor: 'primary.main',\n outlineOffset: sxRem(2),\n },\n },\n});\n\n/** The two ends of a range, as `Calendar` reads them. */\nfunction rangeOf(value: RangeValue): DateRange {\n return {\n start: toLocalDay(typeof value.min === 'string' ? value.min : null),\n end: toLocalDay(typeof value.max === 'string' ? value.max : null),\n };\n}\n\n/**\n * What a tap on the calendar makes of the range.\n *\n * `Calendar` reports the period it holds after the tap: a fresh start (`end`\n * null) or a closed one, already in order. The one case it cannot see is a\n * range with only `Até` — typed, or left by a saved view — where its first tap\n * would drop that `Até`. A first day on or before it keeps it, so \"até 15/10\"\n * plus one tap on the 3rd is 03/10–15/10, as the prototype does.\n */\nexport function rangeFromCalendar(previous: RangeValue, picked: DateRange): RangeValue {\n const min = dayOf(picked.start);\n const max = dayOf(picked.end) ?? keptEnd(previous, min);\n return { ...(min ? { min } : {}), ...(max ? { max } : {}) };\n}\n\nconst dayOf = (date: Date | null | undefined): string | undefined => (date ? toDayString(date) : undefined);\n\n/** The `Até` of a range that has ONLY one, when the new first day is on or before it. */\nfunction keptEnd(previous: RangeValue, min: string | undefined): string | undefined {\n if (previous.min != null || typeof previous.max !== 'string') return undefined;\n return min && min <= previous.max ? previous.max : undefined;\n}\n\n/**\n * The month the calendar opens on while `De` is empty. With `De` set it opens\n * on De's month, which `Calendar` does by itself.\n *\n * With two months the current month sits on the RIGHT (setembro | outubro), so\n * the days a filter usually asks about — the ones just past — are on screen;\n * with only `Até` set, its month takes that place.\n */\nfunction openingMonth(value: RangeValue, months: number): Date | undefined {\n const end = toLocalDay(typeof value.max === 'string' ? value.max : null);\n const anchor = end ?? new Date();\n return new Date(anchor.getFullYear(), anchor.getMonth() - (months > 1 ? 1 : 0), 1);\n}\n\n/** Props of {@link DayRangeCalendar}. */\nexport interface DayRangeCalendarProps {\n /** The filter's own label (\"Data\"), which names the calendar. */\n fieldLabel: string;\n value: RangeValue;\n /** Called with the range a tap leaves; never for a typed day. */\n onChange: (range: RangeValue) => void;\n /**\n * Months side by side. Two read as a period at a glance where there is room;\n * one, with the month/year selectors, where there is not.\n */\n months: 1 | 2;\n /**\n * Changes when the range moved from OUTSIDE the calendar (typed, a preset,\n * \"Limpar\"), so the calendar re-opens on it. Never for its own taps: a\n * calendar that jumped under the finger picking in it would be unusable.\n */\n viewKey: string;\n testId: string;\n}\n\nexport function DayRangeCalendar({\n fieldLabel,\n value,\n onChange,\n months,\n viewKey,\n testId,\n}: DayRangeCalendarProps): React.JSX.Element {\n const copy: DataViewsDayCalendarCopy =\n useDataViewsCopy().filters.dayCalendar ?? (EN_US_DATA_VIEWS_COPY.filters.dayCalendar as DataViewsDayCalendarCopy);\n const range = rangeOf(value);\n const pick = (picked: DateRange) => onChange(rangeFromCalendar(value, picked));\n const waitingForEnd = Boolean(range.start && !range.end);\n\n return (\n <Box sx={ROOT_SX} data-testid={`${testId}-calendar`}>\n <Calendar\n key={viewKey}\n ariaLabel={copy.label(fieldLabel)}\n className={CALENDAR_CLASS}\n selectionMode=\"range\"\n locale={copy.locale}\n labels={copy.caption}\n // Sunday first, as a pt-BR calendar reads (`D S T Q Q S S`) and as the\n // presets' \"Esta semana\" counts.\n firstDayOfWeek={0}\n numberOfMonths={months}\n // Side by side, a day of the next month in this one is the same day\n // twice; one month alone keeps them, muted, as a six-week frame.\n showOutsideDays={months === 1}\n captionLayout={months > 1 ? 'arrows' : 'selectors'}\n defaultMonth={openingMonth(value, months)}\n range={range}\n // The intermediate callback does the work: the other fires only on the\n // tap that CLOSES a period, so the first tap would write nothing.\n onIntermediateRangeChange={pick}\n />\n <Typography\n component=\"p\"\n aria-live=\"polite\"\n data-testid={`${testId}-calendar-hint`}\n sx={{ mt: { xs: 0.25, sm: 1 }, fontSize: sxRem(12), color: 'text.secondary' }}\n >\n {waitingForEnd ? copy.pickEnd : copy.pickStart}\n </Typography>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,OAAO,SAAS;AAChB,OAAO,gBAAgB;AAmInB,SACE,KADF;AAvHJ,IAAM,iBAAiB;AAQvB,IAAM,UAAU,CAAC,WA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,IAAI,MAAM,IAAI,EAAE,GAAG,UAAU,MAAM,EAAE,GAAG,OAAO,iBAAiB;AAAA,QAE3E,0BAAgB,KAAK,UAAU,KAAK;AAAA;AAAA,IACvC;AAAA,KACF;AAEJ;","names":["theme"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isoToMasked
|
|
3
|
+
} from "./chunk-L6YTVXGN.js";
|
|
1
4
|
import {
|
|
2
5
|
dayCount,
|
|
3
6
|
isAfterDay
|
|
4
7
|
} from "./chunk-SUTOAW7I.js";
|
|
5
|
-
import {
|
|
6
|
-
isoToMasked
|
|
7
|
-
} from "./chunk-72HOUWAW.js";
|
|
8
8
|
import {
|
|
9
9
|
EN_US_UI_LABELS
|
|
10
10
|
} from "./chunk-XOXXG7Q5.js";
|
|
@@ -65,4 +65,4 @@ export {
|
|
|
65
65
|
resolveQuickRanges,
|
|
66
66
|
activeQuickRangeId
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-MPWA55CF.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveMapCopy
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
bounceKeyframes
|
|
6
|
-
} from "./chunk-4YYFZ6TE.js";
|
|
3
|
+
} from "./chunk-M5Y42AZ4.js";
|
|
7
4
|
import {
|
|
8
5
|
MARKER_PIXELS_PER_DEGREE
|
|
9
6
|
} from "./chunk-H2J2MTRE.js";
|
|
7
|
+
import {
|
|
8
|
+
bounceKeyframes
|
|
9
|
+
} from "./chunk-4YYFZ6TE.js";
|
|
10
10
|
import {
|
|
11
11
|
shadowInk
|
|
12
12
|
} from "./chunk-XJAD6E3V.js";
|
|
@@ -85,4 +85,4 @@ export {
|
|
|
85
85
|
MapMarkers,
|
|
86
86
|
MapCoordinates
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
88
|
+
//# sourceMappingURL=chunk-MYTV353T.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PillControl
|
|
3
3
|
} from "./chunk-AJ6KFHEE.js";
|
|
4
|
-
import {
|
|
5
|
-
QuickRow
|
|
6
|
-
} from "./chunk-AT6UKTH4.js";
|
|
7
4
|
import {
|
|
8
5
|
isQuickActive
|
|
9
6
|
} from "./chunk-KYUEO2IO.js";
|
|
10
7
|
import {
|
|
11
8
|
RangeBounds
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FORAVDJF.js";
|
|
10
|
+
import {
|
|
11
|
+
QuickRow
|
|
12
|
+
} from "./chunk-AT6UKTH4.js";
|
|
13
13
|
import {
|
|
14
14
|
isRangeSet
|
|
15
15
|
} from "./chunk-GCZJH4XL.js";
|
|
@@ -119,7 +119,8 @@ function OverflowRange({
|
|
|
119
119
|
field: field.range,
|
|
120
120
|
value,
|
|
121
121
|
onChange,
|
|
122
|
-
testId: `${testIdPrefix}-more-${field.id}
|
|
122
|
+
testId: `${testIdPrefix}-more-${field.id}`,
|
|
123
|
+
fillRow: true
|
|
123
124
|
}
|
|
124
125
|
);
|
|
125
126
|
}
|
|
@@ -227,4 +228,4 @@ export {
|
|
|
227
228
|
MoreQuick,
|
|
228
229
|
MoreGroup
|
|
229
230
|
};
|
|
230
|
-
//# sourceMappingURL=chunk-
|
|
231
|
+
//# sourceMappingURL=chunk-MZAYIG2I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-more-fields.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * ONE FIELD, RENDERED INSIDE THE \"MAIS\" PANEL.\n *\n * Split from `data-views-more-filters` at the file-size gate, along the seam\n * that was already there: that module is the trigger, the panel and its\n * footer — the chrome — and this is what goes in it.\n *\n * A field with one or two options renders FLAT: inside a panel there is no\n * space to win back, and two labelled checkboxes are faster than a dropdown\n * needing a second click. Past that — or whenever the field asks for a tree or\n * a search — it is the bar's own {@link PillControl}; see `sharesBarControl`.\n */\nimport Checkbox from \"@mui/material/Checkbox/index.js\";\n\nimport { Box } from \"../../../mui/Box\";\nimport { Text } from \"../../typography/Text\";\n\nimport { PillControl } from \"./data-views-category-pill\";\nimport type { OverflowField } from \"./data-views-overflow\";\nimport { RangeBounds } from \"./data-views-range-pill\";\nimport { isRangeSet } from \"./data-views-range-values\";\nimport type { QuickFilterConfig, RangeValue } from \"./data-views-types\";\nimport { QuickRow } from \"./data-views-quick-chip\";\nimport { isQuickActive } from \"./data-views-overflow-fields\";\nimport { useDataViewsCopy } from \"./data-views-copy-context\";\nimport { fieldRadiusPx } from \"../../../tokens/field-radius\";\nimport { fieldHeight } from \"../../../tokens/field-height\";\nimport { fieldEdge } from \"../../../tokens/field-edge\";\nimport { sxRem } from \"../../../tokens/relative\";\n\n/** What each field's control needs, minus the panel's own chrome. */\nexport interface MoreFieldProps {\n pills: Record<string, string[]>;\n ranges: Record<string, RangeValue>;\n onTogglePill: (fieldId: string, value: string, checked: boolean) => void;\n onChangeRange: (fieldId: string, range: RangeValue) => void;\n /** Presses or releases a quick chip shed into the panel. */\n onToggleQuick?: (quick: QuickFilterConfig) => void;\n testIdPrefix: string;\n}\n\n/**\n * Above this many options a field is a DROPDOWN rather than a flat row of\n * checkboxes. Two options cost two lines and read faster laid out; a \"Cliente\"\n * with a dozen turns the panel into a scrolling wall and buries every field\n * under it, which is exactly what the overflow was meant to avoid.\n */\nconst INLINE_OPTION_LIMIT = 2;\n\n/**\n * Whether an overflowed pill keeps the SAME control it has on the bar.\n *\n * The panel used to build its own flat dropdown for every field past two\n * options, so a field's config only held while it fitted: `control:\n * \"category\"` lost its tree (subcategories flattened into one list, no\n * \"Marcar tudo\", no count footer) and `searchEnabled` lost its search, on\n * exactly the phone widths where most filters live in here. Anything the bar\n * would render as a dropdown now renders as the bar's own {@link PillControl};\n * only a plain two-option field — one that did not ask for a dropdown, a tree\n * or a search — stays a flat checkbox row, which is a panel layout rather than\n * a different control (the filter panel draws the same line).\n */\nfunction sharesBarControl<T extends Record<string, unknown>>(field: OverflowField<T>): boolean {\n const pill = field.pill;\n if (!pill) return false;\n return (\n pill.control === \"category\" ||\n pill.control === \"multiselect\" ||\n pill.searchEnabled === true ||\n pill.options.length > INLINE_OPTION_LIMIT\n );\n}\n\n/** One overflowed pill: the bar's control, or its options as checkboxes. */\nfunction OverflowPill<T extends Record<string, unknown>>({\n field,\n values,\n onTogglePill,\n onClear,\n testIdPrefix,\n}: {\n field: OverflowField<T>;\n values: string[];\n onTogglePill: (fieldId: string, value: string, checked: boolean) => void;\n onClear: () => void;\n testIdPrefix: string;\n}): React.JSX.Element {\n const testId = `${testIdPrefix}-more-${field.id}`;\n if (field.pill && sharesBarControl(field)) {\n return (\n <PillControl\n fieldId={field.id}\n pill={field.pill}\n selected={values}\n onTogglePill={onTogglePill}\n onClearField={onClear}\n testIdPrefix={testIdPrefix}\n testId={testId}\n />\n );\n }\n const onToggle = (value: string, checked: boolean) => onTogglePill(field.id, value, checked);\n return (\n <Box sx={{ display: \"flex\", flexWrap: \"wrap\", gap: 0.75 }}>\n {(field.pill?.options ?? []).map((option) => {\n const checked = values.includes(option.value);\n return (\n <Box\n key={option.value}\n component=\"label\"\n data-testid={`${testId}-${option.value}`}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 0.25,\n pr: 1,\n border: 1,\n borderStyle: \"solid\",\n minHeight: fieldHeight,\n borderColor: (theme) => (checked ? theme.palette.primary.main : fieldEdge(theme)),\n bgcolor: checked ? \"action.selected\" : \"transparent\",\n borderRadius: fieldRadiusPx,\n cursor: \"pointer\",\n fontSize: sxRem(13),\n color: checked ? \"primary.main\" : \"text.secondary\",\n }}\n >\n <Checkbox\n size=\"small\"\n checked={checked}\n onChange={(event) => onToggle(option.value, event.target.checked)}\n inputProps={{ \"aria-label\": `${field.label}: ${option.label}` }}\n />\n {option.label}\n </Box>\n );\n })}\n </Box>\n );\n}\n\n\n/**\n * One overflowed range: its presets and its two bounds, as the same controls\n * the pill uses.\n *\n * The whole control DELEGATES to {@link RangeBounds} rather than being built\n * here, which is the point — this panel used to render a raw\n * `<input type=\"date\">`, so the masked `dd/mm/aaaa` field existed only while\n * the filter FITTED on the bar. The moment \"Data\" overflowed it reverted to the\n * native control the mask replaced, and a merchant on a narrow screen never saw\n * the fix at all (FUT-744). `Valor` had the twin bug: a bare `type=\"number\"`\n * plus `Number(raw)` dropped the decimal comma this panel is meant to accept.\n *\n * That also retires the intrinsic-width workaround this pair used to need — a\n * native date input reports a wide minimum (its own mask plus the picker\n * glyph), which is what made two of them refuse to shrink and scrolled the\n * panel sideways. A text input has no such minimum.\n *\n * `RangeBounds` renders the preset chips ITSELF, above the inputs. This panel\n * must NOT render its own row as well: when the delegation above landed, the\n * chips it used to draw by hand stayed behind, and \"Data\" showed Hoje/Ontem/\n * Esta semana/Este mês/Este ano twice — two rows, duplicated test ids, and half\n * the panel's height spent saying the same thing (FUT-751).\n */\nfunction OverflowRange<T extends Record<string, unknown>>({\n field,\n value,\n onChange,\n testIdPrefix,\n}: {\n field: OverflowField<T>;\n value: RangeValue;\n onChange: (range: RangeValue) => void;\n testIdPrefix: string;\n}): React.JSX.Element | null {\n // `group === \"range\"` is what selects this component, so `range` is always\n // set; the guard is for the type, not for a state the caller can reach.\n if (!field.range) return null;\n return (\n <RangeBounds\n field={field.range}\n value={value}\n onChange={onChange}\n testId={`${testIdPrefix}-more-${field.id}`}\n fillRow\n />\n );\n}\n\n/**\n * Whether a field has anything applied, and how to unapply it — the two shapes\n * (a pill's selected values, a range's bounds) answered in one place so the\n * group that renders them stays a renderer.\n */\nexport function fieldClearing<T extends Record<string, unknown>>({\n field,\n pills,\n ranges,\n onTogglePill,\n onChangeRange,\n}: {\n field: OverflowField<T>;\n} & Pick<MoreFieldProps, \"pills\" | \"ranges\" | \"onTogglePill\" | \"onChangeRange\">): {\n applied: boolean;\n clear: () => void;\n} {\n if (field.group === \"quick\" && field.quick) {\n const quick = field.quick;\n // A `default` chip lit by an empty field has nothing to clear.\n const applied = isQuickActive(quick, pills) && (pills[quick.fieldId]?.length ?? 0) > 0;\n return { applied, clear: () => onTogglePill(quick.fieldId, quick.value, false) };\n }\n if (field.group === \"range\") {\n return {\n applied: isRangeSet(ranges[field.id] ?? {}),\n clear: () => onChangeRange(field.id, {}),\n };\n }\n const values = pills[field.id] ?? [];\n return {\n applied: values.length > 0,\n clear: () => values.forEach((value) => onTogglePill(field.id, value, false)),\n };\n}\n\n\n/**\n * A quick chip shed into the panel: its own line, because label and count are\n * already the whole control — no heading above it, no \"Limpar\" beside it.\n */\nexport function MoreQuick({\n quick,\n pills,\n onToggleQuick,\n testIdPrefix,\n}: {\n quick: QuickFilterConfig;\n} & Pick<MoreFieldProps, \"pills\" | \"onToggleQuick\" | \"testIdPrefix\">): React.JSX.Element {\n return (\n <Box sx={{ mb: 1, \"&:last-of-type\": { mb: 0 } }}>\n <QuickRow\n quick={quick}\n active={isQuickActive(quick, pills)}\n onToggle={() => onToggleQuick?.(quick)}\n testIdPrefix={testIdPrefix}\n />\n </Box>\n );\n}\n\n/** One labelled group in the panel: the field's name, then its control. */\nexport function MoreGroup<T extends Record<string, unknown>>({\n field,\n pills,\n ranges,\n onTogglePill,\n onChangeRange,\n testIdPrefix,\n}: {\n field: OverflowField<T>;\n} & MoreFieldProps): React.JSX.Element {\n const copy = useDataViewsCopy();\n const { applied, clear } = fieldClearing({ field, pills, ranges, onTogglePill, onChangeRange });\n return (\n <Box sx={{ mb: 1.5, \"&:last-of-type\": { mb: 0 } }}>\n <Box sx={{ display: \"flex\", alignItems: \"center\", gap: 1, mb: 0.5 }}>\n <Text variant=\"caption\" as=\"span\">\n <Box component=\"span\" sx={{ color: \"text.secondary\" }}>\n {field.label}\n {field.group === \"range\" && isRangeSet(ranges[field.id] ?? {}) ? \" •\" : \"\"}\n </Box>\n </Text>\n {/* The panel's equivalent of the pill's ✕. Without it a field applied\n in here could only be cleared by finding it again on the bar —\n which is where it goes the moment it becomes active, so the\n operator has to close this panel to undo what they just did. */}\n {applied && (\n <Box\n component=\"button\"\n type=\"button\"\n onClick={clear}\n data-testid={`${testIdPrefix}-more-${field.id}-clear`}\n sx={{\n ml: \"auto\",\n border: 0,\n p: 0,\n bgcolor: \"transparent\",\n cursor: \"pointer\",\n font: \"inherit\",\n fontSize: sxRem(12),\n color: \"primary.main\",\n \"&:hover\": { textDecoration: \"underline\" },\n }}\n >\n {copy.filters.clear}\n </Box>\n )}\n </Box>\n {field.group === \"pill\" ? (\n <OverflowPill\n field={field}\n values={pills[field.id] ?? []}\n onTogglePill={onTogglePill}\n onClear={() => (pills[field.id] ?? []).forEach((v) => onTogglePill(field.id, v, false))}\n testIdPrefix={testIdPrefix}\n />\n ) : (\n <OverflowRange\n field={field}\n value={ranges[field.id] ?? {}}\n onChange={(range) => onChangeRange(field.id, range)}\n testIdPrefix={testIdPrefix}\n />\n )}\n </Box>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,OAAO,cAAc;AA8Ef,cAiBI,YAjBJ;AA3CN,IAAM,sBAAsB;AAe5B,SAAS,iBAAoD,OAAkC;AAC7F,QAAM,OAAO,MAAM;AACnB,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,KAAK,YAAY,cACjB,KAAK,YAAY,iBACjB,KAAK,kBAAkB,QACvB,KAAK,QAAQ,SAAS;AAE1B;AAGA,SAAS,aAAgD;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMsB;AACpB,QAAM,SAAS,GAAG,YAAY,SAAS,MAAM,EAAE;AAC/C,MAAI,MAAM,QAAQ,iBAAiB,KAAK,GAAG;AACzC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,MAAM;AAAA,QACf,MAAM,MAAM;AAAA,QACZ,UAAU;AAAA,QACV;AAAA,QACA,cAAc;AAAA,QACd;AAAA,QACA;AAAA;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