@12-apps/ui 6.25.0 → 6.27.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/dist/_internal/components/data-display/Alert/Alert.helpers.js +5 -1
- package/dist/_internal/components/data-display/Alert/Alert.js +5 -5
- package/dist/_internal/components/data-display/Alert/Alert.metrics.js +2 -2
- package/dist/_internal/components/data-display/Alert/Alert.styles.js +4 -4
- 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/Badge/Badge.animations.js +3 -3
- package/dist/_internal/components/data-display/Badge/Badge.js +7 -7
- package/dist/_internal/components/data-display/Badge/Badge.metrics.js +2 -2
- package/dist/_internal/components/data-display/Badge/Badge.styles.js +5 -5
- package/dist/_internal/components/data-display/Badge/Badge.variants.js +3 -3
- package/dist/_internal/components/data-display/Badge/BadgeContent.js +6 -6
- package/dist/_internal/components/data-display/Banner/Banner.js +4 -4
- package/dist/_internal/components/data-display/Banner/Banner.styles.js +3 -3
- package/dist/_internal/components/data-display/CardKit/CardKebab.js +4 -4
- package/dist/_internal/components/data-display/CardKit/card-actions-context.js +6 -6
- package/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +10 -10
- package/dist/_internal/components/data-display/CardKit/use-row-confirm.js +4 -4
- package/dist/_internal/components/data-display/Carousel/Carousel.chrome.js +1 -1
- package/dist/_internal/components/data-display/Carousel/Carousel.js +1 -1
- package/dist/_internal/components/data-display/Carousel/Carousel.parts.js +1 -1
- package/dist/_internal/components/data-display/Carousel/Carousel.styles.js +1 -1
- package/dist/_internal/components/data-display/Chart/Chart.js +5 -5
- package/dist/_internal/components/data-display/Chart/SpecChart.js +6 -6
- package/dist/_internal/components/data-display/Chart/chart-context.js +3 -3
- package/dist/_internal/components/data-display/Chart/chart-internals.js +1 -1
- package/dist/_internal/components/data-display/Chart/chart-renderers.js +4 -4
- package/dist/_internal/components/data-display/DataViews/DataViewsBoard.js +4 -4
- package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +37 -37
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +55 -54
- package/dist/_internal/components/data-display/DataViews/DeleteViewDialog.js +6 -6
- package/dist/_internal/components/data-display/DataViews/ManageViewsDialog.js +7 -7
- package/dist/_internal/components/data-display/DataViews/SaveViewModal.js +12 -11
- package/dist/_internal/components/data-display/DataViews/base-card.js +9 -9
- package/dist/_internal/components/data-display/DataViews/base-list-card-geometry.js +12 -12
- package/dist/_internal/components/data-display/DataViews/base-list-card-gutters.js +3 -3
- package/dist/_internal/components/data-display/DataViews/base-list-card-slots.js +8 -8
- package/dist/_internal/components/data-display/DataViews/base-list-card.js +16 -16
- package/dist/_internal/components/data-display/DataViews/card-surface.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-category-pill.js +5 -5
- package/dist/_internal/components/data-display/DataViews/data-views-columns-tab.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-columns.js +5 -5
- package/dist/_internal/components/data-display/DataViews/data-views-display-panel.js +11 -11
- package/dist/_internal/components/data-display/DataViews/data-views-display-tabs.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-empty.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-export.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-grid-bodies.js +12 -12
- package/dist/_internal/components/data-display/DataViews/data-views-grid-helpers.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +34 -34
- package/dist/_internal/components/data-display/DataViews/data-views-header-row.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +13 -13
- package/dist/_internal/components/data-display/DataViews/data-views-layout-context.js +2 -2
- package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +7 -7
- package/dist/_internal/components/data-display/DataViews/data-views-scope-tabs.js +3 -3
- package/dist/_internal/components/data-display/DataViews/data-views-select-all-strip.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-shell-toolbar.js +15 -15
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +19 -18
- package/dist/_internal/components/data-display/DataViews/data-views-toolbar.js +14 -14
- package/dist/_internal/components/data-display/DataViews/data-views-view-nav.js +6 -6
- package/dist/_internal/components/data-display/DataViews/list-card-rails.js +3 -3
- package/dist/_internal/components/data-display/DataViews/save-view-preview.js +4 -4
- package/dist/_internal/components/data-display/DataViews/use-data-views-state.js +7 -7
- package/dist/_internal/components/data-display/DataViews/use-saved-views-controller.js +2 -2
- package/dist/_internal/components/data-display/DescriptionItem/DescriptionItem.js +4 -4
- package/dist/_internal/components/data-display/FleetMap/FleetBody.js +11 -11
- package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js +8 -8
- package/dist/_internal/components/data-display/FleetMap/FleetMap.js +13 -13
- package/dist/_internal/components/data-display/FleetMap/FleetRoster.js +2 -2
- package/dist/_internal/components/data-display/Lightbox/Lightbox.js +1 -1
- package/dist/_internal/components/data-display/MapPreview/MapDecorations.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/MapPreview.hooks.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/MapPreview.js +7 -7
- package/dist/_internal/components/data-display/MapPreview/MapTiles.js +2 -2
- package/dist/_internal/components/data-display/MapPreview/StaticMapView.js +4 -4
- package/dist/_internal/components/data-display/MapPreview/useMapPreview.js +3 -3
- package/dist/_internal/components/data-display/Progress/Progress.js +4 -4
- package/dist/_internal/components/data-display/Progress/Progress.metrics.js +2 -2
- package/dist/_internal/components/data-display/Progress/Progress.styles.js +3 -3
- package/dist/_internal/components/data-display/Sheet/Sheet.body.js +1 -1
- package/dist/_internal/components/data-display/Sheet/Sheet.js +4 -4
- package/dist/_internal/components/data-display/Sheet/Sheet.styles.js +1 -1
- package/dist/_internal/components/data-display/Table/Table.js +2 -2
- package/dist/_internal/components/data-display/index.js +44 -44
- package/dist/_internal/components/feedback/ConfirmAction/ConfirmButton.js +4 -4
- package/dist/_internal/components/feedback/index.js +4 -4
- package/dist/_internal/components/form/AddressAutocomplete/AddressAutocomplete.hooks.js +2 -2
- package/dist/_internal/components/form/AddressAutocomplete/AddressAutocomplete.js +5 -5
- package/dist/_internal/components/form/Autocomplete/Autocomplete.js +2 -2
- package/dist/_internal/components/form/Button/Button.js +3 -3
- package/dist/_internal/components/form/Button/Button.styles.js +2 -2
- package/dist/_internal/components/form/Calendar/Calendar.hooks.js +2 -2
- package/dist/_internal/components/form/Calendar/Calendar.js +3 -3
- package/dist/_internal/components/form/CategorySelect/CategoryPanel.js +1 -1
- package/dist/_internal/components/form/CategorySelect/CategorySelect.js +4 -4
- package/dist/_internal/components/form/Checkbox/Checkbox.js +2 -2
- package/dist/_internal/components/form/Command/Command.js +4 -4
- package/dist/_internal/components/form/Command/Command.styles.js +1 -1
- package/dist/_internal/components/form/DateRangePicker/DateRangePicker.js +5 -5
- package/dist/_internal/components/form/Label/Label.js +1 -1
- package/dist/_internal/components/form/Label/Label.styles.js +1 -1
- package/dist/_internal/components/form/Menubar/Menubar.item.js +1 -1
- package/dist/_internal/components/form/Menubar/Menubar.js +1 -1
- package/dist/_internal/components/form/Menubar/Menubar.styles.js +1 -1
- package/dist/_internal/components/form/Menubar/Menubar.toolbar.js +1 -1
- package/dist/_internal/components/form/PhoneInput/PhoneInput.hooks.js +2 -2
- package/dist/_internal/components/form/PhoneInput/PhoneInput.js +3 -3
- package/dist/_internal/components/form/RichTextEditor/RichTextEditor.js +2 -2
- package/dist/_internal/components/form/Switch/Switch.ids.js +8 -0
- package/dist/_internal/components/form/Switch/Switch.ids.js.map +1 -0
- package/dist/_internal/components/form/Switch/Switch.js +6 -5
- package/dist/_internal/components/form/Switch/Switch.metrics.js +5 -1
- package/dist/_internal/components/form/Switch/Switch.parts.js +6 -8
- package/dist/_internal/components/form/Switch/Switch.styles.js +5 -3
- package/dist/_internal/components/form/index.js +34 -33
- package/dist/_internal/components/form/total-form/Fields/CategoryField.js +5 -5
- package/dist/_internal/components/form/total-form/Fields/index.js +6 -6
- package/dist/_internal/components/form/total-form/SubmitButton.js +4 -4
- package/dist/_internal/components/index.js +83 -82
- package/dist/_internal/components/layout/Box/Box.js +4 -4
- package/dist/_internal/components/layout/Stack/Stack.js +5 -5
- package/dist/_internal/components/navigation/AppHeader/AppHeader.details.js +7 -7
- package/dist/_internal/components/navigation/AppHeader/AppHeader.identity.js +1 -1
- package/dist/_internal/components/navigation/index.js +7 -7
- package/dist/_internal/components/typography/Heading/Heading.js +4 -4
- package/dist/_internal/components/typography/Heading/Heading.metrics.js +2 -2
- package/dist/_internal/components/typography/Heading/Heading.styles.js +3 -3
- package/dist/_internal/components/typography/Paragraph/Paragraph.js +2 -2
- package/dist/_internal/components/typography/Text/Text.js +3 -3
- package/dist/_internal/components/typography/Text/Text.metrics.js +2 -2
- package/dist/_internal/components/typography/index.js +7 -7
- package/dist/_internal/icons/Icon.js +4 -4
- package/dist/_internal/provider/UiProvider.js +3 -3
- package/dist/_internal/provider/mui-bridge.js +2 -2
- package/dist/_internal/provider/use-ui-theme.js +3 -3
- package/dist/_internal/social-login-button/social-login-button.js +9 -9
- package/dist/_internal/tokens/theme.js +3 -1
- package/dist/_internal/user-avatar/user-avatar.js +8 -8
- package/dist/charts.js +6 -6
- package/dist/{chunk-2GI7ANEL.js → chunk-22X7TT6Z.js} +4 -4
- package/dist/{chunk-WR5JFDQ5.js → chunk-27BL3DNT.js} +8 -8
- package/dist/{chunk-E55CJV65.js → chunk-2KVQIGVE.js} +2 -2
- package/dist/{chunk-BB2OUERT.js → chunk-2LSCK45B.js} +7 -4
- package/dist/chunk-2LSCK45B.js.map +1 -0
- package/dist/{chunk-W3FAKT3D.js → chunk-2SWQ6HIK.js} +4 -4
- package/dist/{chunk-ISW5K72V.js → chunk-2ZRZTGWP.js} +5 -5
- package/dist/{chunk-I5SBTNV2.js → chunk-3GB6KWHH.js} +2 -2
- package/dist/{chunk-ZEG2LNBY.js → chunk-3PJLT5FX.js} +2 -2
- package/dist/{chunk-57Z2ND3N.js → chunk-3VZT2FAI.js} +4 -4
- package/dist/{chunk-MLCFODJO.js → chunk-3W2IS5RH.js} +5 -1
- package/dist/{chunk-MLCFODJO.js.map → chunk-3W2IS5RH.js.map} +1 -1
- package/dist/{chunk-PFDM2OIP.js → chunk-45OHGD2B.js} +4 -4
- package/dist/{chunk-BH5BXLGI.js → chunk-4A2Q22HO.js} +3 -3
- package/dist/{chunk-46UPILLK.js → chunk-4ETQRBZC.js} +4 -4
- package/dist/{chunk-WM6Y2S6W.js → chunk-5QUSX3TC.js} +5 -5
- package/dist/{chunk-AVGTTWTE.js → chunk-65DLYC4S.js} +4 -4
- package/dist/{chunk-TVPPA4RD.js → chunk-65METCKT.js} +16 -16
- package/dist/{chunk-OQFSYMHJ.js → chunk-67ALTEWH.js} +2 -2
- package/dist/{chunk-OGGHD64H.js → chunk-6SK3MTYJ.js} +2 -2
- package/dist/{chunk-OE2ZVL67.js → chunk-6VHCSPKK.js} +3 -3
- package/dist/{chunk-WAPJ2DL3.js → chunk-72T5PAW7.js} +4 -4
- package/dist/{chunk-SLVQ33AN.js → chunk-77DF5LKI.js} +2 -2
- package/dist/{chunk-7KWBGMQC.js → chunk-77OXG6DH.js} +5 -5
- package/dist/{chunk-Y3KRUT7O.js → chunk-7AIHK2XM.js} +2 -2
- package/dist/{chunk-MHV5Y5MR.js → chunk-7KEGJH3Q.js} +3 -3
- package/dist/{chunk-KMXAPYU2.js → chunk-7NEUPEV5.js} +2 -2
- package/dist/{chunk-67L7HMEP.js → chunk-7Z2AQEC5.js} +2 -2
- package/dist/{chunk-PQECNGDE.js → chunk-AGYGNNOM.js} +2 -2
- package/dist/{chunk-ZTF5C2GA.js → chunk-B5SW7I5W.js} +2 -2
- package/dist/{chunk-TXHJX2NG.js → chunk-BGYLL467.js} +4 -4
- package/dist/{chunk-R7R3LOKW.js → chunk-CA7TA36R.js} +2 -2
- package/dist/{chunk-FPFUXRD2.js → chunk-CKJI7JO5.js} +2 -2
- package/dist/{chunk-HMV4QMXS.js → chunk-CMN26J5Y.js} +4 -4
- package/dist/{chunk-KVEHH4SA.js → chunk-DB2MAYPK.js} +2 -2
- package/dist/{chunk-2ECT4IY2.js → chunk-DIHVWBQV.js} +36 -17
- package/dist/chunk-DIHVWBQV.js.map +1 -0
- package/dist/{chunk-V4FKHLEB.js → chunk-DTIB5KWP.js} +3 -3
- package/dist/{chunk-MESRKY67.js → chunk-DW6GBMLQ.js} +3 -3
- package/dist/{chunk-JO6BBSGY.js → chunk-DWJBOR47.js} +3 -3
- package/dist/{chunk-YW5T6KZ5.js → chunk-DYESJJ3Q.js} +9 -9
- package/dist/{chunk-TZDDL3DR.js → chunk-ECMJ5VPW.js} +2 -2
- package/dist/{chunk-OH3YGJT5.js → chunk-EMNGIYH6.js} +5 -5
- package/dist/{chunk-CZJLWCEG.js → chunk-EPNCYUQ7.js} +4 -4
- package/dist/{chunk-JZXWCEH5.js → chunk-EQA4VQEO.js} +2 -2
- package/dist/{chunk-3N6EK6K5.js → chunk-ERX4XIYC.js} +2 -2
- package/dist/{chunk-TTLI6PF7.js → chunk-FF3R67WD.js} +5 -5
- package/dist/{chunk-WNMYWQ7D.js → chunk-FOF2RAVQ.js} +12 -10
- package/dist/chunk-FOF2RAVQ.js.map +1 -0
- package/dist/{chunk-KLREH4X6.js → chunk-G2JPUHEJ.js} +2 -2
- package/dist/{chunk-4J5EN4FQ.js → chunk-GBX5ACPF.js} +5 -5
- package/dist/{chunk-ZZMZF7PZ.js → chunk-GQJ4NCZ6.js} +3 -3
- package/dist/{chunk-IPVYEPXO.js → chunk-GSTRPZS4.js} +5 -5
- package/dist/{chunk-HFXTAEYY.js → chunk-GTLJYAEG.js} +2 -2
- package/dist/{chunk-M4LFDGI6.js → chunk-GYQT47YZ.js} +2 -2
- package/dist/{chunk-JSH3HFDQ.js → chunk-H3BQFEN5.js} +2 -2
- package/dist/{chunk-OV4WREMW.js → chunk-HKB5C2KY.js} +7 -7
- package/dist/{chunk-BLBOYCOV.js → chunk-HKV4MQ2W.js} +5 -5
- package/dist/{chunk-4MGFUPQT.js → chunk-HOJL2GKW.js} +4 -4
- package/dist/{chunk-HR7YTBR7.js → chunk-IASDP44E.js} +4 -4
- package/dist/{chunk-YMRI5QKG.js → chunk-IV5QQLCS.js} +2 -2
- package/dist/{chunk-JUHUKZGU.js → chunk-JD3D6Y4U.js} +2 -2
- package/dist/{chunk-FR67FG2U.js → chunk-JFRKBSWI.js} +35 -25
- package/dist/chunk-JFRKBSWI.js.map +1 -0
- package/dist/{chunk-AXTLFK4T.js → chunk-KAV63FBG.js} +2 -2
- package/dist/{chunk-2PBGVMM2.js → chunk-KOFO6QZY.js} +2 -2
- package/dist/{chunk-RP5FK3SO.js → chunk-L7LCSZ3H.js} +3 -3
- package/dist/{chunk-MNXVXW4T.js → chunk-L7S6N67X.js} +2 -2
- package/dist/{chunk-N3QUEBNS.js → chunk-L7VH6IMR.js} +14 -1
- package/dist/chunk-L7VH6IMR.js.map +1 -0
- package/dist/{chunk-JXPHU3K5.js → chunk-LGJ2H4AH.js} +5 -5
- package/dist/{chunk-W4YWU7LQ.js → chunk-LO2B7FDQ.js} +2 -2
- package/dist/{chunk-PWR7K5OP.js → chunk-LV4UTYAD.js} +2 -2
- package/dist/{chunk-OG2FP6SE.js → chunk-M4NFXC5R.js} +4 -4
- package/dist/{chunk-ZPIMPOHV.js → chunk-M7E66OSC.js} +4 -4
- package/dist/{chunk-OGGPQVIG.js → chunk-MDTSMJ7C.js} +3 -3
- package/dist/{chunk-YDI6IJ6F.js → chunk-MI2MVH3I.js} +4 -4
- package/dist/{chunk-6ZY5XU4J.js → chunk-MQPT254A.js} +4 -4
- package/dist/{chunk-EWT3WMVY.js → chunk-MYH7VISV.js} +5 -5
- package/dist/{chunk-7NSX7A5H.js → chunk-N5PY7IXI.js} +3 -3
- package/dist/{chunk-BHIGHSXA.js → chunk-NNXZ5RK5.js} +4 -4
- package/dist/{chunk-EQ7PWGBN.js → chunk-O7HLQTB7.js} +3 -3
- package/dist/{chunk-DW5FRWRQ.js → chunk-OAWEUKUC.js} +2 -2
- package/dist/{chunk-O4VCZTK4.js → chunk-OGHW7RQC.js} +2 -2
- package/dist/{chunk-XR6WBW23.js → chunk-OVGASVPW.js} +2 -2
- package/dist/{chunk-HEBQS7QP.js → chunk-OXYR2HVK.js} +3 -3
- package/dist/{chunk-TNVO2DTB.js → chunk-P7FQUGED.js} +5 -5
- package/dist/{chunk-343TTIHD.js → chunk-PENJBKPH.js} +3 -3
- package/dist/{chunk-2RQINU5T.js → chunk-PKFFJAQ6.js} +2 -2
- package/dist/{chunk-M4LQRQFL.js → chunk-PW2WLDX3.js} +2 -2
- package/dist/{chunk-WRDPWEIC.js → chunk-Q3GSDSK2.js} +6 -6
- package/dist/{chunk-SYJMI2NP.js → chunk-Q3OFOOO7.js} +2 -2
- package/dist/{chunk-GGI7GM5O.js → chunk-QE2C35TO.js} +4 -4
- package/dist/{chunk-NQN5Z36J.js → chunk-QLI7ES7Z.js} +10 -1
- package/dist/chunk-QLI7ES7Z.js.map +1 -0
- package/dist/{chunk-CT5K725B.js → chunk-QQLGSMGE.js} +2 -2
- package/dist/{chunk-7MN6I5NK.js → chunk-QXFPTRHB.js} +3 -3
- package/dist/{chunk-CZPU5TW3.js → chunk-RFZU5BTG.js} +2 -2
- package/dist/{chunk-JB67KPGM.js → chunk-RRO2EOJB.js} +4 -4
- package/dist/{chunk-MZQTHSLN.js → chunk-S7HRED4D.js} +2 -2
- package/dist/{chunk-NYEA7JAI.js → chunk-SC72DRTX.js} +6 -6
- package/dist/{chunk-JWW2Z3RH.js → chunk-SMZBGHR2.js} +7 -7
- package/dist/{chunk-EZSEAYYT.js → chunk-SSWZHR46.js} +5 -5
- package/dist/{chunk-NA7MIEG6.js → chunk-SZETT7QV.js} +2 -2
- package/dist/chunk-SZS7VZJN.js +25 -0
- package/dist/chunk-SZS7VZJN.js.map +1 -0
- package/dist/{chunk-2HPP6RVC.js → chunk-TQOPF7LD.js} +2 -2
- package/dist/{chunk-OLVZ6TOV.js → chunk-TUO47RL2.js} +4 -4
- package/dist/{chunk-N5IVVLTH.js → chunk-UG76BO5K.js} +79 -19
- package/dist/chunk-UG76BO5K.js.map +1 -0
- package/dist/{chunk-4IVDVZZ2.js → chunk-UGL6SJN6.js} +3 -3
- package/dist/{chunk-QJRDDVZ2.js → chunk-V5P5Q6HM.js} +3 -3
- package/dist/{chunk-73NJCGQG.js → chunk-VIK3HAUQ.js} +2 -2
- package/dist/{chunk-KM5O4ICK.js → chunk-VK4ULJFH.js} +2 -2
- package/dist/{chunk-QYNCPS5W.js → chunk-WBKWIFXA.js} +6 -6
- package/dist/{chunk-X4Z62ZQY.js → chunk-WETAIIKC.js} +2 -2
- package/dist/{chunk-GMTM6EN7.js → chunk-WKF54CCK.js} +7 -7
- package/dist/{chunk-KT6HWAEN.js → chunk-WZUNBSS7.js} +2 -2
- package/dist/{chunk-Y2B3I3IH.js → chunk-X5RDHO6G.js} +2 -2
- package/dist/{chunk-TXKZEKJN.js → chunk-XNOSTV5F.js} +2 -2
- package/dist/{chunk-7JXLGOM2.js → chunk-Y55ILY2F.js} +3 -3
- package/dist/{chunk-HI2OFZSZ.js → chunk-YPILHGEO.js} +2 -2
- package/dist/{chunk-V3PLFYKO.js → chunk-ZAJO2B75.js} +2 -2
- package/dist/data-display/Alert.js +5 -5
- package/dist/data-display/Avatar.js +3 -3
- package/dist/data-display/Badge.js +7 -7
- package/dist/data-display/Banner.js +4 -4
- package/dist/data-display/CardKit.js +14 -14
- package/dist/data-display/Carousel.js +1 -1
- package/dist/data-display/Chart.js +6 -6
- package/dist/data-display/DataViews.js +69 -68
- package/dist/data-display/DescriptionItem.js +4 -4
- package/dist/data-display/FleetMap.js +13 -13
- package/dist/data-display/Lightbox.js +1 -1
- package/dist/data-display/MapPreview.js +7 -7
- package/dist/data-display/Progress.js +4 -4
- package/dist/data-display/Sheet.js +4 -4
- package/dist/data-display/Table.js +2 -2
- package/dist/feedback/ConfirmAction.js +4 -4
- package/dist/form/AddressAutocomplete.js +5 -5
- package/dist/form/Autocomplete.js +2 -2
- package/dist/form/Button.js +3 -3
- package/dist/form/Calendar.js +3 -3
- package/dist/form/CategorySelect.js +4 -4
- package/dist/form/Checkbox.js +2 -2
- package/dist/form/Command.js +4 -4
- package/dist/form/DateRangePicker.js +10 -10
- package/dist/form/Label.js +1 -1
- package/dist/form/Menubar.js +1 -1
- package/dist/form/PhoneInput.js +3 -3
- package/dist/form/RichTextEditor.js +2 -2
- package/dist/form/Switch.js +6 -5
- package/dist/form/total-form.js +10 -10
- package/dist/icons.js +4 -4
- package/dist/layout/Box.js +4 -4
- package/dist/layout/Stack.js +5 -5
- package/dist/native/chunks/{chunk-2R2R35C5.js → chunk-2SBTJSQE.js} +5 -5
- package/dist/native/chunks/{chunk-WL5LXVCK.js → chunk-6L4UZBQP.js} +3 -3
- package/dist/native/chunks/{chunk-LEMMXZFN.js → chunk-MP3UDWTT.js} +10 -1
- package/dist/native/chunks/{chunk-LEMMXZFN.js.map → chunk-MP3UDWTT.js.map} +1 -1
- package/dist/native/chunks/{chunk-GW7TQ7HO.js → chunk-QEQZ5AF6.js} +3 -3
- package/dist/native/chunks/{chunk-7LTVGW23.js → chunk-UII3IFLP.js} +2 -2
- package/dist/native/chunks/{chunk-75JQYVDZ.js → chunk-UYREIOEM.js} +2 -2
- package/dist/native/chunks/{chunk-GWGIWQO7.js → chunk-XI7HTAVN.js} +2 -2
- package/dist/native/chunks/{chunk-QYUD3S6F.js → chunk-ZOP7UAZK.js} +2 -2
- package/dist/native/data-display/Alert.js +21 -6
- package/dist/native/data-display/Alert.js.map +1 -1
- package/dist/native/data-display/Avatar.js +3 -3
- package/dist/native/data-display/Badge.js +3 -3
- package/dist/native/data-display/Chip.js +3 -3
- package/dist/native/data-display/EmptyState.js +5 -5
- package/dist/native/data-display/ErrorState.js +4 -4
- package/dist/native/data-display/FleetMap.js +6 -6
- package/dist/native/data-display/LoadingState.js +2 -2
- package/dist/native/data-display/Progress.js +2 -2
- package/dist/native/feedback/Dialog.js +3 -3
- package/dist/native/form/Button.js +3 -3
- package/dist/native/form/Checkbox.js +3 -3
- package/dist/native/form/Input.js +3 -3
- package/dist/native/form/Select.js +4 -4
- package/dist/native/form/Switch.js +26 -8
- package/dist/native/form/Switch.js.map +1 -1
- package/dist/native/icons.js +3 -3
- package/dist/native/layout/Box.js +3 -3
- package/dist/native/layout/Card.js +2 -2
- package/dist/native/layout/Container.js +2 -2
- package/dist/native/layout/Skeleton.js +3 -3
- package/dist/native/layout/Spacer.js +2 -2
- package/dist/native/layout/Stack.js +3 -3
- package/dist/native/provider.js +2 -2
- package/dist/native/tokens.js +3 -1
- package/dist/native/typography/Heading.js +2 -2
- package/dist/native/typography/Paragraph.js +2 -2
- package/dist/native/typography/Text.js +2 -2
- package/dist/navigation/AppHeader.js +7 -7
- package/dist/provider.js +4 -4
- package/dist/social-login-button.js +9 -9
- package/dist/tokens.js +3 -1
- package/dist/types/components/data-display/Alert/Alert.base.d.ts +28 -2
- package/dist/types/components/data-display/Alert/Alert.base.d.ts.map +1 -1
- package/dist/types/components/data-display/Alert/Alert.helpers.d.ts +39 -0
- package/dist/types/components/data-display/Alert/Alert.helpers.d.ts.map +1 -1
- package/dist/types/components/form/Button/Button.styles.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.ids.d.ts +42 -0
- package/dist/types/components/form/Switch/Switch.ids.d.ts.map +1 -0
- package/dist/types/components/form/Switch/Switch.metrics.d.ts +19 -0
- package/dist/types/components/form/Switch/Switch.metrics.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.parts.d.ts +31 -11
- package/dist/types/components/form/Switch/Switch.parts.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.styles.d.ts +6 -0
- package/dist/types/components/form/Switch/Switch.styles.d.ts.map +1 -1
- package/dist/types/tokens/theme.d.ts +38 -0
- package/dist/types/tokens/theme.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Alert/Alert.base.d.ts +28 -2
- package/dist/types-native/components/data-display/Alert/Alert.base.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Alert/Alert.helpers.d.ts +39 -0
- package/dist/types-native/components/data-display/Alert/Alert.helpers.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Alert/Alert.native.d.ts.map +1 -1
- package/dist/types-native/components/form/Switch/Switch.look.native.d.ts +26 -2
- package/dist/types-native/components/form/Switch/Switch.look.native.d.ts.map +1 -1
- package/dist/types-native/components/form/Switch/Switch.metrics.d.ts +19 -0
- package/dist/types-native/components/form/Switch/Switch.metrics.d.ts.map +1 -1
- package/dist/types-native/components/form/Switch/Switch.native.d.ts.map +1 -1
- package/dist/types-native/tokens/theme.d.ts +38 -0
- package/dist/types-native/tokens/theme.d.ts.map +1 -1
- package/dist/typography/Heading.js +4 -4
- package/dist/typography/Paragraph.js +2 -2
- package/dist/typography/Text.js +3 -3
- package/dist/user-avatar.js +8 -8
- package/package.json +1 -1
- package/src/components/data-display/Alert/Alert.base.ts +29 -2
- package/src/components/data-display/Alert/Alert.helpers.ts +50 -0
- package/src/components/data-display/Alert/Alert.md +29 -1
- package/src/components/data-display/Alert/Alert.native.tsx +8 -4
- package/src/components/data-display/Alert/Alert.tsx +5 -5
- package/src/components/form/Button/Button.md +8 -0
- package/src/components/form/Button/Button.styles.ts +24 -3
- package/src/components/form/Switch/Switch.ids.ts +63 -0
- package/src/components/form/Switch/Switch.look.native.ts +45 -2
- package/src/components/form/Switch/Switch.md +34 -9
- package/src/components/form/Switch/Switch.metrics.ts +21 -0
- package/src/components/form/Switch/Switch.native.tsx +19 -6
- package/src/components/form/Switch/Switch.parts.tsx +150 -17
- package/src/components/form/Switch/Switch.styles.ts +59 -6
- package/src/components/form/Switch/Switch.tsx +32 -30
- package/src/tokens/theme.ts +50 -0
- package/dist/chunk-2ECT4IY2.js.map +0 -1
- package/dist/chunk-BB2OUERT.js.map +0 -1
- package/dist/chunk-FR67FG2U.js.map +0 -1
- package/dist/chunk-N3QUEBNS.js.map +0 -1
- package/dist/chunk-N5IVVLTH.js.map +0 -1
- package/dist/chunk-NQN5Z36J.js.map +0 -1
- package/dist/chunk-WNMYWQ7D.js.map +0 -1
- /package/dist/{chunk-2GI7ANEL.js.map → chunk-22X7TT6Z.js.map} +0 -0
- /package/dist/{chunk-WR5JFDQ5.js.map → chunk-27BL3DNT.js.map} +0 -0
- /package/dist/{chunk-E55CJV65.js.map → chunk-2KVQIGVE.js.map} +0 -0
- /package/dist/{chunk-W3FAKT3D.js.map → chunk-2SWQ6HIK.js.map} +0 -0
- /package/dist/{chunk-ISW5K72V.js.map → chunk-2ZRZTGWP.js.map} +0 -0
- /package/dist/{chunk-I5SBTNV2.js.map → chunk-3GB6KWHH.js.map} +0 -0
- /package/dist/{chunk-ZEG2LNBY.js.map → chunk-3PJLT5FX.js.map} +0 -0
- /package/dist/{chunk-57Z2ND3N.js.map → chunk-3VZT2FAI.js.map} +0 -0
- /package/dist/{chunk-PFDM2OIP.js.map → chunk-45OHGD2B.js.map} +0 -0
- /package/dist/{chunk-BH5BXLGI.js.map → chunk-4A2Q22HO.js.map} +0 -0
- /package/dist/{chunk-46UPILLK.js.map → chunk-4ETQRBZC.js.map} +0 -0
- /package/dist/{chunk-WM6Y2S6W.js.map → chunk-5QUSX3TC.js.map} +0 -0
- /package/dist/{chunk-AVGTTWTE.js.map → chunk-65DLYC4S.js.map} +0 -0
- /package/dist/{chunk-TVPPA4RD.js.map → chunk-65METCKT.js.map} +0 -0
- /package/dist/{chunk-OQFSYMHJ.js.map → chunk-67ALTEWH.js.map} +0 -0
- /package/dist/{chunk-OGGHD64H.js.map → chunk-6SK3MTYJ.js.map} +0 -0
- /package/dist/{chunk-OE2ZVL67.js.map → chunk-6VHCSPKK.js.map} +0 -0
- /package/dist/{chunk-WAPJ2DL3.js.map → chunk-72T5PAW7.js.map} +0 -0
- /package/dist/{chunk-SLVQ33AN.js.map → chunk-77DF5LKI.js.map} +0 -0
- /package/dist/{chunk-7KWBGMQC.js.map → chunk-77OXG6DH.js.map} +0 -0
- /package/dist/{chunk-Y3KRUT7O.js.map → chunk-7AIHK2XM.js.map} +0 -0
- /package/dist/{chunk-MHV5Y5MR.js.map → chunk-7KEGJH3Q.js.map} +0 -0
- /package/dist/{chunk-KMXAPYU2.js.map → chunk-7NEUPEV5.js.map} +0 -0
- /package/dist/{chunk-67L7HMEP.js.map → chunk-7Z2AQEC5.js.map} +0 -0
- /package/dist/{chunk-PQECNGDE.js.map → chunk-AGYGNNOM.js.map} +0 -0
- /package/dist/{chunk-ZTF5C2GA.js.map → chunk-B5SW7I5W.js.map} +0 -0
- /package/dist/{chunk-TXHJX2NG.js.map → chunk-BGYLL467.js.map} +0 -0
- /package/dist/{chunk-R7R3LOKW.js.map → chunk-CA7TA36R.js.map} +0 -0
- /package/dist/{chunk-FPFUXRD2.js.map → chunk-CKJI7JO5.js.map} +0 -0
- /package/dist/{chunk-HMV4QMXS.js.map → chunk-CMN26J5Y.js.map} +0 -0
- /package/dist/{chunk-KVEHH4SA.js.map → chunk-DB2MAYPK.js.map} +0 -0
- /package/dist/{chunk-V4FKHLEB.js.map → chunk-DTIB5KWP.js.map} +0 -0
- /package/dist/{chunk-MESRKY67.js.map → chunk-DW6GBMLQ.js.map} +0 -0
- /package/dist/{chunk-JO6BBSGY.js.map → chunk-DWJBOR47.js.map} +0 -0
- /package/dist/{chunk-YW5T6KZ5.js.map → chunk-DYESJJ3Q.js.map} +0 -0
- /package/dist/{chunk-TZDDL3DR.js.map → chunk-ECMJ5VPW.js.map} +0 -0
- /package/dist/{chunk-OH3YGJT5.js.map → chunk-EMNGIYH6.js.map} +0 -0
- /package/dist/{chunk-CZJLWCEG.js.map → chunk-EPNCYUQ7.js.map} +0 -0
- /package/dist/{chunk-JZXWCEH5.js.map → chunk-EQA4VQEO.js.map} +0 -0
- /package/dist/{chunk-3N6EK6K5.js.map → chunk-ERX4XIYC.js.map} +0 -0
- /package/dist/{chunk-TTLI6PF7.js.map → chunk-FF3R67WD.js.map} +0 -0
- /package/dist/{chunk-KLREH4X6.js.map → chunk-G2JPUHEJ.js.map} +0 -0
- /package/dist/{chunk-4J5EN4FQ.js.map → chunk-GBX5ACPF.js.map} +0 -0
- /package/dist/{chunk-ZZMZF7PZ.js.map → chunk-GQJ4NCZ6.js.map} +0 -0
- /package/dist/{chunk-IPVYEPXO.js.map → chunk-GSTRPZS4.js.map} +0 -0
- /package/dist/{chunk-HFXTAEYY.js.map → chunk-GTLJYAEG.js.map} +0 -0
- /package/dist/{chunk-M4LFDGI6.js.map → chunk-GYQT47YZ.js.map} +0 -0
- /package/dist/{chunk-JSH3HFDQ.js.map → chunk-H3BQFEN5.js.map} +0 -0
- /package/dist/{chunk-OV4WREMW.js.map → chunk-HKB5C2KY.js.map} +0 -0
- /package/dist/{chunk-BLBOYCOV.js.map → chunk-HKV4MQ2W.js.map} +0 -0
- /package/dist/{chunk-4MGFUPQT.js.map → chunk-HOJL2GKW.js.map} +0 -0
- /package/dist/{chunk-HR7YTBR7.js.map → chunk-IASDP44E.js.map} +0 -0
- /package/dist/{chunk-YMRI5QKG.js.map → chunk-IV5QQLCS.js.map} +0 -0
- /package/dist/{chunk-JUHUKZGU.js.map → chunk-JD3D6Y4U.js.map} +0 -0
- /package/dist/{chunk-AXTLFK4T.js.map → chunk-KAV63FBG.js.map} +0 -0
- /package/dist/{chunk-2PBGVMM2.js.map → chunk-KOFO6QZY.js.map} +0 -0
- /package/dist/{chunk-RP5FK3SO.js.map → chunk-L7LCSZ3H.js.map} +0 -0
- /package/dist/{chunk-MNXVXW4T.js.map → chunk-L7S6N67X.js.map} +0 -0
- /package/dist/{chunk-JXPHU3K5.js.map → chunk-LGJ2H4AH.js.map} +0 -0
- /package/dist/{chunk-W4YWU7LQ.js.map → chunk-LO2B7FDQ.js.map} +0 -0
- /package/dist/{chunk-PWR7K5OP.js.map → chunk-LV4UTYAD.js.map} +0 -0
- /package/dist/{chunk-OG2FP6SE.js.map → chunk-M4NFXC5R.js.map} +0 -0
- /package/dist/{chunk-ZPIMPOHV.js.map → chunk-M7E66OSC.js.map} +0 -0
- /package/dist/{chunk-OGGPQVIG.js.map → chunk-MDTSMJ7C.js.map} +0 -0
- /package/dist/{chunk-YDI6IJ6F.js.map → chunk-MI2MVH3I.js.map} +0 -0
- /package/dist/{chunk-6ZY5XU4J.js.map → chunk-MQPT254A.js.map} +0 -0
- /package/dist/{chunk-EWT3WMVY.js.map → chunk-MYH7VISV.js.map} +0 -0
- /package/dist/{chunk-7NSX7A5H.js.map → chunk-N5PY7IXI.js.map} +0 -0
- /package/dist/{chunk-BHIGHSXA.js.map → chunk-NNXZ5RK5.js.map} +0 -0
- /package/dist/{chunk-EQ7PWGBN.js.map → chunk-O7HLQTB7.js.map} +0 -0
- /package/dist/{chunk-DW5FRWRQ.js.map → chunk-OAWEUKUC.js.map} +0 -0
- /package/dist/{chunk-O4VCZTK4.js.map → chunk-OGHW7RQC.js.map} +0 -0
- /package/dist/{chunk-XR6WBW23.js.map → chunk-OVGASVPW.js.map} +0 -0
- /package/dist/{chunk-HEBQS7QP.js.map → chunk-OXYR2HVK.js.map} +0 -0
- /package/dist/{chunk-TNVO2DTB.js.map → chunk-P7FQUGED.js.map} +0 -0
- /package/dist/{chunk-343TTIHD.js.map → chunk-PENJBKPH.js.map} +0 -0
- /package/dist/{chunk-2RQINU5T.js.map → chunk-PKFFJAQ6.js.map} +0 -0
- /package/dist/{chunk-M4LQRQFL.js.map → chunk-PW2WLDX3.js.map} +0 -0
- /package/dist/{chunk-WRDPWEIC.js.map → chunk-Q3GSDSK2.js.map} +0 -0
- /package/dist/{chunk-SYJMI2NP.js.map → chunk-Q3OFOOO7.js.map} +0 -0
- /package/dist/{chunk-GGI7GM5O.js.map → chunk-QE2C35TO.js.map} +0 -0
- /package/dist/{chunk-CT5K725B.js.map → chunk-QQLGSMGE.js.map} +0 -0
- /package/dist/{chunk-7MN6I5NK.js.map → chunk-QXFPTRHB.js.map} +0 -0
- /package/dist/{chunk-CZPU5TW3.js.map → chunk-RFZU5BTG.js.map} +0 -0
- /package/dist/{chunk-JB67KPGM.js.map → chunk-RRO2EOJB.js.map} +0 -0
- /package/dist/{chunk-MZQTHSLN.js.map → chunk-S7HRED4D.js.map} +0 -0
- /package/dist/{chunk-NYEA7JAI.js.map → chunk-SC72DRTX.js.map} +0 -0
- /package/dist/{chunk-JWW2Z3RH.js.map → chunk-SMZBGHR2.js.map} +0 -0
- /package/dist/{chunk-EZSEAYYT.js.map → chunk-SSWZHR46.js.map} +0 -0
- /package/dist/{chunk-NA7MIEG6.js.map → chunk-SZETT7QV.js.map} +0 -0
- /package/dist/{chunk-2HPP6RVC.js.map → chunk-TQOPF7LD.js.map} +0 -0
- /package/dist/{chunk-OLVZ6TOV.js.map → chunk-TUO47RL2.js.map} +0 -0
- /package/dist/{chunk-4IVDVZZ2.js.map → chunk-UGL6SJN6.js.map} +0 -0
- /package/dist/{chunk-QJRDDVZ2.js.map → chunk-V5P5Q6HM.js.map} +0 -0
- /package/dist/{chunk-73NJCGQG.js.map → chunk-VIK3HAUQ.js.map} +0 -0
- /package/dist/{chunk-KM5O4ICK.js.map → chunk-VK4ULJFH.js.map} +0 -0
- /package/dist/{chunk-QYNCPS5W.js.map → chunk-WBKWIFXA.js.map} +0 -0
- /package/dist/{chunk-X4Z62ZQY.js.map → chunk-WETAIIKC.js.map} +0 -0
- /package/dist/{chunk-GMTM6EN7.js.map → chunk-WKF54CCK.js.map} +0 -0
- /package/dist/{chunk-KT6HWAEN.js.map → chunk-WZUNBSS7.js.map} +0 -0
- /package/dist/{chunk-Y2B3I3IH.js.map → chunk-X5RDHO6G.js.map} +0 -0
- /package/dist/{chunk-TXKZEKJN.js.map → chunk-XNOSTV5F.js.map} +0 -0
- /package/dist/{chunk-7JXLGOM2.js.map → chunk-Y55ILY2F.js.map} +0 -0
- /package/dist/{chunk-HI2OFZSZ.js.map → chunk-YPILHGEO.js.map} +0 -0
- /package/dist/{chunk-V3PLFYKO.js.map → chunk-ZAJO2B75.js.map} +0 -0
- /package/dist/native/chunks/{chunk-2R2R35C5.js.map → chunk-2SBTJSQE.js.map} +0 -0
- /package/dist/native/chunks/{chunk-WL5LXVCK.js.map → chunk-6L4UZBQP.js.map} +0 -0
- /package/dist/native/chunks/{chunk-GW7TQ7HO.js.map → chunk-QEQZ5AF6.js.map} +0 -0
- /package/dist/native/chunks/{chunk-7LTVGW23.js.map → chunk-UII3IFLP.js.map} +0 -0
- /package/dist/native/chunks/{chunk-75JQYVDZ.js.map → chunk-UYREIOEM.js.map} +0 -0
- /package/dist/native/chunks/{chunk-GWGIWQO7.js.map → chunk-XI7HTAVN.js.map} +0 -0
- /package/dist/native/chunks/{chunk-QYUD3S6F.js.map → chunk-ZOP7UAZK.js.map} +0 -0
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
SWITCH_RIPPLE,
|
|
27
27
|
SWITCH_SPINNER,
|
|
28
28
|
SWITCH_TRANSITION,
|
|
29
|
+
RESTING_THUMB,
|
|
29
30
|
THUMB_ELEVATION,
|
|
30
31
|
THUMB_RADIUS,
|
|
31
32
|
TRACK_LABEL,
|
|
@@ -41,7 +42,7 @@ import {
|
|
|
41
42
|
} from './Switch.metrics';
|
|
42
43
|
import type { SwitchVariant } from './Switch.base';
|
|
43
44
|
|
|
44
|
-
import { px } from '../../../tokens/theme';
|
|
45
|
+
import { inkOver, px } from '../../../tokens/theme';
|
|
45
46
|
import type { ColorValue, SizeValue } from '../../../tokens/vocabulary';
|
|
46
47
|
|
|
47
48
|
// Every number below comes from `./Switch.metrics`, which the native renderer
|
|
@@ -125,6 +126,32 @@ const rippleOverlay = (palette: ColorPalette): CSSObject => ({
|
|
|
125
126
|
pointerEvents: 'none',
|
|
126
127
|
});
|
|
127
128
|
|
|
129
|
+
/**
|
|
130
|
+
* The ink on the CHECKED track — the thumb, the `on` wording and any on-icon
|
|
131
|
+
* (FUT-1924).
|
|
132
|
+
*
|
|
133
|
+
* All three stated `#fff`, and the checked track is `palette.main`: the one
|
|
134
|
+
* surface in this component the TENANT picks. A store with a pale brand got a
|
|
135
|
+
* white thumb on a pale green bar, which does not read as a knob at all — the
|
|
136
|
+
* switch looks OFF while it is on, so this is a state a user misreads rather
|
|
137
|
+
* than a colour they dislike.
|
|
138
|
+
*
|
|
139
|
+
* The `gradient` flag paints the track `light → main → dark`, so the fills the
|
|
140
|
+
* thumb travels over are handed over together and {@link inkOver} takes the
|
|
141
|
+
* worst of them.
|
|
142
|
+
*
|
|
143
|
+
* The RESTING track is not here on purpose: it is `theme.palette.action.disabled`
|
|
144
|
+
* washed over the page, which no tenant chooses, and a white thumb on it is the
|
|
145
|
+
* conventional look in both modes.
|
|
146
|
+
*/
|
|
147
|
+
const checkedInk = (flags: SwitchFlags, palette: ColorPalette): string => {
|
|
148
|
+
const fills = flags.gradient
|
|
149
|
+
? [palette.light || palette.main, palette.main, palette.dark || palette.main]
|
|
150
|
+
: [palette.main];
|
|
151
|
+
|
|
152
|
+
return inkOver(fills, palette.contrastText || NEUTRAL_CONTRAST);
|
|
153
|
+
};
|
|
154
|
+
|
|
128
155
|
/** The checked track: the filled bar behind the thumb once the switch is on. */
|
|
129
156
|
const checkedTrack = (flags: SwitchFlags, palette: ColorPalette): CSSObject => ({
|
|
130
157
|
backgroundColor: palette.main,
|
|
@@ -170,9 +197,12 @@ const switchBaseSx = (
|
|
|
170
197
|
// The thumb travels the track minus its own width and both paddings; the
|
|
171
198
|
// iOS look insets differently, so it gets its own distance.
|
|
172
199
|
transform: `translateX(${width - thumbSize - padding * 2}px)`,
|
|
173
|
-
color:
|
|
200
|
+
color: checkedInk(flags, palette),
|
|
174
201
|
'& .MuiSwitch-thumb': {
|
|
175
202
|
animation: flags.loading ? 'none' : `${bounceAnimation} ${seconds(SWITCH_TRANSITION.ms)} ease-out`,
|
|
203
|
+
// `glass` draws its own translucent thumb and means to show the track
|
|
204
|
+
// through it, so it keeps the fill it chose.
|
|
205
|
+
...(flags.glass ? {} : { backgroundColor: checkedInk(flags, palette) }),
|
|
176
206
|
},
|
|
177
207
|
'& + .MuiSwitch-track': checkedTrack(flags, palette),
|
|
178
208
|
'&.Mui-disabled + .MuiSwitch-track': { opacity: DISABLED.checkedTrackOpacity },
|
|
@@ -197,7 +227,9 @@ const thumbSx = (
|
|
|
197
227
|
width: thumbSize,
|
|
198
228
|
height: thumbSize,
|
|
199
229
|
borderRadius: THUMB_RADIUS[look](thumbSize),
|
|
200
|
-
|
|
230
|
+
// `.Mui-checked` above replaces this for the brand-filled track; see
|
|
231
|
+
// {@link RESTING_THUMB} for why the resting one stays white.
|
|
232
|
+
backgroundColor: RESTING_THUMB,
|
|
201
233
|
boxShadow: thumbShadow(theme, look),
|
|
202
234
|
transition: `all ${seconds(SWITCH_TRANSITION.ms)} ${SWITCH_TRANSITION.easing}`,
|
|
203
235
|
position: 'relative',
|
|
@@ -239,7 +271,13 @@ const thumbSx = (
|
|
|
239
271
|
});
|
|
240
272
|
|
|
241
273
|
/** The on/off wording the `label` variant prints inside the track. */
|
|
242
|
-
const trackLabels = (
|
|
274
|
+
const trackLabels = (
|
|
275
|
+
theme: Theme,
|
|
276
|
+
flags: SwitchFlags,
|
|
277
|
+
palette: ColorPalette,
|
|
278
|
+
onText?: string,
|
|
279
|
+
offText?: string,
|
|
280
|
+
): CSSObject => ({
|
|
243
281
|
display: 'flex',
|
|
244
282
|
alignItems: 'center',
|
|
245
283
|
justifyContent: 'space-between',
|
|
@@ -258,7 +296,13 @@ const trackLabels = (theme: Theme, onText?: string, offText?: string): CSSObject
|
|
|
258
296
|
zIndex: 1,
|
|
259
297
|
},
|
|
260
298
|
...(onText && {
|
|
261
|
-
'&::before': {
|
|
299
|
+
'&::before': {
|
|
300
|
+
content: `"${onText}"`,
|
|
301
|
+
left: theme.spacing(TRACK_LABEL.insetUnits),
|
|
302
|
+
// The `on` word sits at the end the thumb travels TO, which is the
|
|
303
|
+
// filled half of the track once checked.
|
|
304
|
+
color: checkedInk(flags, palette),
|
|
305
|
+
},
|
|
262
306
|
}),
|
|
263
307
|
...(offText && {
|
|
264
308
|
'&::after': {
|
|
@@ -297,10 +341,19 @@ const trackSx = (
|
|
|
297
341
|
!glass && {
|
|
298
342
|
background: `linear-gradient(${SWITCH_GRADIENT.resting.angleDeg}deg, ${alpha(palette.light || palette.main, SWITCH_GRADIENT.resting.lightAlpha)}, ${alpha(palette.main, SWITCH_GRADIENT.resting.mainAlpha)})`,
|
|
299
343
|
}),
|
|
300
|
-
...(showsTrackLabels(customVariant, onText, offText) &&
|
|
344
|
+
...(showsTrackLabels(customVariant, onText, offText) &&
|
|
345
|
+
trackLabels(theme, flags, palette, onText, offText)),
|
|
301
346
|
};
|
|
302
347
|
};
|
|
303
348
|
|
|
349
|
+
/**
|
|
350
|
+
* The same checked-track ink, for the two ICONS the control overlays on the
|
|
351
|
+
* track — which are drawn as components rather than styles, so they cannot
|
|
352
|
+
* reach {@link checkedInk} directly.
|
|
353
|
+
*/
|
|
354
|
+
export const onTrackInk = (theme: Theme, flags: SwitchFlags): string =>
|
|
355
|
+
checkedInk(flags, getColorFromTheme(theme, flags.customColor ?? 'primary'));
|
|
356
|
+
|
|
304
357
|
export const switchSx = (theme: Theme, flags: SwitchFlags): CSSObject => {
|
|
305
358
|
const palette = getColorFromTheme(theme, flags.customColor ?? 'primary');
|
|
306
359
|
const geometry = geometryOf(flags.customSize, flags.trackWidth, flags.trackHeight);
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import Box from '@mui/material/Box/index.js';
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useId } from 'react';
|
|
3
3
|
|
|
4
4
|
import { splitTestId } from '../../../platform/test-id';
|
|
5
5
|
import { withDefaults } from '../../../utils/withDefaults';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
SwitchControl,
|
|
10
|
-
SwitchHelper,
|
|
11
|
-
SwitchLabel,
|
|
12
|
-
} from './Switch.parts';
|
|
7
|
+
import { switchIds } from './Switch.ids';
|
|
8
|
+
import { SwitchControl, SwitchHelper, SwitchRow } from './Switch.parts';
|
|
13
9
|
import type { SwitchProps } from './Switch.types';
|
|
14
10
|
|
|
15
11
|
const DEFAULTS = {
|
|
@@ -34,12 +30,24 @@ export const Switch = forwardRef<HTMLButtonElement, SwitchProps>((props, ref) =>
|
|
|
34
30
|
variant, color, size, label, description, glow, glass, gradient, labelPosition,
|
|
35
31
|
onIcon, offIcon, onText, offText, error, helperText, trackWidth, trackHeight,
|
|
36
32
|
checked, onChange, animated, loading, ripple, pulse,
|
|
33
|
+
id, inputProps,
|
|
37
34
|
...others
|
|
38
35
|
} = withDefaults(props, DEFAULTS) as ResolvedProps;
|
|
39
36
|
|
|
40
37
|
const { testId: dataTestId, rest } = splitTestId(others);
|
|
41
38
|
const containerTestId = dataTestId ? `${dataTestId}-container` : 'switch-container';
|
|
42
39
|
|
|
40
|
+
// The input needs an id for the label to point at, and the caller usually has
|
|
41
|
+
// no reason to invent one — see {@link switchIds} for the precedence.
|
|
42
|
+
const { inputId, descriptionId, helperId, describedBy } = switchIds({
|
|
43
|
+
generated: useId(),
|
|
44
|
+
id,
|
|
45
|
+
inputProps,
|
|
46
|
+
description,
|
|
47
|
+
helperText,
|
|
48
|
+
callerDescribedBy: rest['aria-describedby'],
|
|
49
|
+
});
|
|
50
|
+
|
|
43
51
|
const control = (
|
|
44
52
|
<SwitchControl
|
|
45
53
|
customVariant={variant}
|
|
@@ -63,36 +71,30 @@ export const Switch = forwardRef<HTMLButtonElement, SwitchProps>((props, ref) =>
|
|
|
63
71
|
size={size}
|
|
64
72
|
dataTestId={dataTestId}
|
|
65
73
|
switchRef={ref}
|
|
74
|
+
inputId={inputId}
|
|
75
|
+
inputProps={inputProps}
|
|
76
|
+
describedBy={describedBy}
|
|
66
77
|
rest={rest}
|
|
67
78
|
/>
|
|
68
79
|
);
|
|
69
80
|
|
|
70
|
-
const helper =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Box data-testid={containerTestId}>
|
|
75
|
-
{control}
|
|
76
|
-
{helper}
|
|
77
|
-
</Box>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
81
|
+
const helper = (
|
|
82
|
+
<SwitchHelper helperText={helperText} error={error} dataTestId={dataTestId} id={helperId} />
|
|
83
|
+
);
|
|
80
84
|
|
|
81
85
|
return (
|
|
82
86
|
<Box data-testid={containerTestId}>
|
|
83
|
-
<
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</LabelContainer>
|
|
95
|
-
|
|
87
|
+
<SwitchRow
|
|
88
|
+
label={label}
|
|
89
|
+
description={description}
|
|
90
|
+
labelPosition={labelPosition}
|
|
91
|
+
error={error}
|
|
92
|
+
dataTestId={dataTestId}
|
|
93
|
+
htmlFor={inputId}
|
|
94
|
+
descriptionId={descriptionId}
|
|
95
|
+
disabled={Boolean(rest.disabled) || loading}
|
|
96
|
+
control={control}
|
|
97
|
+
/>
|
|
96
98
|
{helper}
|
|
97
99
|
</Box>
|
|
98
100
|
);
|
package/src/tokens/theme.ts
CHANGED
|
@@ -218,6 +218,56 @@ export function contrastText(background: string): string {
|
|
|
218
218
|
: DARK_TEXT_PRIMARY;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
/**
|
|
222
|
+
* The ink that reads on EVERY one of these fills (FUT-1924).
|
|
223
|
+
*
|
|
224
|
+
* {@link contrastText} answers for one fill, which is all MUI's `augmentColor`
|
|
225
|
+
* ever needs: a solid button is a single flat colour. Two components paint the
|
|
226
|
+
* label over something that is not one colour — `Button`'s `gradient` variant
|
|
227
|
+
* runs between two stops, and `Switch`'s thumb travels the whole length of a
|
|
228
|
+
* checked track — and both of them stated `#fff` outright instead, which is
|
|
229
|
+
* white-on-pale the moment a white-labelled host hands the library a pale
|
|
230
|
+
* brand. Audited across the library, those two were the only places a hardcoded
|
|
231
|
+
* white sat over a surface the TENANT chooses.
|
|
232
|
+
*
|
|
233
|
+
* **This deliberately does not follow `contrastText`'s rule.** MUI's is a
|
|
234
|
+
* threshold that PREFERS white — white wherever white clears 3:1 — which is a
|
|
235
|
+
* brand-feel decision, and it is kept for every existing caller so nothing
|
|
236
|
+
* already legible moves. Here the fills can disagree: over MUI's own success
|
|
237
|
+
* pair white is 2.78:1 on `#4caf50` and dark ink 2.66:1 on `#1b5e20`, so
|
|
238
|
+
* neither meets any threshold and asking whether one does is the wrong
|
|
239
|
+
* question. The answer is whichever ink has the better WORST case across the
|
|
240
|
+
* fills — which is also not what either fill says on its own, since
|
|
241
|
+
* `contrastText('#4caf50')` is dark ink.
|
|
242
|
+
*
|
|
243
|
+
* A gradient wide enough that neither ink clears 4.5:1 anywhere is a palette
|
|
244
|
+
* problem this cannot fix — it returns the less bad ink and does not pretend
|
|
245
|
+
* otherwise.
|
|
246
|
+
*
|
|
247
|
+
* `Math.min` is the claim, and it is worth knowing that no test can prove it
|
|
248
|
+
* against `Math.max` today: the two candidate inks sit at opposite ends of the
|
|
249
|
+
* luminance range, so ranking them by their best fill and by their worst gives
|
|
250
|
+
* the same winner for every possible pair (checked exhaustively). Worst case is
|
|
251
|
+
* still what this MEANS, and the moment a third ink or one that is not an
|
|
252
|
+
* extreme is offered, the two stop agreeing.
|
|
253
|
+
*
|
|
254
|
+
* `fallback` is returned when a fill cannot be decomposed: {@link getContrastRatio}
|
|
255
|
+
* throws on a format it does not know, and a throw inside an emotion style
|
|
256
|
+
* function takes the render down with it.
|
|
257
|
+
*/
|
|
258
|
+
export function inkOver(fills: readonly string[], fallback: string): string {
|
|
259
|
+
try {
|
|
260
|
+
const worstCase = (ink: string): number =>
|
|
261
|
+
Math.min(...fills.map((fill) => getContrastRatio(ink, fill)));
|
|
262
|
+
|
|
263
|
+
return worstCase(LIGHT_TEXT_PRIMARY) >= worstCase(DARK_TEXT_PRIMARY)
|
|
264
|
+
? LIGHT_TEXT_PRIMARY
|
|
265
|
+
: DARK_TEXT_PRIMARY;
|
|
266
|
+
} catch {
|
|
267
|
+
return fallback;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
221
271
|
/**
|
|
222
272
|
* MUI's `augmentColor` for a custom colour: derive whatever shade the seed
|
|
223
273
|
* left out. `light` is one tonal offset up, `dark` one and a half down.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/form/Switch/Switch.styles.ts"],"sourcesContent":["import { alpha } from '@mui/material/styles/index.js';\nimport type { CSSObject, Theme } from '@mui/material/styles/index.js';\n\nimport {\n bounceAnimation,\n glowAnimation,\n pulseAnimation,\n rippleAnimation,\n shimmerAnimation,\n spinAnimation,\n} from './Switch.animations';\nimport {\n DISABLED,\n IOS_BASE_OFFSET,\n IOS_THUMB_SHADOW,\n IOS_TRAVEL_INSET,\n SWITCH_GLASS,\n SWITCH_GLOW,\n NEUTRAL_CONTRAST,\n NEUTRAL_FALLBACK,\n NEUTRAL_GREY,\n SWITCH_FOCUS_RING,\n SWITCH_GRADIENT,\n SWITCH_HOVER,\n SWITCH_PULSE,\n SWITCH_RIPPLE,\n SWITCH_SPINNER,\n SWITCH_TRANSITION,\n THUMB_ELEVATION,\n THUMB_RADIUS,\n TRACK_LABEL,\n TRACK_RADIUS,\n geometryOf,\n iosTrackShadow,\n lookOf,\n seconds,\n showsTrackLabels,\n trackColor,\n type SwitchGeometry,\n type SwitchLook,\n} from './Switch.metrics';\nimport type { SwitchVariant } from './Switch.base';\n\nimport { px } from '../../../tokens/theme';\nimport type { ColorValue, SizeValue } from '../../../tokens/vocabulary';\n\n// Every number below comes from `./Switch.metrics`, which the native renderer\n// reads too — see its header. The palette and the shadows stay on the MUI\n// theme so a host that re-themes either keeps moving the web.\ninterface ColorPalette {\n main: string;\n dark?: string;\n light?: string;\n contrastText?: string;\n}\n\n/** `neutral` is not a MUI palette entry, so it is built from the grey ramp. */\nconst neutralPalette = (theme: Theme): ColorPalette => ({\n main: theme.palette.grey?.[NEUTRAL_GREY.main] || NEUTRAL_FALLBACK.main,\n dark: theme.palette.grey?.[NEUTRAL_GREY.dark] || NEUTRAL_FALLBACK.dark,\n light: theme.palette.grey?.[NEUTRAL_GREY.light] || NEUTRAL_FALLBACK.light,\n contrastText: NEUTRAL_CONTRAST,\n});\n\n/**\n * Resolves a colour name to a full palette, filling any step the theme leaves\n * out from `main` and then from the primary palette. `danger` is this\n * component's name for the error palette; the rest map straight through.\n */\nconst getColorFromTheme = (theme: Theme, color: string): ColorPalette => {\n if (color === 'neutral') {\n return neutralPalette(theme);\n }\n\n const colorMap: Record<string, ColorPalette | undefined> = {\n primary: theme.palette.primary,\n secondary: theme.palette.secondary,\n success: theme.palette.success,\n warning: theme.palette.warning,\n info: theme.palette.info,\n danger: theme.palette.error,\n };\n const palette = colorMap[color] ?? theme.palette.primary;\n const { primary } = theme.palette;\n\n return {\n main: palette.main || primary.main,\n dark: palette.dark || palette.main || primary.dark,\n light: palette.light || palette.main || primary.light,\n contrastText: palette.contrastText || NEUTRAL_CONTRAST,\n };\n};\n\nexport interface SwitchFlags {\n customVariant?: SwitchVariant;\n customColor?: ColorValue;\n customSize?: SizeValue;\n glow?: boolean;\n glass?: boolean;\n gradient?: boolean;\n trackWidth?: number;\n trackHeight?: number;\n onText?: string;\n offText?: string;\n loading?: boolean;\n ripple?: boolean;\n pulse?: boolean;\n}\n\nconst thumbShadow = (theme: Theme, look: SwitchLook): string =>\n look === 'ios' ? IOS_THUMB_SHADOW : (theme.shadows[THUMB_ELEVATION[look]] ?? 'none');\n\n/** The ripple that expands from the thumb on hover. */\nconst rippleOverlay = (palette: ColorPalette): CSSObject => ({\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n left: '50%',\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n background: alpha(palette.main, SWITCH_RIPPLE.alpha),\n animation: `${rippleAnimation} ${seconds(SWITCH_RIPPLE.ms)} ease-out`,\n transform: 'translate(-50%, -50%)',\n pointerEvents: 'none',\n});\n\n/** The checked track: the filled bar behind the thumb once the switch is on. */\nconst checkedTrack = (flags: SwitchFlags, palette: ColorPalette): CSSObject => ({\n backgroundColor: palette.main,\n opacity: 1,\n border: 0,\n position: 'relative',\n overflow: 'hidden',\n ...(flags.glow && {\n animation: `${glowAnimation} ${seconds(SWITCH_GLOW.ms)} ease-in-out infinite`,\n boxShadow: `0 0 ${SWITCH_GLOW.blur}px ${alpha(palette.main, SWITCH_GLOW.alpha)}, inset 0 0 ${SWITCH_GLOW.insetBlur}px ${alpha(palette.main, SWITCH_GLOW.insetAlpha)}`,\n }),\n ...(flags.gradient && {\n background: `linear-gradient(${SWITCH_GRADIENT.checked.angleDeg}deg, ${palette.light || palette.main} ${SWITCH_GRADIENT.checked.stops[0]}%, ${palette.main} ${SWITCH_GRADIENT.checked.stops[1]}%, ${palette.dark || palette.main} ${SWITCH_GRADIENT.checked.stops[2]}%)`,\n backgroundSize: '200% 100%',\n animation: `${shimmerAnimation} ${seconds(SWITCH_GRADIENT.shimmerMs)} ease infinite`,\n }),\n});\n\nconst switchBaseSx = (\n theme: Theme,\n flags: SwitchFlags,\n palette: ColorPalette,\n geometry: SwitchGeometry,\n look: SwitchLook,\n): CSSObject => {\n const { width, thumbSize, padding } = geometry;\n const isIos = look === 'ios';\n\n return {\n padding,\n margin: 0,\n transitionDuration: `${SWITCH_TRANSITION.ms}ms`,\n transitionTimingFunction: SWITCH_TRANSITION.easing,\n ...(isIos && { transform: `translateX(${IOS_BASE_OFFSET}px)` }),\n '&:hover': {\n '& .MuiSwitch-thumb': {\n transform: flags.loading ? 'none' : `scale(${SWITCH_HOVER.thumbScale})`,\n boxShadow: `${theme.shadows[SWITCH_HOVER.elevation]}, 0 0 ${SWITCH_HOVER.blur}px ${alpha(palette.main, SWITCH_HOVER.alpha)}`,\n },\n ...(flags.ripple && { '&::after': rippleOverlay(palette) }),\n },\n '&.Mui-checked': {\n // The thumb travels the track minus its own width and both paddings; the\n // iOS look insets differently, so it gets its own distance.\n transform: `translateX(${width - thumbSize - padding * 2}px)`,\n color: '#fff',\n '& .MuiSwitch-thumb': {\n animation: flags.loading ? 'none' : `${bounceAnimation} ${seconds(SWITCH_TRANSITION.ms)} ease-out`,\n },\n '& + .MuiSwitch-track': checkedTrack(flags, palette),\n '&.Mui-disabled + .MuiSwitch-track': { opacity: DISABLED.checkedTrackOpacity },\n ...(isIos && { transform: `translateX(${width - thumbSize - IOS_TRAVEL_INSET}px)` }),\n },\n '&.Mui-focusVisible .MuiSwitch-thumb': {\n color: palette.main,\n border: `${SWITCH_FOCUS_RING.width}px solid ${alpha(palette.main, SWITCH_FOCUS_RING.alpha)}`,\n },\n '&.Mui-disabled .MuiSwitch-thumb': { color: theme.palette.grey[DISABLED.thumbGrey] },\n '&.Mui-disabled + .MuiSwitch-track': { opacity: DISABLED.trackOpacity },\n };\n};\n\nconst thumbSx = (\n theme: Theme,\n flags: SwitchFlags,\n palette: ColorPalette,\n thumbSize: number,\n look: SwitchLook,\n): CSSObject => ({\n width: thumbSize,\n height: thumbSize,\n borderRadius: THUMB_RADIUS[look](thumbSize),\n backgroundColor: '#fff',\n boxShadow: thumbShadow(theme, look),\n transition: `all ${seconds(SWITCH_TRANSITION.ms)} ${SWITCH_TRANSITION.easing}`,\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n ...(flags.glass && {\n backgroundColor: alpha(theme.palette.background.paper, SWITCH_GLASS.thumbAlpha),\n backdropFilter: `blur(${SWITCH_GLASS.thumbBlur}px)`,\n border: `1px solid ${alpha(theme.palette.divider, SWITCH_GLASS.borderAlpha)}`,\n }),\n ...(flags.pulse && { animation: `${pulseAnimation} ${seconds(SWITCH_PULSE.ms)} ease-in-out infinite` }),\n ...(flags.loading && {\n // A spinner drawn inside the thumb rather than over the whole control.\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n width: thumbSize * SWITCH_SPINNER.sizeRatio,\n height: thumbSize * SWITCH_SPINNER.sizeRatio,\n border: `${SWITCH_SPINNER.borderWidth}px solid ${palette.main}`,\n borderTop: `${SWITCH_SPINNER.borderWidth}px solid transparent`,\n borderRadius: '50%',\n animation: `${spinAnimation} ${seconds(SWITCH_SPINNER.ms)} linear infinite`,\n },\n }),\n ...(look === 'material' && {\n '&::before': {\n content: '\"\"',\n position: 'absolute',\n width: '100%',\n height: '100%',\n borderRadius: 'inherit',\n backgroundColor: palette.main,\n opacity: 0,\n transform: 'scale(0)',\n transition: 'all 0.3s ease',\n },\n }),\n});\n\n/** The on/off wording the `label` variant prints inside the track. */\nconst trackLabels = (theme: Theme, onText?: string, offText?: string): CSSObject => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingLeft: theme.spacing(TRACK_LABEL.insetUnits),\n paddingRight: theme.spacing(TRACK_LABEL.insetUnits),\n fontSize: px(TRACK_LABEL.fontSize),\n fontWeight: TRACK_LABEL.fontWeight,\n color: theme.palette.text.secondary,\n '&::before, &::after': {\n content: '\"\"',\n position: 'absolute',\n fontSize: px(TRACK_LABEL.fontSize),\n fontWeight: TRACK_LABEL.fontWeight,\n top: '50%',\n transform: 'translateY(-50%)',\n zIndex: 1,\n },\n ...(onText && {\n '&::before': { content: `\"${onText}\"`, left: theme.spacing(TRACK_LABEL.insetUnits), color: '#fff' },\n }),\n ...(offText && {\n '&::after': {\n content: `\"${offText}\"`,\n right: theme.spacing(TRACK_LABEL.insetUnits),\n color: theme.palette.text.secondary,\n },\n }),\n});\n\nconst trackSx = (\n theme: Theme,\n flags: SwitchFlags,\n palette: ColorPalette,\n height: number,\n look: SwitchLook,\n): CSSObject => {\n const { glass, gradient, onText, offText, customVariant } = flags;\n\n return {\n borderRadius: TRACK_RADIUS[look](height),\n backgroundColor: trackColor(\n { black: theme.palette.common.black, disabled: theme.palette.action.disabled },\n look,\n ),\n opacity: 1,\n transition: `all ${seconds(SWITCH_TRANSITION.ms)} ${SWITCH_TRANSITION.easing}`,\n position: 'relative',\n boxShadow: look === 'ios' ? iosTrackShadow() : 'none',\n ...(glass && {\n backgroundColor: alpha(theme.palette.background.paper, SWITCH_GLASS.trackAlpha),\n backdropFilter: `blur(${SWITCH_GLASS.trackBlur}px)`,\n border: `1px solid ${alpha(theme.palette.divider, SWITCH_GLASS.borderAlpha)}`,\n }),\n ...(gradient &&\n !glass && {\n background: `linear-gradient(${SWITCH_GRADIENT.resting.angleDeg}deg, ${alpha(palette.light || palette.main, SWITCH_GRADIENT.resting.lightAlpha)}, ${alpha(palette.main, SWITCH_GRADIENT.resting.mainAlpha)})`,\n }),\n ...(showsTrackLabels(customVariant, onText, offText) && trackLabels(theme, onText, offText)),\n };\n};\n\nexport const switchSx = (theme: Theme, flags: SwitchFlags): CSSObject => {\n const palette = getColorFromTheme(theme, flags.customColor ?? 'primary');\n const geometry = geometryOf(flags.customSize, flags.trackWidth, flags.trackHeight);\n const look = lookOf(flags.customVariant);\n\n return {\n width: geometry.width,\n height: geometry.height,\n padding: 0,\n overflow: 'visible',\n '& .MuiSwitch-switchBase': switchBaseSx(theme, flags, palette, geometry, look),\n '& .MuiSwitch-thumb': thumbSx(theme, flags, palette, geometry.thumbSize, look),\n '& .MuiSwitch-track': trackSx(theme, flags, palette, geometry.height, look),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AAyDtB,IAAM,iBAAiB,CAAC,WAAgC;AAAA,EACtD,MAAM,MAAM,QAAQ,OAAO,aAAa,IAAI,KAAK,iBAAiB;AAAA,EAClE,MAAM,MAAM,QAAQ,OAAO,aAAa,IAAI,KAAK,iBAAiB;AAAA,EAClE,OAAO,MAAM,QAAQ,OAAO,aAAa,KAAK,KAAK,iBAAiB;AAAA,EACpE,cAAc;AAChB;AAOA,IAAM,o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ACL,OAAO,SAAS;AAAA,IAChB,QAAQ,SAAS;AAAA,IACjB,SAAS;AAAA,IACT,UAAU;AAAA,IACV,2BAA2B,aAAa,OAAO,OAAO,SAAS,UAAU,IAAI;AAAA,IAC7E,sBAAsB,QAAQ,OAAO,OAAO,SAAS,SAAS,WAAW,IAAI;AAAA,IAC7E,sBAAsB,QAAQ,OAAO,OAAO,SAAS,SAAS,QAAQ,IAAI;AAAA,EAC5E;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/form/Button/Button.styles.ts"],"sourcesContent":["import { alpha, darken, keyframes, lighten } from '@mui/material/styles/index.js';\nimport type { CSSObject, Theme } from '@mui/material/styles/index.js';\n\nimport { BUTTON_SIZES, ICON_ONLY_PADDING as ICON_ONLY_PADDING_PX } from './Button.metrics';\nimport { px } from '../../../tokens/theme';\n\n// Define pulse animation globally\nconst pulseAnimation = keyframes`\n 0% {\n box-shadow: 0 0 0 0 currentColor;\n opacity: 1;\n }\n 70% {\n box-shadow: 0 0 0 15px currentColor;\n opacity: 0;\n }\n 100% {\n box-shadow: 0 0 0 0 currentColor;\n opacity: 0;\n }\n`;\n\ninterface ColorPalette {\n main: string;\n dark: string;\n light: string;\n contrastText: string;\n}\n\nconst shade = (\n palette: ColorPalette | undefined,\n key: 'dark' | 'light',\n fallback: ColorPalette,\n): string => palette?.[key] || palette?.main || fallback[key];\n\n/** `neutral` has no MUI palette entry, so its four shades come from grey. */\nconst neutralPalette = (theme: Theme): ColorPalette => ({\n main: theme.palette.grey?.[700] || '#616161',\n dark: theme.palette.grey?.[800] || '#424242',\n light: theme.palette.grey?.[500] || '#9e9e9e',\n contrastText: '#fff',\n});\n\nexport const getColorFromTheme = (theme: Theme, color: string): ColorPalette => {\n if (color === 'neutral') return neutralPalette(theme);\n\n const colorMap: Record<string, ColorPalette> = {\n primary: theme.palette.primary as ColorPalette,\n secondary: theme.palette.secondary as ColorPalette,\n success: theme.palette.success as ColorPalette,\n warning: theme.palette.warning as ColorPalette,\n info: theme.palette.info as ColorPalette,\n danger: theme.palette.error as ColorPalette,\n };\n\n const fallback = theme.palette.primary as ColorPalette;\n const palette = colorMap[color] || fallback;\n\n // Ensure palette has required properties\n return {\n main: palette?.main || fallback.main,\n dark: shade(palette, 'dark', fallback),\n light: shade(palette, 'light', fallback),\n contrastText: palette?.contrastText || '#fff',\n };\n};\n\n// Derived from `Button.metrics.ts`, which the native `Button` reads too — one\n// table, so a size cannot differ between the renderers.\nconst SIZE_MAP: Record<string, CSSObject> = Object.fromEntries(\n Object.entries(BUTTON_SIZES).map(([size, m]) => [\n size,\n { padding: `${m.paddingVertical}px ${m.paddingHorizontal}px`, fontSize: px(m.fontSize) },\n ]),\n);\n\n/** What an unrecognised size falls back to, named so indexing can never be undefined. */\nconst DEFAULT_SIZE: CSSObject = SIZE_MAP.md as CSSObject;\n\n/**\n * A BUTTON THAT IS ONLY AN ICON IS SQUARE.\n *\n * MUI puts a 64px `min-width` on every button, which is right for a label and\n * wrong for a glyph: three dots in a 64px slab reads as a button that failed to\n * load its text, and at the end of a dense row it claims space the row needs.\n * The horizontal padding goes too — a square of padding round a square glyph —\n * and so does the gap MUI reserves beside a start/end icon, since there is\n * nothing on the other side of it.\n *\n * Derived, not declared: a button with an `icon` and no children can only be an\n * icon button, so no consumer has to opt in and none can forget to.\n */\nconst ICON_ONLY_PADDING: Record<string, string> = Object.fromEntries(\n Object.entries(ICON_ONLY_PADDING_PX).map(([size, padding]) => [size, `${padding}px`]),\n);\n\nconst iconOnlySize = (size: string): CSSObject => ({\n minWidth: 0,\n padding: ICON_ONLY_PADDING[size] ?? ICON_ONLY_PADDING.md,\n fontSize: SIZE_MAP[size]?.fontSize ?? DEFAULT_SIZE.fontSize,\n '& .MuiButton-startIcon, & .MuiButton-endIcon': { margin: 0 },\n});\n\n/** The size styles for a button, square when it carries nothing but an icon. */\nexport const buttonSize = (size: string, iconOnly: boolean): CSSObject =>\n iconOnly ? iconOnlySize(size) : (SIZE_MAP[size] ?? DEFAULT_SIZE);\n\n/**\n * MUI centres icons with a negative margin that fights our own padding, so the\n * flex alignment is restated here rather than fought with `!important`.\n */\nexport const iconAlignmentStyles = (theme: Theme): CSSObject => ({\n '& .MuiButton-startIcon, & .MuiButton-endIcon': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: 0,\n verticalAlign: 'middle',\n '& > *': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n lineHeight: 0,\n },\n },\n '& .MuiButton-startIcon': {\n marginRight: theme.spacing(0.5),\n },\n '& .MuiButton-endIcon': {\n marginLeft: theme.spacing(0.5),\n },\n});\n\n// Gradients run between two related hues; the named colours pick a specific pair,\n// anything else runs from its own main to its own dark.\nconst GRADIENT_PAIRS: Record<string, (theme: Theme) => [string, string]> = {\n primary: (theme) => [theme.palette.primary.main, theme.palette.secondary.main],\n secondary: (theme) => [theme.palette.secondary.main, theme.palette.primary.main],\n success: (theme) => [theme.palette.success.light, theme.palette.success.dark],\n warning: (theme) => [theme.palette.warning.light, theme.palette.warning.dark],\n danger: (theme) => [theme.palette.error.light, theme.palette.error.dark],\n};\n\nconst gradientFor = (theme: Theme, color: string, palette: ColorPalette): string => {\n const [from, to] = GRADIENT_PAIRS[color]?.(theme) ?? [palette.main, palette.dark];\n return `linear-gradient(135deg, ${from} 0%, ${to} 100%)`;\n};\n\n/**\n * The label colour for the two variants that paint no background of their own.\n *\n * `ghost` and `text` used `palette.main` directly, which is the same mistake\n * the Alert made with its body text: a palette's `main` is chosen to sit UNDER\n * white — it is the fill of a solid button — and it is not chosen to be read AS\n * text. `#6366F1`, the default primary, is 3.6:1 on white and worse on any\n * tinted surface, so a \"Cancelar\" or an \"Agora não\" placed on a coloured panel\n * turned into a smudge. That is precisely where these two variants belong: they\n * exist to be the quiet option NEXT to a solid one, so they are the buttons\n * most likely to be sitting on something other than plain paper.\n *\n * One step darker (lighter, on a dark theme) keeps the hue the caller asked for\n * and buys the contrast back. `main` still drives the hover wash and every\n * bordered variant, so nothing that was already legible moves.\n */\nconst quietInk = (theme: Theme, palette: ColorPalette): string =>\n theme.palette.mode === 'dark' ? lighten(palette.main, 0.35) : darken(palette.main, 0.3);\n\nconst VARIANT_STYLES: Record<\n string,\n (theme: Theme, palette: ColorPalette, color: string) => CSSObject\n> = {\n solid: (theme, palette) => ({\n backgroundColor: palette.main,\n color: palette.contrastText || '#fff',\n '&:hover': {\n backgroundColor: palette.dark,\n transform: 'translateY(-2px)',\n boxShadow: theme.shadows[8],\n },\n }),\n outline: (_theme, palette) => ({\n backgroundColor: 'transparent',\n color: palette.main,\n border: `1px solid ${palette.main}`,\n '&:hover': {\n backgroundColor: alpha(palette.main, 0.1),\n borderColor: palette.dark,\n },\n }),\n ghost: (theme, palette) => ({\n backgroundColor: 'transparent',\n color: quietInk(theme, palette),\n '&:hover': {\n backgroundColor: alpha(palette.main, 0.1),\n },\n }),\n text: (theme, palette) => ({\n backgroundColor: 'transparent',\n color: quietInk(theme, palette),\n border: `none`,\n '&:hover': {\n backgroundColor: alpha(palette.main, 0.1),\n },\n '&.active': {\n backgroundColor: alpha(palette.main, 0.1),\n color: quietInk(theme, palette),\n },\n }),\n glass: (theme, palette) => ({\n backgroundColor: alpha(theme.palette.background.paper, 0.1),\n backdropFilter: 'blur(20px)',\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n color: palette.main,\n '&:hover': {\n backgroundColor: alpha(theme.palette.background.paper, 0.2),\n transform: 'translateY(-2px)',\n },\n }),\n gradient: (theme, palette, color) => ({\n background: gradientFor(theme, color, palette),\n color: '#fff',\n '&:hover': {\n filter: 'brightness(1.1)',\n transform: 'translateY(-2px)',\n boxShadow: theme.shadows[12],\n },\n }),\n};\n\nexport const buttonVariantStyles = (\n theme: Theme,\n variant: string | undefined,\n palette: ColorPalette,\n color: string,\n): CSSObject => VARIANT_STYLES[variant ?? '']?.(theme, palette, color) ?? {};\n\n// Glow effect - applied with !important to override variant shadows\nconst glowStyles = (palette: ColorPalette): CSSObject => ({\n boxShadow: `0 0 20px 5px ${alpha(palette.main, 0.6)}, 0 0 40px 10px ${alpha(palette.main, 0.3)} !important`,\n filter: 'brightness(1.05)',\n '&:hover': {\n boxShadow: `0 0 25px 8px ${alpha(palette.main, 0.7)}, 0 0 50px 15px ${alpha(palette.main, 0.4)} !important`,\n filter: 'brightness(1.1)',\n transform: 'translateY(-2px) scale(1.02)',\n },\n});\n\n// Pulse animation using pseudo-element\nconst pulseStyles = (palette: ColorPalette): CSSObject => ({\n position: 'relative',\n overflow: 'visible',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n left: '50%',\n width: '100%',\n height: '100%',\n borderRadius: 'inherit',\n transform: 'translate(-50%, -50%)',\n backgroundColor: palette.main,\n opacity: 0.3,\n animation: `${pulseAnimation} 2s infinite`,\n pointerEvents: 'none',\n zIndex: -1,\n },\n});\n\n/**\n * glow and pulse are independent flags. The three combinations used to be spelled\n * out one by one, but each is just the union of whichever flags are set.\n */\nexport const buttonEmphasisStyles = (\n palette: ColorPalette,\n glow?: boolean,\n pulse?: boolean,\n): CSSObject => ({\n ...(glow ? glowStyles(palette) : {}),\n ...(pulse ? pulseStyles(palette) : {}),\n});\n"],"mappings":";;;;;;;;;AAAA,SAAS,OAAO,QAAQ,WAAW,eAAe;AAOlD,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBvB,IAAM,QAAQ,CACZ,SACA,KACA,aACW,UAAU,GAAG,KAAK,SAAS,QAAQ,SAAS,GAAG;AAG5D,IAAM,iBAAiB,CAAC,WAAgC;AAAA,EACtD,MAAM,MAAM,QAAQ,OAAO,GAAG,KAAK;AAAA,EACnC,MAAM,MAAM,QAAQ,OAAO,GAAG,KAAK;AAAA,EACnC,OAAO,MAAM,QAAQ,OAAO,GAAG,KAAK;AAAA,EACpC,cAAc;AAChB;AAEO,IAAM,oBA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,CAAC,OAAO,SAAS,WAAW;AAAA,IACpC,YAAY,YAAY,OAAO,OAAO,OAAO;AAAA,IAC7C,OAAO;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,WAAW,MAAM,QAAQ,EAAE;AAAA,IAC7B;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,CACjC,OACA,SACA,SACA,UACc,eAAe,WAAW,EAAE,IAAI,OAAO,SAAS,KAAK,KAAK,CAAC;AAG3E,IAAM,aAAa,CAAC,aAAsC;AAAA,EACxD,WAAW,gBAAgB,MAAM,QAAQ,MAAM,GAAG,CAAC,mBAAmB,MAAM,QAAQ,MAAM,GAAG,CAAC;AAAA,EAC9F,QAAQ;AAAA,EACR,WAAW;AAAA,IACT,WAAW,gBAAgB,MAAM,QAAQ,MAAM,GAAG,CAAC,mBAAmB,MAAM,QAAQ,MAAM,GAAG,CAAC;AAAA,IAC9F,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AACF;AAGA,IAAM,cAAc,CAAC,aAAsC;AAAA,EACzD,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,IACV,SAAS;AAAA,IACT,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,WAAW;AAAA,IACX,iBAAiB,QAAQ;AAAA,IACzB,SAAS;AAAA,IACT,WAAW,GAAG,cAAc;AAAA,IAC5B,eAAe;AAAA,IACf,QAAQ;AAAA,EACV;AACF;AAMO,IAAM,uBAAuB,CAClC,SACA,MACA,WACe;AAAA,EACf,GAAI,OAAO,WAAW,OAAO,IAAI,CAAC;AAAA,EAClC,GAAI,QAAQ,YAAY,OAAO,IAAI,CAAC;AACtC;","names":["ICON_ONLY_PADDING"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/form/Switch/Switch.tsx"],"sourcesContent":["import Box from '@mui/material/Box/index.js';\nimport React, { forwardRef } from 'react';\n\nimport { splitTestId } from '../../../platform/test-id';\nimport { withDefaults } from '../../../utils/withDefaults';\n\nimport {\n LabelContainer,\n SwitchControl,\n SwitchHelper,\n SwitchLabel,\n} from './Switch.parts';\nimport type { SwitchProps } from './Switch.types';\n\nconst DEFAULTS = {\n variant: 'default',\n color: 'primary',\n size: 'md',\n glow: false,\n glass: false,\n gradient: false,\n labelPosition: 'end',\n error: false,\n animated: true,\n loading: false,\n ripple: false,\n pulse: false,\n} satisfies Partial<SwitchProps>;\n\ntype ResolvedProps = SwitchProps & Required<Pick<SwitchProps, keyof typeof DEFAULTS>>;\n\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>((props, ref) => {\n const {\n variant, color, size, label, description, glow, glass, gradient, labelPosition,\n onIcon, offIcon, onText, offText, error, helperText, trackWidth, trackHeight,\n checked, onChange, animated, loading, ripple, pulse,\n ...others\n } = withDefaults(props, DEFAULTS) as ResolvedProps;\n\n const { testId: dataTestId, rest } = splitTestId(others);\n const containerTestId = dataTestId ? `${dataTestId}-container` : 'switch-container';\n\n const control = (\n <SwitchControl\n customVariant={variant}\n customColor={color}\n customSize={size}\n glow={glow}\n glass={glass}\n gradient={gradient}\n trackWidth={trackWidth}\n trackHeight={trackHeight}\n onText={onText}\n offText={offText}\n loading={loading}\n ripple={ripple}\n pulse={pulse}\n checked={checked}\n onChange={onChange}\n onIcon={onIcon}\n offIcon={offIcon}\n animated={animated}\n size={size}\n dataTestId={dataTestId}\n switchRef={ref}\n rest={rest}\n />\n );\n\n const helper = <SwitchHelper helperText={helperText} error={error} dataTestId={dataTestId} />;\n\n if (!label) {\n return (\n <Box data-testid={containerTestId}>\n {control}\n {helper}\n </Box>\n );\n }\n\n return (\n <Box data-testid={containerTestId}>\n <LabelContainer labelPosition={labelPosition} error={error}>\n {labelPosition === 'start' && control}\n\n <SwitchLabel\n label={label}\n description={description}\n error={error}\n dataTestId={dataTestId}\n />\n\n {labelPosition !== 'start' && control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AAc,YAAwB;AAE3F,MAAI,CAAC,OAAO;AACV,WACE,qBAAC,OAAI,eAAa,iBACf;AAAA;AAAA,MACA;AAAA,OACH;AAAA,EAEJ;AAEA,SACE,qBAAC,OAAI,eAAa,iBAChB;AAAA,yBAAC,kBAAe,eAA8B,OAC3C;AAAA,wBAAkB,WAAW;AAAA,MAE9B;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEC,kBAAkB,WAAW;AAAA,OAChC;AAAA,IAEC;AAAA,KACH;AAEJ,CAAC;AAED,OAAO,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/Alert/Alert.helpers.ts"],"sourcesContent":["import type { AlertBaseFields, AlertVariant } from './Alert.base';\nimport type { IconName } from '../../../icons/Icon.types';\n\ntype AlertDefaultedKeys = 'variant' | 'glow' | 'pulse' | 'showIcon' | 'animate' | 'role' | 'aria-atomic';\n\nexport const ALERT_DEFAULTS: Required<Pick<AlertBaseFields, AlertDefaultedKeys>> & { closable: false } = {\n variant: 'info',\n glow: false,\n pulse: false,\n showIcon: true,\n closable: false,\n animate: true,\n role: 'alert',\n 'aria-atomic': 'true',\n};\n\n/**\n * Generic over the renderer's own props: the web and the native `Alert` pass\n * different extras through, and both come back out untouched.\n */\nexport type ResolvedAlertProps<P extends AlertBaseFields> = P &\n Required<Pick<AlertBaseFields, AlertDefaultedKeys>>;\n\n// Strips explicitly-undefined props before the merge so `prop={undefined}` still\n// falls back to the default, the way a destructuring default would.\nconst definedProps = <P extends AlertBaseFields>(props: P): Partial<P> =>\n Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Partial<P>;\n\n// Through `unknown`: `closable: false` in the defaults belongs to the dismiss\n// union rather than to `AlertBaseFields`, so TypeScript cannot see the merge as\n// comparable to `P` although every field of `P` survives it untouched.\nexport const resolveAlertProps = <P extends AlertBaseFields>(props: P): ResolvedAlertProps<P> =>\n ({ ...ALERT_DEFAULTS, ...definedProps(props) }) as unknown as ResolvedAlertProps<P>;\n\n/** `danger` announces itself; everything else waits its turn. */\nexport const defaultAriaLive = (variant: AlertVariant): 'polite' | 'assertive' =>\n variant === 'danger' ? 'assertive' : 'polite';\n\nexport const testIdFor = (base: string | undefined, suffix: string): string =>\n base ? `${base}-${suffix}` : `alert-${suffix}`;\n\n/**\n * The glyph each semantic variant carries, by the shared icon set's name.\n * `glass` and `gradient` carry none of their own: the web renders an empty\n * icon slot for them unless the caller passes an `icon`, and so does native.\n */\nexport const VARIANT_ICON: Partial<Record<AlertVariant, IconName>> = {\n info: 'Info',\n success: 'CheckCircle',\n warning: 'Warning',\n danger: 'Error',\n};\n"],"mappings":";AAKO,IAAM,iBAA4F;AAAA,EACvG,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,eAAe;AACjB;AAWA,IAAM,eAAe,CAA4B,UAC/C,OAAO;AAAA,EACL,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AACjE;AAKK,IAAM,oBAAoB,CAA4B,WAC1D,EAAE,GAAG,gBAAgB,GAAG,aAAa,KAAK,EAAE;AAGxC,IAAM,kBAAkB,CAAC,YAC9B,YAAY,WAAW,cAAc;AAEhC,IAAM,YAAY,CAAC,MAA0B,WAClD,OAAO,GAAG,IAAI,IAAI,MAAM,KAAK,SAAS,MAAM;AAOvC,IAAM,eAAwD;AAAA,EACnE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/form/Switch/Switch.parts.tsx"],"sourcesContent":["import Box from '@mui/material/Box/index.js';\nimport FormHelperText from '@mui/material/FormHelperText/index.js';\nimport MuiSwitch from '@mui/material/Switch/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { styled } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { LABEL_GAP_UNITS, SWITCH_ICON_SIZES } from './Switch.metrics';\nimport { switchSx } from './Switch.styles';\nimport type { SwitchFlags } from './Switch.styles';\nimport type { SwitchProps } from './Switch.types';\nimport type { SizeValue } from '../../../tokens/vocabulary';\n\nconst StyledSwitch = styled(MuiSwitch, {\n shouldForwardProp: (prop) =>\n ![\n 'customVariant',\n 'customColor',\n 'customSize',\n 'glow',\n 'glass',\n 'gradient',\n 'trackWidth',\n 'trackHeight',\n 'onText',\n 'offText',\n 'loading',\n 'ripple',\n 'pulse',\n ].includes(prop as string),\n})<SwitchFlags>(({ theme, ...flags }) => ({ ...switchSx(theme, flags) }));\n\n/**\n * A top or bottom label stacks and aligns to the start; start/end sit the label\n * beside the control and centre it.\n */\nconst StyledLabelContainer = styled(Box, {\n shouldForwardProp: (prop) => !['labelPosition', 'error'].includes(prop as string),\n})<{ labelPosition?: string; error?: boolean }>(({ theme, labelPosition, error }) => {\n const stacked = labelPosition === 'top' || labelPosition === 'bottom';\n\n return {\n display: 'flex',\n alignItems: stacked ? 'flex-start' : 'center',\n flexDirection:\n labelPosition === 'top' ? 'column' : labelPosition === 'bottom' ? 'column-reverse' : 'row',\n gap: theme.spacing(stacked ? LABEL_GAP_UNITS.stacked : LABEL_GAP_UNITS.beside),\n width: '100%',\n ...(error && { '& .MuiTypography-root': { color: theme.palette.error.main } }),\n };\n});\n\n/**\n * A plain wrapper over the styled row. Exporting the styled component itself\n * needs a @mui/system reference tsc calls unportable (TS2742).\n */\nexport const LabelContainer: React.FC<{\n labelPosition?: string;\n error?: boolean;\n children: React.ReactNode;\n}> = ({ labelPosition, error, children }) => (\n <StyledLabelContainer labelPosition={labelPosition} error={error}>\n {children}\n </StyledLabelContainer>\n);\n\nexport interface SwitchIconProps {\n icon: React.ReactNode;\n /** True when this icon is the one the current state should show. */\n shown: boolean;\n animated: boolean;\n size: string;\n side: 'on' | 'off';\n}\n\n/**\n * One of the two icons overlaid on the track. The on icon slides to the left\n * edge when checked and the off icon to the right when unchecked; they are\n * mirror images, so they share this component rather than being written twice.\n */\nexport const SwitchIcon: React.FC<SwitchIconProps> = ({ icon, shown, animated, size, side }) => {\n const isOn = side === 'on';\n const translate = isOn ? 'translate(-50%, -50%)' : 'translate(50%, -50%)';\n\n return (\n <Box\n sx={{\n position: 'absolute',\n top: '50%',\n ...(isOn ? { left: shown ? 4 : '50%' } : { right: shown ? 4 : '50%' }),\n transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',\n opacity: shown ? 1 : 0,\n transform: `${translate} scale(${shown && animated ? 1 : 0.8})`,\n pointerEvents: 'none',\n zIndex: 2,\n color: isOn ? '#fff' : 'text.secondary',\n fontSize: SWITCH_ICON_SIZES[size as SizeValue] ?? SWITCH_ICON_SIZES.md,\n }}\n >\n {icon}\n </Box>\n );\n};\n\nexport interface SwitchControlProps extends SwitchFlags {\n checked?: boolean;\n onChange?: SwitchProps['onChange'];\n onIcon?: React.ReactNode;\n offIcon?: React.ReactNode;\n animated: boolean;\n size: string;\n dataTestId?: string;\n switchRef?: React.Ref<HTMLButtonElement>;\n rest: Record<string, unknown>;\n}\n\n/** The control itself: the track, and the two icons that may sit over it. */\nexport const SwitchControl: React.FC<SwitchControlProps> = ({\n checked,\n onChange,\n onIcon,\n offIcon,\n animated,\n size,\n dataTestId,\n switchRef,\n rest,\n ...flags\n}) => {\n const props = rest as Record<string, unknown> & {\n disabled?: boolean;\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n };\n\n return (\n <Box sx={{ position: 'relative', display: 'inline-flex' }}>\n <StyledSwitch\n ref={switchRef}\n {...flags}\n checked={checked}\n onChange={onChange}\n disabled={Boolean(flags.loading) || props.disabled}\n inputProps={\n {\n 'aria-label': props['aria-label'],\n 'aria-describedby': props['aria-describedby'],\n ...props.inputProps,\n 'data-testid': dataTestId || 'switch',\n } as React.InputHTMLAttributes<HTMLInputElement>\n }\n {...props}\n />\n\n {onIcon && (\n <SwitchIcon\n icon={onIcon}\n shown={Boolean(checked)}\n animated={animated}\n size={size}\n side=\"on\"\n />\n )}\n {offIcon && (\n <SwitchIcon\n icon={offIcon}\n shown={!checked}\n animated={animated}\n size={size}\n side=\"off\"\n />\n )}\n </Box>\n );\n};\n\nexport const SwitchHelper: React.FC<{\n helperText?: React.ReactNode;\n error?: boolean;\n dataTestId?: string;\n}> = ({ helperText, error, dataTestId }) =>\n helperText ? (\n <FormHelperText\n error={error}\n sx={{ mt: 1 }}\n data-testid={dataTestId ? `${dataTestId}-helper` : 'switch-helper'}\n >\n {helperText}\n </FormHelperText>\n ) : null;\n\nexport const SwitchLabel: React.FC<{\n label: React.ReactNode;\n description?: React.ReactNode;\n error?: boolean;\n dataTestId?: string;\n}> = ({ label, description, error, dataTestId }) => (\n <Box sx={{ flex: 1 }}>\n <Typography\n variant=\"body2\"\n fontWeight={500}\n color={error ? 'error.main' : 'text.primary'}\n data-testid={dataTestId ? `${dataTestId}-label` : 'switch-label'}\n >\n {label}\n </Typography>\n {description && (\n <Typography\n variant=\"caption\"\n color={error ? 'error.main' : 'text.secondary'}\n sx={{ display: 'block', mt: 0.5 }}\n >\n {description}\n </Typography>\n )}\n </Box>\n);\n"],"mappings":";;;;;;;;;AAAA,OAAO,SAAS;AAChB,OAAO,oBAAoB;AAC3B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAyDrB,cA0EE,YA1EF;AAhDF,IAAM,eAAe,OAAO,WAAW;AAAA,EACrC,mBAAmB,CAAC,SAClB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,SAAS,IAAc;AAC7B,CAAC,EAAe,CAA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,eAAe;AAAA,MAC9B,eAAa,aAAa,GAAG,UAAU,WAAW;AAAA,MAEjD;AAAA;AAAA,EACH;AAAA,EACC,eACC;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,OAAO,QAAQ,eAAe;AAAA,MAC9B,IAAI,EAAE,SAAS,SAAS,IAAI,IAAI;AAAA,MAE/B;AAAA;AAAA,EACH;AAAA,GAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tokens/theme.ts"],"sourcesContent":["import { darken, getContrastRatio, lighten } from './color';\nimport { cssLengthToPx, cssTrackingToEm } from './css-units';\nimport { HEADING_SCALE, type HeadingLevel } from './heading-scale';\n\nimport type { SizeValue } from './vocabulary';\n\n/**\n * THE THEME BOTH RENDERERS READ.\n *\n * On the web every component styles itself from MUI's `Theme`, which is built\n * by the host (`@12-apps/app-shell`'s `createAppTheme` in the origin apps) and\n * reaches a component through emotion's context. React Native has no emotion,\n * no CSS and no MUI, so a native `Button` needs the same decisions — the\n * palette, the spacing unit, the radius, the type scale — from somewhere that\n * does not import a renderer.\n *\n * This is that somewhere. `UiTheme` is a plain object of numbers and colour\n * strings. `createUiTheme` derives it the way MUI's `createPalette` derives its\n * own: a `light` shade is `lighten(main, 0.2)`, a `dark` shade `darken(main,\n * 0.3)`, `contrastText` flips at a 3:1 ratio against `rgba(0, 0, 0, 0.87)`.\n * Same seeds in, same shades out, on both sides — that is the whole basis for\n * a native button being the web button's colour and not a near miss.\n *\n * Numbers are in px on the web and dp on native; both are the CSS-pixel unit\n * a design is drawn in, so a `fontSize: 16` here IS `1rem` in a web style\n * and `16` in a `StyleSheet`. The web components keep their `rem` strings and\n * derive them from these numbers where the two meet (see `px()` below and the\n * `*.metrics.ts` file beside each ported component).\n *\n * `danger` and `neutral` are this package's names (see `./scales`); `danger`\n * is MUI's `error` and `neutral` is drawn from the grey ramp the way\n * `Button.styles.ts` has always drawn it.\n */\n\nexport type UiThemeMode = 'light' | 'dark';\n\nexport interface UiPaletteColor {\n main: string;\n light: string;\n dark: string;\n contrastText: string;\n}\n\nexport type UiGreyStep = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n\nexport interface UiPalette {\n mode: UiThemeMode;\n primary: UiPaletteColor;\n secondary: UiPaletteColor;\n success: UiPaletteColor;\n warning: UiPaletteColor;\n info: UiPaletteColor;\n danger: UiPaletteColor;\n neutral: UiPaletteColor;\n text: { primary: string; secondary: string; disabled: string };\n background: { default: string; paper: string };\n divider: string;\n action: {\n active: string;\n hover: string;\n selected: string;\n disabled: string;\n disabledBackground: string;\n focus: string;\n };\n grey: Record<UiGreyStep, string>;\n}\n\n/** One step of the body scale: `fontSize` in px, `lineHeight` as a ratio. */\nexport interface UiTypeStep {\n fontSize: number;\n lineHeight: number;\n}\n\nexport type UiFontWeight = 'light' | 'normal' | 'medium' | 'semibold' | 'bold';\n\nexport interface UiHeadingStep extends UiTypeStep {\n /** In em, so it scales with the step. `undefined` is \"normal\". */\n letterSpacing?: number;\n normalWeight: number;\n}\n\nexport interface UiTypography {\n /**\n * Native has no fallback stacks: a font is either installed and named, or\n * `undefined` and the platform's own. The web default is MUI's Roboto stack.\n */\n fontFamily: string | undefined;\n monospaceFontFamily: string | undefined;\n sizes: Record<SizeValue, UiTypeStep>;\n weights: Record<UiFontWeight, number>;\n heading: Record<HeadingLevel, UiHeadingStep>;\n}\n\nexport interface UiTheme {\n mode: UiThemeMode;\n palette: UiPalette;\n /** MUI's `theme.spacing(n)`: `n` units of {@link UiTheme.spacingUnit}, in px. */\n spacing: (units: number) => number;\n spacingUnit: number;\n /** `md` is MUI's `shape.borderRadius`; the others are its halves and doubles. */\n radius: { sm: number; md: number; lg: number; xl: number; full: number };\n typography: UiTypography;\n zIndex: { appBar: number; drawer: number; modal: number; snackbar: number; tooltip: number };\n}\n\n/** A seed for one palette slot: a hex `main`, or any subset of the four shades. */\nexport type UiPaletteSeed = string | Partial<UiPaletteColor>;\n\nexport interface UiThemeOptions {\n mode?: UiThemeMode;\n palette?: Partial<{\n primary: UiPaletteSeed;\n secondary: UiPaletteSeed;\n success: UiPaletteSeed;\n warning: UiPaletteSeed;\n info: UiPaletteSeed;\n danger: UiPaletteSeed;\n background: Partial<UiPalette['background']>;\n }>;\n typography?: Partial<Pick<UiTypography, 'fontFamily' | 'monospaceFontFamily'>>;\n spacingUnit?: number;\n}\n\nconst ROOT_FONT_PX = 16;\n\n/** The px value as the rem string the web components write. */\nexport const px = (value: number): string => `${value / ROOT_FONT_PX}rem`;\n\n/** MUI's `createPalette` defaults, exactly. */\nconst TONAL_OFFSET = 0.2;\nconst CONTRAST_THRESHOLD = 3;\nconst DARK_TEXT_PRIMARY = 'rgba(0, 0, 0, 0.87)';\nconst LIGHT_TEXT_PRIMARY = '#fff';\n\nexport const GREY: Record<UiGreyStep, string> = {\n 50: '#fafafa',\n 100: '#f5f5f5',\n 200: '#eeeeee',\n 300: '#e0e0e0',\n 400: '#bdbdbd',\n 500: '#9e9e9e',\n 600: '#757575',\n 700: '#616161',\n 800: '#424242',\n 900: '#212121',\n};\n\n/**\n * The platform's own seeds. The pair `@12-apps/ui`'s Storybook preview and\n * `@12-apps/app-shell`'s `DEFAULT_THEME_TOKENS` both carry — keep the three in\n * step if the design tokens change.\n */\nexport const DEFAULT_BRAND: Record<UiThemeMode, { primary: string; secondary: string }> = {\n light: { primary: '#6366F1', secondary: '#8B5CF6' },\n dark: { primary: '#818CF8', secondary: '#A78BFA' },\n};\n\n/** MUI's semantic defaults per mode. These are declared shades, not derived. */\nconst SEMANTIC_DEFAULTS: Record<\n UiThemeMode,\n Record<'success' | 'warning' | 'info' | 'danger', UiPaletteColor>\n> = {\n light: {\n success: { main: '#2e7d32', light: '#4caf50', dark: '#1b5e20', contrastText: '#fff' },\n warning: { main: '#ed6c02', light: '#ff9800', dark: '#e65100', contrastText: '#fff' },\n info: { main: '#0288d1', light: '#03a9f4', dark: '#01579b', contrastText: '#fff' },\n danger: { main: '#d32f2f', light: '#ef5350', dark: '#c62828', contrastText: '#fff' },\n },\n dark: {\n success: { main: '#66bb6a', light: '#81c784', dark: '#388e3c', contrastText: DARK_TEXT_PRIMARY },\n warning: { main: '#ffa726', light: '#ffb74d', dark: '#f57c00', contrastText: DARK_TEXT_PRIMARY },\n info: { main: '#29b6f6', light: '#4fc3f7', dark: '#0288d1', contrastText: DARK_TEXT_PRIMARY },\n danger: { main: '#f44336', light: '#e57373', dark: '#d32f2f', contrastText: '#fff' },\n },\n};\n\nconst MODE_DEFAULTS: Record<\n UiThemeMode,\n Pick<UiPalette, 'text' | 'background' | 'divider' | 'action'>\n> = {\n light: {\n text: { primary: DARK_TEXT_PRIMARY, secondary: 'rgba(0, 0, 0, 0.6)', disabled: 'rgba(0, 0, 0, 0.38)' },\n background: { default: '#fff', paper: '#fff' },\n divider: 'rgba(0, 0, 0, 0.12)',\n action: {\n active: 'rgba(0, 0, 0, 0.54)',\n hover: 'rgba(0, 0, 0, 0.04)',\n selected: 'rgba(0, 0, 0, 0.08)',\n disabled: 'rgba(0, 0, 0, 0.26)',\n disabledBackground: 'rgba(0, 0, 0, 0.12)',\n focus: 'rgba(0, 0, 0, 0.12)',\n },\n },\n dark: {\n text: { primary: '#fff', secondary: 'rgba(255, 255, 255, 0.7)', disabled: 'rgba(255, 255, 255, 0.5)' },\n background: { default: '#121212', paper: '#121212' },\n divider: 'rgba(255, 255, 255, 0.12)',\n action: {\n active: '#fff',\n hover: 'rgba(255, 255, 255, 0.08)',\n selected: 'rgba(255, 255, 255, 0.16)',\n disabled: 'rgba(255, 255, 255, 0.3)',\n disabledBackground: 'rgba(255, 255, 255, 0.12)',\n focus: 'rgba(255, 255, 255, 0.12)',\n },\n },\n};\n\n/**\n * MUI's `getContrastText`: white where white reads at 3:1 on the colour, the\n * light mode's dark ink otherwise. (MUI's source spells the white as the DARK\n * palette's `text.primary`, which is what made it easy to read backwards.)\n */\nexport function contrastText(background: string): string {\n return getContrastRatio(background, LIGHT_TEXT_PRIMARY) >= CONTRAST_THRESHOLD\n ? LIGHT_TEXT_PRIMARY\n : DARK_TEXT_PRIMARY;\n}\n\n/**\n * MUI's `augmentColor` for a custom colour: derive whatever shade the seed\n * left out. `light` is one tonal offset up, `dark` one and a half down.\n */\nexport function augmentColor(seed: UiPaletteSeed): UiPaletteColor {\n const partial = typeof seed === 'string' ? { main: seed } : seed;\n const main = partial.main ?? partial.light ?? partial.dark;\n if (!main) {\n throw new Error('@12-apps/ui: a palette seed needs at least a `main` colour.');\n }\n return {\n main,\n light: partial.light ?? lighten(main, TONAL_OFFSET),\n dark: partial.dark ?? darken(main, TONAL_OFFSET * 1.5),\n contrastText: partial.contrastText ?? contrastText(main),\n };\n}\n\nconst semantic = (\n mode: UiThemeMode,\n key: 'success' | 'warning' | 'info' | 'danger',\n seed: UiPaletteSeed | undefined,\n): UiPaletteColor => (seed === undefined ? SEMANTIC_DEFAULTS[mode][key] : augmentColor(seed));\n\n/** `neutral` as `accentFor` in `./scales` has always drawn it: three greys and white. */\nexport const NEUTRAL: UiPaletteColor = {\n main: GREY[600],\n light: GREY[400],\n dark: GREY[800],\n contrastText: '#fff',\n};\n\n/** The body scale `Text` renders, in px. `Text.tsx`'s rem map is this, divided by 16. */\nexport const TYPE_SIZES: Record<SizeValue, UiTypeStep> = {\n xs: { fontSize: 12, lineHeight: 1.2 },\n sm: { fontSize: 14, lineHeight: 1.3 },\n md: { fontSize: 16, lineHeight: 1.5 },\n lg: { fontSize: 18, lineHeight: 1.4 },\n xl: { fontSize: 20, lineHeight: 1.3 },\n};\n\nexport const FONT_WEIGHTS: Record<UiFontWeight, number> = {\n light: 300,\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n};\n\n// `HEADING_SCALE` speaks CSS, this theme speaks numbers; `./css-units` is the\n// one place that conversion is written.\nconst HEADING_STEPS = Object.fromEntries(\n Object.entries(HEADING_SCALE).map(([level, metrics]) => [\n level,\n {\n fontSize: cssLengthToPx(metrics.fontSize, ROOT_FONT_PX),\n lineHeight: metrics.lineHeight,\n letterSpacing: cssTrackingToEm(metrics.letterSpacing),\n normalWeight: metrics.normalWeight,\n },\n ]),\n) as Record<HeadingLevel, UiHeadingStep>;\n\nexport const WEB_FONT_FAMILY = '\"Roboto\", \"Helvetica\", \"Arial\", sans-serif';\nexport const WEB_MONOSPACE_FONT_FAMILY = 'Monaco, Menlo, \"Ubuntu Mono\", \"Courier New\", monospace';\n\n/**\n * Build the theme. Every field is derived here so a host that changes one\n * seed gets every dependent shade recomputed, on both renderers, identically.\n */\nexport function createUiTheme(options: UiThemeOptions = {}): UiTheme {\n const mode = options.mode ?? 'light';\n const seeds = options.palette ?? {};\n const brand = DEFAULT_BRAND[mode];\n const defaults = MODE_DEFAULTS[mode];\n const spacingUnit = options.spacingUnit ?? 8;\n\n const palette: UiPalette = {\n mode,\n primary: augmentColor(seeds.primary ?? brand.primary),\n secondary: augmentColor(seeds.secondary ?? brand.secondary),\n success: semantic(mode, 'success', seeds.success),\n warning: semantic(mode, 'warning', seeds.warning),\n info: semantic(mode, 'info', seeds.info),\n danger: semantic(mode, 'danger', seeds.danger),\n neutral: NEUTRAL,\n text: defaults.text,\n background: { ...defaults.background, ...seeds.background },\n divider: defaults.divider,\n action: defaults.action,\n grey: GREY,\n };\n\n return {\n mode,\n palette,\n spacing: (units: number) => units * spacingUnit,\n spacingUnit,\n radius: { sm: 2, md: 4, lg: 8, xl: 16, full: 9999 },\n typography: {\n fontFamily: options.typography?.fontFamily,\n monospaceFontFamily: options.typography?.monospaceFontFamily,\n sizes: TYPE_SIZES,\n weights: FONT_WEIGHTS,\n heading: HEADING_STEPS,\n },\n zIndex: { appBar: 1100, drawer: 1200, modal: 1300, snackbar: 1400, tooltip: 1500 },\n };\n}\n\n/** The palette slot a house colour name resolves to. */\nexport type UiPaletteKey = 'primary' | 'secondary' | 'success' | 'warning' | 'info' | 'danger' | 'neutral';\n\nexport const DEFAULT_UI_THEME: UiTheme = createUiTheme();\n"],"mappings":";;;;;;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UAAU,MAAM,MAAM;AAAA,IAC7C,SAAS;AAAA,IACT,MAAM,SAAS;AAAA,IACf,YAAY,EAAE,GAAG,SAAS,YAAY,GAAG,MAAM,WAAW;AAAA,IAC1D,SAAS,SAAS;AAAA,IAClB,QAAQ,SAAS;AAAA,IACjB,MAAM;AAAA,EACR;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,SAAS,CAAC,UAAkB,QAAQ;AAAA,IACpC;AAAA,IACA,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,MAAM,KAAK;AAAA,IAClD,YAAY;AAAA,MACV,YAAY,QAAQ,YAAY;AAAA,MAChC,qBAAqB,QAAQ,YAAY;AAAA,MACzC,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,IACA,QAAQ,EAAE,QAAQ,MAAM,QAAQ,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,KAAK;AAAA,EACnF;AACF;AAKO,IAAM,mBAA4B,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/Alert/Alert.tsx"],"sourcesContent":["import Close from '@mui/icons-material/Close';\nimport MuiAlert from '@mui/material/Alert/index.js';\nimport AlertTitle from '@mui/material/AlertTitle/index.js';\nimport Box from '@mui/material/Box/index.js';\nimport Collapse from '@mui/material/Collapse/index.js';\nimport IconButton from '@mui/material/IconButton/index.js';\nimport { alpha, styled } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { defaultAriaLive, resolveAlertProps, testIdFor } from './Alert.helpers';\nimport type { AlertPalette } from './Alert.metrics';\nimport {\n ACTIVE,\n GLOW,\n ALERT_EASING,\n ALERT_RADIUS_UNITS,\n ALERT_TRANSITION_MS,\n CLOSE_BUTTON,\n CLOSE_DELAY_MS,\n COLLAPSE_MS,\n DESCRIPTION,\n FADE_IN,\n FOCUS,\n HOVER,\n seconds,\n TITLE,\n} from './Alert.metrics';\nimport {\n alertEmphasisStyles,\n alertLayoutStyles,\n alertVariantStyles,\n fadeInScale,\n getColorFromTheme,\n getVariantIcon,\n} from './Alert.styles';\nimport type { AlertColor } from '@mui/material/Alert/index.js';\nimport type { AlertProps } from './Alert.types';\nimport { resolveTestId, withoutTestIdProps } from '../../../platform/test-id';\nimport { px } from '../../../tokens/theme';\n\nconst transition = `all ${seconds(ALERT_TRANSITION_MS)} ${ALERT_EASING}`;\n\n// Define animations\n/**\n * The pointer states' shadow: a flat tint, plus the glow when the alert has one.\n *\n * The tint is an inset spread at 100vmax, which always exceeds the element, so\n * it covers the surface edge to edge. It paints ABOVE the background and BELOW\n * the content, which is what keeps the ink's own contrast out of these states\n * entirely — see `ACTIVE` in `Alert.metrics.ts` for why a layer replaced the\n * opacity dip and the brightness multiplier that each preceded it.\n *\n * The glow is COMPOSED rather than replaced, so hovering a glowing alert keeps\n * its glow; `glowStyles` gave up its `!important` for this.\n */\nfunction pointerShadow(\n theme: Theme,\n colorPalette: AlertPalette,\n glow: boolean,\n variant: string | undefined,\n): (alpha_: number) => string {\n // The tint moves the surface AWAY from its own ink, which is why this reads\n // the variant and not only the mode.\n //\n // `gradient` is the one variant where the two disagree: it paints a\n // mid-lightness sweep (L* 42–61) under WHITE ink in BOTH modes, so the\n // mode-keyed answer tinted it white in dark mode — toward the text. Measured:\n // white-on-gradient fell to 2.90:1 on hover and 2.41:1 pressed, under the 3:1\n // floor and below its own idle. Every other variant's surface tracks the mode,\n // so for them the two rules agree.\n const ink = variant === 'gradient' || theme.palette.mode === 'light' ? '#000000' : '#ffffff';\n const glowShadow = glow\n ? `0 0 ${GLOW.blur}px ${GLOW.spread}px ${alpha(colorPalette.main, GLOW.alpha)}`\n : null;\n return (alpha_) =>\n [`inset 0 0 0 100vmax ${alpha(ink, alpha_)}`, glowShadow].filter(Boolean).join(', ');\n}\n\nconst StyledAlert = styled(MuiAlert, {\n shouldForwardProp: (prop) =>\n !['customVariant', 'customColor', 'glow', 'pulse', 'animate'].includes(prop as string),\n})<{\n customVariant?: string;\n customColor?: string;\n glow?: boolean;\n pulse?: boolean;\n animate?: boolean;\n}>(({ theme, customVariant, customColor, glow, pulse, animate }) => {\n const colorPalette = getColorFromTheme(theme, customColor || customVariant || 'info');\n\n const withTint = pointerShadow(theme, colorPalette, Boolean(glow), customVariant);\n\n return {\n borderRadius: theme.spacing(ALERT_RADIUS_UNITS),\n transition: `${transition}, box-shadow ${seconds(ACTIVE.ms)} ${ALERT_EASING}`,\n position: 'relative',\n overflow: 'hidden',\n animation: animate ? `${fadeInScale} ${seconds(FADE_IN.ms)} ease-out` : 'none',\n willChange: 'transform, opacity',\n\n ...alertLayoutStyles(theme, colorPalette, animate),\n\n // Hover: one tint step, and nothing that moves. An alert is a surface\n // rather than a control, so the pointer only needs telling it is here. The\n // icon keeps its own place for the same reason — it is the variant's\n // meaning, not an affordance to animate.\n '&:hover': {\n boxShadow: withTint(HOVER.tintAlpha),\n\n '&::before': {\n opacity: 1,\n },\n },\n\n // Press: a 20% tint, landing at once and easing back. Still no geometry.\n //\n // `transition: none` here is what makes the dip INSTANT: a click's\n // `:active` lasts about as long as the finger is down, so easing into it\n // would be cut off in its first tenth and read as a flicker. The ease is on\n // the way back, governed by the root.\n //\n // Neither `:hover` nor `:focus-visible` may declare `transition`, and that\n // is not a style preference. `:active` under a mouse ALWAYS implies\n // `:hover`, so a bare shorthand in the hover block outranks the root's\n // (0,2,0 beats 0,1,0) and silently resets the timing this state rests on.\n //\n // The `:not(:has(…))` names CONTROLS, not any descendant. `:active`\n // matches an ancestor of whatever is pressed, so dismissing an alert\n // dimmed the alert being dismissed and pressing a call to action dimmed\n // the message explaining it. Excluding `:has(:active)` wholesale does not\n // work and was the first attempt: pressing the TEXT makes that text\n // `:active` too, so the guard matched on every press and the state never\n // fired at all.\n '&:active:not(:has(button:active, a:active, [role=\"button\"]:active))': {\n boxShadow: withTint(ACTIVE.tintAlpha),\n transition: 'none',\n },\n\n // Focus: `:focus-visible`, not `:focus-within`.\n //\n // The alert carries `tabIndex={0}`, so a MOUSE CLICK focused it and painted\n // the ring — a keyboard affordance answering a pointer, which is what made\n // clicking one look like an error state. `:focus-visible` is the browser's\n // own answer to \"did this focus come from the keyboard\": the ring stays for\n // whoever tabs here and never fires on a click.\n //\n // One ring, not three. It was a 3px outline at 3px offset UNDER a 6px halo,\n // and stacking two rings on one edge is what read as unfinished rather than\n // as emphasis.\n // It declares no `transition`: `outline-style` is discrete, so the ring\n // arrives at full width with only its COLOUR easing — from `currentcolor`,\n // the near-black alert ink, to the blue. That is a visible dark flash on\n // every keyboard focus, and it would also outrank the root's opacity\n // transition the way the hover block did.\n '&:focus-visible': {\n outline: `${FOCUS.ringWidth}px solid ${alpha(colorPalette.main, FOCUS.ringAlpha)}`,\n outlineOffset: `${FOCUS.offset}px`,\n },\n\n ...alertVariantStyles(theme, customVariant, colorPalette),\n ...alertEmphasisStyles(colorPalette, Boolean(glow), Boolean(pulse)),\n };\n});\n\n// glass and gradient are our own looks with no MUI severity of their own; both\n// borrow info's. danger is MUI's error.\nconst MUI_SEVERITY: Record<string, AlertColor> = {\n danger: 'error',\n glass: 'info',\n gradient: 'info',\n};\n\nconst toMuiSeverity = (variant: string): AlertColor =>\n MUI_SEVERITY[variant] ?? (variant as AlertColor);\n\nconst AlertContent: React.FC<{\n title?: AlertProps['title'];\n description?: AlertProps['description'];\n dataTestId?: string;\n children?: React.ReactNode;\n}> = ({ title, description, dataTestId, children }) => (\n <>\n {title && (\n <AlertTitle\n data-testid={testIdFor(dataTestId, 'title')}\n sx={{\n fontWeight: TITLE.fontWeight,\n fontSize: px(TITLE.fontSize),\n marginBottom: description ? TITLE.marginBottomUnits : 0,\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n wordBreak: 'break-word',\n }}\n >\n {title}\n </AlertTitle>\n )}\n {description && (\n <Box\n component=\"div\"\n data-testid={testIdFor(dataTestId, 'message')}\n sx={{\n opacity: DESCRIPTION.opacity,\n fontSize: px(DESCRIPTION.fontSize),\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n wordBreak: 'break-word',\n }}\n >\n {description}\n </Box>\n )}\n {children}\n </>\n);\n\nconst AlertCloseButton: React.FC<{ dataTestId?: string; label: string; onClose: () => void }> = ({\n dataTestId,\n label,\n onClose,\n}) => (\n <IconButton\n data-testid={testIdFor(dataTestId, 'close')}\n aria-label={label}\n color=\"inherit\"\n size=\"small\"\n onClick={onClose}\n sx={(theme) => ({\n transition,\n opacity: CLOSE_BUTTON.opacity,\n // Opacity and a wash only: the button used to spin 90deg and grow 1.1,\n // which drew the eye to the dismiss rather than to the message.\n '&:hover': {\n opacity: 1,\n backgroundColor: alpha(theme.palette.action.hover, CLOSE_BUTTON.washAlpha),\n },\n // A REAL ring, on the keyboard-only selector.\n //\n // This used to be `&:focus` setting `outline: 'none'` over a\n // `rgba(0,0,0,0.1)` wash — 1.25:1 against the info surface, and MUI's\n // ButtonBase already sets `outline: 0`, so there was no UA fallback\n // either. It went unnoticed while the ROOT still matched `:focus-within`\n // and drew a ring around the whole alert; moving the root to\n // `:focus-visible` took that away and left this button with no visible\n // focus at all. `Banner`'s dismiss already draws its own outline, so\n // this is also what keeps the two surfaces telling a keyboard user the\n // same thing.\n '&:focus-visible': {\n opacity: 1,\n // `currentColor` is the alert's own ink, inherited through\n // `color=\"inherit\"`, so the ring is drawn in whatever colour was\n // already chosen to be READ on this surface. Measured 11.2:1 on the\n // semantic variants and 5.7:1 on `gradient`.\n //\n // That is a reasoned choice, not a test-backed one, and the difference\n // matters: `alert-contrast.test.tsx` covers the ink of the four\n // semantic variants only — its `glass` case asserts the pane's alpha\n // rather than its ink, and `gradient` it does not render at all. A\n // translucent surface's contrast depends on what sits behind it, which\n // is why that test stops where it does and why this comment does not\n // borrow a guarantee it never made.\n outline: `${FOCUS.ringWidth}px solid currentColor`,\n outlineOffset: `${FOCUS.offset}px`,\n backgroundColor: alpha(theme.palette.action.focus, CLOSE_BUTTON.washAlpha),\n },\n })}\n >\n <Close fontSize=\"inherit\" />\n </IconButton>\n);\n\n/**\n * The dismiss button, or nothing.\n *\n * Reads `closeLabel` straight off the props rather than through the\n * `definedProps` merge, which would widen it to `string | undefined` and hand\n * the button an empty name. The UNION in `AlertProps` guarantees the label\n * wherever `closable` is true — that narrowing is gone inside the component,\n * which is why the fallback below exists and why it is unreachable.\n */\nfunction dismissButton(\n props: AlertProps,\n dataTestId: string | undefined,\n onClose: () => void,\n): React.JSX.Element | null {\n if (!props.closable) return null;\n return <AlertCloseButton dataTestId={dataTestId} label={props.closeLabel} onClose={onClose} />;\n}\n\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>((alertProps, ref) => {\n const {\n variant,\n color,\n glow,\n pulse,\n icon,\n showIcon,\n onClose,\n title,\n description,\n children,\n animate,\n role,\n 'aria-atomic': ariaAtomic,\n ...others\n } = resolveAlertProps(alertProps);\n\n // Every spelling of the test id the shared contract allows, mapped to the\n // one the DOM reads and defaulted to `alert`; the native Alert does the same.\n const dataTestId = resolveTestId(others, 'alert');\n // Then the dismiss union, which `dismissButton` reads off `alertProps` rather\n // than through this destructure — so without this strip it rides `...props`\n // onto the DOM. `ALERT_DEFAULTS` supplies `closable: false`, so that happened\n // on EVERY alert, not only the closable ones.\n const props = withoutAlertOnlyProps(withoutTestIdProps(others));\n\n // Depends on `variant`, so it cannot live in the static defaults above.\n const ariaLive = alertProps['aria-live'] ?? defaultAriaLive(variant);\n const [open, setOpen] = React.useState(true);\n const [isClosing, setIsClosing] = React.useState(false);\n\n const handleClose = () => {\n setIsClosing(true);\n window.setTimeout(() => {\n setOpen(false);\n onClose?.();\n }, CLOSE_DELAY_MS);\n };\n\n const severity = toMuiSeverity(variant);\n\n const displayIcon = showIcon ? (\n <Box component=\"span\" data-testid={testIdFor(dataTestId, 'icon')}>\n {icon || getVariantIcon(variant)}\n </Box>\n ) : (\n false\n );\n\n const content = (\n <AlertContent title={title} description={description} dataTestId={dataTestId}>\n {children}\n </AlertContent>\n );\n\n return (\n <Collapse in={open && !isClosing} timeout={COLLAPSE_MS}>\n <StyledAlert\n ref={ref}\n data-testid={dataTestId}\n severity={severity}\n customVariant={variant}\n customColor={color}\n glow={glow}\n pulse={pulse}\n animate={animate}\n icon={displayIcon}\n role={role}\n aria-live={ariaLive}\n aria-atomic={ariaAtomic}\n tabIndex={0}\n action={dismissButton(alertProps, dataTestId, handleClose)}\n {...props}\n >\n {content}\n </StyledAlert>\n </Collapse>\n );\n});\n\n/**\n * The props `Alert` OWNS, which must never reach the DOM.\n *\n * `AlertProps` extends MUI's, whose rest-spread is how a host's real HTML\n * attributes get onto the root — so the same spread carries the alert's own\n * configuration unless it is named here. Everything else the component consumes\n * leaves through the destructure above; these two do not, because\n * `dismissButton` reads them off the original props to keep the dismiss union's\n * narrowing intact.\n *\n * Exported so a test can render an alert carrying every name on it and assert\n * none reaches the DOM — the check that would have caught `closable`.\n */\nexport const ALERT_ONLY_PROPS = ['closable', 'closeLabel'] as const;\n\nfunction withoutAlertOnlyProps<P extends object>(rest: P): P {\n const html = { ...rest } as Record<string, unknown>;\n for (const key of ALERT_ONLY_PROPS) delete html[key];\n return html as P;\n}\n\nAlert.displayName = 'Alert';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,gBAAgB;AACvB,OAAO,SAAS;AAChB,OAAO,cAAc;AACrB,OAAO,gBAAgB;AACvB,SAAS,OAAO,cAAc;AAE9B,OAAO,WAAW;AA8KhB,mBAEI,KAFJ;AA7IF,IAAM,aAAa,OAAO,QAAQ,mBAAmB,CAAC,IAAI,YAAY;AAetE,SAAS,cACP,OACA,cACA,MACA,SAC4B;AAU5B,QAAM,MAAM,YAAY,cAAc,MAAM,QAAQ,SAAS,UAAU,YAAY;AACnF,QAAM,aAAa,OACf,OAAO,KAAK,IAAI,MAAM,KAAK,MAAM,MAAM,MAAM,aAAa,MA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jB,WAAO,WAAW,MAAM;AACtB,cAAQ,KAAK;AACb,gBAAU;AAAA,IACZ,GAAG,cAAc;AAAA,EACnB;AAEA,QAAM,WAAW,cAAc,OAAO;AAEtC,QAAM,cAAc,WAClB,oBAAC,OAAI,WAAU,QAAO,eAAa,UAAU,YAAY,MAAM,GAC5D,kBAAQ,eAAe,OAAO,GACjC,IAEA;AAGF,QAAM,UACJ,oBAAC,gBAAa,OAAc,aAA0B,YACnD,UACH;AAGF,SACE,oBAAC,YAAS,IAAI,QAAQ,CAAC,WAAW,SAAS,aACzC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa;AAAA,MACb;AAAA,MACA,eAAe;AAAA,MACf,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN;AAAA,MACA,aAAW;AAAA,MACX,eAAa;AAAA,MACb,UAAU;AAAA,MACV,QAAQ,cAAc,YAAY,YAAY,WAAW;AAAA,MACxD,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AAeM,IAAM,mBAAmB,CAAC,YAAY,YAAY;AAEzD,SAAS,sBAAwC,MAAY;AAC3D,QAAM,OAAO,EAAE,GAAG,KAAK;AACvB,aAAW,OAAO,iBAAkB,QAAO,KAAK,GAAG;AACnD,SAAO;AACT;AAEA,MAAM,cAAc;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|