4
4
import React , { useMemo , useEffect , type ReactNode } from "react" ;
5
5
import * as mui from "@mui/material/styles" ;
6
6
import { fr } from "../fr" ;
7
- import type { FrCoreClassName } from "../fr/generatedFromCss/classNames" ;
8
7
import { useIsDark } from "../useIsDark" ;
9
8
import { typography } from "../fr/generatedFromCss/typography" ;
10
9
import { spacingTokenByValue } from "../fr/generatedFromCss/spacing" ;
11
- import { assert , type Equals } from "tsafe/assert" ;
10
+ import { assert } from "tsafe/assert" ;
12
11
import { objectKeys } from "tsafe/objectKeys" ;
13
12
import { id } from "tsafe/id" ;
14
13
import { useBreakpointsValuesPx , type BreakpointsValues } from "../useBreakpointsValuesPx" ;
@@ -523,7 +522,15 @@ export function createDsfrCustomBrandingProvider(params: {
523
522
"--background-action-high-blue-france" : theme . palette . primary . main ,
524
523
"--border-default-grey" : theme . palette . divider ,
525
524
"--border-action-high-blue-france" : theme . palette . primary . main ,
526
- "--border-default-blue-france" : theme . palette . primary . main
525
+ "--border-default-blue-france" : theme . palette . primary . main ,
526
+
527
+ "--text-inverted-blue-france" : theme . palette . primary . contrastText ,
528
+ "--background-action-high-blue-france-hover" :
529
+ theme . palette . primary . dark ,
530
+ "--background-action-high-blue-france-active" : mui . darken (
531
+ theme . palette . primary . main ,
532
+ 0.24
533
+ )
527
534
528
535
// options:
529
536
/*
@@ -574,20 +581,6 @@ export function createDsfrCustomBrandingProvider(params: {
574
581
[ `.${ fr . cx ( "fr-footer__bottom-copy" ) } ` ] : {
575
582
display : "none"
576
583
} ,
577
- [ getPrimaryButtonClassSelector ( ) ] : {
578
- "--hover-tint" : theme . palette . primary . dark ,
579
- "--active-tint" : mui . darken ( theme . palette . primary . main , 0.24 ) ,
580
- color : theme . palette . primary . contrastText
581
- } ,
582
- [ `.${ fr . cx ( "fr-header__tools-links" ) } ` ] : {
583
- [ `&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& .${ fr . cx ( "fr-btn" ) } ` ] : {
584
- color : theme . palette . primary . main ,
585
- "--hover-tint" :
586
- fr . colors . decisions . background . raised . grey . hover ,
587
- "--active-tint" :
588
- fr . colors . decisions . background . raised . grey . active
589
- }
590
- } ,
591
584
[ `.${ fr . cx ( "fr-input" ) } , .${ fr . cx ( "fr-select" ) } ` ] : {
592
585
"&&&" : {
593
586
borderTopLeftRadius : `0px` ,
@@ -610,65 +603,3 @@ export function createDsfrCustomBrandingProvider(params: {
610
603
611
604
return { DsfrCustomBrandingProvider } ;
612
605
}
613
-
614
- function getPrimaryButtonClassSelector ( ) {
615
- type BtnClassNames = Extract < FrCoreClassName , `fr-btn--${string } `> ;
616
-
617
- type BtnVariant = BtnClassNames extends `fr-btn--${infer Variant } ` ? Variant : never ;
618
-
619
- type BtnVariantWithoutPosition = Exclude <
620
- BtnVariant ,
621
- "align-on-content" | "icon-left" | "icon-right" | "sm" | "lg"
622
- > ;
623
-
624
- const btnVariants = [
625
- "close" ,
626
- "tooltip" ,
627
- "fullscreen" ,
628
- "display" ,
629
- "account" ,
630
- "team" ,
631
- "briefcase" ,
632
- "sort" ,
633
- "secondary" ,
634
- "tertiary" ,
635
- "tertiary-no-outline" ,
636
- "facebook" ,
637
- "linkedin" ,
638
- "mastodon" ,
639
- "threads" ,
640
- "twitter" ,
641
- "twitter-x" ,
642
- "mail" ,
643
- "copy" ,
644
- "dailymotion" ,
645
- "github" ,
646
- "instagram" ,
647
- "snapchat" ,
648
- "telegram" ,
649
- "tiktok" ,
650
- "twitch" ,
651
- "vimeo" ,
652
- "youtube" ,
653
- "menu" ,
654
- "search" ,
655
- "bluesky"
656
- ] as const ;
657
-
658
- type Source = typeof btnVariants [ number ] ;
659
- type Mirrored = BtnVariantWithoutPosition ;
660
-
661
- type InSourceNotInMirrored = Exclude < Source , Mirrored > ;
662
- type InMirroredNotInSource = Exclude < Mirrored , Source > ;
663
-
664
- assert < Equals < InSourceNotInMirrored , never > > ( ) ;
665
- assert < Equals < InMirroredNotInSource , never > > ( ) ;
666
-
667
- let selector = `.${ fr . cx ( "fr-btn" ) } ` ;
668
-
669
- for ( const btnVariant of btnVariants ) {
670
- selector += `:not(.${ fr . cx ( `fr-btn--${ btnVariant } ` ) } )` ;
671
- }
672
-
673
- return selector ;
674
- }
0 commit comments